2 * Copyright (c) 2010 .SE (The Internet Infrastructure Foundation)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef _SOFTHSM_V2_SOFTHSM2_KEYCONV_H
28 #define _SOFTHSM_V2_SOFTHSM2_KEYCONV_H 1
32 typedef struct key_material_t {
44 int to_pkcs8(char* in_path, char* out_path, char* file_pin);
48 int save_rsa_pkcs8(char* out_path, char* file_pin, key_material_t* pkey);
49 int save_dsa_pkcs8(char* out_path, char* file_pin, key_material_t* pkey);
50 void free_key_material(key_material_t* pkey);
54 // base64.c prototypes
59 int b64_pton(const char* , unsigned char*, size_t);
60 int b64_ntop(const unsigned char*, size_t, char*, size_t);
65 // The BIND file version number.
66 #define FILE_MAJOR_VERSION 1
67 #define FILE_MINOR_VERSION 3
69 // Key algorithm number
70 #define DNS_KEYALG_ERROR -1
71 #define DNS_KEYALG_RSAMD5 1
72 #define DNS_KEYALG_DSA 3
73 #define DNS_KEYALG_ECC 4
74 #define DNS_KEYALG_RSASHA1 5
75 #define DNS_KEYALG_DSA_NSEC3_SHA1 6
76 #define DNS_KEYALG_RSASHA1_NSEC3_SHA1 7
77 #define DNS_KEYALG_RSASHA256 8
78 #define DNS_KEYALG_RSASHA512 10
79 #define DNS_KEYALG_ECC_GOST 12
81 // Maximum number of lines / line length
84 // The text fields supported
85 #if !defined(KEYCONV_BOTAN) && !defined(KEYCONV_OSSL)
86 static const char* file_tags[] = {
87 "Private-key-format:",
109 // The number of each text field.
110 // Must match the tags above.
130 // So we know how long this list is
134 #endif /* _SOFTHSM_V2_SOFTHSM2_KEYCONV_H */