run-test4.c run-test5.c run-test6.c run-test7.c \
run-test8.c run-test9.c run-test10.c run-test11.c \
run-test13.c run-test14.c run-test15.c run-test16.c \
- run-test17.c
+ run-test17.c run-test18.c
#ALL_SOURCES = $(TEST_SOURCES) $(LIBDNS_SOURCES) $(PROG_SOURCES)
ALL_SOURCES = $(LIBDNS_SOURCES) $(PROG_SOURCES)
$(LINK) ${LIBS} -o $@ $+
run-test17: run-test17.o $(LIBDNS_OBJECTS) $(LIBOBJS)
$(LINK) ${LIBS} -o $@ $+
+run-test18: run-test18.o $(LIBDNS_OBJECTS) $(LIBOBJS)
+ $(LINK) ${LIBS} -o $@ $+
run-test-trace: run-test-trace.o $(LIBDNS_OBJECTS) $(LIBOBJS)
$(LINK) ${LIBS} -o $@ $+
./run-test10
test11: run-test11
./run-test11
-
-test: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11
+test12: run-test12
+ ./run-test11
+test13: run-test13
+ ./run-test11
+test14: run-test14
+ ./run-test11
+test15: run-test15
+ ./run-test15
+test16: run-test16
+ ./run-test16
+test17: run-test17
+ ./run-test17
+test18: run-test18
+ ./run-test18
+
+test: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
+ test13 test14 test15 test16 test17 test18
## No need for changes here
* generate a new key based on the algorithm
*/
ldns_key *
-ldns_key_new_frm_algorithm(ldns_signing_algorithm alg, int size)
+ldns_key_new_frm_algorithm(ldns_signing_algorithm alg, uint16_t size)
{
ldns_key *k;
DSA *d;
switch(alg) {
case LDNS_SIGN_RSAMD5:
case LDNS_SIGN_RSASHA1:
- r = RSA_generate_key(size, RSA_F4, NULL, NULL);
+ r = RSA_generate_key((int)size, RSA_F4, NULL, NULL);
if (RSA_check_key(r) != 1) {
printf("keygen failed\n");
return NULL;
}
- break;
ldns_key_set_rsa_key(k, r);
+ break;
case LDNS_SIGN_DSA:
- d = DSA_generate_parameters(size, NULL, 0, NULL, NULL, NULL, NULL);
+ d = DSA_generate_parameters((int)size, NULL, 0, NULL, NULL, NULL, NULL);
DSA_generate_key(d);
ldns_key_set_dsa_key(k, d);
break;
bool ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key);
ldns_key * ldns_key_list_pop_key(ldns_key_list *key_list);
-ldns_key * ldns_key_new_frm_algorithm(ldns_signing_algorithm a, int size);
+ldns_key * ldns_key_new_frm_algorithm(ldns_signing_algorithm a, uint16_t size);
+ldns_rr * ldns_key2rr(ldns_key *k);
#endif /* _LDNS_KEYS_H */
--- /dev/null
+/*
+ * mx is a small programs that prints out the mx records
+ * for a particulary domain
+ */
+
+#include <stdio.h>
+#include <config.h>
+#include <ldns/ldns.h>
+
+int
+usage(FILE *fp, char *prog) {
+ fprintf(fp, "%s keygen\n", prog);
+ fprintf(fp, " generate a DNSKEY RR \n");
+ return 0;
+}
+
+int
+main(int argc, char *argv[])
+{
+ ldns_rr *dnskey;
+ ldns_key *privkey;
+
+ privkey = ldns_key_new_frm_algorithm(LDNS_SIGN_RSASHA1, 1024);
+ if (!privkey) {
+ printf("Ah, keygen failed");
+ exit(1);
+ }
+ RSA_print_fp(stdout, ldns_key_rsa_key(privkey), 0);
+ printf("did it print\n");
+
+ dnskey = ldns_key2rr(privkey);
+ if (dnskey) {
+ ldns_rr_print(stdout, dnskey);
+ }
+ printf("\n");
+
+ if (argc != 2) {
+ usage(stdout, argv[0]);
+ exit(1);
+ }
+
+
+ return 0;
+}