1 /* $OpenBSD: pkcs12.h,v 1.24 2018/05/30 15:32:11 tb Exp $ */
2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3  * project 1999.
4  */
5 /* ====================================================================
6  * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in
17  *    the documentation and/or other materials provided with the
18  *    distribution.
19  *
20  * 3. All advertising materials mentioning features or use of this
21  *    software must display the following acknowledgment:
22  *    "This product includes software developed by the OpenSSL Project
23  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24  *
25  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26  *    endorse or promote products derived from this software without
27  *    prior written permission. For written permission, please contact
28  *    licensing@OpenSSL.org.
29  *
30  * 5. Products derived from this software may not be called "OpenSSL"
31  *    nor may "OpenSSL" appear in their names without prior written
32  *    permission of the OpenSSL Project.
33  *
34  * 6. Redistributions of any form whatsoever must retain the following
35  *    acknowledgment:
36  *    "This product includes software developed by the OpenSSL Project
37  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38  *
39  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50  * OF THE POSSIBILITY OF SUCH DAMAGE.
51  * ====================================================================
52  *
53  * This product includes cryptographic software written by Eric Young
54  * (eay@cryptsoft.com).  This product includes software written by Tim
55  * Hudson (tjh@cryptsoft.com).
56  *
57  */
58 module libressl_d.openssl.pkcs12;
59 
60 
61 private static import core.stdc.config;
62 private static import libressl_d.compat.stdio;
63 private static import libressl_d.openssl.asn1;
64 private static import libressl_d.openssl.evp;
65 private static import libressl_d.openssl.objects;
66 private static import libressl_d.openssl.ossl_typ;
67 private static import libressl_d.openssl.pkcs7;
68 private static import libressl_d.openssl.stack;
69 public import libressl_d.openssl.bio;
70 public import libressl_d.openssl.x509;
71 
72 extern (C):
73 nothrow @nogc:
74 
75 enum PKCS12_KEY_ID = 1;
76 enum PKCS12_IV_ID = 2;
77 enum PKCS12_MAC_ID = 3;
78 
79 /* Default iteration count */
80 //#if !defined(PKCS12_DEFAULT_ITER)
81 	alias PKCS12_DEFAULT_ITER = libressl_d.openssl.evp.PKCS5_DEFAULT_ITER;
82 //#endif
83 
84 enum PKCS12_MAC_KEY_LENGTH = 20;
85 
86 enum PKCS12_SALT_LEN = 8;
87 
88 /* Uncomment out next line for unicode password and names, otherwise ASCII */
89 
90 /* version = PBE_UNICODE; */
91 
92 version (PBE_UNICODE) {
93 	alias PKCS12_key_gen = .PKCS12_key_gen_uni;
94 	alias PKCS12_add_friendlyname = .PKCS12_add_friendlyname_uni;
95 } else {
96 	alias PKCS12_key_gen = .PKCS12_key_gen_asc;
97 	alias PKCS12_add_friendlyname = .PKCS12_add_friendlyname_asc;
98 }
99 
100 /* MS key usage constants */
101 
102 enum KEY_EX = 0x10;
103 enum KEY_SIG = 0x80;
104 
105 struct PKCS12_MAC_DATA
106 {
107 	libressl_d.openssl.x509.X509_SIG* dinfo;
108 	libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* salt;
109 
110 	/**
111 	 * defaults to 1
112 	 */
113 	libressl_d.openssl.ossl_typ.ASN1_INTEGER* iter;
114 }
115 
116 struct PKCS12
117 {
118 	libressl_d.openssl.ossl_typ.ASN1_INTEGER* version_;
119 	.PKCS12_MAC_DATA* mac;
120 	libressl_d.openssl.pkcs7.PKCS7* authsafes;
121 }
122 
123 struct PKCS12_SAFEBAG
124 {
125 	libressl_d.openssl.asn1.ASN1_OBJECT* type;
126 
127 	union value_
128 	{
129 		/**
130 		 * secret, crl and certbag
131 		 */
132 		.pkcs12_bag_st* bag;
133 
134 		/**
135 		 * keybag
136 		 */
137 		libressl_d.openssl.x509.pkcs8_priv_key_info_st* keybag;
138 
139 		/**
140 		 * shrouded key bag
141 		 */
142 		libressl_d.openssl.x509.X509_SIG* shkeybag;
143 
144 		.stack_st_PKCS12_SAFEBAG* safes;
145 		libressl_d.openssl.asn1.ASN1_TYPE* other;
146 	}
147 
148 	value_ value;
149 	libressl_d.openssl.x509.stack_st_X509_ATTRIBUTE* attrib;
150 }
151 
152 //DECLARE_STACK_OF(PKCS12_SAFEBAG)
153 struct stack_st_PKCS12_SAFEBAG
154 {
155 	libressl_d.openssl.stack._STACK stack;
156 }
157 
158 //libressl_d.openssl.ossl_typ.DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)
159 
160 struct pkcs12_bag_st
161 {
162 	libressl_d.openssl.asn1.ASN1_OBJECT* type;
163 
164 	union value_
165 	{
166 		libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* x509cert;
167 		libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* x509crl;
168 		libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* octet;
169 		libressl_d.openssl.ossl_typ.ASN1_IA5STRING* sdsicert;
170 
171 		/**
172 		 * Secret or other bag
173 		 */
174 		libressl_d.openssl.asn1.ASN1_TYPE* other;
175 	}
176 
177 	value_ value;
178 }
179 
180 alias PKCS12_BAGS = .pkcs12_bag_st;
181 
182 enum PKCS12_ERROR = 0;
183 enum PKCS12_OK = 1;
184 
185 version (LIBRESSL_INTERNAL) {
186 } else {
187 	/* Compatibility macros */
188 
189 	alias M_PKCS12_x5092certbag = .PKCS12_x5092certbag;
190 	alias M_PKCS12_x509crl2certbag = .PKCS12_x509crl2certbag;
191 
192 	alias M_PKCS12_certbag2x509 = .PKCS12_certbag2x509;
193 	alias M_PKCS12_certbag2x509crl = .PKCS12_certbag2x509crl;
194 
195 	alias M_PKCS12_unpack_p7data = .PKCS12_unpack_p7data;
196 	alias M_PKCS12_pack_authsafes = .PKCS12_pack_authsafes;
197 	alias M_PKCS12_unpack_authsafes = .PKCS12_unpack_authsafes;
198 	alias M_PKCS12_unpack_p7encdata = .PKCS12_unpack_p7encdata;
199 
200 	alias M_PKCS12_decrypt_skey = .PKCS12_decrypt_skey;
201 	alias M_PKCS8_decrypt = .PKCS8_decrypt;
202 
203 	pragma(inline, true)
204 	int M_PKCS12_bag_type(BG)(scope const BG* bg)
205 
206 		in
207 		{
208 			assert(bg != null);
209 		}
210 
211 		do
212 		{
213 			return libressl_d.openssl.objects.OBJ_obj2nid(bg.type);
214 		}
215 
216 	pragma(inline, true)
217 	int M_PKCS12_cert_bag_type(scope const .PKCS12_SAFEBAG* bg)
218 
219 		in
220 		{
221 			assert(bg != null);
222 			assert(bg.value.bag != null);
223 		}
224 
225 		do
226 		{
227 			return libressl_d.openssl.objects.OBJ_obj2nid(bg.value.bag.type);
228 		}
229 
230 	alias M_PKCS12_crl_bag_type = .M_PKCS12_cert_bag_type;
231 }
232 
233 pragma(inline, true)
234 libressl_d.openssl.asn1.ASN1_TYPE* PKCS12_get_attr(BAG)(BAG* bag, int attr_nid)
235 
236 	in
237 	{
238 		assert(bag != null);
239 	}
240 
241 	do
242 	{
243 		return .PKCS12_get_attr_gen(bag.attrib, attr_nid);
244 	}
245 
246 pragma(inline, true)
247 libressl_d.openssl.asn1.ASN1_TYPE* PKCS8_get_attr(P8)(P8* p8, int attr_nid)
248 
249 	in
250 	{
251 		assert(p8 != null);
252 	}
253 
254 	do
255 	{
256 		return .PKCS12_get_attr_gen(p8.attributes, attr_nid);
257 	}
258 
259 pragma(inline, true)
260 pure nothrow @trusted @nogc @live
261 int PKCS12_mac_present(scope const .PKCS12* p12)
262 
263 	in
264 	{
265 		assert(p12 != null);
266 	}
267 
268 	do
269 	{
270 		return (p12.mac) ? (1) : (0);
271 	}
272 
273 .PKCS12_SAFEBAG* PKCS12_x5092certbag(libressl_d.openssl.ossl_typ.X509* x509);
274 .PKCS12_SAFEBAG* PKCS12_x509crl2certbag(libressl_d.openssl.ossl_typ.X509_CRL* crl);
275 libressl_d.openssl.ossl_typ.X509* PKCS12_certbag2x509(.PKCS12_SAFEBAG* bag);
276 libressl_d.openssl.ossl_typ.X509_CRL* PKCS12_certbag2x509crl(.PKCS12_SAFEBAG* bag);
277 
278 .PKCS12_SAFEBAG* PKCS12_item_pack_safebag(void* obj, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, int nid1, int nid2);
279 .PKCS12_SAFEBAG* PKCS12_MAKE_KEYBAG(libressl_d.openssl.ossl_typ.PKCS8_PRIV_KEY_INFO* p8);
280 libressl_d.openssl.ossl_typ.PKCS8_PRIV_KEY_INFO* PKCS8_decrypt(const (libressl_d.openssl.x509.X509_SIG)* p8, const (char)* pass, int passlen);
281 libressl_d.openssl.ossl_typ.PKCS8_PRIV_KEY_INFO* PKCS12_decrypt_skey(const (.PKCS12_SAFEBAG)* bag, const (char)* pass, int passlen);
282 libressl_d.openssl.x509.X509_SIG* PKCS8_encrypt(int pbe_nid, const (libressl_d.openssl.ossl_typ.EVP_CIPHER)* cipher, const (char)* pass, int passlen, ubyte* salt, int saltlen, int iter, libressl_d.openssl.ossl_typ.PKCS8_PRIV_KEY_INFO* p8);
283 .PKCS12_SAFEBAG* PKCS12_MAKE_SHKEYBAG(int pbe_nid, const (char)* pass, int passlen, ubyte* salt, int saltlen, int iter, libressl_d.openssl.ossl_typ.PKCS8_PRIV_KEY_INFO* p8);
284 libressl_d.openssl.pkcs7.PKCS7* PKCS12_pack_p7data(.stack_st_PKCS12_SAFEBAG * sk);
285 .stack_st_PKCS12_SAFEBAG* PKCS12_unpack_p7data(libressl_d.openssl.pkcs7.PKCS7* p7);
286 libressl_d.openssl.pkcs7.PKCS7* PKCS12_pack_p7encdata(int pbe_nid, const (char)* pass, int passlen, ubyte* salt, int saltlen, int iter, .stack_st_PKCS12_SAFEBAG * bags);
287 .stack_st_PKCS12_SAFEBAG* PKCS12_unpack_p7encdata(libressl_d.openssl.pkcs7.PKCS7* p7, const (char)* pass, int passlen);
288 
289 int PKCS12_pack_authsafes(.PKCS12* p12, libressl_d.openssl.pkcs7.stack_st_PKCS7* safes);
290 libressl_d.openssl.pkcs7.stack_st_PKCS7* PKCS12_unpack_authsafes(const (.PKCS12)* p12);
291 
292 int PKCS12_add_localkeyid(.PKCS12_SAFEBAG* bag, ubyte* name, int namelen);
293 int PKCS12_add_friendlyname_asc(.PKCS12_SAFEBAG* bag, const (char)* name, int namelen);
294 int PKCS12_add_CSPName_asc(.PKCS12_SAFEBAG* bag, const (char)* name, int namelen);
295 int PKCS12_add_friendlyname_uni(.PKCS12_SAFEBAG* bag, const (ubyte)* name, int namelen);
296 int PKCS8_add_keyusage(libressl_d.openssl.ossl_typ.PKCS8_PRIV_KEY_INFO* p8, int usage);
297 libressl_d.openssl.asn1.ASN1_TYPE* PKCS12_get_attr_gen(const (libressl_d.openssl.x509.stack_st_X509_ATTRIBUTE)* attrs, int attr_nid);
298 char* PKCS12_get_friendlyname(.PKCS12_SAFEBAG* bag);
299 ubyte* PKCS12_pbe_crypt(const (libressl_d.openssl.ossl_typ.X509_ALGOR)* algor, const (char)* pass, int passlen, const (ubyte)* in_, int inlen, ubyte** data, int* datalen, int en_de);
300 void* PKCS12_item_decrypt_d2i(const (libressl_d.openssl.ossl_typ.X509_ALGOR)* algor, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, const (char)* pass, int passlen, const (libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING)* oct, int zbuf);
301 libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* PKCS12_item_i2d_encrypt(libressl_d.openssl.ossl_typ.X509_ALGOR* algor, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, const (char)* pass, int passlen, void* obj, int zbuf);
302 .PKCS12* PKCS12_init(int mode);
303 int PKCS12_key_gen_asc(const (char)* pass, int passlen, ubyte* salt, int saltlen, int id, int iter, int n, ubyte* out_, const (libressl_d.openssl.ossl_typ.EVP_MD)* md_type);
304 int PKCS12_key_gen_uni(ubyte* pass, int passlen, ubyte* salt, int saltlen, int id, int iter, int n, ubyte* out_, const (libressl_d.openssl.ossl_typ.EVP_MD)* md_type);
305 int PKCS12_PBE_keyivgen(libressl_d.openssl.ossl_typ.EVP_CIPHER_CTX* ctx, const (char)* pass, int passlen, libressl_d.openssl.asn1.ASN1_TYPE* param, const (libressl_d.openssl.ossl_typ.EVP_CIPHER)* cipher, const (libressl_d.openssl.ossl_typ.EVP_MD)* md_type, int en_de);
306 int PKCS12_gen_mac(.PKCS12* p12, const (char)* pass, int passlen, ubyte* mac, uint* maclen);
307 int PKCS12_verify_mac(.PKCS12* p12, const (char)* pass, int passlen);
308 int PKCS12_set_mac(.PKCS12* p12, const (char)* pass, int passlen, ubyte* salt, int saltlen, int iter, const (libressl_d.openssl.ossl_typ.EVP_MD)* md_type);
309 int PKCS12_setup_mac(.PKCS12* p12, int iter, ubyte* salt, int saltlen, const (libressl_d.openssl.ossl_typ.EVP_MD)* md_type);
310 ubyte* OPENSSL_asc2uni(const (char)* asc, int asclen, ubyte** uni, int* unilen);
311 char* OPENSSL_uni2asc(const (ubyte)* uni, int unilen);
312 
313 .PKCS12* PKCS12_new();
314 void PKCS12_free(.PKCS12* a);
315 .PKCS12* d2i_PKCS12(.PKCS12** a, const (ubyte)** in_, core.stdc.config.c_long len);
316 int i2d_PKCS12(.PKCS12* a, ubyte** out_);
317 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM PKCS12_it;
318 .PKCS12_MAC_DATA* PKCS12_MAC_DATA_new();
319 void PKCS12_MAC_DATA_free(.PKCS12_MAC_DATA* a);
320 .PKCS12_MAC_DATA* d2i_PKCS12_MAC_DATA(.PKCS12_MAC_DATA** a, const (ubyte)** in_, core.stdc.config.c_long len);
321 int i2d_PKCS12_MAC_DATA(.PKCS12_MAC_DATA* a, ubyte** out_);
322 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM PKCS12_MAC_DATA_it;
323 .PKCS12_SAFEBAG* PKCS12_SAFEBAG_new();
324 void PKCS12_SAFEBAG_free(.PKCS12_SAFEBAG* a);
325 .PKCS12_SAFEBAG* d2i_PKCS12_SAFEBAG(.PKCS12_SAFEBAG** a, const (ubyte)** in_, core.stdc.config.c_long len);
326 int i2d_PKCS12_SAFEBAG(.PKCS12_SAFEBAG* a, ubyte** out_);
327 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM PKCS12_SAFEBAG_it;
328 .PKCS12_BAGS* PKCS12_BAGS_new();
329 void PKCS12_BAGS_free(.PKCS12_BAGS* a);
330 .PKCS12_BAGS* d2i_PKCS12_BAGS(.PKCS12_BAGS** a, const (ubyte)** in_, core.stdc.config.c_long len);
331 int i2d_PKCS12_BAGS(.PKCS12_BAGS* a, ubyte** out_);
332 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM PKCS12_BAGS_it;
333 
334 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM PKCS12_SAFEBAGS_it;
335 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM PKCS12_AUTHSAFES_it;
336 
337 void PKCS12_PBE_add();
338 int PKCS12_parse(.PKCS12* p12, const (char)* pass, libressl_d.openssl.ossl_typ.EVP_PKEY** pkey, libressl_d.openssl.ossl_typ.X509** cert, libressl_d.openssl.x509.stack_st_X509** ca);
339 .PKCS12* PKCS12_create(const (char)* pass, const (char)* name, libressl_d.openssl.ossl_typ.EVP_PKEY* pkey, libressl_d.openssl.ossl_typ.X509* cert, libressl_d.openssl.x509.stack_st_X509* ca, int nid_key, int nid_cert, int iter, int mac_iter, int keytype);
340 
341 .PKCS12_SAFEBAG* PKCS12_add_cert(.stack_st_PKCS12_SAFEBAG** pbags, libressl_d.openssl.ossl_typ.X509* cert);
342 .PKCS12_SAFEBAG* PKCS12_add_key(.stack_st_PKCS12_SAFEBAG** pbags, libressl_d.openssl.ossl_typ.EVP_PKEY* key, int key_usage, int iter, int key_nid, const (char)* pass);
343 int PKCS12_add_safe(libressl_d.openssl.pkcs7.stack_st_PKCS7** psafes, .stack_st_PKCS12_SAFEBAG * bags, int safe_nid, int iter, const (char)* pass);
344 .PKCS12* PKCS12_add_safes(libressl_d.openssl.pkcs7.stack_st_PKCS7* safes, int p7_nid);
345 
346 int i2d_PKCS12_bio(libressl_d.openssl.bio.BIO* bp, .PKCS12* p12);
347 int i2d_PKCS12_fp(libressl_d.compat.stdio.FILE* fp, .PKCS12* p12);
348 .PKCS12* d2i_PKCS12_bio(libressl_d.openssl.bio.BIO* bp, .PKCS12** p12);
349 .PKCS12* d2i_PKCS12_fp(libressl_d.compat.stdio.FILE* fp, .PKCS12** p12);
350 int PKCS12_newpass(.PKCS12* p12, const (char)* oldpass, const (char)* newpass);
351 
352 /* BEGIN ERROR CODES */
353 /**
354  * The following lines are auto generated by the script mkerr.pl. Any changes
355  * made after this point may be overwritten when the script is next run.
356  */
357 void ERR_load_PKCS12_strings();
358 
359 /* Error codes for the PKCS12 functions. */
360 
361 /* Function codes. */
362 enum PKCS12_F_PARSE_BAG = 129;
363 enum PKCS12_F_PARSE_BAGS = 103;
364 enum PKCS12_F_PKCS12_ADD_FRIENDLYNAME = 100;
365 enum PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC = 127;
366 enum PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI = 102;
367 enum PKCS12_F_PKCS12_ADD_LOCALKEYID = 104;
368 enum PKCS12_F_PKCS12_CREATE = 105;
369 enum PKCS12_F_PKCS12_GEN_MAC = 107;
370 enum PKCS12_F_PKCS12_INIT = 109;
371 enum PKCS12_F_PKCS12_ITEM_DECRYPT_D2I = 106;
372 enum PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT = 108;
373 enum PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG = 117;
374 enum PKCS12_F_PKCS12_KEY_GEN_ASC = 110;
375 enum PKCS12_F_PKCS12_KEY_GEN_UNI = 111;
376 enum PKCS12_F_PKCS12_MAKE_KEYBAG = 112;
377 enum PKCS12_F_PKCS12_MAKE_SHKEYBAG = 113;
378 enum PKCS12_F_PKCS12_NEWPASS = 128;
379 enum PKCS12_F_PKCS12_PACK_P7DATA = 114;
380 enum PKCS12_F_PKCS12_PACK_P7ENCDATA = 115;
381 enum PKCS12_F_PKCS12_PARSE = 118;
382 enum PKCS12_F_PKCS12_PBE_CRYPT = 119;
383 enum PKCS12_F_PKCS12_PBE_KEYIVGEN = 120;
384 enum PKCS12_F_PKCS12_SETUP_MAC = 122;
385 enum PKCS12_F_PKCS12_SET_MAC = 123;
386 enum PKCS12_F_PKCS12_UNPACK_AUTHSAFES = 130;
387 enum PKCS12_F_PKCS12_UNPACK_P7DATA = 131;
388 enum PKCS12_F_PKCS12_VERIFY_MAC = 126;
389 enum PKCS12_F_PKCS8_ADD_KEYUSAGE = 124;
390 enum PKCS12_F_PKCS8_ENCRYPT = 125;
391 
392 /* Reason codes. */
393 enum PKCS12_R_CANT_PACK_STRUCTURE = 100;
394 enum PKCS12_R_CONTENT_TYPE_NOT_DATA = 121;
395 enum PKCS12_R_DECODE_ERROR = 101;
396 enum PKCS12_R_ENCODE_ERROR = 102;
397 enum PKCS12_R_ENCRYPT_ERROR = 103;
398 enum PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE = 120;
399 enum PKCS12_R_INVALID_NULL_ARGUMENT = 104;
400 enum PKCS12_R_INVALID_NULL_PKCS12_POINTER = 105;
401 enum PKCS12_R_IV_GEN_ERROR = 106;
402 enum PKCS12_R_KEY_GEN_ERROR = 107;
403 enum PKCS12_R_MAC_ABSENT = 108;
404 enum PKCS12_R_MAC_GENERATION_ERROR = 109;
405 enum PKCS12_R_MAC_SETUP_ERROR = 110;
406 enum PKCS12_R_MAC_STRING_SET_ERROR = 111;
407 enum PKCS12_R_MAC_VERIFY_ERROR = 112;
408 enum PKCS12_R_MAC_VERIFY_FAILURE = 113;
409 enum PKCS12_R_PARSE_ERROR = 114;
410 enum PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR = 115;
411 enum PKCS12_R_PKCS12_CIPHERFINAL_ERROR = 116;
412 enum PKCS12_R_PKCS12_PBE_CRYPT_ERROR = 117;
413 enum PKCS12_R_UNKNOWN_DIGEST_ALGORITHM = 118;
414 enum PKCS12_R_UNSUPPORTED_PKCS12_MODE = 119;