41 static const char* key_str =
"keys";
60 ods_log_error(
"[%s] create list failed: allocator_alloc() failed",
79 if (!kl || !locator || kl->
count <= 0) {
82 for (i=0; i < kl->
count; i++) {
101 if (!kl || !dnskey || kl->
count <= 0) {
104 for (i=0; i < kl->
count; i++) {
106 if (ldns_rr_compare(kl->
keys[i].
dnskey, dnskey) == 0) {
121 uint8_t algorithm, uint32_t flags,
int publish,
int ksk,
int zsk)
135 ods_fatal_exit(
"[%s] unable to add key: allocator_alloc() failed",
166 fprintf(fd,
"\t\t\t<Key>\n");
167 fprintf(fd,
"\t\t\t\t<Flags>%u</Flags>\n", key->
flags);
168 fprintf(fd,
"\t\t\t\t<Algorithm>%u</Algorithm>\n", key->
algorithm);
170 fprintf(fd,
"\t\t\t\t<Locator>%s</Locator>\n", key->
locator);
173 fprintf(fd,
"\t\t\t\t<KSK />\n");
176 fprintf(fd,
"\t\t\t\t<ZSK />\n");
179 fprintf(fd,
"\t\t\t\t<Publish />\n");
181 fprintf(fd,
"\t\t\t</Key>\n");
192 key_log(
key_type* key,
const char* name)
197 ods_log_debug(
"[%s] zone %s key: LOCATOR[%s] FLAGS[%u] ALGORITHM[%u] "
198 "KSK[%i] ZSK[%i] PUBLISH[%i]", key_str, name?name:
"(null)", key->
locator,
212 if (!fd || !kl || kl->
count <= 0) {
215 for (i=0; i < kl->
count; i++) {
216 key_print(fd, &kl->
keys[i]);
230 if (!kl || kl->
count <= 0) {
233 for (i=0; i < kl->
count; i++) {
234 key_log(&kl->
keys[i], name);
251 hsm_key_free(key->
hsmkey);
252 hsm_sign_params_free(key->
params);
270 for (i=0; i < kl->
count; i++) {
271 key_delfunc(&kl->
keys[i]);
284 key_backup(FILE* fd,
key_type* key,
const char* version)
289 fprintf(fd,
";;Key: locator %s algorithm %u flags %u publish %i ksk %i "
292 if (strcmp(version, ODS_SE_FILE_MAGIC_V2) == 0) {
296 fprintf(fd,
";;Keydone\n");
309 const char* locator = NULL;
310 uint8_t algorithm = 0;
331 free((
void*)locator);
337 return keylist_push(kl, locator, algorithm, flags, publish, ksk, zsk);
349 if (!fd || !kl || kl->
count <= 0) {
352 for (i=0; i < kl->
count; i++) {
353 key_backup(fd, &kl->
keys[i], version);