39 static const char* key_str =
"keys";
58 ods_log_error(
"[%s] create list failed: allocator_alloc() failed",
77 if (!kl || !locator || kl->
count <= 0) {
80 for (i=0; i < kl->
count; i++) {
99 if (!kl || !dnskey || kl->
count <= 0) {
102 for (i=0; i < kl->
count; i++) {
104 if (ldns_rr_compare(kl->
keys[i].
dnskey, dnskey) == 0) {
119 uint8_t algorithm, uint32_t flags,
int publish,
int ksk,
int zsk)
133 ods_fatal_exit(
"[%s] unable to add key: allocator_alloc() failed",
164 fprintf(fd,
"\t\t\t<Key>\n");
165 fprintf(fd,
"\t\t\t\t<Flags>%u</Flags>\n", key->
flags);
166 fprintf(fd,
"\t\t\t\t<Algorithm>%u</Algorithm>\n", key->
algorithm);
168 fprintf(fd,
"\t\t\t\t<Locator>%s</Locator>\n", key->
locator);
171 fprintf(fd,
"\t\t\t\t<KSK />\n");
174 fprintf(fd,
"\t\t\t\t<ZSK />\n");
177 fprintf(fd,
"\t\t\t\t<Publish />\n");
179 fprintf(fd,
"\t\t\t</Key>\n");
190 key_log(
key_type* key,
const char* name)
195 ods_log_debug(
"[%s] zone %s key: LOCATOR[%s] FLAGS[%u] ALGORITHM[%u] "
196 "KSK[%i] ZSK[%i] PUBLISH[%i]", key_str, name?name:
"(null)", key->
locator,
210 if (!fd || !kl || kl->
count <= 0) {
213 for (i=0; i < kl->
count; i++) {
214 key_print(fd, &kl->
keys[i]);
228 if (!kl || kl->
count <= 0) {
231 for (i=0; i < kl->
count; i++) {
232 key_log(&kl->
keys[i], name);
249 hsm_key_free(key->
hsmkey);
250 hsm_sign_params_free(key->
params);
268 for (i=0; i < kl->
count; i++) {
269 key_delfunc(&kl->
keys[i]);
282 key_backup(FILE* fd,
key_type* key,
const char* version)
287 fprintf(fd,
";;Key: locator %s algorithm %u flags %u publish %i ksk %i "
290 if (strcmp(version, ODS_SE_FILE_MAGIC_V2) == 0) {
294 fprintf(fd,
";;Keydone\n");
307 const char* locator = NULL;
308 uint8_t algorithm = 0;
329 free((
void*)locator);
335 return keylist_push(kl, locator, algorithm, flags, publish, ksk, zsk);
347 if (!fd || !kl || kl->
count <= 0) {
350 for (i=0; i < kl->
count; i++) {
351 key_backup(fd, &kl->
keys[i], version);