40 static const char* key_str =
"keys";
57 ods_log_error(
"[%s] create list failed: allocator_alloc() failed",
76 if (!kl || !locator || kl->
count <= 0) {
79 for (i=0; i < kl->
count; i++) {
81 if (ods_strcmp(kl->
keys[i].
locator, locator) == 0) {
96 uint8_t algorithm, uint32_t flags,
int publish,
int ksk,
int zsk)
105 ods_fatal_exit(
"[%s] unable to add key: allocator_alloc() failed",
131 key_log(
key_type* key,
const char* name)
136 ods_log_debug(
"[%s] zone %s key: LOCATOR[%s] FLAGS[%u] ALGORITHM[%u] " 137 "KSK[%i] ZSK[%i] PUBLISH[%i]", key_str, name?name:
"(null)", key->
locator,
150 if (!kl || kl->
count <= 0) {
153 for (i=0; i < kl->
count; i++) {
154 key_log(&kl->
keys[i], name);
170 hsm_sign_params_free(key->
params);
186 for (i=0; i < kl->
count; i++) {
187 key_delfunc(&kl->
keys[i]);
199 key_backup(FILE* fd,
key_type* key,
const char* version)
204 fprintf(fd,
";;Key: locator %s algorithm %u flags %u publish %i ksk %i zsk %i keytag %d\n", key->
locator, (
unsigned) key->
algorithm,
206 if (strcmp(version, ODS_SE_FILE_MAGIC_V2) == 0) {
208 (void)util_rr_print(fd, key->
dnskey);
210 fprintf(fd,
";;Keydone\n");
222 const char* locator = NULL;
223 const char* resourcerecord = NULL;
224 uint8_t algorithm = 0;
250 free((
void*)locator);
256 return keylist_push(kl, locator, resourcerecord, algorithm, flags, publish, ksk, zsk);
268 if (!fd || !kl || kl->
count <= 0) {
271 for (i=0; i < kl->
count; i++) {
272 key_backup(fd, &kl->
keys[i], version);
void keylist_cleanup(keylist_type *kl)
int backup_read_str(FILE *in, const char **str)
void keylist_log(keylist_type *kl, const char *name)
key_type * keylist_lookup_by_locator(keylist_type *kl, const char *locator)
int backup_read_uint8_t(FILE *in, uint8_t *v)
keylist_type * keylist_create(signconf_type *signconf)
int backup_read_int(FILE *in, int *v)
key_type * keylist_push(keylist_type *kl, const char *locator, const char *resourcerecord, uint8_t algorithm, uint32_t flags, int publish, int ksk, int zsk)
const char * resourcerecord
int backup_read_check_str(FILE *in, const char *str)
hsm_sign_params_t * params
key_type * key_recover2(FILE *fd, keylist_type *kl)
void keylist_backup(FILE *fd, keylist_type *kl, const char *version)
int backup_read_uint32_t(FILE *in, uint32_t *v)