1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 /* ====================================================================
11  * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
12  * ECDH support in OpenSSL originally developed by
13  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
14  */
15 
16 module deimos.openssl.x509;
17 
18 import core.stdc.time;
19 
20 import deimos.openssl._d_util;
21 import deimos.openssl.x509v3 : stack_st_ASN1_OBJECT;
22 
23 public import deimos.openssl.e_os2;
24 public import deimos.openssl.ossl_typ;
25 public import deimos.openssl.symhacks;
26 public import deimos.openssl.buffer;
27 public import deimos.openssl.evp;
28 public import deimos.openssl.bio;
29 public import deimos.openssl.stack;
30 public import deimos.openssl.asn1;
31 public import deimos.openssl.safestack;
32 public import deimos.openssl.ec;
33 
34 /* if OPENSSL_API_COMPAT < 0x10100000L */
35 public import deimos.openssl.rsa;
36 public import deimos.openssl.dsa;
37 public import deimos.openssl.dh;
38 /* endif */
39 
40 public import deimos.openssl.sha;
41 
42 extern (C):
43 nothrow:
44 
45 enum X509_FILETYPE_PEM = 1;
46 enum X509_FILETYPE_ASN1 = 2;
47 enum X509_FILETYPE_DEFAULT = 3;
48 
49 enum X509v3_KU_DIGITAL_SIGNATURE = 0x0080;
50 enum X509v3_KU_NON_REPUDIATION = 0x0040;
51 enum X509v3_KU_KEY_ENCIPHERMENT = 0x0020;
52 enum X509v3_KU_DATA_ENCIPHERMENT = 0x0010;
53 enum X509v3_KU_KEY_AGREEMENT = 0x0008;
54 enum X509v3_KU_KEY_CERT_SIGN = 0x0004;
55 enum X509v3_KU_CRL_SIGN = 0x0002;
56 enum X509v3_KU_ENCIPHER_ONLY = 0x0001;
57 enum X509v3_KU_DECIPHER_ONLY = 0x8000;
58 enum X509v3_KU_UNDEF = 0xffff;
59 
60 struct X509_algor_st
61 {
62     ASN1_OBJECT* algorithm;
63     ASN1_TYPE* parameter;
64 } /* X509_ALGOR */
65 
66 /* This is used for a table of trust checking functions */
67 
68 /* standard trust ids */
69 
70 /* Only valid in purpose settings */
71 
72 /* Keep these up to date! */
73 
74 /* trust_flags values */
75 
76 /* No compat trust if self-signed, preempts "DO_SS" */
77 
78 /* Compat trust if no explicit accepted trust EKUs */
79 
80 /* Accept "anyEKU" as a wildcard trust OID */
81 
82 /* check_trust return codes */
83 
84 /* Flags for X509_print_ex() */
85 struct stack_st_X509_ALGOR;
86 alias X509_ALGORS = stack_st_X509_ALGOR;
87 
88 struct X509_val_st
89 {
90     ASN1_TIME* notBefore;
91     ASN1_TIME* notAfter;
92 }
93 
94 alias X509_VAL = X509_val_st;
95 struct X509_sig_st;
96 alias X509_SIG = X509_sig_st;
97 struct X509_name_entry_st;
98 alias X509_NAME_ENTRY = X509_name_entry_st;
99 struct stack_st_X509_NAME_ENTRY;
100 alias sk_X509_NAME_ENTRY_compfunc = int function(const(X509_NAME_ENTRY*)* a, const(X509_NAME_ENTRY*)* b);
101 alias sk_X509_NAME_ENTRY_freefunc = void function(X509_NAME_ENTRY* a);
102 alias sk_X509_NAME_ENTRY_copyfunc = X509_name_entry_st* function(const(X509_NAME_ENTRY)* a);
103 int sk_X509_NAME_ENTRY_num(const(stack_st_X509_NAME_ENTRY)* sk);
104 X509_NAME_ENTRY* sk_X509_NAME_ENTRY_value(const(stack_st_X509_NAME_ENTRY)* sk, int idx);
105 stack_st_X509_NAME_ENTRY* sk_X509_NAME_ENTRY_new(sk_X509_NAME_ENTRY_compfunc compare);
106 stack_st_X509_NAME_ENTRY* sk_X509_NAME_ENTRY_new_null();
107 void sk_X509_NAME_ENTRY_free(stack_st_X509_NAME_ENTRY* sk);
108 void sk_X509_NAME_ENTRY_zero(stack_st_X509_NAME_ENTRY* sk);
109 X509_NAME_ENTRY* sk_X509_NAME_ENTRY_delete(stack_st_X509_NAME_ENTRY* sk, int i);
110 X509_NAME_ENTRY* sk_X509_NAME_ENTRY_delete_ptr(stack_st_X509_NAME_ENTRY* sk, X509_NAME_ENTRY* ptr);
111 int sk_X509_NAME_ENTRY_push(stack_st_X509_NAME_ENTRY* sk, X509_NAME_ENTRY* ptr);
112 int sk_X509_NAME_ENTRY_unshift(stack_st_X509_NAME_ENTRY* sk, X509_NAME_ENTRY* ptr);
113 X509_NAME_ENTRY* sk_X509_NAME_ENTRY_pop(stack_st_X509_NAME_ENTRY* sk);
114 X509_NAME_ENTRY* sk_X509_NAME_ENTRY_shift(stack_st_X509_NAME_ENTRY* sk);
115 void sk_X509_NAME_ENTRY_pop_free(stack_st_X509_NAME_ENTRY* sk, sk_X509_NAME_ENTRY_freefunc freefunc);
116 int sk_X509_NAME_ENTRY_insert(stack_st_X509_NAME_ENTRY* sk, X509_NAME_ENTRY* ptr, int idx);
117 X509_NAME_ENTRY* sk_X509_NAME_ENTRY_set(stack_st_X509_NAME_ENTRY* sk, int idx, X509_NAME_ENTRY* ptr);
118 int sk_X509_NAME_ENTRY_find(stack_st_X509_NAME_ENTRY* sk, X509_NAME_ENTRY* ptr);
119 int sk_X509_NAME_ENTRY_find_ex(stack_st_X509_NAME_ENTRY* sk, X509_NAME_ENTRY* ptr);
120 void sk_X509_NAME_ENTRY_sort(stack_st_X509_NAME_ENTRY* sk);
121 int sk_X509_NAME_ENTRY_is_sorted(const(stack_st_X509_NAME_ENTRY)* sk);
122 stack_st_X509_NAME_ENTRY* sk_X509_NAME_ENTRY_dup(const(stack_st_X509_NAME_ENTRY)* sk);
123 stack_st_X509_NAME_ENTRY* sk_X509_NAME_ENTRY_deep_copy(const(stack_st_X509_NAME_ENTRY)* sk, sk_X509_NAME_ENTRY_copyfunc copyfunc, sk_X509_NAME_ENTRY_freefunc freefunc);
124 sk_X509_NAME_ENTRY_compfunc sk_X509_NAME_ENTRY_set_cmp_func(stack_st_X509_NAME_ENTRY* sk, sk_X509_NAME_ENTRY_compfunc compare);
125 struct stack_st_X509_NAME;
126 alias sk_X509_NAME_compfunc = int function(const(X509_NAME*)* a, const(X509_NAME*)* b);
127 alias sk_X509_NAME_freefunc = void function(X509_NAME* a);
128 alias sk_X509_NAME_copyfunc = X509_name_st* function(const(X509_NAME)* a);
129 int sk_X509_NAME_num(const(stack_st_X509_NAME)* sk);
130 X509_NAME* sk_X509_NAME_value(const(stack_st_X509_NAME)* sk, int idx);
131 stack_st_X509_NAME* sk_X509_NAME_new(sk_X509_NAME_compfunc compare);
132 stack_st_X509_NAME* sk_X509_NAME_new_null();
133 void sk_X509_NAME_free(stack_st_X509_NAME* sk);
134 void sk_X509_NAME_zero(stack_st_X509_NAME* sk);
135 X509_NAME* sk_X509_NAME_delete(stack_st_X509_NAME* sk, int i);
136 X509_NAME* sk_X509_NAME_delete_ptr(stack_st_X509_NAME* sk, X509_NAME* ptr);
137 int sk_X509_NAME_push(stack_st_X509_NAME* sk, X509_NAME* ptr);
138 int sk_X509_NAME_unshift(stack_st_X509_NAME* sk, X509_NAME* ptr);
139 X509_NAME* sk_X509_NAME_pop(stack_st_X509_NAME* sk);
140 X509_NAME* sk_X509_NAME_shift(stack_st_X509_NAME* sk);
141 void sk_X509_NAME_pop_free(stack_st_X509_NAME* sk, sk_X509_NAME_freefunc freefunc);
142 int sk_X509_NAME_insert(stack_st_X509_NAME* sk, X509_NAME* ptr, int idx);
143 X509_NAME* sk_X509_NAME_set(stack_st_X509_NAME* sk, int idx, X509_NAME* ptr);
144 int sk_X509_NAME_find(stack_st_X509_NAME* sk, X509_NAME* ptr);
145 int sk_X509_NAME_find_ex(stack_st_X509_NAME* sk, X509_NAME* ptr);
146 void sk_X509_NAME_sort(stack_st_X509_NAME* sk);
147 int sk_X509_NAME_is_sorted(const(stack_st_X509_NAME)* sk);
148 stack_st_X509_NAME* sk_X509_NAME_dup(const(stack_st_X509_NAME)* sk);
149 stack_st_X509_NAME* sk_X509_NAME_deep_copy(const(stack_st_X509_NAME)* sk, sk_X509_NAME_copyfunc copyfunc, sk_X509_NAME_freefunc freefunc);
150 sk_X509_NAME_compfunc sk_X509_NAME_set_cmp_func(stack_st_X509_NAME* sk, sk_X509_NAME_compfunc compare);
151 enum X509_EX_V_NETSCAPE_HACK = 0x8000;
152 enum X509_EX_V_INIT = 0x0001;
153 struct X509_extension_st;
154 alias X509_EXTENSION = X509_extension_st;
155 struct stack_st_X509_EXTENSION;
156 alias X509_EXTENSIONS = stack_st_X509_EXTENSION;
157 alias sk_X509_EXTENSION_compfunc = int function(const(X509_EXTENSION*)* a, const(X509_EXTENSION*)* b);
158 alias sk_X509_EXTENSION_freefunc = void function(X509_EXTENSION* a);
159 alias sk_X509_EXTENSION_copyfunc = X509_extension_st* function(const(X509_EXTENSION)* a);
160 int sk_X509_EXTENSION_num(const(stack_st_X509_EXTENSION)* sk);
161 X509_EXTENSION* sk_X509_EXTENSION_value(const(stack_st_X509_EXTENSION)* sk, int idx);
162 stack_st_X509_EXTENSION* sk_X509_EXTENSION_new(sk_X509_EXTENSION_compfunc compare);
163 stack_st_X509_EXTENSION* sk_X509_EXTENSION_new_null();
164 void sk_X509_EXTENSION_free(stack_st_X509_EXTENSION* sk);
165 void sk_X509_EXTENSION_zero(stack_st_X509_EXTENSION* sk);
166 X509_EXTENSION* sk_X509_EXTENSION_delete(stack_st_X509_EXTENSION* sk, int i);
167 X509_EXTENSION* sk_X509_EXTENSION_delete_ptr(stack_st_X509_EXTENSION* sk, X509_EXTENSION* ptr);
168 int sk_X509_EXTENSION_push(stack_st_X509_EXTENSION* sk, X509_EXTENSION* ptr);
169 int sk_X509_EXTENSION_unshift(stack_st_X509_EXTENSION* sk, X509_EXTENSION* ptr);
170 X509_EXTENSION* sk_X509_EXTENSION_pop(stack_st_X509_EXTENSION* sk);
171 X509_EXTENSION* sk_X509_EXTENSION_shift(stack_st_X509_EXTENSION* sk);
172 void sk_X509_EXTENSION_pop_free(stack_st_X509_EXTENSION* sk, sk_X509_EXTENSION_freefunc freefunc);
173 int sk_X509_EXTENSION_insert(stack_st_X509_EXTENSION* sk, X509_EXTENSION* ptr, int idx);
174 X509_EXTENSION* sk_X509_EXTENSION_set(stack_st_X509_EXTENSION* sk, int idx, X509_EXTENSION* ptr);
175 int sk_X509_EXTENSION_find(stack_st_X509_EXTENSION* sk, X509_EXTENSION* ptr);
176 int sk_X509_EXTENSION_find_ex(stack_st_X509_EXTENSION* sk, X509_EXTENSION* ptr);
177 void sk_X509_EXTENSION_sort(stack_st_X509_EXTENSION* sk);
178 int sk_X509_EXTENSION_is_sorted(const(stack_st_X509_EXTENSION)* sk);
179 stack_st_X509_EXTENSION* sk_X509_EXTENSION_dup(const(stack_st_X509_EXTENSION)* sk);
180 stack_st_X509_EXTENSION* sk_X509_EXTENSION_deep_copy(const(stack_st_X509_EXTENSION)* sk, sk_X509_EXTENSION_copyfunc copyfunc, sk_X509_EXTENSION_freefunc freefunc);
181 sk_X509_EXTENSION_compfunc sk_X509_EXTENSION_set_cmp_func(stack_st_X509_EXTENSION* sk, sk_X509_EXTENSION_compfunc compare);
182 struct x509_attributes_st;
183 alias X509_ATTRIBUTE = x509_attributes_st;
184 struct stack_st_X509_ATTRIBUTE;
185 alias sk_X509_ATTRIBUTE_compfunc = int function(const(X509_ATTRIBUTE*)* a, const(X509_ATTRIBUTE*)* b);
186 alias sk_X509_ATTRIBUTE_freefunc = void function(X509_ATTRIBUTE* a);
187 alias sk_X509_ATTRIBUTE_copyfunc = x509_attributes_st* function(const(X509_ATTRIBUTE)* a);
188 int sk_X509_ATTRIBUTE_num(const(stack_st_X509_ATTRIBUTE)* sk);
189 X509_ATTRIBUTE* sk_X509_ATTRIBUTE_value(const(stack_st_X509_ATTRIBUTE)* sk, int idx);
190 stack_st_X509_ATTRIBUTE* sk_X509_ATTRIBUTE_new(sk_X509_ATTRIBUTE_compfunc compare);
191 stack_st_X509_ATTRIBUTE* sk_X509_ATTRIBUTE_new_null();
192 void sk_X509_ATTRIBUTE_free(stack_st_X509_ATTRIBUTE* sk);
193 void sk_X509_ATTRIBUTE_zero(stack_st_X509_ATTRIBUTE* sk);
194 X509_ATTRIBUTE* sk_X509_ATTRIBUTE_delete(stack_st_X509_ATTRIBUTE* sk, int i);
195 X509_ATTRIBUTE* sk_X509_ATTRIBUTE_delete_ptr(stack_st_X509_ATTRIBUTE* sk, X509_ATTRIBUTE* ptr);
196 int sk_X509_ATTRIBUTE_push(stack_st_X509_ATTRIBUTE* sk, X509_ATTRIBUTE* ptr);
197 int sk_X509_ATTRIBUTE_unshift(stack_st_X509_ATTRIBUTE* sk, X509_ATTRIBUTE* ptr);
198 X509_ATTRIBUTE* sk_X509_ATTRIBUTE_pop(stack_st_X509_ATTRIBUTE* sk);
199 X509_ATTRIBUTE* sk_X509_ATTRIBUTE_shift(stack_st_X509_ATTRIBUTE* sk);
200 void sk_X509_ATTRIBUTE_pop_free(stack_st_X509_ATTRIBUTE* sk, sk_X509_ATTRIBUTE_freefunc freefunc);
201 int sk_X509_ATTRIBUTE_insert(stack_st_X509_ATTRIBUTE* sk, X509_ATTRIBUTE* ptr, int idx);
202 X509_ATTRIBUTE* sk_X509_ATTRIBUTE_set(stack_st_X509_ATTRIBUTE* sk, int idx, X509_ATTRIBUTE* ptr);
203 int sk_X509_ATTRIBUTE_find(stack_st_X509_ATTRIBUTE* sk, X509_ATTRIBUTE* ptr);
204 int sk_X509_ATTRIBUTE_find_ex(stack_st_X509_ATTRIBUTE* sk, X509_ATTRIBUTE* ptr);
205 void sk_X509_ATTRIBUTE_sort(stack_st_X509_ATTRIBUTE* sk);
206 int sk_X509_ATTRIBUTE_is_sorted(const(stack_st_X509_ATTRIBUTE)* sk);
207 stack_st_X509_ATTRIBUTE* sk_X509_ATTRIBUTE_dup(const(stack_st_X509_ATTRIBUTE)* sk);
208 stack_st_X509_ATTRIBUTE* sk_X509_ATTRIBUTE_deep_copy(const(stack_st_X509_ATTRIBUTE)* sk, sk_X509_ATTRIBUTE_copyfunc copyfunc, sk_X509_ATTRIBUTE_freefunc freefunc);
209 sk_X509_ATTRIBUTE_compfunc sk_X509_ATTRIBUTE_set_cmp_func(stack_st_X509_ATTRIBUTE* sk, sk_X509_ATTRIBUTE_compfunc compare);
210 struct X509_req_info_st;
211 alias X509_REQ_INFO = X509_req_info_st;
212 struct X509_req_st;
213 alias X509_REQ = X509_req_st;
214 struct x509_cert_aux_st;
215 alias X509_CERT_AUX = x509_cert_aux_st;
216 struct x509_cinf_st;
217 alias X509_CINF = x509_cinf_st;
218 struct stack_st_X509;
219 alias sk_X509_compfunc = int function(const(X509*)* a, const(X509*)* b);
220 alias sk_X509_freefunc = void function(X509* a);
221 alias sk_X509_copyfunc = x509_st* function(const(X509)* a);
222 int sk_X509_num(const(stack_st_X509)* sk);
223 X509* sk_X509_value(const(stack_st_X509)* sk, int idx);
224 stack_st_X509* sk_X509_new(sk_X509_compfunc compare);
225 stack_st_X509* sk_X509_new_null();
226 void sk_X509_free(stack_st_X509* sk);
227 void sk_X509_zero(stack_st_X509* sk);
228 X509* sk_X509_delete(stack_st_X509* sk, int i);
229 X509* sk_X509_delete_ptr(stack_st_X509* sk, X509* ptr);
230 int sk_X509_push(stack_st_X509* sk, X509* ptr);
231 int sk_X509_unshift(stack_st_X509* sk, X509* ptr);
232 X509* sk_X509_pop(stack_st_X509* sk);
233 X509* sk_X509_shift(stack_st_X509* sk);
234 void sk_X509_pop_free(stack_st_X509* sk, sk_X509_freefunc freefunc);
235 int sk_X509_insert(stack_st_X509* sk, X509* ptr, int idx);
236 X509* sk_X509_set(stack_st_X509* sk, int idx, X509* ptr);
237 int sk_X509_find(stack_st_X509* sk, X509* ptr);
238 int sk_X509_find_ex(stack_st_X509* sk, X509* ptr);
239 void sk_X509_sort(stack_st_X509* sk);
240 int sk_X509_is_sorted(const(stack_st_X509)* sk);
241 stack_st_X509* sk_X509_dup(const(stack_st_X509)* sk);
242 stack_st_X509* sk_X509_deep_copy(const(stack_st_X509)* sk, sk_X509_copyfunc copyfunc, sk_X509_freefunc freefunc);
243 sk_X509_compfunc sk_X509_set_cmp_func(stack_st_X509* sk, sk_X509_compfunc compare);
244 
245 struct x509_trust_st
246 {
247     int trust;
248     int flags;
249     int function(x509_trust_st*, X509*, int) check_trust;
250     char* name;
251     int arg1;
252     void* arg2;
253 }
254 
255 alias X509_TRUST = x509_trust_st;
256 struct stack_st_X509_TRUST;
257 alias sk_X509_TRUST_compfunc = int function(const(X509_TRUST*)* a, const(X509_TRUST*)* b);
258 alias sk_X509_TRUST_freefunc = void function(X509_TRUST* a);
259 alias sk_X509_TRUST_copyfunc = x509_trust_st* function(const(X509_TRUST)* a);
260 int sk_X509_TRUST_num(const(stack_st_X509_TRUST)* sk);
261 X509_TRUST* sk_X509_TRUST_value(const(stack_st_X509_TRUST)* sk, int idx);
262 stack_st_X509_TRUST* sk_X509_TRUST_new(sk_X509_TRUST_compfunc compare);
263 stack_st_X509_TRUST* sk_X509_TRUST_new_null();
264 void sk_X509_TRUST_free(stack_st_X509_TRUST* sk);
265 void sk_X509_TRUST_zero(stack_st_X509_TRUST* sk);
266 X509_TRUST* sk_X509_TRUST_delete(stack_st_X509_TRUST* sk, int i);
267 X509_TRUST* sk_X509_TRUST_delete_ptr(stack_st_X509_TRUST* sk, X509_TRUST* ptr);
268 int sk_X509_TRUST_push(stack_st_X509_TRUST* sk, X509_TRUST* ptr);
269 int sk_X509_TRUST_unshift(stack_st_X509_TRUST* sk, X509_TRUST* ptr);
270 X509_TRUST* sk_X509_TRUST_pop(stack_st_X509_TRUST* sk);
271 X509_TRUST* sk_X509_TRUST_shift(stack_st_X509_TRUST* sk);
272 void sk_X509_TRUST_pop_free(stack_st_X509_TRUST* sk, sk_X509_TRUST_freefunc freefunc);
273 int sk_X509_TRUST_insert(stack_st_X509_TRUST* sk, X509_TRUST* ptr, int idx);
274 X509_TRUST* sk_X509_TRUST_set(stack_st_X509_TRUST* sk, int idx, X509_TRUST* ptr);
275 int sk_X509_TRUST_find(stack_st_X509_TRUST* sk, X509_TRUST* ptr);
276 int sk_X509_TRUST_find_ex(stack_st_X509_TRUST* sk, X509_TRUST* ptr);
277 void sk_X509_TRUST_sort(stack_st_X509_TRUST* sk);
278 int sk_X509_TRUST_is_sorted(const(stack_st_X509_TRUST)* sk);
279 stack_st_X509_TRUST* sk_X509_TRUST_dup(const(stack_st_X509_TRUST)* sk);
280 stack_st_X509_TRUST* sk_X509_TRUST_deep_copy(const(stack_st_X509_TRUST)* sk, sk_X509_TRUST_copyfunc copyfunc, sk_X509_TRUST_freefunc freefunc);
281 sk_X509_TRUST_compfunc sk_X509_TRUST_set_cmp_func(stack_st_X509_TRUST* sk, sk_X509_TRUST_compfunc compare);
282 enum X509_TRUST_DEFAULT = 0;
283 enum X509_TRUST_COMPAT = 1;
284 enum X509_TRUST_SSL_CLIENT = 2;
285 enum X509_TRUST_SSL_SERVER = 3;
286 enum X509_TRUST_EMAIL = 4;
287 enum X509_TRUST_OBJECT_SIGN = 5;
288 enum X509_TRUST_OCSP_SIGN = 6;
289 enum X509_TRUST_OCSP_REQUEST = 7;
290 enum X509_TRUST_TSA = 8;
291 enum X509_TRUST_MIN = 1;
292 enum X509_TRUST_MAX = 8;
293 enum X509_TRUST_DYNAMIC = 1U << 0;
294 enum X509_TRUST_DYNAMIC_NAME = 1U << 1;
295 enum X509_TRUST_NO_SS_COMPAT = 1U << 2;
296 enum X509_TRUST_DO_SS_COMPAT = 1U << 3;
297 enum X509_TRUST_OK_ANY_EKU = 1U << 4;
298 enum X509_TRUST_TRUSTED = 1;
299 enum X509_TRUST_REJECTED = 2;
300 enum X509_TRUST_UNTRUSTED = 3;
301 
302 enum X509_FLAG_COMPAT = 0;
303 enum X509_FLAG_NO_HEADER = 1L;
304 enum X509_FLAG_NO_VERSION = 1L << 1;
305 enum X509_FLAG_NO_SERIAL = 1L << 2;
306 enum X509_FLAG_NO_SIGNAME = 1L << 3;
307 enum X509_FLAG_NO_ISSUER = 1L << 4;
308 enum X509_FLAG_NO_VALIDITY = 1L << 5;
309 enum X509_FLAG_NO_SUBJECT = 1L << 6;
310 enum X509_FLAG_NO_PUBKEY = 1L << 7;
311 enum X509_FLAG_NO_EXTENSIONS = 1L << 8;
312 enum X509_FLAG_NO_SIGDUMP = 1L << 9;
313 enum X509_FLAG_NO_AUX = 1L << 10;
314 enum X509_FLAG_NO_ATTRIBUTES = 1L << 11;
315 enum X509_FLAG_NO_IDS = 1L << 12;
316 
317 /* Flags specific to X509_NAME_print_ex() */
318 
319 /* The field separator information */
320 
321 enum XN_FLAG_SEP_MASK = 0xf << 16;
322 
323 enum XN_FLAG_COMPAT = 0; /* Traditional; use old X509_NAME_print */
324 enum XN_FLAG_SEP_COMMA_PLUS = 1 << 16; /* RFC2253 ,+ */
325 enum XN_FLAG_SEP_CPLUS_SPC = 2 << 16; /* ,+ spaced: more readable */
326 enum XN_FLAG_SEP_SPLUS_SPC = 3 << 16; /* ;+ spaced */
327 enum XN_FLAG_SEP_MULTILINE = 4 << 16; /* One line per field */
328 
329 enum XN_FLAG_DN_REV = 1 << 20; /* Reverse DN order */
330 
331 /* How the field name is shown */
332 
333 enum XN_FLAG_FN_MASK = 0x3 << 21;
334 
335 enum XN_FLAG_FN_SN = 0; /* Object short name */
336 enum XN_FLAG_FN_LN = 1 << 21; /* Object long name */
337 enum XN_FLAG_FN_OID = 2 << 21; /* Always use OIDs */
338 enum XN_FLAG_FN_NONE = 3 << 21; /* No field names */
339 
340 enum XN_FLAG_SPC_EQ = 1 << 23; /* Put spaces round '=' */
341 
342 /*
343  * This determines if we dump fields we don't recognise: RFC2253 requires
344  * this.
345  */
346 
347 enum XN_FLAG_DUMP_UNKNOWN_FIELDS = 1 << 24;
348 
349 enum XN_FLAG_FN_ALIGN = 1 << 25; /* Align field names to 20
350  * characters */
351 
352 /* Complete set of RFC2253 flags */
353 
354 enum XN_FLAG_RFC2253 = ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS;
355 
356 /* readable oneline form */
357 
358 enum XN_FLAG_ONELINE = ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN;
359 
360 /* readable multiline form */
361 
362 enum XN_FLAG_MULTILINE = ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN;
363 
364 struct stack_st_X509_REVOKED;
365 alias sk_X509_REVOKED_compfunc = int function(const(X509_REVOKED*)* a, const(X509_REVOKED*)* b);
366 alias sk_X509_REVOKED_freefunc = void function(X509_REVOKED* a);
367 alias sk_X509_REVOKED_copyfunc = x509_revoked_st* function(const(X509_REVOKED)* a);
368 int sk_X509_REVOKED_num(const(stack_st_X509_REVOKED)* sk);
369 X509_REVOKED* sk_X509_REVOKED_value(const(stack_st_X509_REVOKED)* sk, int idx);
370 stack_st_X509_REVOKED* sk_X509_REVOKED_new(sk_X509_REVOKED_compfunc compare);
371 stack_st_X509_REVOKED* sk_X509_REVOKED_new_null();
372 void sk_X509_REVOKED_free(stack_st_X509_REVOKED* sk);
373 void sk_X509_REVOKED_zero(stack_st_X509_REVOKED* sk);
374 X509_REVOKED* sk_X509_REVOKED_delete(stack_st_X509_REVOKED* sk, int i);
375 X509_REVOKED* sk_X509_REVOKED_delete_ptr(stack_st_X509_REVOKED* sk, X509_REVOKED* ptr);
376 int sk_X509_REVOKED_push(stack_st_X509_REVOKED* sk, X509_REVOKED* ptr);
377 int sk_X509_REVOKED_unshift(stack_st_X509_REVOKED* sk, X509_REVOKED* ptr);
378 X509_REVOKED* sk_X509_REVOKED_pop(stack_st_X509_REVOKED* sk);
379 X509_REVOKED* sk_X509_REVOKED_shift(stack_st_X509_REVOKED* sk);
380 void sk_X509_REVOKED_pop_free(stack_st_X509_REVOKED* sk, sk_X509_REVOKED_freefunc freefunc);
381 int sk_X509_REVOKED_insert(stack_st_X509_REVOKED* sk, X509_REVOKED* ptr, int idx);
382 X509_REVOKED* sk_X509_REVOKED_set(stack_st_X509_REVOKED* sk, int idx, X509_REVOKED* ptr);
383 int sk_X509_REVOKED_find(stack_st_X509_REVOKED* sk, X509_REVOKED* ptr);
384 int sk_X509_REVOKED_find_ex(stack_st_X509_REVOKED* sk, X509_REVOKED* ptr);
385 void sk_X509_REVOKED_sort(stack_st_X509_REVOKED* sk);
386 int sk_X509_REVOKED_is_sorted(const(stack_st_X509_REVOKED)* sk);
387 stack_st_X509_REVOKED* sk_X509_REVOKED_dup(const(stack_st_X509_REVOKED)* sk);
388 stack_st_X509_REVOKED* sk_X509_REVOKED_deep_copy(const(stack_st_X509_REVOKED)* sk, sk_X509_REVOKED_copyfunc copyfunc, sk_X509_REVOKED_freefunc freefunc);
389 sk_X509_REVOKED_compfunc sk_X509_REVOKED_set_cmp_func(stack_st_X509_REVOKED* sk, sk_X509_REVOKED_compfunc compare);
390 
391 struct X509_crl_info_st;
392 alias X509_CRL_INFO = X509_crl_info_st;
393 
394 struct stack_st_X509_CRL;
395 alias sk_X509_CRL_compfunc = int function(const(X509_CRL*)* a, const(X509_CRL*)* b);
396 alias sk_X509_CRL_freefunc = void function(X509_CRL* a);
397 alias sk_X509_CRL_copyfunc = X509_crl_st* function(const(X509_CRL)* a);
398 int sk_X509_CRL_num(const(stack_st_X509_CRL)* sk);
399 X509_CRL* sk_X509_CRL_value(const(stack_st_X509_CRL)* sk, int idx);
400 stack_st_X509_CRL* sk_X509_CRL_new(sk_X509_CRL_compfunc compare);
401 stack_st_X509_CRL* sk_X509_CRL_new_null();
402 void sk_X509_CRL_free(stack_st_X509_CRL* sk);
403 void sk_X509_CRL_zero(stack_st_X509_CRL* sk);
404 X509_CRL* sk_X509_CRL_delete(stack_st_X509_CRL* sk, int i);
405 X509_CRL* sk_X509_CRL_delete_ptr(stack_st_X509_CRL* sk, X509_CRL* ptr);
406 int sk_X509_CRL_push(stack_st_X509_CRL* sk, X509_CRL* ptr);
407 int sk_X509_CRL_unshift(stack_st_X509_CRL* sk, X509_CRL* ptr);
408 X509_CRL* sk_X509_CRL_pop(stack_st_X509_CRL* sk);
409 X509_CRL* sk_X509_CRL_shift(stack_st_X509_CRL* sk);
410 void sk_X509_CRL_pop_free(stack_st_X509_CRL* sk, sk_X509_CRL_freefunc freefunc);
411 int sk_X509_CRL_insert(stack_st_X509_CRL* sk, X509_CRL* ptr, int idx);
412 X509_CRL* sk_X509_CRL_set(stack_st_X509_CRL* sk, int idx, X509_CRL* ptr);
413 int sk_X509_CRL_find(stack_st_X509_CRL* sk, X509_CRL* ptr);
414 int sk_X509_CRL_find_ex(stack_st_X509_CRL* sk, X509_CRL* ptr);
415 void sk_X509_CRL_sort(stack_st_X509_CRL* sk);
416 int sk_X509_CRL_is_sorted(const(stack_st_X509_CRL)* sk);
417 stack_st_X509_CRL* sk_X509_CRL_dup(const(stack_st_X509_CRL)* sk);
418 stack_st_X509_CRL* sk_X509_CRL_deep_copy(const(stack_st_X509_CRL)* sk, sk_X509_CRL_copyfunc copyfunc, sk_X509_CRL_freefunc freefunc);
419 sk_X509_CRL_compfunc sk_X509_CRL_set_cmp_func(stack_st_X509_CRL* sk, sk_X509_CRL_compfunc compare);
420 
421 struct private_key_st
422 {
423     int version_;
424     /* The PKCS#8 data types */
425     X509_ALGOR* enc_algor;
426     ASN1_OCTET_STRING* enc_pkey; /* encrypted pub key */
427     /* When decrypted, the following will not be NULL */
428     EVP_PKEY* dec_pkey;
429     /* used to encrypt and decrypt */
430     int key_length;
431     char* key_data;
432     int key_free; /* true if we should auto free key_data */
433     /* expanded version of 'enc_algor' */
434     EVP_CIPHER_INFO cipher;
435 }
436 
437 alias X509_PKEY = private_key_st;
438 
439 struct X509_info_st
440 {
441     X509* x509;
442     X509_CRL* crl;
443     X509_PKEY* x_pkey;
444     EVP_CIPHER_INFO enc_cipher;
445     int enc_len;
446     char* enc_data;
447 }
448 
449 alias X509_INFO = X509_info_st;
450 
451 struct stack_st_X509_INFO;
452 alias sk_X509_INFO_compfunc = int function(const(X509_INFO*)* a, const(X509_INFO*)* b);
453 alias sk_X509_INFO_freefunc = void function(X509_INFO* a);
454 alias sk_X509_INFO_copyfunc = X509_info_st* function(const(X509_INFO)* a);
455 int sk_X509_INFO_num(const(stack_st_X509_INFO)* sk);
456 X509_INFO* sk_X509_INFO_value(const(stack_st_X509_INFO)* sk, int idx);
457 stack_st_X509_INFO* sk_X509_INFO_new(sk_X509_INFO_compfunc compare);
458 stack_st_X509_INFO* sk_X509_INFO_new_null();
459 void sk_X509_INFO_free(stack_st_X509_INFO* sk);
460 void sk_X509_INFO_zero(stack_st_X509_INFO* sk);
461 X509_INFO* sk_X509_INFO_delete(stack_st_X509_INFO* sk, int i);
462 X509_INFO* sk_X509_INFO_delete_ptr(stack_st_X509_INFO* sk, X509_INFO* ptr);
463 int sk_X509_INFO_push(stack_st_X509_INFO* sk, X509_INFO* ptr);
464 int sk_X509_INFO_unshift(stack_st_X509_INFO* sk, X509_INFO* ptr);
465 X509_INFO* sk_X509_INFO_pop(stack_st_X509_INFO* sk);
466 X509_INFO* sk_X509_INFO_shift(stack_st_X509_INFO* sk);
467 void sk_X509_INFO_pop_free(stack_st_X509_INFO* sk, sk_X509_INFO_freefunc freefunc);
468 int sk_X509_INFO_insert(stack_st_X509_INFO* sk, X509_INFO* ptr, int idx);
469 X509_INFO* sk_X509_INFO_set(stack_st_X509_INFO* sk, int idx, X509_INFO* ptr);
470 int sk_X509_INFO_find(stack_st_X509_INFO* sk, X509_INFO* ptr);
471 int sk_X509_INFO_find_ex(stack_st_X509_INFO* sk, X509_INFO* ptr);
472 void sk_X509_INFO_sort(stack_st_X509_INFO* sk);
473 int sk_X509_INFO_is_sorted(const(stack_st_X509_INFO)* sk);
474 stack_st_X509_INFO* sk_X509_INFO_dup(const(stack_st_X509_INFO)* sk);
475 stack_st_X509_INFO* sk_X509_INFO_deep_copy(const(stack_st_X509_INFO)* sk, sk_X509_INFO_copyfunc copyfunc, sk_X509_INFO_freefunc freefunc);
476 sk_X509_INFO_compfunc sk_X509_INFO_set_cmp_func(stack_st_X509_INFO* sk, sk_X509_INFO_compfunc compare);
477 
478 /*
479  * The next 2 structures and their 8 routines were sent to me by Pat Richard
480  * <patr@x509.com> and are used to manipulate Netscapes spki structures -
481  * useful if you are writing a CA web page
482  */
483 struct Netscape_spkac_st
484 {
485     X509_PUBKEY* pubkey;
486     ASN1_IA5STRING* challenge; /* challenge sent in atlas >= PR2 */
487 }
488 
489 alias NETSCAPE_SPKAC = Netscape_spkac_st;
490 
491 struct Netscape_spki_st
492 {
493     NETSCAPE_SPKAC* spkac; /* signed public key and challenge */
494     X509_ALGOR sig_algor;
495     ASN1_BIT_STRING* signature;
496 }
497 
498 alias NETSCAPE_SPKI = Netscape_spki_st;
499 
500 /* Netscape certificate sequence structure */
501 struct Netscape_certificate_sequence
502 {
503     ASN1_OBJECT* type;
504     stack_st_X509* certs;
505 }
506 
507 alias NETSCAPE_CERT_SEQUENCE = Netscape_certificate_sequence;
508 
509 /*- Unused (and iv length is wrong)
510 typedef struct CBCParameter_st
511         {
512         unsigned char iv[8];
513         } CBC_PARAM;
514 */
515 
516 /* Password based encryption structure */
517 
518 struct PBEPARAM_st
519 {
520     ASN1_OCTET_STRING* salt;
521     ASN1_INTEGER* iter;
522 }
523 
524 alias PBEPARAM = PBEPARAM_st;
525 
526 /* Password based encryption V2 structures */
527 
528 struct PBE2PARAM_st
529 {
530     X509_ALGOR* keyfunc;
531     X509_ALGOR* encryption;
532 }
533 
534 alias PBE2PARAM = PBE2PARAM_st;
535 
536 struct PBKDF2PARAM_st
537 {
538     /* Usually OCTET STRING but could be anything */
539     ASN1_TYPE* salt;
540     ASN1_INTEGER* iter;
541     ASN1_INTEGER* keylength;
542     X509_ALGOR* prf;
543 }
544 
545 alias PBKDF2PARAM = PBKDF2PARAM_st;
546 
547 public import deimos.openssl.x509_vfy;
548 public import deimos.openssl.pkcs7;
549 
550 enum X509_EXT_PACK_UNKNOWN = 1;
551 enum X509_EXT_PACK_STRING = 2;
552 
553 alias X509_extract_key = X509_get_pubkey; /*****/
554 alias X509_REQ_extract_key = X509_REQ_get_pubkey;
555 alias X509_name_cmp = X509_NAME_cmp;
556 
557 void X509_CRL_set_default_method(const(X509_CRL_METHOD)* meth);
558 X509_CRL_METHOD* X509_CRL_METHOD_new(
559     int function(X509_CRL* crl) crl_init,
560     int function(X509_CRL* crl) crl_free,
561     int function(X509_CRL* crl, X509_REVOKED** ret, ASN1_INTEGER* ser, X509_NAME* issuer) crl_lookup,
562     int function(X509_CRL* crl, EVP_PKEY* pk) crl_verify);
563 void X509_CRL_METHOD_free(X509_CRL_METHOD* m);
564 
565 void X509_CRL_set_meth_data(X509_CRL* crl, void* dat);
566 void* X509_CRL_get_meth_data(X509_CRL* crl);
567 
568 const(char)* X509_verify_cert_error_string(c_long n);
569 
570 int X509_verify(X509* a, EVP_PKEY* r);
571 
572 int X509_REQ_verify(X509_REQ* a, EVP_PKEY* r);
573 int X509_CRL_verify(X509_CRL* a, EVP_PKEY* r);
574 int NETSCAPE_SPKI_verify(NETSCAPE_SPKI* a, EVP_PKEY* r);
575 
576 NETSCAPE_SPKI* NETSCAPE_SPKI_b64_decode(const(char)* str, int len);
577 char* NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI* x);
578 EVP_PKEY* NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI* x);
579 int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI* x, EVP_PKEY* pkey);
580 
581 int NETSCAPE_SPKI_print(BIO* out_, NETSCAPE_SPKI* spki);
582 
583 int X509_signature_dump(BIO* bp, const(ASN1_STRING)* sig, int indent);
584 int X509_signature_print(
585     BIO* bp,
586     const(X509_ALGOR)* alg,
587     const(ASN1_STRING)* sig);
588 
589 int X509_sign(X509* x, EVP_PKEY* pkey, const(EVP_MD)* md);
590 int X509_sign_ctx(X509* x, EVP_MD_CTX* ctx);
591 
592 version(OPENSSL_NO_OCSP) {} else {
593 int X509_http_nbio(OCSP_REQ_CTX* rctx, X509** pcert);
594 }
595 
596 int X509_REQ_sign(X509_REQ* x, EVP_PKEY* pkey, const(EVP_MD)* md);
597 int X509_REQ_sign_ctx(X509_REQ* x, EVP_MD_CTX* ctx);
598 int X509_CRL_sign(X509_CRL* x, EVP_PKEY* pkey, const(EVP_MD)* md);
599 int X509_CRL_sign_ctx(X509_CRL* x, EVP_MD_CTX* ctx);
600 
601 version(OPENSSL_NO_OCSP) {} else {
602 int X509_CRL_http_nbio(OCSP_REQ_CTX* rctx, X509_CRL** pcrl);
603 }
604 
605 int NETSCAPE_SPKI_sign(NETSCAPE_SPKI* x, EVP_PKEY* pkey, const(EVP_MD)* md);
606 
607 int X509_pubkey_digest(
608     const(X509)* data,
609     const(EVP_MD)* type,
610     ubyte* md,
611     uint* len);
612 int X509_digest(const(X509)* data, const(EVP_MD)* type, ubyte* md, uint* len);
613 int X509_CRL_digest(
614     const(X509_CRL)* data,
615     const(EVP_MD)* type,
616     ubyte* md,
617     uint* len);
618 int X509_REQ_digest(
619     const(X509_REQ)* data,
620     const(EVP_MD)* type,
621     ubyte* md,
622     uint* len);
623 int X509_NAME_digest(
624     const(X509_NAME)* data,
625     const(EVP_MD)* type,
626     ubyte* md,
627     uint* len);
628 
629 version(OPENSSL_NO_STDIO) {} else {
630 X509* d2i_X509_fp(FILE* fp, X509** x509);
631 int i2d_X509_fp(FILE* fp, X509* x509);
632 X509_CRL* d2i_X509_CRL_fp(FILE* fp, X509_CRL** crl);
633 int i2d_X509_CRL_fp(FILE* fp, X509_CRL* crl);
634 X509_REQ* d2i_X509_REQ_fp(FILE* fp, X509_REQ** req);
635 int i2d_X509_REQ_fp(FILE* fp, X509_REQ* req);
636 
637 version(OPENSSL_NO_RSA) {} else {
638 RSA* d2i_RSAPrivateKey_fp(FILE* fp, RSA** rsa);
639 int i2d_RSAPrivateKey_fp(FILE* fp, RSA* rsa);
640 RSA* d2i_RSAPublicKey_fp(FILE* fp, RSA** rsa);
641 int i2d_RSAPublicKey_fp(FILE* fp, RSA* rsa);
642 RSA* d2i_RSA_PUBKEY_fp(FILE* fp, RSA** rsa);
643 int i2d_RSA_PUBKEY_fp(FILE* fp, RSA* rsa);
644 }
645 
646 version(OPENSSL_NO_DSA) {} else {
647 DSA* d2i_DSA_PUBKEY_fp(FILE* fp, DSA** dsa);
648 int i2d_DSA_PUBKEY_fp(FILE* fp, DSA* dsa);
649 DSA* d2i_DSAPrivateKey_fp(FILE* fp, DSA** dsa);
650 int i2d_DSAPrivateKey_fp(FILE* fp, DSA* dsa);
651 }
652 
653 version(OPENSSL_NO_EC) {} else {
654 EC_KEY* d2i_EC_PUBKEY_fp(FILE* fp, EC_KEY** eckey);
655 int i2d_EC_PUBKEY_fp(FILE* fp, EC_KEY* eckey);
656 EC_KEY* d2i_ECPrivateKey_fp(FILE* fp, EC_KEY** eckey);
657 int i2d_ECPrivateKey_fp(FILE* fp, EC_KEY* eckey);
658 }
659 
660 X509_SIG* d2i_PKCS8_fp(FILE* fp, X509_SIG** p8);
661 int i2d_PKCS8_fp(FILE* fp, X509_SIG* p8);
662 PKCS8_PRIV_KEY_INFO* d2i_PKCS8_PRIV_KEY_INFO_fp(
663     FILE* fp,
664     PKCS8_PRIV_KEY_INFO** p8inf);
665 int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE* fp, PKCS8_PRIV_KEY_INFO* p8inf);
666 int i2d_PKCS8PrivateKeyInfo_fp(FILE* fp, EVP_PKEY* key);
667 int i2d_PrivateKey_fp(FILE* fp, EVP_PKEY* pkey);
668 EVP_PKEY* d2i_PrivateKey_fp(FILE* fp, EVP_PKEY** a);
669 int i2d_PUBKEY_fp(FILE* fp, EVP_PKEY* pkey);
670 EVP_PKEY* d2i_PUBKEY_fp(FILE* fp, EVP_PKEY** a);
671 } /+ OPENSSL_NO_STDIO +/
672 X509* d2i_X509_bio(BIO* bp, X509** x509);
673 int i2d_X509_bio(BIO* bp, X509* x509);
674 X509_CRL* d2i_X509_CRL_bio(BIO* bp, X509_CRL** crl);
675 int i2d_X509_CRL_bio(BIO* bp, X509_CRL* crl);
676 X509_REQ* d2i_X509_REQ_bio(BIO* bp, X509_REQ** req);
677 int i2d_X509_REQ_bio(BIO* bp, X509_REQ* req);
678 
679 version(OPENSSL_NO_RSA) {} else {
680 RSA* d2i_RSAPrivateKey_bio(BIO* bp, RSA** rsa);
681 int i2d_RSAPrivateKey_bio(BIO* bp, RSA* rsa);
682 RSA* d2i_RSAPublicKey_bio(BIO* bp, RSA** rsa);
683 int i2d_RSAPublicKey_bio(BIO* bp, RSA* rsa);
684 RSA* d2i_RSA_PUBKEY_bio(BIO* bp, RSA** rsa);
685 int i2d_RSA_PUBKEY_bio(BIO* bp, RSA* rsa);
686 }
687 
688 version(OPENSSL_NO_DSA) {} else {
689 DSA* d2i_DSA_PUBKEY_bio(BIO* bp, DSA** dsa);
690 int i2d_DSA_PUBKEY_bio(BIO* bp, DSA* dsa);
691 DSA* d2i_DSAPrivateKey_bio(BIO* bp, DSA** dsa);
692 int i2d_DSAPrivateKey_bio(BIO* bp, DSA* dsa);
693 }
694 
695 version(OPENSSL_NO_EC) {} else {
696 EC_KEY* d2i_EC_PUBKEY_bio(BIO* bp, EC_KEY** eckey);
697 int i2d_EC_PUBKEY_bio(BIO* bp, EC_KEY* eckey);
698 EC_KEY* d2i_ECPrivateKey_bio(BIO* bp, EC_KEY** eckey);
699 int i2d_ECPrivateKey_bio(BIO* bp, EC_KEY* eckey);
700 }
701 
702 X509_SIG* d2i_PKCS8_bio(BIO* bp, X509_SIG** p8);
703 int i2d_PKCS8_bio(BIO* bp, X509_SIG* p8);
704 PKCS8_PRIV_KEY_INFO* d2i_PKCS8_PRIV_KEY_INFO_bio(
705     BIO* bp,
706     PKCS8_PRIV_KEY_INFO** p8inf);
707 int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO* bp, PKCS8_PRIV_KEY_INFO* p8inf);
708 int i2d_PKCS8PrivateKeyInfo_bio(BIO* bp, EVP_PKEY* key);
709 int i2d_PrivateKey_bio(BIO* bp, EVP_PKEY* pkey);
710 EVP_PKEY* d2i_PrivateKey_bio(BIO* bp, EVP_PKEY** a);
711 int i2d_PUBKEY_bio(BIO* bp, EVP_PKEY* pkey);
712 EVP_PKEY* d2i_PUBKEY_bio(BIO* bp, EVP_PKEY** a);
713 
714 X509* X509_dup(X509* x509);
715 X509_ATTRIBUTE* X509_ATTRIBUTE_dup(X509_ATTRIBUTE* xa);
716 X509_EXTENSION* X509_EXTENSION_dup(X509_EXTENSION* ex);
717 X509_CRL* X509_CRL_dup(X509_CRL* crl);
718 X509_REVOKED* X509_REVOKED_dup(X509_REVOKED* rev);
719 X509_REQ* X509_REQ_dup(X509_REQ* req);
720 X509_ALGOR* X509_ALGOR_dup(X509_ALGOR* xn);
721 int X509_ALGOR_set0(X509_ALGOR* alg, ASN1_OBJECT* aobj, int ptype, void* pval);
722 void X509_ALGOR_get0(
723     const(ASN1_OBJECT*)* paobj,
724     int* pptype,
725     const(void*)* ppval,
726     const(X509_ALGOR)* algor);
727 void X509_ALGOR_set_md(X509_ALGOR* alg, const(EVP_MD)* md);
728 int X509_ALGOR_cmp(const(X509_ALGOR)* a, const(X509_ALGOR)* b);
729 
730 X509_NAME* X509_NAME_dup(X509_NAME* xn);
731 X509_NAME_ENTRY* X509_NAME_ENTRY_dup(X509_NAME_ENTRY* ne);
732 
733 int X509_cmp_time(const(ASN1_TIME)* s, time_t* t);
734 int X509_cmp_current_time(const(ASN1_TIME)* s);
735 ASN1_TIME* X509_time_adj(ASN1_TIME* s, c_long adj, time_t* t);
736 ASN1_TIME* X509_time_adj_ex(
737     ASN1_TIME* s,
738     int offset_day,
739     c_long offset_sec,
740     time_t* t);
741 ASN1_TIME* X509_gmtime_adj(ASN1_TIME* s, c_long adj);
742 
743 const(char)* X509_get_default_cert_area();
744 const(char)* X509_get_default_cert_dir();
745 const(char)* X509_get_default_cert_file();
746 const(char)* X509_get_default_cert_dir_env();
747 const(char)* X509_get_default_cert_file_env();
748 const(char)* X509_get_default_private_dir();
749 
750 X509_REQ* X509_to_X509_REQ(X509* x, EVP_PKEY* pkey, const(EVP_MD)* md);
751 X509* X509_REQ_to_X509(X509_REQ* r, int days, EVP_PKEY* pkey);
752 
753 X509_ALGOR* X509_ALGOR_new();
754 void X509_ALGOR_free(X509_ALGOR* a);
755 X509_ALGOR* d2i_X509_ALGOR(X509_ALGOR** a, const(ubyte*)* in_, c_long len);
756 int i2d_X509_ALGOR(X509_ALGOR* a, ubyte** out_);
757 extern __gshared const ASN1_ITEM X509_ALGOR_it;
758 X509_ALGORS* d2i_X509_ALGORS(X509_ALGORS** a, const(ubyte*)* in_, c_long len);
759 int i2d_X509_ALGORS(X509_ALGORS* a, ubyte** out_);
760 extern __gshared const ASN1_ITEM X509_ALGORS_it;
761 X509_VAL* X509_VAL_new();
762 void X509_VAL_free(X509_VAL* a);
763 X509_VAL* d2i_X509_VAL(X509_VAL** a, const(ubyte*)* in_, c_long len);
764 int i2d_X509_VAL(X509_VAL* a, ubyte** out_);
765 extern __gshared const ASN1_ITEM X509_VAL_it;
766 
767 X509_PUBKEY* X509_PUBKEY_new();
768 void X509_PUBKEY_free(X509_PUBKEY* a);
769 X509_PUBKEY* d2i_X509_PUBKEY(X509_PUBKEY** a, const(ubyte*)* in_, c_long len);
770 int i2d_X509_PUBKEY(X509_PUBKEY* a, ubyte** out_);
771 extern __gshared const ASN1_ITEM X509_PUBKEY_it;
772 
773 int X509_PUBKEY_set(X509_PUBKEY** x, EVP_PKEY* pkey);
774 EVP_PKEY* X509_PUBKEY_get0(X509_PUBKEY* key);
775 EVP_PKEY* X509_PUBKEY_get(X509_PUBKEY* key);
776 int X509_get_pubkey_parameters(EVP_PKEY* pkey, stack_st_X509* chain);
777 c_long X509_get_pathlen(X509* x);
778 int i2d_PUBKEY(EVP_PKEY* a, ubyte** pp);
779 EVP_PKEY* d2i_PUBKEY(EVP_PKEY** a, const(ubyte*)* pp, c_long length);
780 
781 version(OPENSSL_NO_RSA) {} else {
782 int i2d_RSA_PUBKEY(RSA* a, ubyte** pp);
783 RSA* d2i_RSA_PUBKEY(RSA** a, const(ubyte*)* pp, c_long length);
784 }
785 
786 version(OPENSSL_NO_DSA) {} else {
787 int i2d_DSA_PUBKEY(DSA* a, ubyte** pp);
788 DSA* d2i_DSA_PUBKEY(DSA** a, const(ubyte*)* pp, c_long length);
789 }
790 
791 version(OPENSSL_NO_EC) {} else {
792 int i2d_EC_PUBKEY(EC_KEY* a, ubyte** pp);
793 EC_KEY* d2i_EC_PUBKEY(EC_KEY** a, const(ubyte*)* pp, c_long length);
794 }
795 
796 X509_SIG* X509_SIG_new();
797 void X509_SIG_free(X509_SIG* a);
798 X509_SIG* d2i_X509_SIG(X509_SIG** a, const(ubyte*)* in_, c_long len);
799 int i2d_X509_SIG(X509_SIG* a, ubyte** out_);
800 extern __gshared const ASN1_ITEM X509_SIG_it;
801 void X509_SIG_get0(
802     const(X509_SIG)* sig,
803     const(X509_ALGOR*)* palg,
804     const(ASN1_OCTET_STRING*)* pdigest);
805 void X509_SIG_getm(
806     X509_SIG* sig,
807     X509_ALGOR** palg,
808     ASN1_OCTET_STRING** pdigest);
809 
810 X509_REQ_INFO* X509_REQ_INFO_new();
811 void X509_REQ_INFO_free(X509_REQ_INFO* a);
812 X509_REQ_INFO* d2i_X509_REQ_INFO(X509_REQ_INFO** a, const(ubyte*)* in_, c_long len);
813 int i2d_X509_REQ_INFO(X509_REQ_INFO* a, ubyte** out_);
814 extern __gshared const ASN1_ITEM X509_REQ_INFO_it;
815 X509_REQ* X509_REQ_new();
816 void X509_REQ_free(X509_REQ* a);
817 X509_REQ* d2i_X509_REQ(X509_REQ** a, const(ubyte*)* in_, c_long len);
818 int i2d_X509_REQ(X509_REQ* a, ubyte** out_);
819 extern __gshared const ASN1_ITEM X509_REQ_it;
820 
821 X509_ATTRIBUTE* X509_ATTRIBUTE_new();
822 void X509_ATTRIBUTE_free(X509_ATTRIBUTE* a);
823 X509_ATTRIBUTE* d2i_X509_ATTRIBUTE(X509_ATTRIBUTE** a, const(ubyte*)* in_, c_long len);
824 int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE* a, ubyte** out_);
825 extern __gshared const ASN1_ITEM X509_ATTRIBUTE_it;
826 X509_ATTRIBUTE* X509_ATTRIBUTE_create(int nid, int atrtype, void* value);
827 
828 X509_EXTENSION* X509_EXTENSION_new();
829 void X509_EXTENSION_free(X509_EXTENSION* a);
830 X509_EXTENSION* d2i_X509_EXTENSION(X509_EXTENSION** a, const(ubyte*)* in_, c_long len);
831 int i2d_X509_EXTENSION(X509_EXTENSION* a, ubyte** out_);
832 extern __gshared const ASN1_ITEM X509_EXTENSION_it;
833 X509_EXTENSIONS* d2i_X509_EXTENSIONS(X509_EXTENSIONS** a, const(ubyte*)* in_, c_long len);
834 int i2d_X509_EXTENSIONS(X509_EXTENSIONS* a, ubyte** out_);
835 extern __gshared const ASN1_ITEM X509_EXTENSIONS_it;
836 
837 X509_NAME_ENTRY* X509_NAME_ENTRY_new();
838 void X509_NAME_ENTRY_free(X509_NAME_ENTRY* a);
839 X509_NAME_ENTRY* d2i_X509_NAME_ENTRY(X509_NAME_ENTRY** a, const(ubyte*)* in_, c_long len);
840 int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY* a, ubyte** out_);
841 extern __gshared const ASN1_ITEM X509_NAME_ENTRY_it;
842 
843 X509_NAME* X509_NAME_new();
844 void X509_NAME_free(X509_NAME* a);
845 X509_NAME* d2i_X509_NAME(X509_NAME** a, const(ubyte*)* in_, c_long len);
846 int i2d_X509_NAME(X509_NAME* a, ubyte** out_);
847 extern __gshared const ASN1_ITEM X509_NAME_it;
848 
849 int X509_NAME_set(X509_NAME** xn, X509_NAME* name);
850 
851 X509_CINF* X509_CINF_new();
852 void X509_CINF_free(X509_CINF* a);
853 X509_CINF* d2i_X509_CINF(X509_CINF** a, const(ubyte*)* in_, c_long len);
854 int i2d_X509_CINF(X509_CINF* a, ubyte** out_);
855 extern __gshared const ASN1_ITEM X509_CINF_it;
856 
857 X509* X509_new();
858 void X509_free(X509* a);
859 X509* d2i_X509(X509** a, const(ubyte*)* in_, c_long len);
860 int i2d_X509(X509* a, ubyte** out_);
861 extern __gshared const ASN1_ITEM X509_it;
862 X509_CERT_AUX* X509_CERT_AUX_new();
863 void X509_CERT_AUX_free(X509_CERT_AUX* a);
864 X509_CERT_AUX* d2i_X509_CERT_AUX(X509_CERT_AUX** a, const(ubyte*)* in_, c_long len);
865 int i2d_X509_CERT_AUX(X509_CERT_AUX* a, ubyte** out_);
866 extern __gshared const ASN1_ITEM X509_CERT_AUX_it;
867 
868 extern (D) auto X509_get_ex_new_index(T0, T1, T2, T3, T4)(auto ref T0 l, auto ref T1 p, auto ref T2 newf, auto ref T3 dupf, auto ref T4 freef)
869 {
870     return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef);
871 }
872 
873 int X509_set_ex_data(X509* r, int idx, void* arg);
874 void* X509_get_ex_data(X509* r, int idx);
875 int i2d_X509_AUX(X509* a, ubyte** pp);
876 X509* d2i_X509_AUX(X509** a, const(ubyte*)* pp, c_long length);
877 
878 int i2d_re_X509_tbs(X509* x, ubyte** pp);
879 
880 void X509_get0_signature(
881     const(ASN1_BIT_STRING*)* psig,
882     const(X509_ALGOR*)* palg,
883     const(X509)* x);
884 int X509_get_signature_nid(const(X509)* x);
885 
886 int X509_trusted(const(X509)* x);
887 int X509_alias_set1(X509* x, const(ubyte)* name, int len);
888 int X509_keyid_set1(X509* x, const(ubyte)* id, int len);
889 ubyte* X509_alias_get0(X509* x, int* len);
890 ubyte* X509_keyid_get0(X509* x, int* len);
891 int function(int, X509*, int, int function(int, X509*, int) trust) X509_TRUST_set_default(
892     int,
893     X509*,
894     int,
895     int function(int, X509*, int) trust);
896 int X509_TRUST_set(int* t, int trust);
897 int X509_add1_trust_object(X509* x, const(ASN1_OBJECT)* obj);
898 int X509_add1_reject_object(X509* x, const(ASN1_OBJECT)* obj);
899 void X509_trust_clear(X509* x);
900 void X509_reject_clear(X509* x);
901 
902 stack_st_ASN1_OBJECT* X509_get0_trust_objects(X509* x);
903 stack_st_ASN1_OBJECT* X509_get0_reject_objects(X509* x);
904 
905 X509_REVOKED* X509_REVOKED_new();
906 void X509_REVOKED_free(X509_REVOKED* a);
907 X509_REVOKED* d2i_X509_REVOKED(X509_REVOKED** a, const(ubyte*)* in_, c_long len);
908 int i2d_X509_REVOKED(X509_REVOKED* a, ubyte** out_);
909 extern __gshared const ASN1_ITEM X509_REVOKED_it;
910 X509_CRL_INFO* X509_CRL_INFO_new();
911 void X509_CRL_INFO_free(X509_CRL_INFO* a);
912 X509_CRL_INFO* d2i_X509_CRL_INFO(X509_CRL_INFO** a, const(ubyte*)* in_, c_long len);
913 int i2d_X509_CRL_INFO(X509_CRL_INFO* a, ubyte** out_);
914 extern __gshared const ASN1_ITEM X509_CRL_INFO_it;
915 X509_CRL* X509_CRL_new();
916 void X509_CRL_free(X509_CRL* a);
917 X509_CRL* d2i_X509_CRL(X509_CRL** a, const(ubyte*)* in_, c_long len);
918 int i2d_X509_CRL(X509_CRL* a, ubyte** out_);
919 extern __gshared const ASN1_ITEM X509_CRL_it;
920 
921 int X509_CRL_add0_revoked(X509_CRL* crl, X509_REVOKED* rev);
922 int X509_CRL_get0_by_serial(
923     X509_CRL* crl,
924     X509_REVOKED** ret,
925     ASN1_INTEGER* serial);
926 int X509_CRL_get0_by_cert(X509_CRL* crl, X509_REVOKED** ret, X509* x);
927 
928 X509_PKEY* X509_PKEY_new();
929 void X509_PKEY_free(X509_PKEY* a);
930 
931 NETSCAPE_SPKI* NETSCAPE_SPKI_new();
932 void NETSCAPE_SPKI_free(NETSCAPE_SPKI* a);
933 NETSCAPE_SPKI* d2i_NETSCAPE_SPKI(NETSCAPE_SPKI** a, const(ubyte*)* in_, c_long len);
934 int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI* a, ubyte** out_);
935 extern __gshared const ASN1_ITEM NETSCAPE_SPKI_it;
936 NETSCAPE_SPKAC* NETSCAPE_SPKAC_new();
937 void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC* a);
938 NETSCAPE_SPKAC* d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC** a, const(ubyte*)* in_, c_long len);
939 int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC* a, ubyte** out_);
940 extern __gshared const ASN1_ITEM NETSCAPE_SPKAC_it;
941 NETSCAPE_CERT_SEQUENCE* NETSCAPE_CERT_SEQUENCE_new();
942 void NETSCAPE_CERT_SEQUENCE_free(NETSCAPE_CERT_SEQUENCE* a);
943 NETSCAPE_CERT_SEQUENCE* d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE** a, const(ubyte*)* in_, c_long len);
944 int i2d_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE* a, ubyte** out_);
945 extern __gshared const ASN1_ITEM NETSCAPE_CERT_SEQUENCE_it;
946 
947 X509_INFO* X509_INFO_new();
948 void X509_INFO_free(X509_INFO* a);
949 char* X509_NAME_oneline(const(X509_NAME)* a, char* buf, int size);
950 
951 int ASN1_verify(
952     int function() i2d,
953     X509_ALGOR* algor1,
954     ASN1_BIT_STRING* signature,
955     char* data,
956     EVP_PKEY* pkey);
957 
958 int ASN1_digest(
959     int function() i2d,
960     const(EVP_MD)* type,
961     char* data,
962     ubyte* md,
963     uint* len);
964 
965 int ASN1_sign(
966     int function() i2d,
967     X509_ALGOR* algor1,
968     X509_ALGOR* algor2,
969     ASN1_BIT_STRING* signature,
970     char* data,
971     EVP_PKEY* pkey,
972     const(EVP_MD)* type);
973 
974 int ASN1_item_digest(
975     const(ASN1_ITEM)* it,
976     const(EVP_MD)* type,
977     void* data,
978     ubyte* md,
979     uint* len);
980 
981 int ASN1_item_verify(
982     const(ASN1_ITEM)* it,
983     X509_ALGOR* algor1,
984     ASN1_BIT_STRING* signature,
985     void* data,
986     EVP_PKEY* pkey);
987 
988 int ASN1_item_sign(
989     const(ASN1_ITEM)* it,
990     X509_ALGOR* algor1,
991     X509_ALGOR* algor2,
992     ASN1_BIT_STRING* signature,
993     void* data,
994     EVP_PKEY* pkey,
995     const(EVP_MD)* type);
996 int ASN1_item_sign_ctx(
997     const(ASN1_ITEM)* it,
998     X509_ALGOR* algor1,
999     X509_ALGOR* algor2,
1000     ASN1_BIT_STRING* signature,
1001     void* asn,
1002     EVP_MD_CTX* ctx);
1003 
1004 c_long X509_get_version(const(X509)* x);
1005 int X509_set_version(X509* x, c_long version_);
1006 int X509_set_serialNumber(X509* x, ASN1_INTEGER* serial);
1007 ASN1_INTEGER* X509_get_serialNumber(X509* x);
1008 const(ASN1_INTEGER)* X509_get0_serialNumber(const(X509)* x);
1009 int X509_set_issuer_name(X509* x, X509_NAME* name);
1010 X509_NAME* X509_get_issuer_name(const(X509)* a);
1011 int X509_set_subject_name(X509* x, X509_NAME* name);
1012 X509_NAME* X509_get_subject_name(const(X509)* a);
1013 const(ASN1_TIME)* X509_get0_notBefore(const(X509)* x);
1014 ASN1_TIME* X509_getm_notBefore(const(X509)* x);
1015 int X509_set1_notBefore(X509* x, const(ASN1_TIME)* tm);
1016 const(ASN1_TIME)* X509_get0_notAfter(const(X509)* x);
1017 ASN1_TIME* X509_getm_notAfter(const(X509)* x);
1018 int X509_set1_notAfter(X509* x, const(ASN1_TIME)* tm);
1019 int X509_set_pubkey(X509* x, EVP_PKEY* pkey);
1020 int X509_up_ref(X509* x);
1021 int X509_get_signature_type(const(X509)* x);
1022 
1023 alias X509_get_notBefore = X509_getm_notBefore;
1024 alias X509_get_notAfter = X509_getm_notAfter;
1025 alias X509_set_notBefore = X509_set1_notBefore;
1026 alias X509_set_notAfter = X509_set1_notAfter;
1027 
1028 /*
1029  * This one is only used so that a binary form can output, as in
1030  * i2d_X509_NAME(X509_get_X509_PUBKEY(x), &buf)
1031  */
1032 X509_PUBKEY* X509_get_X509_PUBKEY(const(X509)* x);
1033 const(stack_st_X509_EXTENSION)* X509_get0_extensions(const(X509)* x);
1034 void X509_get0_uids(
1035     const(X509)* x,
1036     const(ASN1_BIT_STRING*)* piuid,
1037     const(ASN1_BIT_STRING*)* psuid);
1038 const(X509_ALGOR)* X509_get0_tbs_sigalg(const(X509)* x);
1039 
1040 EVP_PKEY* X509_get0_pubkey(const(X509)* x);
1041 EVP_PKEY* X509_get_pubkey(X509* x);
1042 ASN1_BIT_STRING* X509_get0_pubkey_bitstr(const(X509)* x);
1043 int X509_certificate_type(const(X509)* x, const(EVP_PKEY)* pubkey);
1044 
1045 c_long X509_REQ_get_version(const(X509_REQ)* req);
1046 int X509_REQ_set_version(X509_REQ* x, c_long version_);
1047 X509_NAME* X509_REQ_get_subject_name(const(X509_REQ)* req);
1048 int X509_REQ_set_subject_name(X509_REQ* req, X509_NAME* name);
1049 void X509_REQ_get0_signature(
1050     const(X509_REQ)* req,
1051     const(ASN1_BIT_STRING*)* psig,
1052     const(X509_ALGOR*)* palg);
1053 int X509_REQ_get_signature_nid(const(X509_REQ)* req);
1054 int i2d_re_X509_REQ_tbs(X509_REQ* req, ubyte** pp);
1055 int X509_REQ_set_pubkey(X509_REQ* x, EVP_PKEY* pkey);
1056 EVP_PKEY* X509_REQ_get_pubkey(X509_REQ* req);
1057 EVP_PKEY* X509_REQ_get0_pubkey(X509_REQ* req);
1058 X509_PUBKEY* X509_REQ_get_X509_PUBKEY(X509_REQ* req);
1059 int X509_REQ_extension_nid(int nid);
1060 int* X509_REQ_get_extension_nids();
1061 void X509_REQ_set_extension_nids(int* nids);
1062 stack_st_X509_EXTENSION* X509_REQ_get_extensions(X509_REQ* req);
1063 int X509_REQ_add_extensions_nid(
1064     X509_REQ* req,
1065     stack_st_X509_EXTENSION* exts,
1066     int nid);
1067 int X509_REQ_add_extensions(X509_REQ* req, stack_st_X509_EXTENSION* exts);
1068 int X509_REQ_get_attr_count(const(X509_REQ)* req);
1069 int X509_REQ_get_attr_by_NID(const(X509_REQ)* req, int nid, int lastpos);
1070 int X509_REQ_get_attr_by_OBJ(
1071     const(X509_REQ)* req,
1072     const(ASN1_OBJECT)* obj,
1073     int lastpos);
1074 X509_ATTRIBUTE* X509_REQ_get_attr(const(X509_REQ)* req, int loc);
1075 X509_ATTRIBUTE* X509_REQ_delete_attr(X509_REQ* req, int loc);
1076 int X509_REQ_add1_attr(X509_REQ* req, X509_ATTRIBUTE* attr);
1077 int X509_REQ_add1_attr_by_OBJ(
1078     X509_REQ* req,
1079     const(ASN1_OBJECT)* obj,
1080     int type,
1081     const(ubyte)* bytes,
1082     int len);
1083 int X509_REQ_add1_attr_by_NID(
1084     X509_REQ* req,
1085     int nid,
1086     int type,
1087     const(ubyte)* bytes,
1088     int len);
1089 int X509_REQ_add1_attr_by_txt(
1090     X509_REQ* req,
1091     const(char)* attrname,
1092     int type,
1093     const(ubyte)* bytes,
1094     int len);
1095 
1096 int X509_CRL_set_version(X509_CRL* x, c_long version_);
1097 int X509_CRL_set_issuer_name(X509_CRL* x, X509_NAME* name);
1098 int X509_CRL_set1_lastUpdate(X509_CRL* x, const(ASN1_TIME)* tm);
1099 int X509_CRL_set1_nextUpdate(X509_CRL* x, const(ASN1_TIME)* tm);
1100 int X509_CRL_sort(X509_CRL* crl);
1101 int X509_CRL_up_ref(X509_CRL* crl);
1102 
1103 alias X509_CRL_set_lastUpdate = X509_CRL_set1_lastUpdate;
1104 alias X509_CRL_set_nextUpdate = X509_CRL_set1_nextUpdate;
1105 
1106 c_long X509_CRL_get_version(const(X509_CRL)* crl);
1107 const(ASN1_TIME)* X509_CRL_get0_lastUpdate(const(X509_CRL)* crl);
1108 const(ASN1_TIME)* X509_CRL_get0_nextUpdate(const(X509_CRL)* crl);
1109 ASN1_TIME* X509_CRL_get_lastUpdate(X509_CRL* crl);
1110 ASN1_TIME* X509_CRL_get_nextUpdate(X509_CRL* crl);
1111 X509_NAME* X509_CRL_get_issuer(const(X509_CRL)* crl);
1112 const(stack_st_X509_EXTENSION)* X509_CRL_get0_extensions(const(X509_CRL)* crl);
1113 stack_st_X509_REVOKED* X509_CRL_get_REVOKED(X509_CRL* crl);
1114 void X509_CRL_get0_signature(
1115     const(X509_CRL)* crl,
1116     const(ASN1_BIT_STRING*)* psig,
1117     const(X509_ALGOR*)* palg);
1118 int X509_CRL_get_signature_nid(const(X509_CRL)* crl);
1119 int i2d_re_X509_CRL_tbs(X509_CRL* req, ubyte** pp);
1120 
1121 const(ASN1_INTEGER)* X509_REVOKED_get0_serialNumber(const(X509_REVOKED)* x);
1122 int X509_REVOKED_set_serialNumber(X509_REVOKED* x, ASN1_INTEGER* serial);
1123 const(ASN1_TIME)* X509_REVOKED_get0_revocationDate(const(X509_REVOKED)* x);
1124 int X509_REVOKED_set_revocationDate(X509_REVOKED* r, ASN1_TIME* tm);
1125 const(stack_st_X509_EXTENSION)* X509_REVOKED_get0_extensions(
1126     const(X509_REVOKED)* r);
1127 
1128 X509_CRL* X509_CRL_diff(
1129     X509_CRL* base,
1130     X509_CRL* newer,
1131     EVP_PKEY* skey,
1132     const(EVP_MD)* md,
1133     uint flags);
1134 
1135 int X509_REQ_check_private_key(X509_REQ* x509, EVP_PKEY* pkey);
1136 
1137 int X509_check_private_key(const(X509)* x509, const(EVP_PKEY)* pkey);
1138 int X509_chain_check_suiteb(
1139     int* perror_depth,
1140     X509* x,
1141     stack_st_X509* chain,
1142     c_ulong flags);
1143 int X509_CRL_check_suiteb(X509_CRL* crl, EVP_PKEY* pk, c_ulong flags);
1144 stack_st_X509* X509_chain_up_ref(stack_st_X509* chain);
1145 
1146 int X509_issuer_and_serial_cmp(const(X509)* a, const(X509)* b);
1147 c_ulong X509_issuer_and_serial_hash(X509* a);
1148 
1149 int X509_issuer_name_cmp(const(X509)* a, const(X509)* b);
1150 c_ulong X509_issuer_name_hash(X509* a);
1151 
1152 int X509_subject_name_cmp(const(X509)* a, const(X509)* b);
1153 c_ulong X509_subject_name_hash(X509* x);
1154 
1155 version(OPENSSL_NO_MD5) {} else {
1156 c_ulong X509_issuer_name_hash_old(X509* a);
1157 c_ulong X509_subject_name_hash_old(X509* x);
1158 }
1159 
1160 int X509_cmp(const(X509)* a, const(X509)* b);
1161 int X509_NAME_cmp(const(X509_NAME)* a, const(X509_NAME)* b);
1162 c_ulong X509_NAME_hash(X509_NAME* x);
1163 c_ulong X509_NAME_hash_old(X509_NAME* x);
1164 
1165 int X509_CRL_cmp(const(X509_CRL)* a, const(X509_CRL)* b);
1166 int X509_CRL_match(const(X509_CRL)* a, const(X509_CRL)* b);
1167 int X509_aux_print(BIO* out_, X509* x, int indent);
1168 
1169 version(OPENSSL_NO_STDIO) {} else {
1170 int X509_print_ex_fp(FILE* bp, X509* x, c_ulong nmflag, c_ulong cflag);
1171 int X509_print_fp(FILE* bp, X509* x);
1172 int X509_CRL_print_fp(FILE* bp, X509_CRL* x);
1173 int X509_REQ_print_fp(FILE* bp, X509_REQ* req);
1174 int X509_NAME_print_ex_fp(
1175     FILE* fp,
1176     const(X509_NAME)* nm,
1177     int indent,
1178     c_ulong flags);
1179 }
1180 
1181 int X509_NAME_print(BIO* bp, const(X509_NAME)* name, int obase);
1182 int X509_NAME_print_ex(
1183     BIO* out_,
1184     const(X509_NAME)* nm,
1185     int indent,
1186     c_ulong flags);
1187 int X509_print_ex(BIO* bp, X509* x, c_ulong nmflag, c_ulong cflag);
1188 int X509_print(BIO* bp, X509* x);
1189 int X509_ocspid_print(BIO* bp, X509* x);
1190 int X509_CRL_print(BIO* bp, X509_CRL* x);
1191 int X509_REQ_print_ex(BIO* bp, X509_REQ* x, c_ulong nmflag, c_ulong cflag);
1192 int X509_REQ_print(BIO* bp, X509_REQ* req);
1193 
1194 int X509_NAME_entry_count(const(X509_NAME)* name);
1195 int X509_NAME_get_text_by_NID(X509_NAME* name, int nid, char* buf, int len);
1196 int X509_NAME_get_text_by_OBJ(
1197     X509_NAME* name,
1198     const(ASN1_OBJECT)* obj,
1199     char* buf,
1200     int len);
1201 
1202 /*
1203  * NOTE: you should be passing -1, not 0 as lastpos. The functions that use
1204  * lastpos, search after that position on.
1205  */
1206 int X509_NAME_get_index_by_NID(X509_NAME* name, int nid, int lastpos);
1207 int X509_NAME_get_index_by_OBJ(
1208     X509_NAME* name,
1209     const(ASN1_OBJECT)* obj,
1210     int lastpos);
1211 X509_NAME_ENTRY* X509_NAME_get_entry(const(X509_NAME)* name, int loc);
1212 X509_NAME_ENTRY* X509_NAME_delete_entry(X509_NAME* name, int loc);
1213 int X509_NAME_add_entry(
1214     X509_NAME* name,
1215     const(X509_NAME_ENTRY)* ne,
1216     int loc,
1217     int set);
1218 int X509_NAME_add_entry_by_OBJ(
1219     X509_NAME* name,
1220     const(ASN1_OBJECT)* obj,
1221     int type,
1222     const(ubyte)* bytes,
1223     int len,
1224     int loc,
1225     int set);
1226 int X509_NAME_add_entry_by_NID(
1227     X509_NAME* name,
1228     int nid,
1229     int type,
1230     const(ubyte)* bytes,
1231     int len,
1232     int loc,
1233     int set);
1234 X509_NAME_ENTRY* X509_NAME_ENTRY_create_by_txt(
1235     X509_NAME_ENTRY** ne,
1236     const(char)* field,
1237     int type,
1238     const(ubyte)* bytes,
1239     int len);
1240 X509_NAME_ENTRY* X509_NAME_ENTRY_create_by_NID(
1241     X509_NAME_ENTRY** ne,
1242     int nid,
1243     int type,
1244     const(ubyte)* bytes,
1245     int len);
1246 int X509_NAME_add_entry_by_txt(
1247     X509_NAME* name,
1248     const(char)* field,
1249     int type,
1250     const(ubyte)* bytes,
1251     int len,
1252     int loc,
1253     int set);
1254 X509_NAME_ENTRY* X509_NAME_ENTRY_create_by_OBJ(
1255     X509_NAME_ENTRY** ne,
1256     const(ASN1_OBJECT)* obj,
1257     int type,
1258     const(ubyte)* bytes,
1259     int len);
1260 int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY* ne, const(ASN1_OBJECT)* obj);
1261 int X509_NAME_ENTRY_set_data(
1262     X509_NAME_ENTRY* ne,
1263     int type,
1264     const(ubyte)* bytes,
1265     int len);
1266 ASN1_OBJECT* X509_NAME_ENTRY_get_object(const(X509_NAME_ENTRY)* ne);
1267 ASN1_STRING* X509_NAME_ENTRY_get_data(const(X509_NAME_ENTRY)* ne);
1268 int X509_NAME_ENTRY_set(const(X509_NAME_ENTRY)* ne);
1269 
1270 int X509_NAME_get0_der(X509_NAME* nm, const(ubyte*)* pder, size_t* pderlen);
1271 
1272 int X509v3_get_ext_count(const(stack_st_X509_EXTENSION)* x);
1273 int X509v3_get_ext_by_NID(
1274     const(stack_st_X509_EXTENSION)* x,
1275     int nid,
1276     int lastpos);
1277 int X509v3_get_ext_by_OBJ(
1278     const(stack_st_X509_EXTENSION)* x,
1279     const(ASN1_OBJECT)* obj,
1280     int lastpos);
1281 int X509v3_get_ext_by_critical(
1282     const(stack_st_X509_EXTENSION)* x,
1283     int crit,
1284     int lastpos);
1285 X509_EXTENSION* X509v3_get_ext(const(stack_st_X509_EXTENSION)* x, int loc);
1286 X509_EXTENSION* X509v3_delete_ext(stack_st_X509_EXTENSION* x, int loc);
1287 stack_st_X509_EXTENSION* X509v3_add_ext(
1288     stack_st_X509_EXTENSION** x,
1289     X509_EXTENSION* ex,
1290     int loc);
1291 
1292 int X509_get_ext_count(const(X509)* x);
1293 int X509_get_ext_by_NID(const(X509)* x, int nid, int lastpos);
1294 int X509_get_ext_by_OBJ(const(X509)* x, const(ASN1_OBJECT)* obj, int lastpos);
1295 int X509_get_ext_by_critical(const(X509)* x, int crit, int lastpos);
1296 X509_EXTENSION* X509_get_ext(const(X509)* x, int loc);
1297 X509_EXTENSION* X509_delete_ext(X509* x, int loc);
1298 int X509_add_ext(X509* x, X509_EXTENSION* ex, int loc);
1299 void* X509_get_ext_d2i(const(X509)* x, int nid, int* crit, int* idx);
1300 int X509_add1_ext_i2d(X509* x, int nid, void* value, int crit, c_ulong flags);
1301 
1302 int X509_CRL_get_ext_count(const(X509_CRL)* x);
1303 int X509_CRL_get_ext_by_NID(const(X509_CRL)* x, int nid, int lastpos);
1304 int X509_CRL_get_ext_by_OBJ(
1305     const(X509_CRL)* x,
1306     const(ASN1_OBJECT)* obj,
1307     int lastpos);
1308 int X509_CRL_get_ext_by_critical(const(X509_CRL)* x, int crit, int lastpos);
1309 X509_EXTENSION* X509_CRL_get_ext(const(X509_CRL)* x, int loc);
1310 X509_EXTENSION* X509_CRL_delete_ext(X509_CRL* x, int loc);
1311 int X509_CRL_add_ext(X509_CRL* x, X509_EXTENSION* ex, int loc);
1312 void* X509_CRL_get_ext_d2i(const(X509_CRL)* x, int nid, int* crit, int* idx);
1313 int X509_CRL_add1_ext_i2d(
1314     X509_CRL* x,
1315     int nid,
1316     void* value,
1317     int crit,
1318     c_ulong flags);
1319 
1320 int X509_REVOKED_get_ext_count(const(X509_REVOKED)* x);
1321 int X509_REVOKED_get_ext_by_NID(const(X509_REVOKED)* x, int nid, int lastpos);
1322 int X509_REVOKED_get_ext_by_OBJ(
1323     const(X509_REVOKED)* x,
1324     const(ASN1_OBJECT)* obj,
1325     int lastpos);
1326 int X509_REVOKED_get_ext_by_critical(
1327     const(X509_REVOKED)* x,
1328     int crit,
1329     int lastpos);
1330 X509_EXTENSION* X509_REVOKED_get_ext(const(X509_REVOKED)* x, int loc);
1331 X509_EXTENSION* X509_REVOKED_delete_ext(X509_REVOKED* x, int loc);
1332 int X509_REVOKED_add_ext(X509_REVOKED* x, X509_EXTENSION* ex, int loc);
1333 void* X509_REVOKED_get_ext_d2i(
1334     const(X509_REVOKED)* x,
1335     int nid,
1336     int* crit,
1337     int* idx);
1338 int X509_REVOKED_add1_ext_i2d(
1339     X509_REVOKED* x,
1340     int nid,
1341     void* value,
1342     int crit,
1343     c_ulong flags);
1344 
1345 X509_EXTENSION* X509_EXTENSION_create_by_NID(
1346     X509_EXTENSION** ex,
1347     int nid,
1348     int crit,
1349     ASN1_OCTET_STRING* data);
1350 X509_EXTENSION* X509_EXTENSION_create_by_OBJ(
1351     X509_EXTENSION** ex,
1352     const(ASN1_OBJECT)* obj,
1353     int crit,
1354     ASN1_OCTET_STRING* data);
1355 int X509_EXTENSION_set_object(X509_EXTENSION* ex, const(ASN1_OBJECT)* obj);
1356 int X509_EXTENSION_set_critical(X509_EXTENSION* ex, int crit);
1357 int X509_EXTENSION_set_data(X509_EXTENSION* ex, ASN1_OCTET_STRING* data);
1358 ASN1_OBJECT* X509_EXTENSION_get_object(X509_EXTENSION* ex);
1359 ASN1_OCTET_STRING* X509_EXTENSION_get_data(X509_EXTENSION* ne);
1360 int X509_EXTENSION_get_critical(const(X509_EXTENSION)* ex);
1361 
1362 int X509at_get_attr_count(const(stack_st_X509_ATTRIBUTE)* x);
1363 int X509at_get_attr_by_NID(
1364     const(stack_st_X509_ATTRIBUTE)* x,
1365     int nid,
1366     int lastpos);
1367 int X509at_get_attr_by_OBJ(
1368     const(stack_st_X509_ATTRIBUTE)* sk,
1369     const(ASN1_OBJECT)* obj,
1370     int lastpos);
1371 X509_ATTRIBUTE* X509at_get_attr(const(stack_st_X509_ATTRIBUTE)* x, int loc);
1372 X509_ATTRIBUTE* X509at_delete_attr(stack_st_X509_ATTRIBUTE* x, int loc);
1373 stack_st_X509_ATTRIBUTE* X509at_add1_attr(
1374     stack_st_X509_ATTRIBUTE** x,
1375     X509_ATTRIBUTE* attr);
1376 stack_st_X509_ATTRIBUTE* X509at_add1_attr_by_OBJ(
1377     stack_st_X509_ATTRIBUTE** x,
1378     const(ASN1_OBJECT)* obj,
1379     int type,
1380     const(ubyte)* bytes,
1381     int len);
1382 stack_st_X509_ATTRIBUTE* X509at_add1_attr_by_NID(
1383     stack_st_X509_ATTRIBUTE** x,
1384     int nid,
1385     int type,
1386     const(ubyte)* bytes,
1387     int len);
1388 stack_st_X509_ATTRIBUTE* X509at_add1_attr_by_txt(
1389     stack_st_X509_ATTRIBUTE** x,
1390     const(char)* attrname,
1391     int type,
1392     const(ubyte)* bytes,
1393     int len);
1394 void* X509at_get0_data_by_OBJ(
1395     stack_st_X509_ATTRIBUTE* x,
1396     const(ASN1_OBJECT)* obj,
1397     int lastpos,
1398     int type);
1399 X509_ATTRIBUTE* X509_ATTRIBUTE_create_by_NID(
1400     X509_ATTRIBUTE** attr,
1401     int nid,
1402     int atrtype,
1403     const(void)* data,
1404     int len);
1405 X509_ATTRIBUTE* X509_ATTRIBUTE_create_by_OBJ(
1406     X509_ATTRIBUTE** attr,
1407     const(ASN1_OBJECT)* obj,
1408     int atrtype,
1409     const(void)* data,
1410     int len);
1411 X509_ATTRIBUTE* X509_ATTRIBUTE_create_by_txt(
1412     X509_ATTRIBUTE** attr,
1413     const(char)* atrname,
1414     int type,
1415     const(ubyte)* bytes,
1416     int len);
1417 int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE* attr, const(ASN1_OBJECT)* obj);
1418 int X509_ATTRIBUTE_set1_data(
1419     X509_ATTRIBUTE* attr,
1420     int attrtype,
1421     const(void)* data,
1422     int len);
1423 void* X509_ATTRIBUTE_get0_data(
1424     X509_ATTRIBUTE* attr,
1425     int idx,
1426     int atrtype,
1427     void* data);
1428 int X509_ATTRIBUTE_count(const(X509_ATTRIBUTE)* attr);
1429 ASN1_OBJECT* X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE* attr);
1430 ASN1_TYPE* X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE* attr, int idx);
1431 
1432 int EVP_PKEY_get_attr_count(const(EVP_PKEY)* key);
1433 int EVP_PKEY_get_attr_by_NID(const(EVP_PKEY)* key, int nid, int lastpos);
1434 int EVP_PKEY_get_attr_by_OBJ(
1435     const(EVP_PKEY)* key,
1436     const(ASN1_OBJECT)* obj,
1437     int lastpos);
1438 X509_ATTRIBUTE* EVP_PKEY_get_attr(const(EVP_PKEY)* key, int loc);
1439 X509_ATTRIBUTE* EVP_PKEY_delete_attr(EVP_PKEY* key, int loc);
1440 int EVP_PKEY_add1_attr(EVP_PKEY* key, X509_ATTRIBUTE* attr);
1441 int EVP_PKEY_add1_attr_by_OBJ(
1442     EVP_PKEY* key,
1443     const(ASN1_OBJECT)* obj,
1444     int type,
1445     const(ubyte)* bytes,
1446     int len);
1447 int EVP_PKEY_add1_attr_by_NID(
1448     EVP_PKEY* key,
1449     int nid,
1450     int type,
1451     const(ubyte)* bytes,
1452     int len);
1453 int EVP_PKEY_add1_attr_by_txt(
1454     EVP_PKEY* key,
1455     const(char)* attrname,
1456     int type,
1457     const(ubyte)* bytes,
1458     int len);
1459 
1460 int X509_verify_cert(X509_STORE_CTX* ctx);
1461 
1462 /* lookup a cert from a X509 STACK */
1463 X509* X509_find_by_issuer_and_serial(
1464     stack_st_X509* sk,
1465     X509_NAME* name,
1466     ASN1_INTEGER* serial);
1467 X509* X509_find_by_subject(stack_st_X509* sk, X509_NAME* name);
1468 
1469 PBEPARAM* PBEPARAM_new();
1470 void PBEPARAM_free(PBEPARAM* a);
1471 PBEPARAM* d2i_PBEPARAM(PBEPARAM** a, const(ubyte*)* in_, c_long len);
1472 int i2d_PBEPARAM(PBEPARAM* a, ubyte** out_);
1473 extern __gshared const ASN1_ITEM PBEPARAM_it;
1474 PBE2PARAM* PBE2PARAM_new();
1475 void PBE2PARAM_free(PBE2PARAM* a);
1476 PBE2PARAM* d2i_PBE2PARAM(PBE2PARAM** a, const(ubyte*)* in_, c_long len);
1477 int i2d_PBE2PARAM(PBE2PARAM* a, ubyte** out_);
1478 extern __gshared const ASN1_ITEM PBE2PARAM_it;
1479 PBKDF2PARAM* PBKDF2PARAM_new();
1480 void PBKDF2PARAM_free(PBKDF2PARAM* a);
1481 PBKDF2PARAM* d2i_PBKDF2PARAM(PBKDF2PARAM** a, const(ubyte*)* in_, c_long len);
1482 int i2d_PBKDF2PARAM(PBKDF2PARAM* a, ubyte** out_);
1483 extern __gshared const ASN1_ITEM PBKDF2PARAM_it;
1484 
1485 int PKCS5_pbe_set0_algor(
1486     X509_ALGOR* algor,
1487     int alg,
1488     int iter,
1489     const(ubyte)* salt,
1490     int saltlen);
1491 
1492 X509_ALGOR* PKCS5_pbe_set(int alg, int iter, const(ubyte)* salt, int saltlen);
1493 X509_ALGOR* PKCS5_pbe2_set(
1494     const(EVP_CIPHER)* cipher,
1495     int iter,
1496     ubyte* salt,
1497     int saltlen);
1498 X509_ALGOR* PKCS5_pbe2_set_iv(
1499     const(EVP_CIPHER)* cipher,
1500     int iter,
1501     ubyte* salt,
1502     int saltlen,
1503     ubyte* aiv,
1504     int prf_nid);
1505 
1506 version(OPENSSL_NO_SCRYPT) {} else {
1507 X509_ALGOR* PKCS5_pbe2_set_scrypt(
1508     const(EVP_CIPHER)* cipher,
1509     const(ubyte)* salt,
1510     int saltlen,
1511     ubyte* aiv,
1512     ulong N,
1513     ulong r,
1514     ulong p);
1515 }
1516 
1517 X509_ALGOR* PKCS5_pbkdf2_set(
1518     int iter,
1519     ubyte* salt,
1520     int saltlen,
1521     int prf_nid,
1522     int keylen);
1523 
1524 /* PKCS#8 utilities */
1525 
1526 PKCS8_PRIV_KEY_INFO* PKCS8_PRIV_KEY_INFO_new();
1527 void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO* a);
1528 PKCS8_PRIV_KEY_INFO* d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO** a, const(ubyte*)* in_, c_long len);
1529 int i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO* a, ubyte** out_);
1530 extern __gshared const ASN1_ITEM PKCS8_PRIV_KEY_INFO_it;
1531 
1532 EVP_PKEY* EVP_PKCS82PKEY(const(PKCS8_PRIV_KEY_INFO)* p8);
1533 PKCS8_PRIV_KEY_INFO* EVP_PKEY2PKCS8(EVP_PKEY* pkey);
1534 
1535 int PKCS8_pkey_set0(
1536     PKCS8_PRIV_KEY_INFO* priv,
1537     ASN1_OBJECT* aobj,
1538     int version_,
1539     int ptype,
1540     void* pval,
1541     ubyte* penc,
1542     int penclen);
1543 int PKCS8_pkey_get0(
1544     const(ASN1_OBJECT*)* ppkalg,
1545     const(ubyte*)* pk,
1546     int* ppklen,
1547     const(X509_ALGOR*)* pa,
1548     const(PKCS8_PRIV_KEY_INFO)* p8);
1549 
1550 const(stack_st_X509_ATTRIBUTE)* PKCS8_pkey_get0_attrs(
1551     const(PKCS8_PRIV_KEY_INFO)* p8);
1552 int PKCS8_pkey_add1_attr_by_NID(
1553     PKCS8_PRIV_KEY_INFO* p8,
1554     int nid,
1555     int type,
1556     const(ubyte)* bytes,
1557     int len);
1558 
1559 int X509_PUBKEY_set0_param(
1560     X509_PUBKEY* pub,
1561     ASN1_OBJECT* aobj,
1562     int ptype,
1563     void* pval,
1564     ubyte* penc,
1565     int penclen);
1566 int X509_PUBKEY_get0_param(
1567     ASN1_OBJECT** ppkalg,
1568     const(ubyte*)* pk,
1569     int* ppklen,
1570     X509_ALGOR** pa,
1571     X509_PUBKEY* pub);
1572 
1573 int X509_check_trust(X509* x, int id, int flags);
1574 int X509_TRUST_get_count();
1575 X509_TRUST* X509_TRUST_get0(int idx);
1576 int X509_TRUST_get_by_id(int id);
1577 int X509_TRUST_add(
1578     int id,
1579     int flags,
1580     int function(X509_TRUST*, X509*, int) ck,
1581     const(char)* name,
1582     int arg1,
1583     void* arg2);
1584 void X509_TRUST_cleanup();
1585 int X509_TRUST_get_flags(const(X509_TRUST)* xp);
1586 char* X509_TRUST_get0_name(const(X509_TRUST)* xp);
1587 int X509_TRUST_get_trust(const(X509_TRUST)* xp);
1588 
1589 /* BEGIN ERROR CODES */
1590 /*
1591  * The following lines are auto generated by the script mkerr.pl. Any changes
1592  * made after this point may be overwritten when the script is next run.
1593  */
1594 
1595 int ERR_load_X509_strings();
1596 
1597 /* Error codes for the X509 functions. */
1598 
1599 /* Function codes. */
1600 enum X509_F_ADD_CERT_DIR = 100;
1601 enum X509_F_BUILD_CHAIN = 106;
1602 enum X509_F_BY_FILE_CTRL = 101;
1603 enum X509_F_CHECK_NAME_CONSTRAINTS = 149;
1604 enum X509_F_CHECK_POLICY = 145;
1605 enum X509_F_DANE_I2D = 107;
1606 enum X509_F_DIR_CTRL = 102;
1607 enum X509_F_GET_CERT_BY_SUBJECT = 103;
1608 enum X509_F_NETSCAPE_SPKI_B64_DECODE = 129;
1609 enum X509_F_NETSCAPE_SPKI_B64_ENCODE = 130;
1610 enum X509_F_X509AT_ADD1_ATTR = 135;
1611 enum X509_F_X509V3_ADD_EXT = 104;
1612 enum X509_F_X509_ATTRIBUTE_CREATE_BY_NID = 136;
1613 enum X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ = 137;
1614 enum X509_F_X509_ATTRIBUTE_CREATE_BY_TXT = 140;
1615 enum X509_F_X509_ATTRIBUTE_GET0_DATA = 139;
1616 enum X509_F_X509_ATTRIBUTE_SET1_DATA = 138;
1617 enum X509_F_X509_CHECK_PRIVATE_KEY = 128;
1618 enum X509_F_X509_CRL_DIFF = 105;
1619 enum X509_F_X509_CRL_PRINT_FP = 147;
1620 enum X509_F_X509_EXTENSION_CREATE_BY_NID = 108;
1621 enum X509_F_X509_EXTENSION_CREATE_BY_OBJ = 109;
1622 enum X509_F_X509_GET_PUBKEY_PARAMETERS = 110;
1623 enum X509_F_X509_LOAD_CERT_CRL_FILE = 132;
1624 enum X509_F_X509_LOAD_CERT_FILE = 111;
1625 enum X509_F_X509_LOAD_CRL_FILE = 112;
1626 enum X509_F_X509_NAME_ADD_ENTRY = 113;
1627 enum X509_F_X509_NAME_ENTRY_CREATE_BY_NID = 114;
1628 enum X509_F_X509_NAME_ENTRY_CREATE_BY_TXT = 131;
1629 enum X509_F_X509_NAME_ENTRY_SET_OBJECT = 115;
1630 enum X509_F_X509_NAME_ONELINE = 116;
1631 enum X509_F_X509_NAME_PRINT = 117;
1632 enum X509_F_X509_OBJECT_NEW = 150;
1633 enum X509_F_X509_PRINT_EX_FP = 118;
1634 enum X509_F_X509_PUBKEY_DECODE = 148;
1635 enum X509_F_X509_PUBKEY_GET0 = 119;
1636 enum X509_F_X509_PUBKEY_SET = 120;
1637 enum X509_F_X509_REQ_CHECK_PRIVATE_KEY = 144;
1638 enum X509_F_X509_REQ_PRINT_EX = 121;
1639 enum X509_F_X509_REQ_PRINT_FP = 122;
1640 enum X509_F_X509_REQ_TO_X509 = 123;
1641 enum X509_F_X509_STORE_ADD_CERT = 124;
1642 enum X509_F_X509_STORE_ADD_CRL = 125;
1643 enum X509_F_X509_STORE_CTX_GET1_ISSUER = 146;
1644 enum X509_F_X509_STORE_CTX_INIT = 143;
1645 enum X509_F_X509_STORE_CTX_NEW = 142;
1646 enum X509_F_X509_STORE_CTX_PURPOSE_INHERIT = 134;
1647 enum X509_F_X509_TO_X509_REQ = 126;
1648 enum X509_F_X509_TRUST_ADD = 133;
1649 enum X509_F_X509_TRUST_SET = 141;
1650 enum X509_F_X509_VERIFY_CERT = 127;
1651 
1652 /* Reason codes. */
1653 enum X509_R_AKID_MISMATCH = 110;
1654 enum X509_R_BAD_SELECTOR = 133;
1655 enum X509_R_BAD_X509_FILETYPE = 100;
1656 enum X509_R_BASE64_DECODE_ERROR = 118;
1657 enum X509_R_CANT_CHECK_DH_KEY = 114;
1658 enum X509_R_CERT_ALREADY_IN_HASH_TABLE = 101;
1659 enum X509_R_CRL_ALREADY_DELTA = 127;
1660 enum X509_R_CRL_VERIFY_FAILURE = 131;
1661 enum X509_R_IDP_MISMATCH = 128;
1662 enum X509_R_INVALID_DIRECTORY = 113;
1663 enum X509_R_INVALID_FIELD_NAME = 119;
1664 enum X509_R_INVALID_TRUST = 123;
1665 enum X509_R_ISSUER_MISMATCH = 129;
1666 enum X509_R_KEY_TYPE_MISMATCH = 115;
1667 enum X509_R_KEY_VALUES_MISMATCH = 116;
1668 enum X509_R_LOADING_CERT_DIR = 103;
1669 enum X509_R_LOADING_DEFAULTS = 104;
1670 enum X509_R_METHOD_NOT_SUPPORTED = 124;
1671 enum X509_R_NAME_TOO_LONG = 134;
1672 enum X509_R_NEWER_CRL_NOT_NEWER = 132;
1673 enum X509_R_NO_CERT_SET_FOR_US_TO_VERIFY = 105;
1674 enum X509_R_NO_CRL_NUMBER = 130;
1675 enum X509_R_PUBLIC_KEY_DECODE_ERROR = 125;
1676 enum X509_R_PUBLIC_KEY_ENCODE_ERROR = 126;
1677 enum X509_R_SHOULD_RETRY = 106;
1678 enum X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN = 107;
1679 enum X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY = 108;
1680 enum X509_R_UNKNOWN_KEY_TYPE = 117;
1681 enum X509_R_UNKNOWN_NID = 109;
1682 enum X509_R_UNKNOWN_PURPOSE_ID = 121;
1683 enum X509_R_UNKNOWN_TRUST_ID = 120;
1684 enum X509_R_UNSUPPORTED_ALGORITHM = 111;
1685 enum X509_R_WRONG_LOOKUP_TYPE = 112;
1686 enum X509_R_WRONG_TYPE = 122;
1687