OpenDNSSEC-signer  1.3.16
keys.h
Go to the documentation of this file.
1 /*
2  * $Id: keys.h 5380 2011-08-09 21:00:32Z matthijs $
3  *
4  * Copyright (c) 2009 NLNet Labs. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
34 #ifndef SIGNER_KEYS_H
35 #define SIGNER_KEYS_H
36 
37 #include "shared/allocator.h"
38 #include "shared/status.h"
39 
40 #ifdef HAVE_SYS_TYPES_H
41 # include <sys/types.h>
42 #endif
43 #ifdef HAVE_UNISTD_H
44 # include <unistd.h>
45 #endif
46 #include <ldns/ldns.h>
47 #include <libhsm.h>
48 #include <libhsmdns.h>
49 
50 
55 typedef struct key_struct key_type;
56 struct key_struct {
58  const char* locator;
59  ldns_rr* dnskey;
60  hsm_key_t* hsmkey;
61  hsm_sign_params_t* params;
62  uint8_t algorithm;
63  uint32_t flags;
64  int publish;
65  int ksk;
66  int zsk;
68 };
69 
77  size_t count;
79 };
80 
93 key_type* key_create(allocator_type* allocator, const char* locator,
94  uint8_t algorithm, uint32_t flags, int publish, int ksk, int zsk);
95 
103 key_type* key_recover(FILE* fd, allocator_type* allocator);
104 
112 
121 
129 key_type* keylist_lookup(keylist_type* kl, const char* locator);
130 
138 key_type* keylist_lookup_by_dnskey(keylist_type* kl, ldns_rr* dnskey);
139 
145 void keylist_cleanup(keylist_type* kl);
146 
153 void keylist_print(FILE* fd, keylist_type* kl);
154 
161 void keylist_backup(FILE* fd, keylist_type* kl);
162 
169 void keylist_log(keylist_type* kl, const char* name);
170 
171 #endif /* SIGNER_KEYS_H */
key_type * next
Definition: keys.h:67
void keylist_cleanup(keylist_type *kl)
Definition: keys.c:482
int publish
Definition: keys.h:64
int zsk
Definition: keys.h:66
void keylist_log(keylist_type *kl, const char *name)
Definition: keys.c:431
ldns_rr * dnskey
Definition: keys.h:59
allocator_type * allocator
Definition: keys.h:57
enum ods_enum_status ods_status
Definition: status.h:64
void keylist_backup(FILE *fd, keylist_type *kl)
Definition: keys.c:408
void keylist_print(FILE *fd, keylist_type *kl)
Definition: keys.c:388
ods_status keylist_push(keylist_type *kl, key_type *key)
Definition: keys.c:299
key_type * key_create(allocator_type *allocator, const char *locator, uint8_t algorithm, uint32_t flags, int publish, int ksk, int zsk)
Definition: keys.c:49
keylist_type * keylist_create(allocator_type *allocator)
Definition: keys.c:268
key_type * key_recover(FILE *fd, allocator_type *allocator)
Definition: keys.c:98
const char * locator
Definition: keys.h:58
size_t count
Definition: keys.h:77
int ksk
Definition: keys.h:65
uint8_t algorithm
Definition: keys.h:62
key_type * keylist_lookup_by_dnskey(keylist_type *list, ldns_rr *dnskey)
Definition: keys.c:359
hsm_sign_params_t * params
Definition: keys.h:61
key_type * keylist_lookup(keylist_type *list, const char *locator)
Definition: keys.c:330
key_type * first_key
Definition: keys.h:78
allocator_type * allocator
Definition: keys.h:76
uint32_t flags
Definition: keys.h:63
hsm_key_t * hsmkey
Definition: keys.h:60