 |
ldns
1.7.0
|
Go to the documentation of this file.
15 #include <openssl/ssl.h>
16 #include <openssl/evp.h>
17 #include <openssl/rand.h>
18 #include <openssl/err.h>
19 #include <openssl/md5.h>
131 # ifdef HAVE_EVP_DSS1
165 EVP_get_digestbyname(
"md_gost94"));
183 case LDNS_SIGN_ED25519:
191 case LDNS_SIGN_ED448:
206 printf(
"unknown algorithm, ");
207 printf(
"is the one used available on this system?\n");
335 unsigned char *sha1_hash;
349 sha1_hash = SHA1((
unsigned char*)ldns_buffer_begin(to_sign),
350 ldns_buffer_position(to_sign), NULL);
356 sig = DSA_do_sign(sha1_hash, SHA_DIGEST_LENGTH, key);
362 data =
LDNS_XMALLOC(uint8_t, 1 + 2 * SHA_DIGEST_LENGTH);
370 # ifdef HAVE_DSA_SIG_GET0
371 DSA_SIG_get0(sig, &
R, &S);
376 pad = 20 - (size_t) BN_num_bytes(
R);
378 memset(data + 1, 0, pad);
380 BN_bn2bin(
R, (
unsigned char *) (data + 1) + pad);
382 pad = 20 - (size_t) BN_num_bytes(S);
384 memset(data + 1 + SHA_DIGEST_LENGTH, 0, pad);
386 BN_bn2bin(S, (
unsigned char *) (data + 1 + SHA_DIGEST_LENGTH + pad));
389 1 + 2 * SHA_DIGEST_LENGTH,
398 (void)to_sign; (void)key;
407 ldns_pkey_is_ecdsa(EVP_PKEY* pkey)
411 #ifdef HAVE_EVP_PKEY_BASE_ID
412 if(EVP_PKEY_base_id(pkey) != EVP_PKEY_EC)
415 if(EVP_PKEY_type(key->type) != EVP_PKEY_EC)
418 ec = EVP_PKEY_get1_EC_KEY(pkey);
419 g = EC_KEY_get0_group(ec);
424 if(EC_GROUP_get_curve_name(g) == NID_X9_62_prime256v1) {
428 if(EC_GROUP_get_curve_name(g) == NID_secp384r1) {
442 const EVP_MD *digest_type)
448 const EVP_MD *md_type;
458 md_type = digest_type;
465 #ifdef HAVE_EVP_MD_CTX_NEW
466 ctx = EVP_MD_CTX_new();
468 ctx = (EVP_MD_CTX*)malloc(
sizeof(*ctx));
469 if(ctx) EVP_MD_CTX_init(ctx);
476 r = EVP_SignInit(ctx, md_type);
478 r = EVP_SignUpdate(ctx, (
unsigned char*)
479 ldns_buffer_begin(to_sign),
480 ldns_buffer_position(to_sign));
483 EVP_MD_CTX_destroy(ctx);
487 r = EVP_SignFinal(ctx, (
unsigned char*)
488 ldns_buffer_begin(b64sig), &siglen, key);
491 EVP_MD_CTX_destroy(ctx);
496 EVP_MD_CTX_destroy(ctx);
505 # ifdef HAVE_EVP_PKEY_BASE_ID
506 if (EVP_PKEY_base_id(key) == EVP_PKEY_DSA) {
508 if (EVP_PKEY_type(key->type) == EVP_PKEY_DSA) {
515 #if defined(USE_ECDSA) || defined(USE_ED25519) || defined(USE_ED448)
518 EVP_PKEY_base_id(key)
520 EVP_PKEY_type(key->type)
524 if(ldns_pkey_is_ecdsa(key)) {
527 b64sig, (
long)siglen, ldns_pkey_is_ecdsa(key));
531 if(EVP_PKEY_id(key) == NID_X25519) {
538 if(EVP_PKEY_id(key) == NID_X448) {
549 ldns_buffer_begin(b64sig));
552 EVP_MD_CTX_destroy(ctx);
559 unsigned char *sha1_hash;
571 sha1_hash = SHA1((
unsigned char*)ldns_buffer_begin(to_sign),
572 ldns_buffer_position(to_sign), NULL);
578 result = RSA_sign(NID_sha1, sha1_hash, SHA_DIGEST_LENGTH,
579 (
unsigned char*)ldns_buffer_begin(b64sig),
587 ldns_buffer_begin(b64sig));
595 unsigned char *md5_hash;
605 md5_hash = MD5((
unsigned char*)ldns_buffer_begin(to_sign),
606 ldns_buffer_position(to_sign), NULL);
612 RSA_sign(NID_md5, md5_hash, MD5_DIGEST_LENGTH,
613 (
unsigned char*)ldns_buffer_begin(b64sig),
617 ldns_buffer_begin(b64sig));
627 ldns_dnssec_addresses_on_glue_list(
635 for (cur_rrs = cur_rrset->
rrs;
637 cur_rrs = cur_rrs->
next) {
651 cur_rrset = cur_rrset->
next;
681 int below_delegation = -1;
684 if (!zone || !zone->
names) {
709 if (below_delegation && glue_list) {
710 s = ldns_dnssec_addresses_on_glue_list(
732 below_delegation = 1;
734 s = ldns_dnssec_addresses_on_glue_list(
743 below_delegation = 0;
819 cur_node = first_node;
827 while (cur_node && next_node) {
839 cur_node = next_node;
846 if (cur_node && !next_node) {
867 ldns_hashed_names_node_free(
ldns_rbnode_t *node,
void *arg) {
892 if (!zone || !new_rrs || !zone->
names) {
917 ldns_hashed_names_node_free, NULL);
928 current_name_node = first_name_node;
944 if (!current_name->
rrsets) {
952 if (hashmap_node == NULL) {
963 hashmap_node->
data = current_name;
980 if (nsec3_list == NULL) {
1004 uint16_t iterations,
1005 uint8_t salt_length,
1008 return ldns_dnssec_zone_create_nsec3s_mkmap(zone, new_rrs, algorithm,
1009 flags, iterations, salt_length, salt, NULL);
1017 ,
int (*func)(
ldns_rr *,
void *)
1030 switch(func(NULL, arg)) {
1040 fprintf(stderr,
"[XX] unknown return value from callback\n");
1046 (void)func(cur_rr->
rr, arg);
1049 next_rr = cur_rr->
next;
1051 switch (func(cur_rr->
rr, arg)) {
1078 prev_rr->
next = next_rr;
1086 prev_rr->
next = next_rr;
1094 fprintf(stderr,
"[XX] unknown return value from callback\n");
1109 int (*func)(
ldns_rr *,
void*),
1118 ldns_key_list_filter_for_dnskey(
ldns_key_list *key_list,
int flags)
1160 ldns_key_list_filter_for_non_dnskey(
ldns_key_list *key_list,
int flags)
1204 ,
int (*func)(
ldns_rr *,
void*)
1222 int on_delegation_point = 0;
1242 cur_rrset = cur_name->
rrsets;
1256 ldns_key_list_filter_for_dnskey(key_list, flags);
1259 ldns_key_list_filter_for_non_dnskey(key_list, flags);
1264 cur_rr = cur_rrset->
rrs;
1267 cur_rr = cur_rr->
next;
1273 if (!on_delegation_point ||
1302 cur_rrset = cur_rrset->
next;
1312 ldns_key_list_filter_for_non_dnskey(key_list, flags);
1347 int (*func)(
ldns_rr *,
void *),
1357 int (*func)(
ldns_rr *,
void *),
1363 if (!zone || !new_rrs || !key_list) {
1395 int (*func)(
ldns_rr *,
void *),
1399 uint16_t iterations,
1400 uint8_t salt_length,
1404 func, arg, algorithm, flags, iterations, salt_length, salt, 0,
1412 int (*func)(
ldns_rr *,
void *),
1416 uint16_t iterations,
1417 uint8_t salt_length,
1469 result = ldns_dnssec_zone_create_nsec3s_mkmap(zone,
1497 int (*func)(
ldns_rr *,
void *),
1501 uint16_t iterations,
1502 uint8_t salt_length,
1507 func, arg, algorithm, flags, iterations, salt_length, salt,
ldns_rdf * ldns_rr_rdf(const ldns_rr *rr, size_t nr)
returns the rdata field member counter.
bool ldns_rr_rrsig_set_sig(ldns_rr *r, ldns_rdf *f)
sets the signature data of a LDNS_RR_TYPE_RRSIG rr
ldns_rdf * ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value)
returns the rdf containing the native uint16_t representation.
List or Set of Resource Records.
enum ldns_enum_rr_class ldns_rr_class
ldns_rr * nsec
NSEC pointing to the next name (or NSEC3 pointing to the next NSEC3)
definition for tree struct
size_t ldns_rdf_size(const ldns_rdf *rd)
returns the size of the rdf.
bool ldns_rr_rrsig_set_algorithm(ldns_rr *r, ldns_rdf *f)
sets the algorithm of a LDNS_RR_TYPE_RRSIG rr
implementation of buffers to ease operations
#define LDNS_MAX_PACKETLEN
ldns_buffer * ldns_buffer_new(size_t capacity)
creates a new buffer with the specified capacity.
ldns_dnssec_zone * ldns_dnssec_zone_new(void)
Creates a new dnssec_zone structure.
bool ldns_rr_rrsig_set_signame(ldns_rr *r, ldns_rdf *f)
sets the signers name of a LDNS_RR_TYPE_RRSIG rr
@ LDNS_RDF_TYPE_INT32
32 bits
EVP_PKEY * ldns_key_evp_key(const ldns_key *k)
returns the (openssl) EVP struct contained in the key
ldns_rr * ldns_key2rr(const ldns_key *k)
converts a ldns_key to a public key rr If the key data exists at an external point,...
ldns_rdf * ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value)
returns an rdf that contains the given int32 value.
ldns_status ldns_dnssec_zone_sign(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int(*func)(ldns_rr *, void *), void *arg)
signs the given zone with the given keys
ldns_rbtree_t * ldns_rbtree_create(int(*cmpf)(const void *, const void *))
Create new tree (malloced) with given key compare function.
#define HAVE_EVP_PKEY_BASE_ID
ldns_zone * ldns_zone_new(void)
create a new ldns_zone structure
ldns_rdf * ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value)
returns the rdf containing the native uint8_t repr.
ldns_status ldns_dnssec_zone_mark_and_get_glue(ldns_dnssec_zone *zone, ldns_rr_list *glue_list)
Marks the names in the zone that are occluded.
ldns_rdf * ldns_convert_ed448_rrsig_asn12rdf(const ldns_buffer *sig, long sig_len)
Converts the ECDSA signature from ASN1 representation (as used by OpenSSL) to raw signature data as u...
ldns_status ldns_dnssec_zone_mark_glue(ldns_dnssec_zone *zone)
Marks the names in the zone that are occluded.
ldns_dnssec_rrs * ldns_dnssec_rrs_new(void)
Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs.
#define LDNS_SIGNATURE_REMOVE_NO_ADD
ldns_status ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr)
Adds the given RR to the zone.
bool ldns_rr_rrsig_set_keytag(ldns_rr *r, ldns_rdf *f)
sets the keytag of a LDNS_RR_TYPE_RRSIG rr
@ LDNS_RDF_TYPE_INT16
16 bits
ldns_status ldns_rrsig2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr)
Converts a rrsig to wireformat BUT EXCLUDE the rrsig rdata This is needed in DNSSEC verification.
bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr)
push an single rr to a zone structure.
ldns_rdf * ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key)
Sign a buffer with the RSA key (hash with MD5)
ldns_rdf * ldns_rr_pop_rdf(ldns_rr *rr)
removes a rd_field member, it will be popped from the last position.
ldns_status ldns_dnssec_chain_nsec3_list(ldns_rr_list *nsec3_rrs)
chains nsec3 list
ldns_status ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr)
Adds an RR to the list of RRs.
bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr)
pushes an rr to an rrlist.
ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos)
look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label.
int ldns_dnssec_rrsets_contains_type(const ldns_dnssec_rrsets *rrsets, ldns_rr_type type)
returns whether a rrset of the given type is found in the rrsets.
#define LDNS_KEY_ZONE_KEY
Same as rr_list, but now for keys.
void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl)
sets the ttl in the rr structure.
void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class)
sets the class in the rr.
ldns_status ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs)
Adds NSEC records to the given dnssec_zone.
ldns_status ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int(*func)(ldns_rr *, void *), void *arg, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt, int signflags)
signs the given zone with the given new zone, with NSEC3
@ LDNS_SIGN_ECDSAP256SHA256
@ LDNS_STATUS_NSEC3_DOMAINNAME_OVERFLOW
void ldns_rr_list_deep_free(ldns_rr_list *rr_list)
frees an rr_list structure and all rrs contained therein.
int ldns_dname_is_wildcard(const ldns_rdf *dname)
Check if dname is a wildcard, starts with *.
uint16_t ldns_key_flags(const ldns_key *k)
return the flag of the key
ldns_status ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int(*func)(ldns_rr *, void *), void *arg, int flags)
signs the given zone with the given keys
void ldns_rr2canonical(ldns_rr *rr)
converts each dname in a rr to its canonical form.
ldns_rdf * ldns_rr_rrsig_keytag(const ldns_rr *r)
returns the keytag of a LDNS_RR_TYPE_RRSIG RR
ldns_dnssec_rrs * ldns_dnssec_remove_signatures(ldns_dnssec_rrs *signatures, ldns_key_list *key_list __attribute__((unused)), int(*func)(ldns_rr *, void *), void *arg)
ldns_rr_list * ldns_zone_rrs(const ldns_zone *z)
Get a list of a zone's content.
const void * key
pointer to sorting key
ldns_rdf * ldns_sign_public_buffer(ldns_buffer *sign_buf, ldns_key *current_key)
Sign the buffer which contains the wiredata of an rrset, and the corresponding empty rrsig rr with th...
void ldns_set_bit(uint8_t *byte, int bit_nr, bool value)
ldns_rbnode_t * ldns_dnssec_name_node_next_nonglue(ldns_rbnode_t *node)
Finds the first dnssec_name node in the rbtree that is not occluded.
@ LDNS_RR_TYPE_NSEC3PARAM
bool ldns_key_use(const ldns_key *k)
return the use flag
ldns_rr_class ldns_rr_get_class(const ldns_rr *rr)
returns the class of the rr.
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
ldns_dnssec_rrsets * rrsets
The rrsets for this name.
ldns_dnssec_rrs * nsec_signatures
signatures for the NSEC record
ldns_rdf * name
pointer to a dname containing the name.
ldns_status ldns_dnssec_zone_create_rrsigs(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int(*func)(ldns_rr *, void *), void *arg)
Adds signatures to the zone.
ldns_rdf * ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key)
Sign data with DSA.
void ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa)
Set the zone's soa record.
ldns_rdf * ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data)
allocates a new rdf structure and fills it.
void ldns_key_set_use(ldns_key *k, bool v)
ldns_rdf * ldns_convert_ed25519_rrsig_asn12rdf(const ldns_buffer *sig, long sig_len)
Converts the ECDSA signature from ASN1 representation (as used by OpenSSL) to raw signature data as u...
@ LDNS_RR_TYPE_DS
RFC4034, RFC3658.
Structure containing a dnssec zone.
void ldns_rdf_free(ldns_rdf *rd)
frees a rdf structure, leaving the data pointer intact.
ldns_dnssec_rrs * signatures
void ldns_dnssec_zone_free(ldns_dnssec_zone *zone)
Frees the given zone structure, and its rbtree of dnssec_names Individual ldns_rr RRs within those na...
void ldns_nsec3_add_param_rdfs(ldns_rr *rr, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, const uint8_t *salt)
Sets all the NSEC3 options.
@ LDNS_RR_TYPE_NS
an authoritative name server
void ldns_key_list_set_use(ldns_key_list *keys, bool v)
ldns_rr_list * ldns_rr_list_clone(const ldns_rr_list *rrlist)
clones an rrlist.
ldns_status ldns_rr_list2buffer_wire(ldns_buffer *buffer, const ldns_rr_list *rr_list)
Copies the rr_list data to the buffer in wire format.
ldns_rdf * ldns_dnssec_name_name(const ldns_dnssec_name *name)
Returns the domain name of the given dnssec_name structure.
void ldns_buffer_free(ldns_buffer *buffer)
frees the buffer.
ldns_rdf * hashed_name
pointer to store the hashed name (only used when in an NSEC3 zone
@ LDNS_RR_TYPE_SOA
marks the start of a zone of authority
ldns_rr * ldns_rr_clone(const ldns_rr *rr)
clones a rr and all its data
General key structure, can contain all types of keys that are used in DNSSEC.
bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent)
test wether the name sub falls under parent (i.e.
ldns_status ldns_dnssec_zone_create_nsec3s(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt)
Adds NSEC3 records to the zone.
size_t ldns_key_list_key_count(const ldns_key_list *key_list)
returns the number of keys in the key list
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
void ldns_dname2canonical(const ldns_rdf *rd)
Put a dname into canonical fmt - ie.
ldns_rdf * ldns_rdf_clone(const ldns_rdf *rd)
clones a rdf structure.
#define LDNS_MALLOC(type)
Memory management macros.
uint32_t ldns_rdf2native_int32(const ldns_rdf *rd)
returns the native uint32_t representation from the rdf.
@ LDNS_RR_TYPE_DNAME
RFC2672.
ldns_rr * ldns_rr_new_frm_type(ldns_rr_type t)
creates a new rr structure, based on the given type.
uint32_t ldns_key_expiration(const ldns_key *k)
return the key's expiration date
void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner)
sets the owner in the rr structure.
ldns_status ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone)
Adds explicit dnssec_name structures for the empty nonterminals in this zone.
void ldns_rr_list_sort(ldns_rr_list *unsorted)
sorts an rr_list (canonical wire format).
bool ldns_rr_rrsig_set_typecovered(ldns_rr *r, ldns_rdf *f)
sets the typecovered of a LDNS_RR_TYPE_RRSIG rr
void ldns_traverse_postorder(ldns_rbtree_t *tree, void(*func)(ldns_rbnode_t *, void *), void *arg)
Call function for all elements in the redblack tree, such that leaf elements are called before parent...
bool ldns_rr_rrsig_set_origttl(ldns_rr *r, ldns_rdf *f)
sets the original TTL of a LDNS_RR_TYPE_RRSIG rr
ldns_status ldns_dnssec_zone_create_rrsigs_flg(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int(*func)(ldns_rr *, void *), void *arg, int flags)
Adds signatures to the zone.
enum ldns_enum_status ldns_status
ldns_rr_list * ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys)
use this function to sign with a public/private key alg return the created signatures
@ LDNS_RDF_TYPE_B64
b64 string
#define LDNS_XMALLOC(type, count)
ldns_rbtree_t * names
tree of ldns_dnssec_names
ldns_rr * ldns_zone_soa(const ldns_zone *z)
Return the soa record of a zone.
ldns_rdf * ldns_convert_ecdsa_rrsig_asn1len2rdf(const ldns_buffer *sig, const long sig_len, int num_bytes)
Converts the ECDSA signature from ASN1 representation (as used by OpenSSL) to raw signature data as u...
signed char is_glue
Unlike what the name is_glue suggests, this field is set to true by ldns_dnssec_zone_mark_glue() or l...
Resource record data field.
ldns_rdf * ldns_sign_public_evp(ldns_buffer *to_sign, EVP_PKEY *key, const EVP_MD *digest_type)
Sign data with EVP (general method for different algorithms)
uint16_t ldns_rdf2native_int16(const ldns_rdf *rd)
returns the native uint16_t representation from the rdf.
uint32_t ldns_rr_ttl(const ldns_rr *rr)
returns the ttl of an rr structure.
@ LDNS_RDF_TYPE_INT8
8 bits
ldns_rr_type ldns_rr_list_type(const ldns_rr_list *rr_list)
Returns the type of the first element of the RR If there are no elements present, 0 is returned.
ldns_rdf * ldns_key_pubkey_owner(const ldns_key *k)
return the public key's owner
uint8_t * ldns_rdf_data(const ldns_rdf *rd)
returns the data of the rdf.
ldns_status ldns_dnssec_name_add_rr(ldns_dnssec_name *name, ldns_rr *rr)
Inserts the given rr at the right place in the current dnssec_name No checking is done whether the na...
uint16_t ldns_key_keytag(const ldns_key *k)
return the keytag
ldns_rr * ldns_create_empty_rrsig(const ldns_rr_list *rrset, const ldns_key *current_key)
Create an empty RRSIG RR (i.e.
ldns_status ldns_dnssec_zone_sign_nsec3_flg_mkmap(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int(*func)(ldns_rr *, void *), void *arg, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt, int signflags, ldns_rbtree_t **map)
signs the given zone with the given new zone, with NSEC3
#define LDNS_SIGNATURE_LEAVE_NO_ADD
uint8_t ldns_dname_label_count(const ldns_rdf *r)
count the number of labels inside a LDNS_RDF_DNAME type rdf.
ldns_rbtree_t * hashed_names
tree of ldns_dnssec_names by nsec3 hashes (when applicible)
#define LDNS_SIGNATURE_REMOVE_ADD_NEW
ldns_rbnode_t * root
The root of the red-black tree.
ldns_rr_list * ldns_rr_list_new(void)
creates a new rr_list structure.
ldns_dnssec_rrsets * next
@ LDNS_RR_TYPE_RRSIG
DNSSEC.
@ LDNS_RR_TYPE_A
a host address
int ldns_dnssec_default_replace_signatures(ldns_rr *sig __attribute__((unused)), void *n __attribute__((unused)))
ldns_key * ldns_key_list_key(const ldns_key_list *key, size_t nr)
returns a pointer to the key in the list at the given position
ldns_zone * ldns_zone_sign_nsec3(ldns_zone *zone, ldns_key_list *key_list, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt)
Signs the zone with NSEC3, and returns a newly allocated signed zone.
bool ldns_rr_rrsig_set_inception(ldns_rr *r, ldns_rdf *f)
sets the inception date of a LDNS_RR_TYPE_RRSIG rr
const void * data
pointer to data
ldns_dnssec_rrsets * ldns_dnssec_zone_find_rrset(const ldns_dnssec_zone *zone, const ldns_rdf *dname, ldns_rr_type type)
Find the RRset with the given name and type in the zone.
#define LDNS_DEFAULT_EXP_TIME
int ldns_dname_compare_v(const void *a, const void *b)
Given in dnssec_zone.c, also used in dnssec_sign.c:w.
ldns_rdf * ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key)
Sign a buffer with the RSA key (hash with SHA1)
ldns_dnssec_rrsets * ldns_dnssec_name_find_rrset(const ldns_dnssec_name *name, ldns_rr_type type)
Find the RRset with the given type in within this name structure.
ldns_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
#define LDNS_RBTREE_NULL
The nullpointer, points to empty node.
void ldns_rr_list_free(ldns_rr_list *rr_list)
frees an rr_list structure.
#define LDNS_SIGN_WITH_ALL_ALGORITHMS
ldns_rbnode_t * ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data)
Insert data into the tree.
enum ldns_enum_signing_algorithm ldns_signing_algorithm
@ LDNS_RDF_TYPE_TYPE
a RR type
bool ldns_rr_rrsig_set_labels(ldns_rr *r, ldns_rdf *f)
sets the number of labels of a LDNS_RR_TYPE_RRSIG rr
@ LDNS_SIGN_RSASHA1_NSEC3
The rbnode_t struct definition.
ldns_zone * ldns_zone_sign(const ldns_zone *zone, ldns_key_list *key_list)
Signs the zone, and returns a newly allocated signed zone.
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
uint32_t ldns_key_inception(const ldns_key *k)
return the key's inception date
#define LDNS_SIGN_DNSKEY_WITH_ZSK
dnssec_verify
ldns_dnssec_name * soa
points to the name containing the SOA RR
ldns_rdf * ldns_convert_dsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len)
Converts the DSA signature from ASN1 representation (RFC2459, as used by OpenSSL) to raw signature da...
@ LDNS_RDF_TYPE_TIME
time (32 bits)
ldns_rr * ldns_dnssec_create_nsec(const ldns_dnssec_name *from, const ldns_dnssec_name *to, ldns_rr_type nsec_type)
Creates NSEC.
#define LDNS_SIGNATURE_LEAVE_ADD_NEW
return values for the old-signature callback
ldns_rbnode_t * ldns_rbtree_next(ldns_rbnode_t *node)
Returns next larger node in the tree.
bool ldns_rr_rrsig_set_expiration(ldns_rr *r, ldns_rdf *f)
sets the expireation date of a LDNS_RR_TYPE_RRSIG rr
ldns_rr * ldns_dnssec_create_nsec3(const ldns_dnssec_name *from, const ldns_dnssec_name *to, const ldns_rdf *zone_name, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, const uint8_t *salt)
Creates NSEC3.
@ LDNS_RR_TYPE_AAAA
ipv6 address
ldns_signing_algorithm ldns_key_algorithm(const ldns_key *k)
return the signing alg of the key
@ LDNS_SIGN_ECDSAP384SHA384
ldns_rbnode_t * ldns_rbtree_first(const ldns_rbtree_t *rbtree)
Returns first (smallest) node in the tree.
@ LDNS_RDF_TYPE_ALG
a key algorithm
ldns_status ldns_dnssec_zone_sign_nsec3(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int(*func)(ldns_rr *, void *), void *arg, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt)
signs the given zone with the given new zone, with NSEC3
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.