Go to the source code of this file.
Functions | |
ldns_key_list * | ldns_key_list_new () |
Creates a new empty key list. More... | |
ldns_key * | ldns_key_new () |
Creates a new empty key structure. More... | |
ldns_status | ldns_key_new_frm_fp (ldns_key **k, FILE *fp) |
Creates a new priv key based on the contents of the file pointed by fp. More... | |
ldns_status | ldns_key_new_frm_engine (ldns_key **key, ENGINE *e, char *key_id, ldns_algorithm alg) |
Read the key with the given id from the given engine and store it in the given ldns_key structure. More... | |
ldns_status | ldns_key_new_frm_fp_l (ldns_key **key, FILE *fp, int *line_nr) |
Creates a new private key based on the contents of the file pointed by fp. More... | |
RSA * | ldns_key_new_frm_fp_rsa (FILE *f) |
frm_fp helper function. More... | |
RSA * | ldns_key_new_frm_fp_rsa_l (FILE *f, int *line_nr) |
frm_fp helper function. More... | |
DSA * | ldns_key_new_frm_fp_dsa (FILE *f) |
frm_fp helper function. More... | |
if (!d||!dsa||!buf) | |
if (ldns_fget_keyword_data_l(f,"Primep",": ", d,"\n", 10230, line_nr)==-1) | |
if (!dsa->p) | |
if (ldns_fget_keyword_data_l(f,"Subprimeq",": ", d,"\n", 10230, line_nr)==-1) | |
if (ldns_fget_keyword_data_l(f,"Baseg",": ", d,"\n", 10230, line_nr)==-1) | |
if (ldns_fget_keyword_data_l(f,"Private_valuex",": ", d,"\n", 10230, line_nr)==-1) | |
if (ldns_fget_keyword_data_l(f,"Public_valuey",": ", d,"\n", 10230, line_nr)==-1) | |
while (0) | |
DSA_free (dsa) | |
unsigned char * | ldns_key_new_frm_fp_hmac (FILE *f, size_t *hmac_size) |
frm_fp helper function. More... | |
unsigned char * | ldns_key_new_frm_fp_hmac_l (FILE *f, int *line_nr __attribute__((unused)), size_t *hmac_size) |
ldns_key * | ldns_key_new_frm_algorithm (ldns_signing_algorithm alg, uint16_t size) |
Creates a new key based on the algorithm. More... | |
void | ldns_key_print (FILE *output, const ldns_key *k) |
print a private key to the file ouput More... | |
void | ldns_key_set_algorithm (ldns_key *k, ldns_signing_algorithm l) |
Set the key's algorithm. More... | |
void | ldns_key_set_flags (ldns_key *k, uint16_t f) |
Set the key's flags. More... | |
void | ldns_key_set_evp_key (ldns_key *k, EVP_PKEY *e) |
Set the key's evp key. More... | |
void | ldns_key_set_rsa_key (ldns_key *k, RSA *r) |
Set the key's rsa data. More... | |
void | ldns_key_set_dsa_key (ldns_key *k, DSA *d) |
Set the key's dsa data The dsa data should be freed by the user. More... | |
void | ldns_key_assign_rsa_key (ldns_key *k, RSA *r) |
Assign the key's rsa data The rsa data will be freed automatically when the key is freed. More... | |
void | ldns_key_assign_dsa_key (ldns_key *k, DSA *d) |
Assign the key's dsa data The dsa data will be freed automatically when the key is freed. More... | |
void | ldns_key_set_hmac_key (ldns_key *k, unsigned char *hmac) |
Set the key's hmac data. More... | |
void | ldns_key_set_hmac_size (ldns_key *k, size_t hmac_size) |
Set the key's hmac size. More... | |
void | ldns_key_set_external_key (ldns_key *k, void *external_key) |
Set the key id data. More... | |
void | ldns_key_set_origttl (ldns_key *k, uint32_t t) |
Set the key's original ttl. More... | |
void | ldns_key_set_inception (ldns_key *k, uint32_t i) |
Set the key's inception date (seconds after epoch) More... | |
void | ldns_key_set_expiration (ldns_key *k, uint32_t e) |
Set the key's expiration date (seconds after epoch) More... | |
void | ldns_key_set_pubkey_owner (ldns_key *k, ldns_rdf *r) |
Set the key's pubkey owner. More... | |
void | ldns_key_set_keytag (ldns_key *k, uint16_t tag) |
Set the key's key tag. More... | |
size_t | ldns_key_list_key_count (const ldns_key_list *key_list) |
returns the number of keys in the key list More... | |
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 More... | |
ldns_signing_algorithm | ldns_key_algorithm (const ldns_key *k) |
return the signing alg of the key More... | |
void | ldns_key_set_use (ldns_key *k, bool v) |
bool | ldns_key_use (const ldns_key *k) |
return the use flag More... | |
EVP_PKEY * | ldns_key_evp_key (const ldns_key *k) |
returns the (openssl) EVP struct contained in the key More... | |
RSA * | ldns_key_rsa_key (const ldns_key *k) |
returns the (openssl) RSA struct contained in the key More... | |
DSA * | ldns_key_dsa_key (const ldns_key *k) |
returns the (openssl) DSA struct contained in the key More... | |
unsigned char * | ldns_key_hmac_key (const ldns_key *k) |
return the hmac key data More... | |
size_t | ldns_key_hmac_size (const ldns_key *k) |
return the hmac key size More... | |
void * | ldns_key_external_key (const ldns_key *k) |
return the key id key data More... | |
uint32_t | ldns_key_origttl (const ldns_key *k) |
return the original ttl of the key More... | |
uint16_t | ldns_key_flags (const ldns_key *k) |
return the flag of the key More... | |
uint32_t | ldns_key_inception (const ldns_key *k) |
return the key's inception date More... | |
uint32_t | ldns_key_expiration (const ldns_key *k) |
return the key's expiration date More... | |
uint16_t | ldns_key_keytag (const ldns_key *k) |
return the keytag More... | |
ldns_rdf * | ldns_key_pubkey_owner (const ldns_key *k) |
return the public key's owner More... | |
void | ldns_key_list_set_use (ldns_key_list *keys, bool v) |
void | ldns_key_list_set_key_count (ldns_key_list *key, size_t count) |
Set the keylist's key count to count. More... | |
bool | ldns_key_list_push_key (ldns_key_list *key_list, ldns_key *key) |
pushes a key to a keylist More... | |
ldns_key * | ldns_key_list_pop_key (ldns_key_list *key_list) |
pops the last rr from a keylist More... | |
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, the corresponding rdata field must still be added with ldns_rr_rdf_push() to the result rr of this function More... | |
void | ldns_key_free (ldns_key *key) |
frees a key structure, but not its internal data structures More... | |
void | ldns_key_deep_free (ldns_key *key) |
frees a key structure and all its internal data structures, except the data set by ldns_key_set_external_key() More... | |
void | ldns_key_list_free (ldns_key_list *key_list) |
Frees a key list structure. More... | |
ldns_rr * | ldns_read_anchor_file (const char *filename) |
Instantiates a DNSKEY or DS RR from file. More... | |
char * | ldns_key_get_file_base_name (ldns_key *key) |
Returns the 'default base name' for key files; IE. More... | |
int | ldns_key_algo_supported (int algo) |
See if a key algorithm is supported. More... | |
ldns_signing_algorithm | ldns_get_signing_algorithm_by_name (const char *name) |
Get signing algorithm by name. More... | |
Variables | |
ldns_lookup_table | ldns_signing_algorithms [] |
DSA *char * | d |
DSA * | dsa = DSA_new() |
uint8_t * | buf = (( uint8_t *) malloc(( 10230 ) * sizeof( uint8_t ))) |
i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))) | |
dsa | p = BN_bin2bn((const char unsigned*)buf, i, NULL) |
dsa | q = BN_bin2bn((const char unsigned*)buf, i, NULL) |
dsa | g = BN_bin2bn((const char unsigned*)buf, i, NULL) |
dsa | priv_key = BN_bin2bn((const char unsigned*)buf, i, NULL) |
dsa | pub_key = BN_bin2bn((const char unsigned*)buf, i, NULL) |
do { free(( buf )) | |
error | __pad0__ |
return | NULL |
ldns_key_list* ldns_key_list_new | ( | ) |
Creates a new empty key list.
Definition at line 47 of file keys.c.
References ldns_struct_key_list::_key_count, ldns_struct_key_list::_keys, LDNS_MALLOC, and NULL.
ldns_key* ldns_key_new | ( | ) |
Creates a new empty key structure.
Definition at line 60 of file keys.c.
References ldns_key_set_evp_key(), ldns_key_set_expiration(), ldns_key_set_external_key(), ldns_key_set_flags(), ldns_key_set_hmac_key(), ldns_key_set_inception(), ldns_key_set_keytag(), ldns_key_set_origttl(), ldns_key_set_pubkey_owner(), ldns_key_set_use(), LDNS_KEY_ZONE_KEY, LDNS_MALLOC, and NULL.
ldns_status ldns_key_new_frm_fp | ( | ldns_key ** | k, |
FILE * | fp | ||
) |
Creates a new priv key based on the contents of the file pointed by fp.
The file should be in Private-key-format v1.x.
[out] | k | the new ldns_key structure |
[in] | fp | the file pointer to use |
Definition at line 86 of file keys.c.
References ldns_key_new_frm_fp_l(), and NULL.
ldns_status ldns_key_new_frm_engine | ( | ldns_key ** | key, |
ENGINE * | e, | ||
char * | key_id, | ||
ldns_algorithm | |||
) |
Read the key with the given id from the given engine and store it in the given ldns_key structure.
The algorithm type is set
Definition at line 93 of file keys.c.
References ldns_struct_key::_key, ldns_struct_key::key, ldns_key_free(), ldns_key_new(), ldns_key_set_algorithm(), LDNS_STATUS_ENGINE_KEY_NOT_LOADED, LDNS_STATUS_ERR, LDNS_STATUS_MEM_ERR, LDNS_STATUS_OK, and NULL.
ldns_status ldns_key_new_frm_fp_l | ( | ldns_key ** | k, |
FILE * | fp, | ||
int * | line_nr | ||
) |
Creates a new private key based on the contents of the file pointed by fp.
The file should be in Private-key-format v1.x.
[out] | k | the new ldns_key structure |
[in] | fp | the file pointer to use |
[in] | line_nr | pointer to an integer containing the current line number (for debugging purposes) |
Definition at line 291 of file keys.c.
References ldns_struct_key::_key, d, dsa, ldns_struct_key::key, ldns_calc_keytag(), LDNS_DH, LDNS_ECC, ldns_fget_keyword_data_l(), LDNS_FREE, ldns_key2rr(), ldns_key_assign_dsa_key(), ldns_key_assign_rsa_key(), ldns_key_EVP_load_gost_id(), ldns_key_free(), ldns_key_new(), ldns_key_new_frm_fp_dsa_l(), ldns_key_new_frm_fp_hmac_l(), ldns_key_new_frm_fp_rsa_l(), ldns_key_set_algorithm(), ldns_key_set_evp_key(), ldns_key_set_hmac_key(), ldns_key_set_hmac_size(), ldns_key_set_keytag(), LDNS_MAX_LINELEN, ldns_rr_free(), LDNS_SIGN_DSA, LDNS_SIGN_DSA_NSEC3, LDNS_SIGN_ECC_GOST, LDNS_SIGN_ECDSAP256SHA256, LDNS_SIGN_ECDSAP384SHA384, LDNS_SIGN_HMACMD5, LDNS_SIGN_HMACSHA1, LDNS_SIGN_HMACSHA256, LDNS_SIGN_RSAMD5, LDNS_SIGN_RSASHA1, LDNS_SIGN_RSASHA1_NSEC3, LDNS_SIGN_RSASHA256, LDNS_SIGN_RSASHA512, LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, LDNS_STATUS_ERR, LDNS_STATUS_MEM_ERR, LDNS_STATUS_OK, LDNS_STATUS_SYNTAX_ALG_ERR, LDNS_STATUS_SYNTAX_ERR, LDNS_STATUS_SYNTAX_VERSION_ERR, and LDNS_XMALLOC.
RSA* ldns_key_new_frm_fp_rsa | ( | FILE * | fp | ) |
frm_fp helper function.
This function parses the remainder of the (RSA) priv. key file generated from bind9
[in] | fp | the file to parse |
Definition at line 512 of file keys.c.
References ldns_key_new_frm_fp_rsa_l(), and NULL.
RSA* ldns_key_new_frm_fp_rsa_l | ( | FILE * | fp, |
int * | line_nr | ||
) |
frm_fp helper function.
This function parses the remainder of the (RSA) priv. key file generated from bind9
[in] | fp | the file to parse |
[in] | line_nr | pointer to an integer containing the current line number (for debugging purposes) |
Definition at line 518 of file keys.c.
References buf, d, i, ldns_b64_pton(), ldns_fget_keyword_data_l(), LDNS_FREE, LDNS_MAX_LINELEN, LDNS_XMALLOC, and NULL.
DSA* ldns_key_new_frm_fp_dsa | ( | FILE * | fp | ) |
frm_fp helper function.
This function parses the remainder of the (DSA) priv. key file
[in] | fp | the file to parse |
Definition at line 655 of file keys.c.
References ldns_key_new_frm_fp_dsa_l(), and NULL.
if | ( | ldns_fget_keyword_data_l(f,"Primep",": ", d,"\n",10230, line_nr) | = = -1 | ) |
if | ( | ldns_fget_keyword_data_l(f,"Subprimeq",": ", d,"\n",10230, line_nr) | = = -1 | ) |
if | ( | ldns_fget_keyword_data_l(f,"Baseg",": ", d,"\n",10230, line_nr) | = = -1 | ) |
if | ( | ldns_fget_keyword_data_l(f,"Private_valuex",": ", d,"\n",10230, line_nr) | = = -1 | ) |
if | ( | ldns_fget_keyword_data_l(f,"Public_valuey",": ", d,"\n",10230, line_nr) | = = -1 | ) |
while | ( | 0 | ) |
DSA_free | ( | dsa | ) |
unsigned char* ldns_key_new_frm_fp_hmac | ( | FILE * | fp, |
size_t * | hmac_size | ||
) |
frm_fp helper function.
This function parses the remainder of the (HMAC-MD5) key file This function allocated a buffer that needs to be freed
[in] | fp | the file to parse |
[out] | hmac_size | the number of bits in the resulting buffer |
Definition at line 742 of file keys.c.
References ldns_key_new_frm_fp_hmac_l(), and NULL.
unsigned char* ldns_key_new_frm_fp_hmac_l | ( | FILE * | f, |
int *line_nr | __attribute__(unused), | ||
size_t * | hmac_size | ||
) |
Definition at line 748 of file keys.c.
References buf, d, i, ldns_b64_pton(), ldns_fget_keyword_data_l(), LDNS_FREE, LDNS_MAX_LINELEN, LDNS_XMALLOC, and NULL.
ldns_key* ldns_key_new_frm_algorithm | ( | ldns_signing_algorithm | a, |
uint16_t | size | ||
) |
Creates a new key based on the algorithm.
[in] | a | The algorithm to use |
[in] | size | the number of bytes for the keysize |
Definition at line 809 of file keys.c.
References ldns_struct_key::_key, d, DSA_free(), i, ldns_struct_key::key, LDNS_FREE, ldns_key_free(), ldns_key_new(), ldns_key_set_algorithm(), ldns_key_set_dsa_key(), ldns_key_set_evp_key(), ldns_key_set_flags(), ldns_key_set_hmac_key(), ldns_key_set_hmac_size(), ldns_key_set_rsa_key(), LDNS_SIGN_DSA, LDNS_SIGN_DSA_NSEC3, LDNS_SIGN_ECC_GOST, LDNS_SIGN_ECDSAP256SHA256, LDNS_SIGN_ECDSAP384SHA384, LDNS_SIGN_HMACMD5, LDNS_SIGN_HMACSHA1, LDNS_SIGN_HMACSHA256, LDNS_SIGN_RSAMD5, LDNS_SIGN_RSASHA1, LDNS_SIGN_RSASHA1_NSEC3, LDNS_SIGN_RSASHA256, LDNS_SIGN_RSASHA512, LDNS_XMALLOC, and NULL.
void ldns_key_print | ( | FILE * | output, |
const ldns_key * | k | ||
) |
print a private key to the file ouput
[in] | output | the FILE descriptor where to print to |
[in] | k | the ldns_key to print |
Definition at line 955 of file keys.c.
References LDNS_FREE, and ldns_key2str().
void ldns_key_set_algorithm | ( | ldns_key * | k, |
ldns_signing_algorithm | l | ||
) |
Set the key's algorithm.
[in] | k | the key |
[in] | l | the algorithm |
Definition at line 968 of file keys.c.
References ldns_struct_key::_alg.
void ldns_key_set_flags | ( | ldns_key * | k, |
uint16_t | flags | ||
) |
Set the key's flags.
[in] | k | the key |
[in] | flags | the flags |
Definition at line 974 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
void ldns_key_set_evp_key | ( | ldns_key * | k, |
EVP_PKEY * | e | ||
) |
Set the key's evp key.
[in] | k | the key |
[in] | e | the evp key |
Definition at line 982 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::key.
void ldns_key_set_rsa_key | ( | ldns_key * | k, |
RSA * | r | ||
) |
Set the key's rsa data.
The rsa data should be freed by the user.
[in] | k | the key |
[in] | r | the rsa data |
Definition at line 988 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::key.
void ldns_key_set_dsa_key | ( | ldns_key * | k, |
DSA * | d | ||
) |
Set the key's dsa data The dsa data should be freed by the user.
[in] | k | the key |
[in] | d | the dsa data |
Definition at line 996 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::key.
void ldns_key_assign_rsa_key | ( | ldns_key * | k, |
RSA * | r | ||
) |
Assign the key's rsa data The rsa data will be freed automatically when the key is freed.
[in] | k | the key |
[in] | r | the rsa data |
Definition at line 1004 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::key.
void ldns_key_assign_dsa_key | ( | ldns_key * | k, |
DSA * | d | ||
) |
Assign the key's dsa data The dsa data will be freed automatically when the key is freed.
[in] | k | the key |
[in] | d | the dsa data |
Definition at line 1012 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::key.
void ldns_key_set_hmac_key | ( | ldns_key * | k, |
unsigned char * | hmac | ||
) |
Set the key's hmac data.
[in] | k | the key |
[in] | hmac | the raw key data |
Definition at line 1022 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::hmac.
void ldns_key_set_hmac_size | ( | ldns_key * | k, |
size_t | hmac_size | ||
) |
Set the key's hmac size.
[in] | k | the key |
[in] | hmac_size | the size of the hmac data |
Definition at line 1028 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::hmac.
void ldns_key_set_external_key | ( | ldns_key * | key, |
void * | external_key | ||
) |
Set the key id data.
This is used if the key points to some externally stored key data
Only the pointer is set, the data there is not copied, and must be freed manually; ldns_key_deep_free() does not free this data
[in] | key | the key |
[in] | external_key | key id data |
Definition at line 1034 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::external_key.
void ldns_key_set_origttl | ( | ldns_key * | k, |
uint32_t | t | ||
) |
Set the key's original ttl.
[in] | k | the key |
[in] | t | the ttl |
Definition at line 1040 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
void ldns_key_set_inception | ( | ldns_key * | k, |
uint32_t | i | ||
) |
Set the key's inception date (seconds after epoch)
[in] | k | the key |
[in] | i | the inception |
Definition at line 1046 of file keys.c.
References ldns_struct_key::_extra, ldns_struct_key::dnssec, and i.
void ldns_key_set_expiration | ( | ldns_key * | k, |
uint32_t | e | ||
) |
Set the key's expiration date (seconds after epoch)
[in] | k | the key |
[in] | e | the expiration |
Definition at line 1052 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
Set the key's pubkey owner.
[in] | k | the key |
[in] | r | the owner |
Definition at line 1058 of file keys.c.
References ldns_struct_key::_pubkey_owner.
void ldns_key_set_keytag | ( | ldns_key * | k, |
uint16_t | tag | ||
) |
Set the key's key tag.
[in] | k | the key |
[in] | tag | the keytag |
Definition at line 1064 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
size_t ldns_key_list_key_count | ( | const ldns_key_list * | key_list | ) |
returns the number of keys in the key list
[in] | key_list | the key_list |
Definition at line 1071 of file keys.c.
References ldns_struct_key_list::_key_count.
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
[in] | key | the key |
[in] | nr | the position in the list |
Definition at line 1077 of file keys.c.
References ldns_struct_key_list::_keys, ldns_key_list_key_count(), and NULL.
ldns_signing_algorithm ldns_key_algorithm | ( | const ldns_key * | k | ) |
return the signing alg of the key
[in] | k | the key |
Definition at line 1087 of file keys.c.
References ldns_struct_key::_alg.
Definition at line 1093 of file keys.c.
References ldns_struct_key::_use.
return the use flag
[in] | k | the key |
Definition at line 1101 of file keys.c.
References ldns_struct_key::_use.
EVP_PKEY* ldns_key_evp_key | ( | const ldns_key * | k | ) |
returns the (openssl) EVP struct contained in the key
[in] | k | the key to look in |
Definition at line 1112 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::key.
RSA* ldns_key_rsa_key | ( | const ldns_key * | k | ) |
returns the (openssl) RSA struct contained in the key
[in] | k | the key to look in |
Definition at line 1118 of file keys.c.
References ldns_struct_key::_key, ldns_struct_key::key, and NULL.
DSA* ldns_key_dsa_key | ( | const ldns_key * | k | ) |
returns the (openssl) DSA struct contained in the key
Definition at line 1128 of file keys.c.
References ldns_struct_key::_key, ldns_struct_key::key, and NULL.
unsigned char* ldns_key_hmac_key | ( | const ldns_key * | k | ) |
return the hmac key data
[in] | k | the key |
Definition at line 1140 of file keys.c.
References ldns_struct_key::_key, ldns_struct_key::hmac, and NULL.
size_t ldns_key_hmac_size | ( | const ldns_key * | k | ) |
return the hmac key size
[in] | k | the key |
Definition at line 1150 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::hmac.
void* ldns_key_external_key | ( | const ldns_key * | k | ) |
return the key id key data
[in] | k | the key |
Definition at line 1160 of file keys.c.
References ldns_struct_key::_key, and ldns_struct_key::external_key.
uint32_t ldns_key_origttl | ( | const ldns_key * | k | ) |
return the original ttl of the key
[in] | k | the key |
Definition at line 1166 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
uint16_t ldns_key_flags | ( | const ldns_key * | k | ) |
return the flag of the key
[in] | k | the key |
Definition at line 1172 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
uint32_t ldns_key_inception | ( | const ldns_key * | k | ) |
return the key's inception date
[in] | k | the key |
Definition at line 1178 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
uint32_t ldns_key_expiration | ( | const ldns_key * | k | ) |
return the key's expiration date
[in] | k | the key |
Definition at line 1184 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
uint16_t ldns_key_keytag | ( | const ldns_key * | k | ) |
return the keytag
[in] | k | the key |
Definition at line 1190 of file keys.c.
References ldns_struct_key::_extra, and ldns_struct_key::dnssec.
return the public key's owner
[in] | k | the key |
Definition at line 1196 of file keys.c.
References ldns_struct_key::_pubkey_owner.
void ldns_key_list_set_use | ( | ldns_key_list * | keys, |
bool | v | ||
) |
Definition at line 1203 of file keys.c.
References i, ldns_key_list_key(), ldns_key_list_key_count(), and ldns_key_set_use().
void ldns_key_list_set_key_count | ( | ldns_key_list * | key, |
size_t | count | ||
) |
Set the keylist's key count to count.
[in] | key | the key |
[in] | count | the cuont |
Definition at line 1213 of file keys.c.
References ldns_struct_key_list::_key_count.
bool ldns_key_list_push_key | ( | ldns_key_list * | key_list, |
ldns_key * | key | ||
) |
pushes a key to a keylist
[in] | key_list | the key_list to push to |
[in] | key | the key to push |
Definition at line 1219 of file keys.c.
References ldns_struct_key_list::_keys, ldns_key_list_key_count(), ldns_key_list_set_key_count(), and LDNS_XREALLOC.
ldns_key* ldns_key_list_pop_key | ( | ldns_key_list * | key_list | ) |
pops the last rr from a keylist
[in] | key_list | the rr_list to pop from |
Definition at line 1242 of file keys.c.
References ldns_struct_key_list::_keys, ldns_key_list_key(), ldns_key_list_key_count(), ldns_key_list_set_key_count(), LDNS_XREALLOC, and NULL.
converts a ldns_key to a public key rr If the key data exists at an external point, the corresponding rdata field must still be added with ldns_rr_rdf_push() to the result rr of this function
[in] | k | the ldns_key to convert |
Definition at line 1358 of file keys.c.
References ldns_struct_key::_key, DSA_free(), ldns_struct_key::key, LDNS_DNSSEC_KEYPROTO, LDNS_DSA, LDNS_DSA_NSEC3, LDNS_FREE, ldns_key_algorithm(), ldns_key_dsa_key(), ldns_key_flags(), ldns_key_hmac_key(), ldns_key_hmac_size(), ldns_key_pubkey_owner(), ldns_key_rsa_key(), LDNS_MAX_KEYLEN, ldns_native2rdf_int16(), ldns_native2rdf_int8(), ldns_rdf_clone(), ldns_rdf_new_frm_data(), LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT8, ldns_rr_free(), ldns_rr_new(), ldns_rr_push_rdf(), ldns_rr_set_owner(), ldns_rr_set_type(), LDNS_RR_TYPE_DNSKEY, LDNS_RR_TYPE_KEY, LDNS_SIGN_DSA, LDNS_SIGN_DSA_NSEC3, LDNS_SIGN_ECC_GOST, LDNS_SIGN_ECDSAP256SHA256, LDNS_SIGN_ECDSAP384SHA384, LDNS_SIGN_HMACMD5, LDNS_SIGN_HMACSHA1, LDNS_SIGN_HMACSHA256, LDNS_SIGN_RSAMD5, LDNS_SIGN_RSASHA1, LDNS_SIGN_RSASHA1_NSEC3, LDNS_SIGN_RSASHA256, LDNS_SIGN_RSASHA512, LDNS_XMALLOC, and NULL.
void ldns_key_free | ( | ldns_key * | key | ) |
void ldns_key_deep_free | ( | ldns_key * | key | ) |
frees a key structure and all its internal data structures, except the data set by ldns_key_set_external_key()
[in] | key | the key object to free |
Definition at line 1563 of file keys.c.
References LDNS_FREE, ldns_key_evp_key(), ldns_key_hmac_key(), ldns_key_pubkey_owner(), and ldns_rdf_deep_free().
void ldns_key_list_free | ( | ldns_key_list * | key_list | ) |
Frees a key list structure.
[in] | key_list | the key list object to free |
Definition at line 1582 of file keys.c.
References ldns_struct_key_list::_keys, i, LDNS_FREE, ldns_key_deep_free(), ldns_key_list_key(), and ldns_key_list_key_count().
ldns_rr* ldns_read_anchor_file | ( | const char * | filename | ) |
Instantiates a DNSKEY or DS RR from file.
[in] | filename | the file to read the record from |
Definition at line 1593 of file keys.c.
References i, LDNS_FREE, ldns_get_errorstr_by_id(), LDNS_MAX_PACKETLEN, ldns_rr_get_type(), ldns_rr_new_frm_str(), LDNS_RR_TYPE_DNSKEY, LDNS_RR_TYPE_DS, LDNS_STATUS_OK, LDNS_XMALLOC, and NULL.
char* ldns_key_get_file_base_name | ( | ldns_key * | key | ) |
Returns the 'default base name' for key files; IE.
K<zone>+<alg>+<keytag> (without the .key or .private) The memory for this is allocated by this function, and should be freed by the caller
[in] | key | the key to get the file name from |
Definition at line 1639 of file keys.c.
References ldns_buffer_export(), ldns_buffer_free(), ldns_buffer_new(), ldns_buffer_printf(), ldns_key_algorithm(), ldns_key_keytag(), ldns_key_pubkey_owner(), and ldns_rdf2buffer_str_dname().
See if a key algorithm is supported.
[in] | algo | the signing algorithm number. |
Definition at line 1656 of file keys.c.
References ldns_struct_lookup_table::id, ldns_signing_algorithms, and ldns_struct_lookup_table::name.
ldns_signing_algorithm ldns_get_signing_algorithm_by_name | ( | const char * | name | ) |
Get signing algorithm by name.
Comparison is case insensitive.
[in] | name | string with the name. |
Definition at line 1667 of file keys.c.
References ldns_struct_lookup_table::id, LDNS_DH, LDNS_ECC, LDNS_INDIRECT, LDNS_PRIVATEDNS, LDNS_PRIVATEOID, LDNS_SIGN_DSA_NSEC3, LDNS_SIGN_ECC_GOST, LDNS_SIGN_HMACMD5, LDNS_SIGN_RSASHA1_NSEC3, ldns_signing_algorithms, ldns_struct_lookup_table::name, and NULL.
ldns_lookup_table ldns_signing_algorithms[] |
d |
i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))) |