OpenDNSSEC-signer  1.4.3
keys.h
Go to the documentation of this file.
1 /*
2  * $Id: keys.h 6215 2012-03-20 13:30:51Z 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 {
57  ldns_rr* dnskey;
58  hsm_key_t* hsmkey;
59  hsm_sign_params_t* params;
60  const char* locator;
61  uint8_t algorithm;
62  uint32_t flags;
63  int publish;
64  int ksk;
65  int zsk;
66 };
67 
74  void* sc;
76  size_t count;
77 };
78 
85 keylist_type* keylist_create(void* sc);
86 
94 key_type* keylist_lookup_by_locator(keylist_type* kl, const char* locator);
95 
103 key_type* keylist_lookup_by_dnskey(keylist_type* kl, ldns_rr* dnskey);
104 
117 key_type* keylist_push(keylist_type* kl, const char* locator,
118  uint8_t algorithm, uint32_t flags, int publish, int ksk, int zsk);
119 
126 void keylist_print(FILE* fd, keylist_type* kl);
127 
134 void keylist_log(keylist_type* kl, const char* name);
135 
141 void keylist_cleanup(keylist_type* kl);
142 
150 key_type* key_recover2(FILE* fd, keylist_type* kl);
151 
159 void keylist_backup(FILE* fd, keylist_type* kl, const char* version);
160 
161 #endif /* SIGNER_KEYS_H */
key_type * keylist_lookup_by_dnskey(keylist_type *kl, ldns_rr *dnskey)
Definition: keys.c:98
key_type * keylist_push(keylist_type *kl, const char *locator, uint8_t algorithm, uint32_t flags, int publish, int ksk, int zsk)
Definition: keys.c:120
int publish
Definition: keys.h:63
int zsk
Definition: keys.h:65
void keylist_print(FILE *fd, keylist_type *kl)
Definition: keys.c:209
ldns_rr * dnskey
Definition: keys.h:57
key_type * keylist_lookup_by_locator(keylist_type *kl, const char *locator)
Definition: keys.c:76
keylist_type * keylist_create(void *sc)
Definition: keys.c:49
const char * locator
Definition: keys.h:60
key_type * keys
Definition: keys.h:75
void keylist_backup(FILE *fd, keylist_type *kl, const char *version)
Definition: keys.c:346
void keylist_cleanup(keylist_type *kl)
Definition: keys.c:263
size_t count
Definition: keys.h:76
void * sc
Definition: keys.h:74
int ksk
Definition: keys.h:64
uint8_t algorithm
Definition: keys.h:61
hsm_sign_params_t * params
Definition: keys.h:59
void keylist_log(keylist_type *kl, const char *name)
Definition: keys.c:227
key_type * key_recover2(FILE *fd, keylist_type *kl)
Definition: keys.c:307
uint32_t flags
Definition: keys.h:62
hsm_key_t * hsmkey
Definition: keys.h:58