1 /*
2  * Copyright 1999-2018 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 module deimos.openssl.x509v3;
11 
12 import deimos.openssl._d_util;
13 import deimos.openssl.crypto:OPENSSL_buf2hexstr, OPENSSL_hexstr2buf;
14 import deimos.openssl.asn1:ASN1_OBJECT;
15 
16 public import deimos.openssl.bio;
17 public import deimos.openssl.x509;
18 public import deimos.openssl.conf;
19 
20 
21 extern (C):
22 nothrow:
23 
24 /* Forward reference */
25 
26 /* Useful typedefs */
27 
28 alias X509V3_EXT_NEW = void* function();
29 alias X509V3_EXT_FREE = void function(void*);
30 alias X509V3_EXT_D2I = void* function(void*, const(ubyte*)*, c_long);
31 alias X509V3_EXT_I2D = int function(void*, ubyte**);
32 struct stack_st_CONF_VALUE;
33 alias X509V3_EXT_I2V = stack_st_CONF_VALUE* function(
34     const(v3_ext_method)* method,
35     void* ext,
36     stack_st_CONF_VALUE* extlist);
37 alias X509V3_EXT_V2I = void* function(
38     const(v3_ext_method)* method,
39     v3_ext_ctx* ctx,
40     stack_st_CONF_VALUE* values);
41 alias X509V3_EXT_I2S = char* function(const(v3_ext_method)* method, void* ext);
42 alias X509V3_EXT_S2I = void* function(
43     const(v3_ext_method)* method,
44     v3_ext_ctx* ctx,
45     const(char)* str);
46 alias X509V3_EXT_I2R = int function(
47     const(v3_ext_method)* method,
48     void* ext,
49     BIO* out_,
50     int indent);
51 alias X509V3_EXT_R2I = void* function(
52     const(v3_ext_method)* method,
53     v3_ext_ctx* ctx,
54     const(char)* str);
55 
56 /* V3 extension structure */
57 
58 struct v3_ext_method
59 {
60     int ext_nid;
61     int ext_flags;
62     /* If this is set the following four fields are ignored */
63     ASN1_ITEM_EXP* it;
64     /* Old style ASN1 calls */
65     X509V3_EXT_NEW ext_new;
66     X509V3_EXT_FREE ext_free;
67     X509V3_EXT_D2I d2i;
68     X509V3_EXT_I2D i2d;
69     /* The following pair is used for string extensions */
70     X509V3_EXT_I2S i2s;
71     X509V3_EXT_S2I s2i;
72     /* The following pair is used for multi-valued extensions */
73     X509V3_EXT_I2V i2v;
74     X509V3_EXT_V2I v2i;
75     /* The following are used for raw extensions */
76     X509V3_EXT_I2R i2r;
77     X509V3_EXT_R2I r2i;
78     void* usr_data; /* Any extension specific data */
79 }
80 
81 struct X509V3_CONF_METHOD_st
82 {
83     char* function(void* db, const(char)* section, const(char)* value) get_string;
84     stack_st_CONF_VALUE* function(void* db, const(char)* section) get_section;
85     void function(void* db, char* string) free_string;
86     void function(void* db, stack_st_CONF_VALUE* section) free_section;
87 }
88 
89 alias X509V3_CONF_METHOD = X509V3_CONF_METHOD_st;
90 
91 /* Context specific info */
92 struct v3_ext_ctx
93 {
94     int flags;
95     X509* issuer_cert;
96     X509* subject_cert;
97     X509_REQ* subject_req;
98     X509_CRL* crl;
99     X509V3_CONF_METHOD* db_meth;
100     void* db;
101     /* Maybe more here */
102 }
103 
104 enum CTX_TEST = 0x1;
105 enum X509V3_CTX_REPLACE = 0x2;
106 
107 alias X509V3_EXT_METHOD = v3_ext_method;
108 
109 struct stack_st_X509V3_EXT_METHOD;
110 alias sk_X509V3_EXT_METHOD_compfunc = int function(const(X509V3_EXT_METHOD*)* a, const(X509V3_EXT_METHOD*)* b);
111 alias sk_X509V3_EXT_METHOD_freefunc = void function(X509V3_EXT_METHOD* a);
112 alias sk_X509V3_EXT_METHOD_copyfunc = v3_ext_method* function(const(X509V3_EXT_METHOD)* a);
113 int sk_X509V3_EXT_METHOD_num(const(stack_st_X509V3_EXT_METHOD)* sk);
114 X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_value(const(stack_st_X509V3_EXT_METHOD)* sk, int idx);
115 stack_st_X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_new(sk_X509V3_EXT_METHOD_compfunc compare);
116 stack_st_X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_new_null();
117 void sk_X509V3_EXT_METHOD_free(stack_st_X509V3_EXT_METHOD* sk);
118 void sk_X509V3_EXT_METHOD_zero(stack_st_X509V3_EXT_METHOD* sk);
119 X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_delete(stack_st_X509V3_EXT_METHOD* sk, int i);
120 X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_delete_ptr(stack_st_X509V3_EXT_METHOD* sk, X509V3_EXT_METHOD* ptr);
121 int sk_X509V3_EXT_METHOD_push(stack_st_X509V3_EXT_METHOD* sk, X509V3_EXT_METHOD* ptr);
122 int sk_X509V3_EXT_METHOD_unshift(stack_st_X509V3_EXT_METHOD* sk, X509V3_EXT_METHOD* ptr);
123 X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_pop(stack_st_X509V3_EXT_METHOD* sk);
124 X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_shift(stack_st_X509V3_EXT_METHOD* sk);
125 void sk_X509V3_EXT_METHOD_pop_free(stack_st_X509V3_EXT_METHOD* sk, sk_X509V3_EXT_METHOD_freefunc freefunc);
126 int sk_X509V3_EXT_METHOD_insert(stack_st_X509V3_EXT_METHOD* sk, X509V3_EXT_METHOD* ptr, int idx);
127 X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_set(stack_st_X509V3_EXT_METHOD* sk, int idx, X509V3_EXT_METHOD* ptr);
128 int sk_X509V3_EXT_METHOD_find(stack_st_X509V3_EXT_METHOD* sk, X509V3_EXT_METHOD* ptr);
129 int sk_X509V3_EXT_METHOD_find_ex(stack_st_X509V3_EXT_METHOD* sk, X509V3_EXT_METHOD* ptr);
130 void sk_X509V3_EXT_METHOD_sort(stack_st_X509V3_EXT_METHOD* sk);
131 int sk_X509V3_EXT_METHOD_is_sorted(const(stack_st_X509V3_EXT_METHOD)* sk);
132 stack_st_X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_dup(const(stack_st_X509V3_EXT_METHOD)* sk);
133 stack_st_X509V3_EXT_METHOD* sk_X509V3_EXT_METHOD_deep_copy(const(stack_st_X509V3_EXT_METHOD)* sk, sk_X509V3_EXT_METHOD_copyfunc copyfunc, sk_X509V3_EXT_METHOD_freefunc freefunc);
134 sk_X509V3_EXT_METHOD_compfunc sk_X509V3_EXT_METHOD_set_cmp_func(stack_st_X509V3_EXT_METHOD* sk, sk_X509V3_EXT_METHOD_compfunc compare);
135 
136 /* ext_flags values */
137 enum X509V3_EXT_DYNAMIC = 0x1;
138 enum X509V3_EXT_CTX_DEP = 0x2;
139 enum X509V3_EXT_MULTILINE = 0x4;
140 
141 alias ENUMERATED_NAMES = BIT_STRING_BITNAME_st;
142 
143 struct BASIC_CONSTRAINTS_st
144 {
145     int ca;
146     ASN1_INTEGER* pathlen;
147 }
148 
149 alias BASIC_CONSTRAINTS = BASIC_CONSTRAINTS_st;
150 
151 struct PKEY_USAGE_PERIOD_st
152 {
153     ASN1_GENERALIZEDTIME* notBefore;
154     ASN1_GENERALIZEDTIME* notAfter;
155 }
156 
157 alias PKEY_USAGE_PERIOD = PKEY_USAGE_PERIOD_st;
158 
159 struct otherName_st
160 {
161     ASN1_OBJECT* type_id;
162     ASN1_TYPE* value;
163 }
164 
165 alias OTHERNAME = otherName_st;
166 
167 struct EDIPartyName_st
168 {
169     ASN1_STRING* nameAssigner;
170     ASN1_STRING* partyName;
171 }
172 
173 alias EDIPARTYNAME = EDIPartyName_st;
174 
175 struct GENERAL_NAME_st
176 {
177     int type;
178 
179     /* otherName */
180 
181     /* Old names */
182     /* iPAddress */
183     /* dirn */
184     /* rfc822Name, dNSName,
185      * uniformResourceIdentifier */
186     /* registeredID */
187     /* x400Address */
188     union _Anonymous_0
189     {
190         char* ptr;
191         OTHERNAME* otherName;
192         ASN1_IA5STRING* rfc822Name;
193         ASN1_IA5STRING* dNSName;
194         ASN1_TYPE* x400Address;
195         X509_NAME* directoryName;
196         EDIPARTYNAME* ediPartyName;
197         ASN1_IA5STRING* uniformResourceIdentifier;
198         ASN1_OCTET_STRING* iPAddress;
199         ASN1_OBJECT* registeredID;
200         ASN1_OCTET_STRING* ip;
201         X509_NAME* dirn;
202         ASN1_IA5STRING* ia5;
203         ASN1_OBJECT* rid;
204         ASN1_TYPE* other;
205     }
206 
207     _Anonymous_0 d;
208 }
209 
210 enum GEN_OTHERNAME = 0;
211 enum GEN_EMAIL = 1;
212 enum GEN_DNS = 2;
213 enum GEN_X400 = 3;
214 enum GEN_DIRNAME = 4;
215 enum GEN_EDIPARTY = 5;
216 enum GEN_URI = 6;
217 enum GEN_IPADD = 7;
218 enum GEN_RID = 8;
219 alias GENERAL_NAME = GENERAL_NAME_st;
220 
221 struct ACCESS_DESCRIPTION_st
222 {
223     ASN1_OBJECT* method;
224     GENERAL_NAME* location;
225 }
226 
227 alias ACCESS_DESCRIPTION = ACCESS_DESCRIPTION_st;
228 
229 struct stack_st_ACCESS_DESCRIPTION;
230 alias AUTHORITY_INFO_ACCESS = stack_st_ACCESS_DESCRIPTION;
231 
232 /* If relativename then this contains the full distribution point name */
233 
234 /* All existing reasons */
235 
236 /* Strong extranet structures */
237 
238 /* Proxy certificate structures, see RFC 3820 */
239 
240 /* Values in idp_flags field */
241 /* IDP present */
242 
243 /* IDP values inconsistent */
244 
245 /* onlyuser true */
246 
247 /* onlyCA true */
248 
249 /* onlyattr true */
250 
251 /* indirectCRL true */
252 
253 /* onlysomereasons present */
254 
255 /* X509_PURPOSE stuff */
256 
257 /* Really self issued not necessarily self signed */
258 
259 /* EXFLAG_SET is set to indicate that some values have been precomputed */
260 
261 /* Self signed */
262 
263 /* Default trust ID */
264 
265 /* Flags for X509V3_EXT_print() */
266 
267 /* Return error for unknown extensions */
268 
269 /* Print error for unknown extensions */
270 
271 /* ASN1 parse unknown extensions */
272 
273 /* BIO_dump unknown extensions */
274 
275 /* Flags for X509V3_add1_i2d */
276 
277 struct stack_st_ASN1_OBJECT;
278 alias EXTENDED_KEY_USAGE = stack_st_ASN1_OBJECT;
279 struct stack_st_ASN1_INTEGER;
280 alias TLS_FEATURE = stack_st_ASN1_INTEGER;
281 struct stack_st_GENERAL_NAME;
282 alias sk_GENERAL_NAME_compfunc = int function(const(GENERAL_NAME*)* a, const(GENERAL_NAME*)* b);
283 alias sk_GENERAL_NAME_freefunc = void function(GENERAL_NAME* a);
284 alias sk_GENERAL_NAME_copyfunc = GENERAL_NAME_st* function(const(GENERAL_NAME)* a);
285 int sk_GENERAL_NAME_num(const(stack_st_GENERAL_NAME)* sk);
286 GENERAL_NAME* sk_GENERAL_NAME_value(const(stack_st_GENERAL_NAME)* sk, int idx);
287 stack_st_GENERAL_NAME* sk_GENERAL_NAME_new(sk_GENERAL_NAME_compfunc compare);
288 stack_st_GENERAL_NAME* sk_GENERAL_NAME_new_null();
289 void sk_GENERAL_NAME_free(stack_st_GENERAL_NAME* sk);
290 void sk_GENERAL_NAME_zero(stack_st_GENERAL_NAME* sk);
291 GENERAL_NAME* sk_GENERAL_NAME_delete(stack_st_GENERAL_NAME* sk, int i);
292 GENERAL_NAME* sk_GENERAL_NAME_delete_ptr(stack_st_GENERAL_NAME* sk, GENERAL_NAME* ptr);
293 int sk_GENERAL_NAME_push(stack_st_GENERAL_NAME* sk, GENERAL_NAME* ptr);
294 int sk_GENERAL_NAME_unshift(stack_st_GENERAL_NAME* sk, GENERAL_NAME* ptr);
295 GENERAL_NAME* sk_GENERAL_NAME_pop(stack_st_GENERAL_NAME* sk);
296 GENERAL_NAME* sk_GENERAL_NAME_shift(stack_st_GENERAL_NAME* sk);
297 void sk_GENERAL_NAME_pop_free(stack_st_GENERAL_NAME* sk, sk_GENERAL_NAME_freefunc freefunc);
298 int sk_GENERAL_NAME_insert(stack_st_GENERAL_NAME* sk, GENERAL_NAME* ptr, int idx);
299 GENERAL_NAME* sk_GENERAL_NAME_set(stack_st_GENERAL_NAME* sk, int idx, GENERAL_NAME* ptr);
300 int sk_GENERAL_NAME_find(stack_st_GENERAL_NAME* sk, GENERAL_NAME* ptr);
301 int sk_GENERAL_NAME_find_ex(stack_st_GENERAL_NAME* sk, GENERAL_NAME* ptr);
302 void sk_GENERAL_NAME_sort(stack_st_GENERAL_NAME* sk);
303 int sk_GENERAL_NAME_is_sorted(const(stack_st_GENERAL_NAME)* sk);
304 stack_st_GENERAL_NAME* sk_GENERAL_NAME_dup(const(stack_st_GENERAL_NAME)* sk);
305 stack_st_GENERAL_NAME* sk_GENERAL_NAME_deep_copy(const(stack_st_GENERAL_NAME)* sk, sk_GENERAL_NAME_copyfunc copyfunc, sk_GENERAL_NAME_freefunc freefunc);
306 sk_GENERAL_NAME_compfunc sk_GENERAL_NAME_set_cmp_func(stack_st_GENERAL_NAME* sk, sk_GENERAL_NAME_compfunc compare);
307 alias GENERAL_NAMES = stack_st_GENERAL_NAME;
308 struct stack_st_GENERAL_NAMES;
309 alias sk_GENERAL_NAMES_compfunc = int function(const(GENERAL_NAMES*)* a, const(GENERAL_NAMES*)* b);
310 alias sk_GENERAL_NAMES_freefunc = void function(GENERAL_NAMES* a);
311 alias sk_GENERAL_NAMES_copyfunc = stack_st_GENERAL_NAME* function(const(GENERAL_NAMES)* a);
312 int sk_GENERAL_NAMES_num(const(stack_st_GENERAL_NAMES)* sk);
313 GENERAL_NAMES* sk_GENERAL_NAMES_value(const(stack_st_GENERAL_NAMES)* sk, int idx);
314 stack_st_GENERAL_NAMES* sk_GENERAL_NAMES_new(sk_GENERAL_NAMES_compfunc compare);
315 stack_st_GENERAL_NAMES* sk_GENERAL_NAMES_new_null();
316 void sk_GENERAL_NAMES_free(stack_st_GENERAL_NAMES* sk);
317 void sk_GENERAL_NAMES_zero(stack_st_GENERAL_NAMES* sk);
318 GENERAL_NAMES* sk_GENERAL_NAMES_delete(stack_st_GENERAL_NAMES* sk, int i);
319 GENERAL_NAMES* sk_GENERAL_NAMES_delete_ptr(stack_st_GENERAL_NAMES* sk, GENERAL_NAMES* ptr);
320 int sk_GENERAL_NAMES_push(stack_st_GENERAL_NAMES* sk, GENERAL_NAMES* ptr);
321 int sk_GENERAL_NAMES_unshift(stack_st_GENERAL_NAMES* sk, GENERAL_NAMES* ptr);
322 GENERAL_NAMES* sk_GENERAL_NAMES_pop(stack_st_GENERAL_NAMES* sk);
323 GENERAL_NAMES* sk_GENERAL_NAMES_shift(stack_st_GENERAL_NAMES* sk);
324 void sk_GENERAL_NAMES_pop_free(stack_st_GENERAL_NAMES* sk, sk_GENERAL_NAMES_freefunc freefunc);
325 int sk_GENERAL_NAMES_insert(stack_st_GENERAL_NAMES* sk, GENERAL_NAMES* ptr, int idx);
326 GENERAL_NAMES* sk_GENERAL_NAMES_set(stack_st_GENERAL_NAMES* sk, int idx, GENERAL_NAMES* ptr);
327 int sk_GENERAL_NAMES_find(stack_st_GENERAL_NAMES* sk, GENERAL_NAMES* ptr);
328 int sk_GENERAL_NAMES_find_ex(stack_st_GENERAL_NAMES* sk, GENERAL_NAMES* ptr);
329 void sk_GENERAL_NAMES_sort(stack_st_GENERAL_NAMES* sk);
330 int sk_GENERAL_NAMES_is_sorted(const(stack_st_GENERAL_NAMES)* sk);
331 stack_st_GENERAL_NAMES* sk_GENERAL_NAMES_dup(const(stack_st_GENERAL_NAMES)* sk);
332 stack_st_GENERAL_NAMES* sk_GENERAL_NAMES_deep_copy(const(stack_st_GENERAL_NAMES)* sk, sk_GENERAL_NAMES_copyfunc copyfunc, sk_GENERAL_NAMES_freefunc freefunc);
333 sk_GENERAL_NAMES_compfunc sk_GENERAL_NAMES_set_cmp_func(stack_st_GENERAL_NAMES* sk, sk_GENERAL_NAMES_compfunc compare);
334 alias sk_ACCESS_DESCRIPTION_compfunc = int function(const(ACCESS_DESCRIPTION*)* a, const(ACCESS_DESCRIPTION*)* b);
335 alias sk_ACCESS_DESCRIPTION_freefunc = void function(ACCESS_DESCRIPTION* a);
336 alias sk_ACCESS_DESCRIPTION_copyfunc = ACCESS_DESCRIPTION_st* function(const(ACCESS_DESCRIPTION)* a);
337 int sk_ACCESS_DESCRIPTION_num(const(stack_st_ACCESS_DESCRIPTION)* sk);
338 ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_value(const(stack_st_ACCESS_DESCRIPTION)* sk, int idx);
339 stack_st_ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_new(sk_ACCESS_DESCRIPTION_compfunc compare);
340 stack_st_ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_new_null();
341 void sk_ACCESS_DESCRIPTION_free(stack_st_ACCESS_DESCRIPTION* sk);
342 void sk_ACCESS_DESCRIPTION_zero(stack_st_ACCESS_DESCRIPTION* sk);
343 ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_delete(stack_st_ACCESS_DESCRIPTION* sk, int i);
344 ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_delete_ptr(stack_st_ACCESS_DESCRIPTION* sk, ACCESS_DESCRIPTION* ptr);
345 int sk_ACCESS_DESCRIPTION_push(stack_st_ACCESS_DESCRIPTION* sk, ACCESS_DESCRIPTION* ptr);
346 int sk_ACCESS_DESCRIPTION_unshift(stack_st_ACCESS_DESCRIPTION* sk, ACCESS_DESCRIPTION* ptr);
347 ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_pop(stack_st_ACCESS_DESCRIPTION* sk);
348 ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_shift(stack_st_ACCESS_DESCRIPTION* sk);
349 void sk_ACCESS_DESCRIPTION_pop_free(stack_st_ACCESS_DESCRIPTION* sk, sk_ACCESS_DESCRIPTION_freefunc freefunc);
350 int sk_ACCESS_DESCRIPTION_insert(stack_st_ACCESS_DESCRIPTION* sk, ACCESS_DESCRIPTION* ptr, int idx);
351 ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_set(stack_st_ACCESS_DESCRIPTION* sk, int idx, ACCESS_DESCRIPTION* ptr);
352 int sk_ACCESS_DESCRIPTION_find(stack_st_ACCESS_DESCRIPTION* sk, ACCESS_DESCRIPTION* ptr);
353 int sk_ACCESS_DESCRIPTION_find_ex(stack_st_ACCESS_DESCRIPTION* sk, ACCESS_DESCRIPTION* ptr);
354 void sk_ACCESS_DESCRIPTION_sort(stack_st_ACCESS_DESCRIPTION* sk);
355 int sk_ACCESS_DESCRIPTION_is_sorted(const(stack_st_ACCESS_DESCRIPTION)* sk);
356 stack_st_ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_dup(const(stack_st_ACCESS_DESCRIPTION)* sk);
357 stack_st_ACCESS_DESCRIPTION* sk_ACCESS_DESCRIPTION_deep_copy(const(stack_st_ACCESS_DESCRIPTION)* sk, sk_ACCESS_DESCRIPTION_copyfunc copyfunc, sk_ACCESS_DESCRIPTION_freefunc freefunc);
358 sk_ACCESS_DESCRIPTION_compfunc sk_ACCESS_DESCRIPTION_set_cmp_func(stack_st_ACCESS_DESCRIPTION* sk, sk_ACCESS_DESCRIPTION_compfunc compare);
359 
360 struct DIST_POINT_NAME_st
361 {
362     int type;
363 
364     union _Anonymous_1
365     {
366         GENERAL_NAMES* fullname;
367         stack_st_X509_NAME_ENTRY* relativename;
368     }
369 
370     _Anonymous_1 name;
371     X509_NAME* dpname;
372 }
373 
374 alias DIST_POINT_NAME = DIST_POINT_NAME_st;
375 enum CRLDP_ALL_REASONS = 0x807f;
376 enum CRL_REASON_NONE = -1;
377 enum CRL_REASON_UNSPECIFIED = 0;
378 enum CRL_REASON_KEY_COMPROMISE = 1;
379 enum CRL_REASON_CA_COMPROMISE = 2;
380 enum CRL_REASON_AFFILIATION_CHANGED = 3;
381 enum CRL_REASON_SUPERSEDED = 4;
382 enum CRL_REASON_CESSATION_OF_OPERATION = 5;
383 enum CRL_REASON_CERTIFICATE_HOLD = 6;
384 enum CRL_REASON_REMOVE_FROM_CRL = 8;
385 enum CRL_REASON_PRIVILEGE_WITHDRAWN = 9;
386 enum CRL_REASON_AA_COMPROMISE = 10;
387 
388 struct DIST_POINT_st
389 {
390     DIST_POINT_NAME* distpoint;
391     ASN1_BIT_STRING* reasons;
392     GENERAL_NAMES* CRLissuer;
393     int dp_reasons;
394 }
395 
396 struct stack_st_DIST_POINT;
397 alias CRL_DIST_POINTS = stack_st_DIST_POINT;
398 alias sk_DIST_POINT_compfunc = int function(const(DIST_POINT*)* a, const(DIST_POINT*)* b);
399 alias sk_DIST_POINT_freefunc = void function(DIST_POINT* a);
400 alias sk_DIST_POINT_copyfunc = DIST_POINT_st* function(const(DIST_POINT)* a);
401 int sk_DIST_POINT_num(const(stack_st_DIST_POINT)* sk);
402 DIST_POINT* sk_DIST_POINT_value(const(stack_st_DIST_POINT)* sk, int idx);
403 stack_st_DIST_POINT* sk_DIST_POINT_new(sk_DIST_POINT_compfunc compare);
404 stack_st_DIST_POINT* sk_DIST_POINT_new_null();
405 void sk_DIST_POINT_free(stack_st_DIST_POINT* sk);
406 void sk_DIST_POINT_zero(stack_st_DIST_POINT* sk);
407 DIST_POINT* sk_DIST_POINT_delete(stack_st_DIST_POINT* sk, int i);
408 DIST_POINT* sk_DIST_POINT_delete_ptr(stack_st_DIST_POINT* sk, DIST_POINT* ptr);
409 int sk_DIST_POINT_push(stack_st_DIST_POINT* sk, DIST_POINT* ptr);
410 int sk_DIST_POINT_unshift(stack_st_DIST_POINT* sk, DIST_POINT* ptr);
411 DIST_POINT* sk_DIST_POINT_pop(stack_st_DIST_POINT* sk);
412 DIST_POINT* sk_DIST_POINT_shift(stack_st_DIST_POINT* sk);
413 void sk_DIST_POINT_pop_free(stack_st_DIST_POINT* sk, sk_DIST_POINT_freefunc freefunc);
414 int sk_DIST_POINT_insert(stack_st_DIST_POINT* sk, DIST_POINT* ptr, int idx);
415 DIST_POINT* sk_DIST_POINT_set(stack_st_DIST_POINT* sk, int idx, DIST_POINT* ptr);
416 int sk_DIST_POINT_find(stack_st_DIST_POINT* sk, DIST_POINT* ptr);
417 int sk_DIST_POINT_find_ex(stack_st_DIST_POINT* sk, DIST_POINT* ptr);
418 void sk_DIST_POINT_sort(stack_st_DIST_POINT* sk);
419 int sk_DIST_POINT_is_sorted(const(stack_st_DIST_POINT)* sk);
420 stack_st_DIST_POINT* sk_DIST_POINT_dup(const(stack_st_DIST_POINT)* sk);
421 stack_st_DIST_POINT* sk_DIST_POINT_deep_copy(const(stack_st_DIST_POINT)* sk, sk_DIST_POINT_copyfunc copyfunc, sk_DIST_POINT_freefunc freefunc);
422 sk_DIST_POINT_compfunc sk_DIST_POINT_set_cmp_func(stack_st_DIST_POINT* sk, sk_DIST_POINT_compfunc compare);
423 
424 struct AUTHORITY_KEYID_st
425 {
426     ASN1_OCTET_STRING* keyid;
427     GENERAL_NAMES* issuer;
428     ASN1_INTEGER* serial;
429 }
430 
431 struct SXNET_ID_st
432 {
433     ASN1_INTEGER* zone;
434     ASN1_OCTET_STRING* user;
435 }
436 
437 alias SXNETID = SXNET_ID_st;
438 struct stack_st_SXNETID;
439 alias sk_SXNETID_compfunc = int function(const(SXNETID*)* a, const(SXNETID*)* b);
440 alias sk_SXNETID_freefunc = void function(SXNETID* a);
441 alias sk_SXNETID_copyfunc = SXNET_ID_st* function(const(SXNETID)* a);
442 int sk_SXNETID_num(const(stack_st_SXNETID)* sk);
443 SXNETID* sk_SXNETID_value(const(stack_st_SXNETID)* sk, int idx);
444 stack_st_SXNETID* sk_SXNETID_new(sk_SXNETID_compfunc compare);
445 stack_st_SXNETID* sk_SXNETID_new_null();
446 void sk_SXNETID_free(stack_st_SXNETID* sk);
447 void sk_SXNETID_zero(stack_st_SXNETID* sk);
448 SXNETID* sk_SXNETID_delete(stack_st_SXNETID* sk, int i);
449 SXNETID* sk_SXNETID_delete_ptr(stack_st_SXNETID* sk, SXNETID* ptr);
450 int sk_SXNETID_push(stack_st_SXNETID* sk, SXNETID* ptr);
451 int sk_SXNETID_unshift(stack_st_SXNETID* sk, SXNETID* ptr);
452 SXNETID* sk_SXNETID_pop(stack_st_SXNETID* sk);
453 SXNETID* sk_SXNETID_shift(stack_st_SXNETID* sk);
454 void sk_SXNETID_pop_free(stack_st_SXNETID* sk, sk_SXNETID_freefunc freefunc);
455 int sk_SXNETID_insert(stack_st_SXNETID* sk, SXNETID* ptr, int idx);
456 SXNETID* sk_SXNETID_set(stack_st_SXNETID* sk, int idx, SXNETID* ptr);
457 int sk_SXNETID_find(stack_st_SXNETID* sk, SXNETID* ptr);
458 int sk_SXNETID_find_ex(stack_st_SXNETID* sk, SXNETID* ptr);
459 void sk_SXNETID_sort(stack_st_SXNETID* sk);
460 int sk_SXNETID_is_sorted(const(stack_st_SXNETID)* sk);
461 stack_st_SXNETID* sk_SXNETID_dup(const(stack_st_SXNETID)* sk);
462 stack_st_SXNETID* sk_SXNETID_deep_copy(const(stack_st_SXNETID)* sk, sk_SXNETID_copyfunc copyfunc, sk_SXNETID_freefunc freefunc);
463 sk_SXNETID_compfunc sk_SXNETID_set_cmp_func(stack_st_SXNETID* sk, sk_SXNETID_compfunc compare);
464 
465 struct SXNET_st
466 {
467     ASN1_INTEGER* version_;
468     stack_st_SXNETID* ids;
469 }
470 
471 alias SXNET = SXNET_st;
472 
473 struct NOTICEREF_st
474 {
475     ASN1_STRING* organization;
476     stack_st_ASN1_INTEGER* noticenos;
477 }
478 
479 alias NOTICEREF = NOTICEREF_st;
480 
481 struct USERNOTICE_st
482 {
483     NOTICEREF* noticeref;
484     ASN1_STRING* exptext;
485 }
486 
487 alias USERNOTICE = USERNOTICE_st;
488 
489 struct POLICYQUALINFO_st
490 {
491     ASN1_OBJECT* pqualid;
492 
493     union _Anonymous_2
494     {
495         ASN1_IA5STRING* cpsuri;
496         USERNOTICE* usernotice;
497         ASN1_TYPE* other;
498     }
499 
500     _Anonymous_2 d;
501 }
502 
503 alias POLICYQUALINFO = POLICYQUALINFO_st;
504 struct stack_st_POLICYQUALINFO;
505 alias sk_POLICYQUALINFO_compfunc = int function(const(POLICYQUALINFO*)* a, const(POLICYQUALINFO*)* b);
506 alias sk_POLICYQUALINFO_freefunc = void function(POLICYQUALINFO* a);
507 alias sk_POLICYQUALINFO_copyfunc = POLICYQUALINFO_st* function(const(POLICYQUALINFO)* a);
508 int sk_POLICYQUALINFO_num(const(stack_st_POLICYQUALINFO)* sk);
509 POLICYQUALINFO* sk_POLICYQUALINFO_value(const(stack_st_POLICYQUALINFO)* sk, int idx);
510 stack_st_POLICYQUALINFO* sk_POLICYQUALINFO_new(sk_POLICYQUALINFO_compfunc compare);
511 stack_st_POLICYQUALINFO* sk_POLICYQUALINFO_new_null();
512 void sk_POLICYQUALINFO_free(stack_st_POLICYQUALINFO* sk);
513 void sk_POLICYQUALINFO_zero(stack_st_POLICYQUALINFO* sk);
514 POLICYQUALINFO* sk_POLICYQUALINFO_delete(stack_st_POLICYQUALINFO* sk, int i);
515 POLICYQUALINFO* sk_POLICYQUALINFO_delete_ptr(stack_st_POLICYQUALINFO* sk, POLICYQUALINFO* ptr);
516 int sk_POLICYQUALINFO_push(stack_st_POLICYQUALINFO* sk, POLICYQUALINFO* ptr);
517 int sk_POLICYQUALINFO_unshift(stack_st_POLICYQUALINFO* sk, POLICYQUALINFO* ptr);
518 POLICYQUALINFO* sk_POLICYQUALINFO_pop(stack_st_POLICYQUALINFO* sk);
519 POLICYQUALINFO* sk_POLICYQUALINFO_shift(stack_st_POLICYQUALINFO* sk);
520 void sk_POLICYQUALINFO_pop_free(stack_st_POLICYQUALINFO* sk, sk_POLICYQUALINFO_freefunc freefunc);
521 int sk_POLICYQUALINFO_insert(stack_st_POLICYQUALINFO* sk, POLICYQUALINFO* ptr, int idx);
522 POLICYQUALINFO* sk_POLICYQUALINFO_set(stack_st_POLICYQUALINFO* sk, int idx, POLICYQUALINFO* ptr);
523 int sk_POLICYQUALINFO_find(stack_st_POLICYQUALINFO* sk, POLICYQUALINFO* ptr);
524 int sk_POLICYQUALINFO_find_ex(stack_st_POLICYQUALINFO* sk, POLICYQUALINFO* ptr);
525 void sk_POLICYQUALINFO_sort(stack_st_POLICYQUALINFO* sk);
526 int sk_POLICYQUALINFO_is_sorted(const(stack_st_POLICYQUALINFO)* sk);
527 stack_st_POLICYQUALINFO* sk_POLICYQUALINFO_dup(const(stack_st_POLICYQUALINFO)* sk);
528 stack_st_POLICYQUALINFO* sk_POLICYQUALINFO_deep_copy(const(stack_st_POLICYQUALINFO)* sk, sk_POLICYQUALINFO_copyfunc copyfunc, sk_POLICYQUALINFO_freefunc freefunc);
529 sk_POLICYQUALINFO_compfunc sk_POLICYQUALINFO_set_cmp_func(stack_st_POLICYQUALINFO* sk, sk_POLICYQUALINFO_compfunc compare);
530 
531 struct POLICYINFO_st
532 {
533     ASN1_OBJECT* policyid;
534     stack_st_POLICYQUALINFO* qualifiers;
535 }
536 
537 alias POLICYINFO = POLICYINFO_st;
538 struct stack_st_POLICYINFO;
539 alias CERTIFICATEPOLICIES = stack_st_POLICYINFO;
540 alias sk_POLICYINFO_compfunc = int function(const(POLICYINFO*)* a, const(POLICYINFO*)* b);
541 alias sk_POLICYINFO_freefunc = void function(POLICYINFO* a);
542 alias sk_POLICYINFO_copyfunc = POLICYINFO_st* function(const(POLICYINFO)* a);
543 int sk_POLICYINFO_num(const(stack_st_POLICYINFO)* sk);
544 POLICYINFO* sk_POLICYINFO_value(const(stack_st_POLICYINFO)* sk, int idx);
545 stack_st_POLICYINFO* sk_POLICYINFO_new(sk_POLICYINFO_compfunc compare);
546 stack_st_POLICYINFO* sk_POLICYINFO_new_null();
547 void sk_POLICYINFO_free(stack_st_POLICYINFO* sk);
548 void sk_POLICYINFO_zero(stack_st_POLICYINFO* sk);
549 POLICYINFO* sk_POLICYINFO_delete(stack_st_POLICYINFO* sk, int i);
550 POLICYINFO* sk_POLICYINFO_delete_ptr(stack_st_POLICYINFO* sk, POLICYINFO* ptr);
551 int sk_POLICYINFO_push(stack_st_POLICYINFO* sk, POLICYINFO* ptr);
552 int sk_POLICYINFO_unshift(stack_st_POLICYINFO* sk, POLICYINFO* ptr);
553 POLICYINFO* sk_POLICYINFO_pop(stack_st_POLICYINFO* sk);
554 POLICYINFO* sk_POLICYINFO_shift(stack_st_POLICYINFO* sk);
555 void sk_POLICYINFO_pop_free(stack_st_POLICYINFO* sk, sk_POLICYINFO_freefunc freefunc);
556 int sk_POLICYINFO_insert(stack_st_POLICYINFO* sk, POLICYINFO* ptr, int idx);
557 POLICYINFO* sk_POLICYINFO_set(stack_st_POLICYINFO* sk, int idx, POLICYINFO* ptr);
558 int sk_POLICYINFO_find(stack_st_POLICYINFO* sk, POLICYINFO* ptr);
559 int sk_POLICYINFO_find_ex(stack_st_POLICYINFO* sk, POLICYINFO* ptr);
560 void sk_POLICYINFO_sort(stack_st_POLICYINFO* sk);
561 int sk_POLICYINFO_is_sorted(const(stack_st_POLICYINFO)* sk);
562 stack_st_POLICYINFO* sk_POLICYINFO_dup(const(stack_st_POLICYINFO)* sk);
563 stack_st_POLICYINFO* sk_POLICYINFO_deep_copy(const(stack_st_POLICYINFO)* sk, sk_POLICYINFO_copyfunc copyfunc, sk_POLICYINFO_freefunc freefunc);
564 sk_POLICYINFO_compfunc sk_POLICYINFO_set_cmp_func(stack_st_POLICYINFO* sk, sk_POLICYINFO_compfunc compare);
565 
566 struct POLICY_MAPPING_st
567 {
568     ASN1_OBJECT* issuerDomainPolicy;
569     ASN1_OBJECT* subjectDomainPolicy;
570 }
571 
572 alias POLICY_MAPPING = POLICY_MAPPING_st;
573 struct stack_st_POLICY_MAPPING;
574 alias sk_POLICY_MAPPING_compfunc = int function(const(POLICY_MAPPING*)* a, const(POLICY_MAPPING*)* b);
575 alias sk_POLICY_MAPPING_freefunc = void function(POLICY_MAPPING* a);
576 alias sk_POLICY_MAPPING_copyfunc = POLICY_MAPPING_st* function(const(POLICY_MAPPING)* a);
577 int sk_POLICY_MAPPING_num(const(stack_st_POLICY_MAPPING)* sk);
578 POLICY_MAPPING* sk_POLICY_MAPPING_value(const(stack_st_POLICY_MAPPING)* sk, int idx);
579 stack_st_POLICY_MAPPING* sk_POLICY_MAPPING_new(sk_POLICY_MAPPING_compfunc compare);
580 stack_st_POLICY_MAPPING* sk_POLICY_MAPPING_new_null();
581 void sk_POLICY_MAPPING_free(stack_st_POLICY_MAPPING* sk);
582 void sk_POLICY_MAPPING_zero(stack_st_POLICY_MAPPING* sk);
583 POLICY_MAPPING* sk_POLICY_MAPPING_delete(stack_st_POLICY_MAPPING* sk, int i);
584 POLICY_MAPPING* sk_POLICY_MAPPING_delete_ptr(stack_st_POLICY_MAPPING* sk, POLICY_MAPPING* ptr);
585 int sk_POLICY_MAPPING_push(stack_st_POLICY_MAPPING* sk, POLICY_MAPPING* ptr);
586 int sk_POLICY_MAPPING_unshift(stack_st_POLICY_MAPPING* sk, POLICY_MAPPING* ptr);
587 POLICY_MAPPING* sk_POLICY_MAPPING_pop(stack_st_POLICY_MAPPING* sk);
588 POLICY_MAPPING* sk_POLICY_MAPPING_shift(stack_st_POLICY_MAPPING* sk);
589 void sk_POLICY_MAPPING_pop_free(stack_st_POLICY_MAPPING* sk, sk_POLICY_MAPPING_freefunc freefunc);
590 int sk_POLICY_MAPPING_insert(stack_st_POLICY_MAPPING* sk, POLICY_MAPPING* ptr, int idx);
591 POLICY_MAPPING* sk_POLICY_MAPPING_set(stack_st_POLICY_MAPPING* sk, int idx, POLICY_MAPPING* ptr);
592 int sk_POLICY_MAPPING_find(stack_st_POLICY_MAPPING* sk, POLICY_MAPPING* ptr);
593 int sk_POLICY_MAPPING_find_ex(stack_st_POLICY_MAPPING* sk, POLICY_MAPPING* ptr);
594 void sk_POLICY_MAPPING_sort(stack_st_POLICY_MAPPING* sk);
595 int sk_POLICY_MAPPING_is_sorted(const(stack_st_POLICY_MAPPING)* sk);
596 stack_st_POLICY_MAPPING* sk_POLICY_MAPPING_dup(const(stack_st_POLICY_MAPPING)* sk);
597 stack_st_POLICY_MAPPING* sk_POLICY_MAPPING_deep_copy(const(stack_st_POLICY_MAPPING)* sk, sk_POLICY_MAPPING_copyfunc copyfunc, sk_POLICY_MAPPING_freefunc freefunc);
598 sk_POLICY_MAPPING_compfunc sk_POLICY_MAPPING_set_cmp_func(stack_st_POLICY_MAPPING* sk, sk_POLICY_MAPPING_compfunc compare);
599 alias POLICY_MAPPINGS = stack_st_POLICY_MAPPING;
600 
601 struct GENERAL_SUBTREE_st
602 {
603     GENERAL_NAME* base;
604     ASN1_INTEGER* minimum;
605     ASN1_INTEGER* maximum;
606 }
607 
608 alias GENERAL_SUBTREE = GENERAL_SUBTREE_st;
609 struct stack_st_GENERAL_SUBTREE;
610 alias sk_GENERAL_SUBTREE_compfunc = int function(const(GENERAL_SUBTREE*)* a, const(GENERAL_SUBTREE*)* b);
611 alias sk_GENERAL_SUBTREE_freefunc = void function(GENERAL_SUBTREE* a);
612 alias sk_GENERAL_SUBTREE_copyfunc = GENERAL_SUBTREE_st* function(const(GENERAL_SUBTREE)* a);
613 int sk_GENERAL_SUBTREE_num(const(stack_st_GENERAL_SUBTREE)* sk);
614 GENERAL_SUBTREE* sk_GENERAL_SUBTREE_value(const(stack_st_GENERAL_SUBTREE)* sk, int idx);
615 stack_st_GENERAL_SUBTREE* sk_GENERAL_SUBTREE_new(sk_GENERAL_SUBTREE_compfunc compare);
616 stack_st_GENERAL_SUBTREE* sk_GENERAL_SUBTREE_new_null();
617 void sk_GENERAL_SUBTREE_free(stack_st_GENERAL_SUBTREE* sk);
618 void sk_GENERAL_SUBTREE_zero(stack_st_GENERAL_SUBTREE* sk);
619 GENERAL_SUBTREE* sk_GENERAL_SUBTREE_delete(stack_st_GENERAL_SUBTREE* sk, int i);
620 GENERAL_SUBTREE* sk_GENERAL_SUBTREE_delete_ptr(stack_st_GENERAL_SUBTREE* sk, GENERAL_SUBTREE* ptr);
621 int sk_GENERAL_SUBTREE_push(stack_st_GENERAL_SUBTREE* sk, GENERAL_SUBTREE* ptr);
622 int sk_GENERAL_SUBTREE_unshift(stack_st_GENERAL_SUBTREE* sk, GENERAL_SUBTREE* ptr);
623 GENERAL_SUBTREE* sk_GENERAL_SUBTREE_pop(stack_st_GENERAL_SUBTREE* sk);
624 GENERAL_SUBTREE* sk_GENERAL_SUBTREE_shift(stack_st_GENERAL_SUBTREE* sk);
625 void sk_GENERAL_SUBTREE_pop_free(stack_st_GENERAL_SUBTREE* sk, sk_GENERAL_SUBTREE_freefunc freefunc);
626 int sk_GENERAL_SUBTREE_insert(stack_st_GENERAL_SUBTREE* sk, GENERAL_SUBTREE* ptr, int idx);
627 GENERAL_SUBTREE* sk_GENERAL_SUBTREE_set(stack_st_GENERAL_SUBTREE* sk, int idx, GENERAL_SUBTREE* ptr);
628 int sk_GENERAL_SUBTREE_find(stack_st_GENERAL_SUBTREE* sk, GENERAL_SUBTREE* ptr);
629 int sk_GENERAL_SUBTREE_find_ex(stack_st_GENERAL_SUBTREE* sk, GENERAL_SUBTREE* ptr);
630 void sk_GENERAL_SUBTREE_sort(stack_st_GENERAL_SUBTREE* sk);
631 int sk_GENERAL_SUBTREE_is_sorted(const(stack_st_GENERAL_SUBTREE)* sk);
632 stack_st_GENERAL_SUBTREE* sk_GENERAL_SUBTREE_dup(const(stack_st_GENERAL_SUBTREE)* sk);
633 stack_st_GENERAL_SUBTREE* sk_GENERAL_SUBTREE_deep_copy(const(stack_st_GENERAL_SUBTREE)* sk, sk_GENERAL_SUBTREE_copyfunc copyfunc, sk_GENERAL_SUBTREE_freefunc freefunc);
634 sk_GENERAL_SUBTREE_compfunc sk_GENERAL_SUBTREE_set_cmp_func(stack_st_GENERAL_SUBTREE* sk, sk_GENERAL_SUBTREE_compfunc compare);
635 
636 struct NAME_CONSTRAINTS_st
637 {
638     stack_st_GENERAL_SUBTREE* permittedSubtrees;
639     stack_st_GENERAL_SUBTREE* excludedSubtrees;
640 }
641 
642 struct POLICY_CONSTRAINTS_st
643 {
644     ASN1_INTEGER* requireExplicitPolicy;
645     ASN1_INTEGER* inhibitPolicyMapping;
646 }
647 
648 alias POLICY_CONSTRAINTS = POLICY_CONSTRAINTS_st;
649 
650 struct PROXY_POLICY_st
651 {
652     ASN1_OBJECT* policyLanguage;
653     ASN1_OCTET_STRING* policy;
654 }
655 
656 alias PROXY_POLICY = PROXY_POLICY_st;
657 
658 struct PROXY_CERT_INFO_EXTENSION_st
659 {
660     ASN1_INTEGER* pcPathLengthConstraint;
661     PROXY_POLICY* proxyPolicy;
662 }
663 
664 alias PROXY_CERT_INFO_EXTENSION = PROXY_CERT_INFO_EXTENSION_st;
665 PROXY_POLICY* PROXY_POLICY_new();
666 void PROXY_POLICY_free(PROXY_POLICY* a);
667 PROXY_POLICY* d2i_PROXY_POLICY(PROXY_POLICY** a, const(ubyte*)* in_, c_long len);
668 int i2d_PROXY_POLICY(PROXY_POLICY* a, ubyte** out_);
669 extern __gshared const ASN1_ITEM PROXY_POLICY_it;
670 PROXY_CERT_INFO_EXTENSION* PROXY_CERT_INFO_EXTENSION_new();
671 void PROXY_CERT_INFO_EXTENSION_free(PROXY_CERT_INFO_EXTENSION* a);
672 PROXY_CERT_INFO_EXTENSION* d2i_PROXY_CERT_INFO_EXTENSION(PROXY_CERT_INFO_EXTENSION** a, const(ubyte*)* in_, c_long len);
673 int i2d_PROXY_CERT_INFO_EXTENSION(PROXY_CERT_INFO_EXTENSION* a, ubyte** out_);
674 extern __gshared const ASN1_ITEM PROXY_CERT_INFO_EXTENSION_it;
675 
676 struct ISSUING_DIST_POINT_st
677 {
678     DIST_POINT_NAME* distpoint;
679     int onlyuser;
680     int onlyCA;
681     ASN1_BIT_STRING* onlysomereasons;
682     int indirectCRL;
683     int onlyattr;
684 }
685 
686 enum IDP_PRESENT = 0x1;
687 enum IDP_INVALID = 0x2;
688 enum IDP_ONLYUSER = 0x4;
689 enum IDP_ONLYCA = 0x8;
690 enum IDP_ONLYATTR = 0x10;
691 enum IDP_INDIRECT = 0x20;
692 enum IDP_REASONS = 0x40;
693 
694 extern (D) auto X509V3_set_ctx_test(T)(auto ref T ctx)
695 {
696     return X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST);
697 }
698 
699 enum EXFLAG_BCONS = 0x1;
700 enum EXFLAG_KUSAGE = 0x2;
701 enum EXFLAG_XKUSAGE = 0x4;
702 enum EXFLAG_NSCERT = 0x8;
703 enum EXFLAG_CA = 0x10;
704 enum EXFLAG_SI = 0x20;
705 enum EXFLAG_V1 = 0x40;
706 enum EXFLAG_INVALID = 0x80;
707 enum EXFLAG_SET = 0x100;
708 enum EXFLAG_CRITICAL = 0x200;
709 enum EXFLAG_PROXY = 0x400;
710 enum EXFLAG_INVALID_POLICY = 0x800;
711 enum EXFLAG_FRESHEST = 0x1000;
712 enum EXFLAG_SS = 0x2000;
713 enum KU_DIGITAL_SIGNATURE = 0x0080;
714 enum KU_NON_REPUDIATION = 0x0040;
715 enum KU_KEY_ENCIPHERMENT = 0x0020;
716 enum KU_DATA_ENCIPHERMENT = 0x0010;
717 enum KU_KEY_AGREEMENT = 0x0008;
718 enum KU_KEY_CERT_SIGN = 0x0004;
719 enum KU_CRL_SIGN = 0x0002;
720 enum KU_ENCIPHER_ONLY = 0x0001;
721 enum KU_DECIPHER_ONLY = 0x8000;
722 enum NS_SSL_CLIENT = 0x80;
723 enum NS_SSL_SERVER = 0x40;
724 enum NS_SMIME = 0x20;
725 enum NS_OBJSIGN = 0x10;
726 enum NS_SSL_CA = 0x04;
727 enum NS_SMIME_CA = 0x02;
728 enum NS_OBJSIGN_CA = 0x01;
729 enum NS_ANY_CA = NS_SSL_CA | NS_SMIME_CA | NS_OBJSIGN_CA;
730 enum XKU_SSL_SERVER = 0x1;
731 enum XKU_SSL_CLIENT = 0x2;
732 enum XKU_SMIME = 0x4;
733 enum XKU_CODE_SIGN = 0x8;
734 enum XKU_SGC = 0x10;
735 enum XKU_OCSP_SIGN = 0x20;
736 enum XKU_TIMESTAMP = 0x40;
737 enum XKU_DVCS = 0x80;
738 enum XKU_ANYEKU = 0x100;
739 enum X509_PURPOSE_DYNAMIC = 0x1;
740 enum X509_PURPOSE_DYNAMIC_NAME = 0x2;
741 
742 struct x509_purpose_st
743 {
744     int purpose;
745     int trust;
746     int flags;
747     int function(const(x509_purpose_st)*, const(X509)*, int) check_purpose;
748     char* name;
749     char* sname;
750     void* usr_data;
751 }
752 
753 alias X509_PURPOSE = x509_purpose_st;
754 enum X509_PURPOSE_SSL_CLIENT = 1;
755 enum X509_PURPOSE_SSL_SERVER = 2;
756 enum X509_PURPOSE_NS_SSL_SERVER = 3;
757 enum X509_PURPOSE_SMIME_SIGN = 4;
758 enum X509_PURPOSE_SMIME_ENCRYPT = 5;
759 enum X509_PURPOSE_CRL_SIGN = 6;
760 enum X509_PURPOSE_ANY = 7;
761 enum X509_PURPOSE_OCSP_HELPER = 8;
762 enum X509_PURPOSE_TIMESTAMP_SIGN = 9;
763 enum X509_PURPOSE_MIN = 1;
764 enum X509_PURPOSE_MAX = 9;
765 enum X509V3_EXT_UNKNOWN_MASK = 0xfL << 16;
766 enum X509V3_EXT_DEFAULT = 0;
767 enum X509V3_EXT_ERROR_UNKNOWN = 1L << 16;
768 enum X509V3_EXT_PARSE_UNKNOWN = 2L << 16;
769 enum X509V3_EXT_DUMP_UNKNOWN = 3L << 16;
770 enum X509V3_ADD_OP_MASK = 0xfL;
771 enum X509V3_ADD_DEFAULT = 0L;
772 enum X509V3_ADD_APPEND = 1L;
773 enum X509V3_ADD_REPLACE = 2L;
774 enum X509V3_ADD_REPLACE_EXISTING = 3L;
775 enum X509V3_ADD_KEEP_EXISTING = 4L;
776 enum X509V3_ADD_DELETE = 5L;
777 enum X509V3_ADD_SILENT = 0x10;
778 struct stack_st_X509_PURPOSE;
779 alias sk_X509_PURPOSE_compfunc = int function(const(X509_PURPOSE*)* a, const(X509_PURPOSE*)* b);
780 alias sk_X509_PURPOSE_freefunc = void function(X509_PURPOSE* a);
781 alias sk_X509_PURPOSE_copyfunc = x509_purpose_st* function(const(X509_PURPOSE)* a);
782 int sk_X509_PURPOSE_num(const(stack_st_X509_PURPOSE)* sk);
783 X509_PURPOSE* sk_X509_PURPOSE_value(const(stack_st_X509_PURPOSE)* sk, int idx);
784 stack_st_X509_PURPOSE* sk_X509_PURPOSE_new(sk_X509_PURPOSE_compfunc compare);
785 stack_st_X509_PURPOSE* sk_X509_PURPOSE_new_null();
786 void sk_X509_PURPOSE_free(stack_st_X509_PURPOSE* sk);
787 void sk_X509_PURPOSE_zero(stack_st_X509_PURPOSE* sk);
788 X509_PURPOSE* sk_X509_PURPOSE_delete(stack_st_X509_PURPOSE* sk, int i);
789 X509_PURPOSE* sk_X509_PURPOSE_delete_ptr(stack_st_X509_PURPOSE* sk, X509_PURPOSE* ptr);
790 int sk_X509_PURPOSE_push(stack_st_X509_PURPOSE* sk, X509_PURPOSE* ptr);
791 int sk_X509_PURPOSE_unshift(stack_st_X509_PURPOSE* sk, X509_PURPOSE* ptr);
792 X509_PURPOSE* sk_X509_PURPOSE_pop(stack_st_X509_PURPOSE* sk);
793 X509_PURPOSE* sk_X509_PURPOSE_shift(stack_st_X509_PURPOSE* sk);
794 void sk_X509_PURPOSE_pop_free(stack_st_X509_PURPOSE* sk, sk_X509_PURPOSE_freefunc freefunc);
795 int sk_X509_PURPOSE_insert(stack_st_X509_PURPOSE* sk, X509_PURPOSE* ptr, int idx);
796 X509_PURPOSE* sk_X509_PURPOSE_set(stack_st_X509_PURPOSE* sk, int idx, X509_PURPOSE* ptr);
797 int sk_X509_PURPOSE_find(stack_st_X509_PURPOSE* sk, X509_PURPOSE* ptr);
798 int sk_X509_PURPOSE_find_ex(stack_st_X509_PURPOSE* sk, X509_PURPOSE* ptr);
799 void sk_X509_PURPOSE_sort(stack_st_X509_PURPOSE* sk);
800 int sk_X509_PURPOSE_is_sorted(const(stack_st_X509_PURPOSE)* sk);
801 stack_st_X509_PURPOSE* sk_X509_PURPOSE_dup(const(stack_st_X509_PURPOSE)* sk);
802 stack_st_X509_PURPOSE* sk_X509_PURPOSE_deep_copy(const(stack_st_X509_PURPOSE)* sk, sk_X509_PURPOSE_copyfunc copyfunc, sk_X509_PURPOSE_freefunc freefunc);
803 sk_X509_PURPOSE_compfunc sk_X509_PURPOSE_set_cmp_func(stack_st_X509_PURPOSE* sk, sk_X509_PURPOSE_compfunc compare);
804 BASIC_CONSTRAINTS* BASIC_CONSTRAINTS_new();
805 void BASIC_CONSTRAINTS_free(BASIC_CONSTRAINTS* a);
806 BASIC_CONSTRAINTS* d2i_BASIC_CONSTRAINTS(BASIC_CONSTRAINTS** a, const(ubyte*)* in_, c_long len);
807 int i2d_BASIC_CONSTRAINTS(BASIC_CONSTRAINTS* a, ubyte** out_);
808 extern __gshared const ASN1_ITEM BASIC_CONSTRAINTS_it;
809 SXNET* SXNET_new();
810 void SXNET_free(SXNET* a);
811 SXNET* d2i_SXNET(SXNET** a, const(ubyte*)* in_, c_long len);
812 int i2d_SXNET(SXNET* a, ubyte** out_);
813 extern __gshared const ASN1_ITEM SXNET_it;
814 SXNETID* SXNETID_new();
815 void SXNETID_free(SXNETID* a);
816 SXNETID* d2i_SXNETID(SXNETID** a, const(ubyte*)* in_, c_long len);
817 int i2d_SXNETID(SXNETID* a, ubyte** out_);
818 extern __gshared const ASN1_ITEM SXNETID_it;
819 int SXNET_add_id_asc(SXNET** psx, const(char)* zone, const(char)* user, int userlen);
820 int SXNET_add_id_ulong(
821     SXNET** psx,
822     c_ulong lzone,
823     const(char)* user,
824     int userlen);
825 int SXNET_add_id_INTEGER(
826     SXNET** psx,
827     ASN1_INTEGER* izone,
828     const(char)* user,
829     int userlen);
830 ASN1_OCTET_STRING* SXNET_get_id_asc(SXNET* sx, const(char)* zone);
831 ASN1_OCTET_STRING* SXNET_get_id_ulong(SXNET* sx, c_ulong lzone);
832 ASN1_OCTET_STRING* SXNET_get_id_INTEGER(SXNET* sx, ASN1_INTEGER* zone);
833 AUTHORITY_KEYID* AUTHORITY_KEYID_new();
834 void AUTHORITY_KEYID_free(AUTHORITY_KEYID* a);
835 AUTHORITY_KEYID* d2i_AUTHORITY_KEYID(AUTHORITY_KEYID** a, const(ubyte*)* in_, c_long len);
836 int i2d_AUTHORITY_KEYID(AUTHORITY_KEYID* a, ubyte** out_);
837 extern __gshared const ASN1_ITEM AUTHORITY_KEYID_it;
838 PKEY_USAGE_PERIOD* PKEY_USAGE_PERIOD_new();
839 void PKEY_USAGE_PERIOD_free(PKEY_USAGE_PERIOD* a);
840 PKEY_USAGE_PERIOD* d2i_PKEY_USAGE_PERIOD(PKEY_USAGE_PERIOD** a, const(ubyte*)* in_, c_long len);
841 int i2d_PKEY_USAGE_PERIOD(PKEY_USAGE_PERIOD* a, ubyte** out_);
842 extern __gshared const ASN1_ITEM PKEY_USAGE_PERIOD_it;
843 GENERAL_NAME* GENERAL_NAME_new();
844 void GENERAL_NAME_free(GENERAL_NAME* a);
845 GENERAL_NAME* d2i_GENERAL_NAME(GENERAL_NAME** a, const(ubyte*)* in_, c_long len);
846 int i2d_GENERAL_NAME(GENERAL_NAME* a, ubyte** out_);
847 extern __gshared const ASN1_ITEM GENERAL_NAME_it;
848 GENERAL_NAME* GENERAL_NAME_dup(GENERAL_NAME* a);
849 int GENERAL_NAME_cmp(GENERAL_NAME* a, GENERAL_NAME* b);
850 ASN1_BIT_STRING* v2i_ASN1_BIT_STRING(
851     X509V3_EXT_METHOD* method,
852     X509V3_CTX* ctx,
853     stack_st_CONF_VALUE* nval);
854 stack_st_CONF_VALUE* i2v_ASN1_BIT_STRING(
855     X509V3_EXT_METHOD* method,
856     ASN1_BIT_STRING* bits,
857     stack_st_CONF_VALUE* extlist);
858 char* i2s_ASN1_IA5STRING(X509V3_EXT_METHOD* method, ASN1_IA5STRING* ia5);
859 ASN1_IA5STRING* s2i_ASN1_IA5STRING(
860     X509V3_EXT_METHOD* method,
861     X509V3_CTX* ctx,
862     const(char)* str);
863 stack_st_CONF_VALUE* i2v_GENERAL_NAME(
864     X509V3_EXT_METHOD* method,
865     GENERAL_NAME* gen,
866     stack_st_CONF_VALUE* ret);
867 int GENERAL_NAME_print(BIO* out_, GENERAL_NAME* gen);
868 GENERAL_NAMES* GENERAL_NAMES_new();
869 void GENERAL_NAMES_free(GENERAL_NAMES* a);
870 GENERAL_NAMES* d2i_GENERAL_NAMES(GENERAL_NAMES** a, const(ubyte*)* in_, c_long len);
871 int i2d_GENERAL_NAMES(GENERAL_NAMES* a, ubyte** out_);
872 extern __gshared const ASN1_ITEM GENERAL_NAMES_it;
873 stack_st_CONF_VALUE* i2v_GENERAL_NAMES(
874     X509V3_EXT_METHOD* method,
875     GENERAL_NAMES* gen,
876     stack_st_CONF_VALUE* extlist);
877 GENERAL_NAMES* v2i_GENERAL_NAMES(
878     const(X509V3_EXT_METHOD)* method,
879     X509V3_CTX* ctx,
880     stack_st_CONF_VALUE* nval);
881 OTHERNAME* OTHERNAME_new();
882 void OTHERNAME_free(OTHERNAME* a);
883 OTHERNAME* d2i_OTHERNAME(OTHERNAME** a, const(ubyte*)* in_, c_long len);
884 int i2d_OTHERNAME(OTHERNAME* a, ubyte** out_);
885 extern __gshared const ASN1_ITEM OTHERNAME_it;
886 EDIPARTYNAME* EDIPARTYNAME_new();
887 void EDIPARTYNAME_free(EDIPARTYNAME* a);
888 EDIPARTYNAME* d2i_EDIPARTYNAME(EDIPARTYNAME** a, const(ubyte*)* in_, c_long len);
889 int i2d_EDIPARTYNAME(EDIPARTYNAME* a, ubyte** out_);
890 extern __gshared const ASN1_ITEM EDIPARTYNAME_it;
891 int OTHERNAME_cmp(OTHERNAME* a, OTHERNAME* b);
892 void GENERAL_NAME_set0_value(GENERAL_NAME* a, int type, void* value);
893 void* GENERAL_NAME_get0_value(GENERAL_NAME* a, int* ptype);
894 int GENERAL_NAME_set0_othername(
895     GENERAL_NAME* gen,
896     ASN1_OBJECT* oid,
897     ASN1_TYPE* value);
898 int GENERAL_NAME_get0_otherName(
899     GENERAL_NAME* gen,
900     ASN1_OBJECT** poid,
901     ASN1_TYPE** pvalue);
902 char* i2s_ASN1_OCTET_STRING(
903     X509V3_EXT_METHOD* method,
904     const(ASN1_OCTET_STRING)* ia5);
905 ASN1_OCTET_STRING* s2i_ASN1_OCTET_STRING(
906     X509V3_EXT_METHOD* method,
907     X509V3_CTX* ctx,
908     const(char)* str);
909 EXTENDED_KEY_USAGE* EXTENDED_KEY_USAGE_new();
910 void EXTENDED_KEY_USAGE_free(EXTENDED_KEY_USAGE* a);
911 EXTENDED_KEY_USAGE* d2i_EXTENDED_KEY_USAGE(EXTENDED_KEY_USAGE** a, const(ubyte*)* in_, c_long len);
912 int i2d_EXTENDED_KEY_USAGE(EXTENDED_KEY_USAGE* a, ubyte** out_);
913 extern __gshared const ASN1_ITEM EXTENDED_KEY_USAGE_it;
914 int i2a_ACCESS_DESCRIPTION(BIO* bp, const(ACCESS_DESCRIPTION)* a);
915 TLS_FEATURE* TLS_FEATURE_new();
916 void TLS_FEATURE_free(TLS_FEATURE* a);
917 CERTIFICATEPOLICIES* CERTIFICATEPOLICIES_new();
918 void CERTIFICATEPOLICIES_free(CERTIFICATEPOLICIES* a);
919 CERTIFICATEPOLICIES* d2i_CERTIFICATEPOLICIES(CERTIFICATEPOLICIES** a, const(ubyte*)* in_, c_long len);
920 int i2d_CERTIFICATEPOLICIES(CERTIFICATEPOLICIES* a, ubyte** out_);
921 extern __gshared const ASN1_ITEM CERTIFICATEPOLICIES_it;
922 POLICYINFO* POLICYINFO_new();
923 void POLICYINFO_free(POLICYINFO* a);
924 POLICYINFO* d2i_POLICYINFO(POLICYINFO** a, const(ubyte*)* in_, c_long len);
925 int i2d_POLICYINFO(POLICYINFO* a, ubyte** out_);
926 extern __gshared const ASN1_ITEM POLICYINFO_it;
927 POLICYQUALINFO* POLICYQUALINFO_new();
928 void POLICYQUALINFO_free(POLICYQUALINFO* a);
929 POLICYQUALINFO* d2i_POLICYQUALINFO(POLICYQUALINFO** a, const(ubyte*)* in_, c_long len);
930 int i2d_POLICYQUALINFO(POLICYQUALINFO* a, ubyte** out_);
931 extern __gshared const ASN1_ITEM POLICYQUALINFO_it;
932 USERNOTICE* USERNOTICE_new();
933 void USERNOTICE_free(USERNOTICE* a);
934 USERNOTICE* d2i_USERNOTICE(USERNOTICE** a, const(ubyte*)* in_, c_long len);
935 int i2d_USERNOTICE(USERNOTICE* a, ubyte** out_);
936 extern __gshared const ASN1_ITEM USERNOTICE_it;
937 NOTICEREF* NOTICEREF_new();
938 void NOTICEREF_free(NOTICEREF* a);
939 NOTICEREF* d2i_NOTICEREF(NOTICEREF** a, const(ubyte*)* in_, c_long len);
940 int i2d_NOTICEREF(NOTICEREF* a, ubyte** out_);
941 extern __gshared const ASN1_ITEM NOTICEREF_it;
942 CRL_DIST_POINTS* CRL_DIST_POINTS_new();
943 void CRL_DIST_POINTS_free(CRL_DIST_POINTS* a);
944 CRL_DIST_POINTS* d2i_CRL_DIST_POINTS(CRL_DIST_POINTS** a, const(ubyte*)* in_, c_long len);
945 int i2d_CRL_DIST_POINTS(CRL_DIST_POINTS* a, ubyte** out_);
946 extern __gshared const ASN1_ITEM CRL_DIST_POINTS_it;
947 DIST_POINT* DIST_POINT_new();
948 void DIST_POINT_free(DIST_POINT* a);
949 DIST_POINT* d2i_DIST_POINT(DIST_POINT** a, const(ubyte*)* in_, c_long len);
950 int i2d_DIST_POINT(DIST_POINT* a, ubyte** out_);
951 extern __gshared const ASN1_ITEM DIST_POINT_it;
952 DIST_POINT_NAME* DIST_POINT_NAME_new();
953 void DIST_POINT_NAME_free(DIST_POINT_NAME* a);
954 DIST_POINT_NAME* d2i_DIST_POINT_NAME(DIST_POINT_NAME** a, const(ubyte*)* in_, c_long len);
955 int i2d_DIST_POINT_NAME(DIST_POINT_NAME* a, ubyte** out_);
956 extern __gshared const ASN1_ITEM DIST_POINT_NAME_it;
957 ISSUING_DIST_POINT* ISSUING_DIST_POINT_new();
958 void ISSUING_DIST_POINT_free(ISSUING_DIST_POINT* a);
959 ISSUING_DIST_POINT* d2i_ISSUING_DIST_POINT(ISSUING_DIST_POINT** a, const(ubyte*)* in_, c_long len);
960 int i2d_ISSUING_DIST_POINT(ISSUING_DIST_POINT* a, ubyte** out_);
961 extern __gshared const ASN1_ITEM ISSUING_DIST_POINT_it;
962 int DIST_POINT_set_dpname(DIST_POINT_NAME* dpn, X509_NAME* iname);
963 int NAME_CONSTRAINTS_check(X509* x, NAME_CONSTRAINTS* nc);
964 int NAME_CONSTRAINTS_check_CN(X509* x, NAME_CONSTRAINTS* nc);
965 ACCESS_DESCRIPTION* ACCESS_DESCRIPTION_new();
966 void ACCESS_DESCRIPTION_free(ACCESS_DESCRIPTION* a);
967 ACCESS_DESCRIPTION* d2i_ACCESS_DESCRIPTION(ACCESS_DESCRIPTION** a, const(ubyte*)* in_, c_long len);
968 int i2d_ACCESS_DESCRIPTION(ACCESS_DESCRIPTION* a, ubyte** out_);
969 extern __gshared const ASN1_ITEM ACCESS_DESCRIPTION_it;
970 AUTHORITY_INFO_ACCESS* AUTHORITY_INFO_ACCESS_new();
971 void AUTHORITY_INFO_ACCESS_free(AUTHORITY_INFO_ACCESS* a);
972 AUTHORITY_INFO_ACCESS* d2i_AUTHORITY_INFO_ACCESS(AUTHORITY_INFO_ACCESS** a, const(ubyte*)* in_, c_long len);
973 int i2d_AUTHORITY_INFO_ACCESS(AUTHORITY_INFO_ACCESS* a, ubyte** out_);
974 extern __gshared const ASN1_ITEM AUTHORITY_INFO_ACCESS_it;
975 extern __gshared const ASN1_ITEM POLICY_MAPPING_it;
976 POLICY_MAPPING* POLICY_MAPPING_new();
977 void POLICY_MAPPING_free(POLICY_MAPPING* a);
978 extern __gshared const ASN1_ITEM POLICY_MAPPINGS_it;
979 
980 extern __gshared const ASN1_ITEM GENERAL_SUBTREE_it;
981 GENERAL_SUBTREE* GENERAL_SUBTREE_new();
982 void GENERAL_SUBTREE_free(GENERAL_SUBTREE* a);
983 
984 extern __gshared const ASN1_ITEM NAME_CONSTRAINTS_it;
985 NAME_CONSTRAINTS* NAME_CONSTRAINTS_new();
986 void NAME_CONSTRAINTS_free(NAME_CONSTRAINTS* a);
987 
988 POLICY_CONSTRAINTS* POLICY_CONSTRAINTS_new();
989 void POLICY_CONSTRAINTS_free(POLICY_CONSTRAINTS* a);
990 extern __gshared const ASN1_ITEM POLICY_CONSTRAINTS_it;
991 
992 GENERAL_NAME* a2i_GENERAL_NAME(
993     GENERAL_NAME* out_,
994     const(X509V3_EXT_METHOD)* method,
995     X509V3_CTX* ctx,
996     int gen_type,
997     const(char)* value,
998     int is_nc);
999 
1000 GENERAL_NAME* v2i_GENERAL_NAME(
1001     const(X509V3_EXT_METHOD)* method,
1002     X509V3_CTX* ctx,
1003     CONF_VALUE* cnf);
1004 GENERAL_NAME* v2i_GENERAL_NAME_ex(
1005     GENERAL_NAME* out_,
1006     const(X509V3_EXT_METHOD)* method,
1007     X509V3_CTX* ctx,
1008     CONF_VALUE* cnf,
1009     int is_nc);
1010 void X509V3_conf_free(CONF_VALUE* val);
1011 
1012 X509_EXTENSION* X509V3_EXT_nconf_nid(
1013     CONF* conf,
1014     X509V3_CTX* ctx,
1015     int ext_nid,
1016     const(char)* value);
1017 X509_EXTENSION* X509V3_EXT_nconf(
1018     CONF* conf,
1019     X509V3_CTX* ctx,
1020     const(char)* name,
1021     const(char)* value);
1022 int X509V3_EXT_add_nconf_sk(
1023     CONF* conf,
1024     X509V3_CTX* ctx,
1025     const(char)* section,
1026     stack_st_X509_EXTENSION** sk);
1027 int X509V3_EXT_add_nconf(
1028     CONF* conf,
1029     X509V3_CTX* ctx,
1030     const(char)* section,
1031     X509* cert);
1032 int X509V3_EXT_REQ_add_nconf(
1033     CONF* conf,
1034     X509V3_CTX* ctx,
1035     const(char)* section,
1036     X509_REQ* req);
1037 int X509V3_EXT_CRL_add_nconf(
1038     CONF* conf,
1039     X509V3_CTX* ctx,
1040     const(char)* section,
1041     X509_CRL* crl);
1042 
1043 X509_EXTENSION* X509V3_EXT_conf_nid(
1044     lhash_st_CONF_VALUE* conf,
1045     X509V3_CTX* ctx,
1046     int ext_nid,
1047     const(char)* value);
1048 X509_EXTENSION* X509V3_EXT_conf(
1049     lhash_st_CONF_VALUE* conf,
1050     X509V3_CTX* ctx,
1051     const(char)* name,
1052     const(char)* value);
1053 int X509V3_EXT_add_conf(
1054     lhash_st_CONF_VALUE* conf,
1055     X509V3_CTX* ctx,
1056     const(char)* section,
1057     X509* cert);
1058 int X509V3_EXT_REQ_add_conf(
1059     lhash_st_CONF_VALUE* conf,
1060     X509V3_CTX* ctx,
1061     const(char)* section,
1062     X509_REQ* req);
1063 int X509V3_EXT_CRL_add_conf(
1064     lhash_st_CONF_VALUE* conf,
1065     X509V3_CTX* ctx,
1066     const(char)* section,
1067     X509_CRL* crl);
1068 
1069 int X509V3_add_value_bool_nf(
1070     const(char)* name,
1071     int asn1_bool,
1072     stack_st_CONF_VALUE** extlist);
1073 int X509V3_get_value_bool(const(CONF_VALUE)* value, int* asn1_bool);
1074 int X509V3_get_value_int(const(CONF_VALUE)* value, ASN1_INTEGER** aint);
1075 void X509V3_set_nconf(X509V3_CTX* ctx, CONF* conf);
1076 void X509V3_set_conf_lhash(X509V3_CTX* ctx, lhash_st_CONF_VALUE* lhash);
1077 
1078 char* X509V3_get_string(X509V3_CTX* ctx, const(char)* name, const(char)* section);
1079 stack_st_CONF_VALUE* X509V3_get_section(X509V3_CTX* ctx, const(char)* section);
1080 void X509V3_string_free(X509V3_CTX* ctx, char* str);
1081 void X509V3_section_free(X509V3_CTX* ctx, stack_st_CONF_VALUE* section);
1082 void X509V3_set_ctx(
1083     X509V3_CTX* ctx,
1084     X509* issuer,
1085     X509* subject,
1086     X509_REQ* req,
1087     X509_CRL* crl,
1088     int flags);
1089 
1090 int X509V3_add_value(
1091     const(char)* name,
1092     const(char)* value,
1093     stack_st_CONF_VALUE** extlist);
1094 int X509V3_add_value_uchar(
1095     const(char)* name,
1096     const(ubyte)* value,
1097     stack_st_CONF_VALUE** extlist);
1098 int X509V3_add_value_bool(
1099     const(char)* name,
1100     int asn1_bool,
1101     stack_st_CONF_VALUE** extlist);
1102 int X509V3_add_value_int(
1103     const(char)* name,
1104     const(ASN1_INTEGER)* aint,
1105     stack_st_CONF_VALUE** extlist);
1106 char* i2s_ASN1_INTEGER(X509V3_EXT_METHOD* meth, const(ASN1_INTEGER)* aint);
1107 ASN1_INTEGER* s2i_ASN1_INTEGER(X509V3_EXT_METHOD* meth, const(char)* value);
1108 char* i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD* meth, const(ASN1_ENUMERATED)* aint);
1109 char* i2s_ASN1_ENUMERATED_TABLE(
1110     X509V3_EXT_METHOD* meth,
1111     const(ASN1_ENUMERATED)* aint);
1112 int X509V3_EXT_add(X509V3_EXT_METHOD* ext);
1113 int X509V3_EXT_add_list(X509V3_EXT_METHOD* extlist);
1114 int X509V3_EXT_add_alias(int nid_to, int nid_from);
1115 void X509V3_EXT_cleanup();
1116 
1117 const(X509V3_EXT_METHOD)* X509V3_EXT_get(X509_EXTENSION* ext);
1118 const(X509V3_EXT_METHOD)* X509V3_EXT_get_nid(int nid);
1119 int X509V3_add_standard_extensions();
1120 stack_st_CONF_VALUE* X509V3_parse_list(const(char)* line);
1121 void* X509V3_EXT_d2i(X509_EXTENSION* ext);
1122 void* X509V3_get_d2i(
1123     const(stack_st_X509_EXTENSION)* x,
1124     int nid,
1125     int* crit,
1126     int* idx);
1127 
1128 X509_EXTENSION* X509V3_EXT_i2d(int ext_nid, int crit, void* ext_struc);
1129 int X509V3_add1_i2d(
1130     stack_st_X509_EXTENSION** x,
1131     int nid,
1132     void* value,
1133     int crit,
1134     c_ulong flags);
1135 
1136 /* The new declarations are in crypto.h, but the old ones were here. */
1137 alias hex_to_string = OPENSSL_buf2hexstr;
1138 alias string_to_hex = OPENSSL_hexstr2buf;
1139 
1140 void X509V3_EXT_val_prn(
1141     BIO* out_,
1142     stack_st_CONF_VALUE* val,
1143     int indent,
1144     int ml);
1145 int X509V3_EXT_print(BIO* out_, X509_EXTENSION* ext, c_ulong flag, int indent);
1146 
1147 version(OPENSSL_NO_STDIO) {} else {
1148 int X509V3_EXT_print_fp(FILE* out_, X509_EXTENSION* ext, int flag, int indent);
1149 }
1150 
1151 int X509V3_extensions_print(
1152     BIO* out_,
1153     const(char)* title,
1154     const(stack_st_X509_EXTENSION)* exts,
1155     c_ulong flag,
1156     int indent);
1157 
1158 int X509_check_ca(X509* x);
1159 int X509_check_purpose(X509* x, int id, int ca);
1160 int X509_supported_extension(X509_EXTENSION* ex);
1161 int X509_PURPOSE_set(int* p, int purpose);
1162 int X509_check_issued(X509* issuer, X509* subject);
1163 int X509_check_akid(X509* issuer, AUTHORITY_KEYID* akid);
1164 void X509_set_proxy_flag(X509* x);
1165 void X509_set_proxy_pathlen(X509* x, c_long l);
1166 c_long X509_get_proxy_pathlen(X509* x);
1167 
1168 uint X509_get_extension_flags(X509* x);
1169 uint X509_get_key_usage(X509* x);
1170 uint X509_get_extended_key_usage(X509* x);
1171 const(ASN1_OCTET_STRING)* X509_get0_subject_key_id(X509* x);
1172 const(ASN1_OCTET_STRING)* X509_get0_authority_key_id(X509* x);
1173 
1174 int X509_PURPOSE_get_count();
1175 X509_PURPOSE* X509_PURPOSE_get0(int idx);
1176 int X509_PURPOSE_get_by_sname(const(char)* sname);
1177 int X509_PURPOSE_get_by_id(int id);
1178 int X509_PURPOSE_add(
1179     int id,
1180     int trust,
1181     int flags,
1182     int function(const(X509_PURPOSE)*, const(X509)*, int) ck,
1183     const(char)* name,
1184     const(char)* sname,
1185     void* arg);
1186 char* X509_PURPOSE_get0_name(const(X509_PURPOSE)* xp);
1187 char* X509_PURPOSE_get0_sname(const(X509_PURPOSE)* xp);
1188 int X509_PURPOSE_get_trust(const(X509_PURPOSE)* xp);
1189 void X509_PURPOSE_cleanup();
1190 int X509_PURPOSE_get_id(const(X509_PURPOSE)*);
1191 
1192 stack_st_OPENSSL_STRING* X509_get1_email(X509* x);
1193 stack_st_OPENSSL_STRING* X509_REQ_get1_email(X509_REQ* x);
1194 void X509_email_free(stack_st_OPENSSL_STRING* sk);
1195 stack_st_OPENSSL_STRING* X509_get1_ocsp(X509* x);
1196 /* Flags for X509_check_* functions */
1197 
1198 /*
1199  * Always check subject name for host match even if subject alt names present
1200  */
1201 enum X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT = 0x1;
1202 /* Disable wildcard matching for dnsName fields and common name. */
1203 enum X509_CHECK_FLAG_NO_WILDCARDS = 0x2;
1204 /* Wildcards must not match a partial label. */
1205 enum X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS = 0x4;
1206 /* Allow (non-partial) wildcards to match multiple labels. */
1207 enum X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS = 0x8;
1208 /* Constraint verifier subdomain patterns to match a single labels. */
1209 enum X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS = 0x10;
1210 /* Never check the subject CN */
1211 enum X509_CHECK_FLAG_NEVER_CHECK_SUBJECT = 0x20;
1212 /*
1213  * Match reference identifiers starting with "." to any sub-domain.
1214  * This is a non-public flag, turned on implicitly when the subject
1215  * reference identity is a DNS name.
1216  */
1217 enum _X509_CHECK_FLAG_DOT_SUBDOMAINS = 0x8000;
1218 
1219 int X509_check_host(
1220     X509* x,
1221     const(char)* chk,
1222     size_t chklen,
1223     uint flags,
1224     char** peername);
1225 int X509_check_email(X509* x, const(char)* chk, size_t chklen, uint flags);
1226 int X509_check_ip(X509* x, const(ubyte)* chk, size_t chklen, uint flags);
1227 int X509_check_ip_asc(X509* x, const(char)* ipasc, uint flags);
1228 
1229 ASN1_OCTET_STRING* a2i_IPADDRESS(const(char)* ipasc);
1230 ASN1_OCTET_STRING* a2i_IPADDRESS_NC(const(char)* ipasc);
1231 int X509V3_NAME_from_section(
1232     X509_NAME* nm,
1233     stack_st_CONF_VALUE* dn_sk,
1234     c_ulong chtype);
1235 
1236 void X509_POLICY_NODE_print(BIO* out_, X509_POLICY_NODE* node, int indent);
1237 struct stack_st_X509_POLICY_NODE;
1238 alias sk_X509_POLICY_NODE_compfunc = int function(const(X509_POLICY_NODE*)* a, const(X509_POLICY_NODE*)* b);
1239 alias sk_X509_POLICY_NODE_freefunc = void function(X509_POLICY_NODE* a);
1240 alias sk_X509_POLICY_NODE_copyfunc = X509_POLICY_NODE_st* function(const(X509_POLICY_NODE)* a);
1241 int sk_X509_POLICY_NODE_num(const(stack_st_X509_POLICY_NODE)* sk);
1242 X509_POLICY_NODE* sk_X509_POLICY_NODE_value(const(stack_st_X509_POLICY_NODE)* sk, int idx);
1243 stack_st_X509_POLICY_NODE* sk_X509_POLICY_NODE_new(sk_X509_POLICY_NODE_compfunc compare);
1244 stack_st_X509_POLICY_NODE* sk_X509_POLICY_NODE_new_null();
1245 void sk_X509_POLICY_NODE_free(stack_st_X509_POLICY_NODE* sk);
1246 void sk_X509_POLICY_NODE_zero(stack_st_X509_POLICY_NODE* sk);
1247 X509_POLICY_NODE* sk_X509_POLICY_NODE_delete(stack_st_X509_POLICY_NODE* sk, int i);
1248 X509_POLICY_NODE* sk_X509_POLICY_NODE_delete_ptr(stack_st_X509_POLICY_NODE* sk, X509_POLICY_NODE* ptr);
1249 int sk_X509_POLICY_NODE_push(stack_st_X509_POLICY_NODE* sk, X509_POLICY_NODE* ptr);
1250 int sk_X509_POLICY_NODE_unshift(stack_st_X509_POLICY_NODE* sk, X509_POLICY_NODE* ptr);
1251 X509_POLICY_NODE* sk_X509_POLICY_NODE_pop(stack_st_X509_POLICY_NODE* sk);
1252 X509_POLICY_NODE* sk_X509_POLICY_NODE_shift(stack_st_X509_POLICY_NODE* sk);
1253 void sk_X509_POLICY_NODE_pop_free(stack_st_X509_POLICY_NODE* sk, sk_X509_POLICY_NODE_freefunc freefunc);
1254 int sk_X509_POLICY_NODE_insert(stack_st_X509_POLICY_NODE* sk, X509_POLICY_NODE* ptr, int idx);
1255 X509_POLICY_NODE* sk_X509_POLICY_NODE_set(stack_st_X509_POLICY_NODE* sk, int idx, X509_POLICY_NODE* ptr);
1256 int sk_X509_POLICY_NODE_find(stack_st_X509_POLICY_NODE* sk, X509_POLICY_NODE* ptr);
1257 int sk_X509_POLICY_NODE_find_ex(stack_st_X509_POLICY_NODE* sk, X509_POLICY_NODE* ptr);
1258 void sk_X509_POLICY_NODE_sort(stack_st_X509_POLICY_NODE* sk);
1259 int sk_X509_POLICY_NODE_is_sorted(const(stack_st_X509_POLICY_NODE)* sk);
1260 stack_st_X509_POLICY_NODE* sk_X509_POLICY_NODE_dup(const(stack_st_X509_POLICY_NODE)* sk);
1261 stack_st_X509_POLICY_NODE* sk_X509_POLICY_NODE_deep_copy(const(stack_st_X509_POLICY_NODE)* sk, sk_X509_POLICY_NODE_copyfunc copyfunc, sk_X509_POLICY_NODE_freefunc freefunc);
1262 sk_X509_POLICY_NODE_compfunc sk_X509_POLICY_NODE_set_cmp_func(stack_st_X509_POLICY_NODE* sk, sk_X509_POLICY_NODE_compfunc compare);
1263 
1264 version(OPENSSL_NO_RFC3779) {} else {
1265 struct ASRange_st
1266 {
1267     ASN1_INTEGER* min;
1268     ASN1_INTEGER* max;
1269 }
1270 
1271 alias ASRange = ASRange_st;
1272 
1273 enum ASIdOrRange_id = 0;
1274 enum ASIdOrRange_range = 1;
1275 
1276 struct ASIdOrRange_st
1277 {
1278     int type;
1279 
1280     union _Anonymous_3
1281     {
1282         ASN1_INTEGER* id;
1283         ASRange* range;
1284     }
1285 
1286     _Anonymous_3 u;
1287 }
1288 
1289 alias ASIdOrRange = ASIdOrRange_st;
1290 
1291 struct stack_st_ASIdOrRange;
1292 alias ASIdOrRanges = stack_st_ASIdOrRange;
1293 alias sk_ASIdOrRange_compfunc = int function(const(ASIdOrRange*)* a, const(ASIdOrRange*)* b);
1294 alias sk_ASIdOrRange_freefunc = void function(ASIdOrRange* a);
1295 alias sk_ASIdOrRange_copyfunc = ASIdOrRange_st* function(const(ASIdOrRange)* a);
1296 int sk_ASIdOrRange_num(const(stack_st_ASIdOrRange)* sk);
1297 ASIdOrRange* sk_ASIdOrRange_value(const(stack_st_ASIdOrRange)* sk, int idx);
1298 stack_st_ASIdOrRange* sk_ASIdOrRange_new(sk_ASIdOrRange_compfunc compare);
1299 stack_st_ASIdOrRange* sk_ASIdOrRange_new_null();
1300 void sk_ASIdOrRange_free(stack_st_ASIdOrRange* sk);
1301 void sk_ASIdOrRange_zero(stack_st_ASIdOrRange* sk);
1302 ASIdOrRange* sk_ASIdOrRange_delete(stack_st_ASIdOrRange* sk, int i);
1303 ASIdOrRange* sk_ASIdOrRange_delete_ptr(stack_st_ASIdOrRange* sk, ASIdOrRange* ptr);
1304 int sk_ASIdOrRange_push(stack_st_ASIdOrRange* sk, ASIdOrRange* ptr);
1305 int sk_ASIdOrRange_unshift(stack_st_ASIdOrRange* sk, ASIdOrRange* ptr);
1306 ASIdOrRange* sk_ASIdOrRange_pop(stack_st_ASIdOrRange* sk);
1307 ASIdOrRange* sk_ASIdOrRange_shift(stack_st_ASIdOrRange* sk);
1308 void sk_ASIdOrRange_pop_free(stack_st_ASIdOrRange* sk, sk_ASIdOrRange_freefunc freefunc);
1309 int sk_ASIdOrRange_insert(stack_st_ASIdOrRange* sk, ASIdOrRange* ptr, int idx);
1310 ASIdOrRange* sk_ASIdOrRange_set(stack_st_ASIdOrRange* sk, int idx, ASIdOrRange* ptr);
1311 int sk_ASIdOrRange_find(stack_st_ASIdOrRange* sk, ASIdOrRange* ptr);
1312 int sk_ASIdOrRange_find_ex(stack_st_ASIdOrRange* sk, ASIdOrRange* ptr);
1313 void sk_ASIdOrRange_sort(stack_st_ASIdOrRange* sk);
1314 int sk_ASIdOrRange_is_sorted(const(stack_st_ASIdOrRange)* sk);
1315 stack_st_ASIdOrRange* sk_ASIdOrRange_dup(const(stack_st_ASIdOrRange)* sk);
1316 stack_st_ASIdOrRange* sk_ASIdOrRange_deep_copy(const(stack_st_ASIdOrRange)* sk, sk_ASIdOrRange_copyfunc copyfunc, sk_ASIdOrRange_freefunc freefunc);
1317 sk_ASIdOrRange_compfunc sk_ASIdOrRange_set_cmp_func(stack_st_ASIdOrRange* sk, sk_ASIdOrRange_compfunc compare);
1318 
1319 enum ASIdentifierChoice_inherit = 0;
1320 enum ASIdentifierChoice_asIdsOrRanges = 1;
1321 
1322 struct ASIdentifierChoice_st
1323 {
1324     int type;
1325 
1326     union _Anonymous_4
1327     {
1328         ASN1_NULL* inherit;
1329         ASIdOrRanges* asIdsOrRanges;
1330     }
1331 
1332     _Anonymous_4 u;
1333 }
1334 
1335 alias ASIdentifierChoice = ASIdentifierChoice_st;
1336 
1337 struct ASIdentifiers_st
1338 {
1339     ASIdentifierChoice* asnum;
1340     ASIdentifierChoice* rdi;
1341 }
1342 
1343 alias ASIdentifiers = ASIdentifiers_st;
1344 
1345 ASRange* ASRange_new();
1346 void ASRange_free(ASRange* a);
1347 ASRange* d2i_ASRange(ASRange** a, const(ubyte*)* in_, c_long len);
1348 int i2d_ASRange(ASRange* a, ubyte** out_);
1349 extern __gshared const ASN1_ITEM ASRange_it;
1350 ASIdOrRange* ASIdOrRange_new();
1351 void ASIdOrRange_free(ASIdOrRange* a);
1352 ASIdOrRange* d2i_ASIdOrRange(ASIdOrRange** a, const(ubyte*)* in_, c_long len);
1353 int i2d_ASIdOrRange(ASIdOrRange* a, ubyte** out_);
1354 extern __gshared const ASN1_ITEM ASIdOrRange_it;
1355 ASIdentifierChoice* ASIdentifierChoice_new();
1356 void ASIdentifierChoice_free(ASIdentifierChoice* a);
1357 ASIdentifierChoice* d2i_ASIdentifierChoice(ASIdentifierChoice** a, const(ubyte*)* in_, c_long len);
1358 int i2d_ASIdentifierChoice(ASIdentifierChoice* a, ubyte** out_);
1359 extern __gshared const ASN1_ITEM ASIdentifierChoice_it;
1360 ASIdentifiers* ASIdentifiers_new();
1361 void ASIdentifiers_free(ASIdentifiers* a);
1362 ASIdentifiers* d2i_ASIdentifiers(ASIdentifiers** a, const(ubyte*)* in_, c_long len);
1363 int i2d_ASIdentifiers(ASIdentifiers* a, ubyte** out_);
1364 extern __gshared const ASN1_ITEM ASIdentifiers_it;
1365 
1366 struct IPAddressRange_st
1367 {
1368     ASN1_BIT_STRING* min;
1369     ASN1_BIT_STRING* max;
1370 }
1371 
1372 alias IPAddressRange = IPAddressRange_st;
1373 
1374 enum IPAddressOrRange_addressPrefix = 0;
1375 enum IPAddressOrRange_addressRange = 1;
1376 
1377 struct IPAddressOrRange_st
1378 {
1379     int type;
1380 
1381     union _Anonymous_5
1382     {
1383         ASN1_BIT_STRING* addressPrefix;
1384         IPAddressRange* addressRange;
1385     }
1386 
1387     _Anonymous_5 u;
1388 }
1389 
1390 alias IPAddressOrRange = IPAddressOrRange_st;
1391 
1392 struct stack_st_IPAddressOrRange;
1393 alias IPAddressOrRanges = stack_st_IPAddressOrRange;
1394 alias sk_IPAddressOrRange_compfunc = int function(const(IPAddressOrRange*)* a, const(IPAddressOrRange*)* b);
1395 alias sk_IPAddressOrRange_freefunc = void function(IPAddressOrRange* a);
1396 alias sk_IPAddressOrRange_copyfunc = IPAddressOrRange_st* function(const(IPAddressOrRange)* a);
1397 int sk_IPAddressOrRange_num(const(stack_st_IPAddressOrRange)* sk);
1398 IPAddressOrRange* sk_IPAddressOrRange_value(const(stack_st_IPAddressOrRange)* sk, int idx);
1399 stack_st_IPAddressOrRange* sk_IPAddressOrRange_new(sk_IPAddressOrRange_compfunc compare);
1400 stack_st_IPAddressOrRange* sk_IPAddressOrRange_new_null();
1401 void sk_IPAddressOrRange_free(stack_st_IPAddressOrRange* sk);
1402 void sk_IPAddressOrRange_zero(stack_st_IPAddressOrRange* sk);
1403 IPAddressOrRange* sk_IPAddressOrRange_delete(stack_st_IPAddressOrRange* sk, int i);
1404 IPAddressOrRange* sk_IPAddressOrRange_delete_ptr(stack_st_IPAddressOrRange* sk, IPAddressOrRange* ptr);
1405 int sk_IPAddressOrRange_push(stack_st_IPAddressOrRange* sk, IPAddressOrRange* ptr);
1406 int sk_IPAddressOrRange_unshift(stack_st_IPAddressOrRange* sk, IPAddressOrRange* ptr);
1407 IPAddressOrRange* sk_IPAddressOrRange_pop(stack_st_IPAddressOrRange* sk);
1408 IPAddressOrRange* sk_IPAddressOrRange_shift(stack_st_IPAddressOrRange* sk);
1409 void sk_IPAddressOrRange_pop_free(stack_st_IPAddressOrRange* sk, sk_IPAddressOrRange_freefunc freefunc);
1410 int sk_IPAddressOrRange_insert(stack_st_IPAddressOrRange* sk, IPAddressOrRange* ptr, int idx);
1411 IPAddressOrRange* sk_IPAddressOrRange_set(stack_st_IPAddressOrRange* sk, int idx, IPAddressOrRange* ptr);
1412 int sk_IPAddressOrRange_find(stack_st_IPAddressOrRange* sk, IPAddressOrRange* ptr);
1413 int sk_IPAddressOrRange_find_ex(stack_st_IPAddressOrRange* sk, IPAddressOrRange* ptr);
1414 void sk_IPAddressOrRange_sort(stack_st_IPAddressOrRange* sk);
1415 int sk_IPAddressOrRange_is_sorted(const(stack_st_IPAddressOrRange)* sk);
1416 stack_st_IPAddressOrRange* sk_IPAddressOrRange_dup(const(stack_st_IPAddressOrRange)* sk);
1417 stack_st_IPAddressOrRange* sk_IPAddressOrRange_deep_copy(const(stack_st_IPAddressOrRange)* sk, sk_IPAddressOrRange_copyfunc copyfunc, sk_IPAddressOrRange_freefunc freefunc);
1418 sk_IPAddressOrRange_compfunc sk_IPAddressOrRange_set_cmp_func(stack_st_IPAddressOrRange* sk, sk_IPAddressOrRange_compfunc compare);
1419 
1420 enum IPAddressChoice_inherit = 0;
1421 enum IPAddressChoice_addressesOrRanges = 1;
1422 
1423 struct IPAddressChoice_st
1424 {
1425     int type;
1426 
1427     union _Anonymous_6
1428     {
1429         ASN1_NULL* inherit;
1430         IPAddressOrRanges* addressesOrRanges;
1431     }
1432 
1433     _Anonymous_6 u;
1434 }
1435 
1436 alias IPAddressChoice = IPAddressChoice_st;
1437 
1438 struct IPAddressFamily_st
1439 {
1440     ASN1_OCTET_STRING* addressFamily;
1441     IPAddressChoice* ipAddressChoice;
1442 }
1443 
1444 alias IPAddressFamily = IPAddressFamily_st;
1445 
1446 struct stack_st_IPAddressFamily;
1447 alias IPAddrBlocks = stack_st_IPAddressFamily;
1448 alias sk_IPAddressFamily_compfunc = int function(const(IPAddressFamily*)* a, const(IPAddressFamily*)* b);
1449 alias sk_IPAddressFamily_freefunc = void function(IPAddressFamily* a);
1450 alias sk_IPAddressFamily_copyfunc = IPAddressFamily_st* function(const(IPAddressFamily)* a);
1451 int sk_IPAddressFamily_num(const(stack_st_IPAddressFamily)* sk);
1452 IPAddressFamily* sk_IPAddressFamily_value(const(stack_st_IPAddressFamily)* sk, int idx);
1453 stack_st_IPAddressFamily* sk_IPAddressFamily_new(sk_IPAddressFamily_compfunc compare);
1454 stack_st_IPAddressFamily* sk_IPAddressFamily_new_null();
1455 void sk_IPAddressFamily_free(stack_st_IPAddressFamily* sk);
1456 void sk_IPAddressFamily_zero(stack_st_IPAddressFamily* sk);
1457 IPAddressFamily* sk_IPAddressFamily_delete(stack_st_IPAddressFamily* sk, int i);
1458 IPAddressFamily* sk_IPAddressFamily_delete_ptr(stack_st_IPAddressFamily* sk, IPAddressFamily* ptr);
1459 int sk_IPAddressFamily_push(stack_st_IPAddressFamily* sk, IPAddressFamily* ptr);
1460 int sk_IPAddressFamily_unshift(stack_st_IPAddressFamily* sk, IPAddressFamily* ptr);
1461 IPAddressFamily* sk_IPAddressFamily_pop(stack_st_IPAddressFamily* sk);
1462 IPAddressFamily* sk_IPAddressFamily_shift(stack_st_IPAddressFamily* sk);
1463 void sk_IPAddressFamily_pop_free(stack_st_IPAddressFamily* sk, sk_IPAddressFamily_freefunc freefunc);
1464 int sk_IPAddressFamily_insert(stack_st_IPAddressFamily* sk, IPAddressFamily* ptr, int idx);
1465 IPAddressFamily* sk_IPAddressFamily_set(stack_st_IPAddressFamily* sk, int idx, IPAddressFamily* ptr);
1466 int sk_IPAddressFamily_find(stack_st_IPAddressFamily* sk, IPAddressFamily* ptr);
1467 int sk_IPAddressFamily_find_ex(stack_st_IPAddressFamily* sk, IPAddressFamily* ptr);
1468 void sk_IPAddressFamily_sort(stack_st_IPAddressFamily* sk);
1469 int sk_IPAddressFamily_is_sorted(const(stack_st_IPAddressFamily)* sk);
1470 stack_st_IPAddressFamily* sk_IPAddressFamily_dup(const(stack_st_IPAddressFamily)* sk);
1471 stack_st_IPAddressFamily* sk_IPAddressFamily_deep_copy(const(stack_st_IPAddressFamily)* sk, sk_IPAddressFamily_copyfunc copyfunc, sk_IPAddressFamily_freefunc freefunc);
1472 sk_IPAddressFamily_compfunc sk_IPAddressFamily_set_cmp_func(stack_st_IPAddressFamily* sk, sk_IPAddressFamily_compfunc compare);
1473 
1474 IPAddressRange* IPAddressRange_new();
1475 void IPAddressRange_free(IPAddressRange* a);
1476 IPAddressRange* d2i_IPAddressRange(IPAddressRange** a, const(ubyte*)* in_, c_long len);
1477 int i2d_IPAddressRange(IPAddressRange* a, ubyte** out_);
1478 extern __gshared const ASN1_ITEM IPAddressRange_it;
1479 IPAddressOrRange* IPAddressOrRange_new();
1480 void IPAddressOrRange_free(IPAddressOrRange* a);
1481 IPAddressOrRange* d2i_IPAddressOrRange(IPAddressOrRange** a, const(ubyte*)* in_, c_long len);
1482 int i2d_IPAddressOrRange(IPAddressOrRange* a, ubyte** out_);
1483 extern __gshared const ASN1_ITEM IPAddressOrRange_it;
1484 IPAddressChoice* IPAddressChoice_new();
1485 void IPAddressChoice_free(IPAddressChoice* a);
1486 IPAddressChoice* d2i_IPAddressChoice(IPAddressChoice** a, const(ubyte*)* in_, c_long len);
1487 int i2d_IPAddressChoice(IPAddressChoice* a, ubyte** out_);
1488 extern __gshared const ASN1_ITEM IPAddressChoice_it;
1489 IPAddressFamily* IPAddressFamily_new();
1490 void IPAddressFamily_free(IPAddressFamily* a);
1491 IPAddressFamily* d2i_IPAddressFamily(IPAddressFamily** a, const(ubyte*)* in_, c_long len);
1492 int i2d_IPAddressFamily(IPAddressFamily* a, ubyte** out_);
1493 extern __gshared const ASN1_ITEM IPAddressFamily_it;
1494 
1495 /*
1496  * API tag for elements of the ASIdentifer SEQUENCE.
1497  */
1498 enum V3_ASID_ASNUM = 0;
1499 enum V3_ASID_RDI = 1;
1500 
1501 /*
1502  * AFI values, assigned by IANA.  It'd be nice to make the AFI
1503  * handling code totally generic, but there are too many little things
1504  * that would need to be defined for other address families for it to
1505  * be worth the trouble.
1506  */
1507 enum IANA_AFI_IPV4 = 1;
1508 enum IANA_AFI_IPV6 = 2;
1509 
1510 /*
1511  * Utilities to construct and extract values from RFC3779 extensions,
1512  * since some of the encodings (particularly for IP address prefixes
1513  * and ranges) are a bit tedious to work with directly.
1514  */
1515 int X509v3_asid_add_inherit(ASIdentifiers* asid, int which);
1516 int X509v3_asid_add_id_or_range(
1517     ASIdentifiers* asid,
1518     int which,
1519     ASN1_INTEGER* min,
1520     ASN1_INTEGER* max);
1521 int X509v3_addr_add_inherit(
1522     IPAddrBlocks* addr,
1523     const uint afi,
1524     const(uint)* safi);
1525 int X509v3_addr_add_prefix(
1526     IPAddrBlocks* addr,
1527     const uint afi,
1528     const(uint)* safi,
1529     ubyte* a,
1530     const int prefixlen);
1531 int X509v3_addr_add_range(
1532     IPAddrBlocks* addr,
1533     const uint afi,
1534     const(uint)* safi,
1535     ubyte* min,
1536     ubyte* max);
1537 uint X509v3_addr_get_afi(const(IPAddressFamily)* f);
1538 int X509v3_addr_get_range(
1539     IPAddressOrRange* aor,
1540     const uint afi,
1541     ubyte* min,
1542     ubyte* max,
1543     const int length);
1544 
1545 /*
1546  * Canonical forms.
1547  */
1548 int X509v3_asid_is_canonical(ASIdentifiers* asid);
1549 int X509v3_addr_is_canonical(IPAddrBlocks* addr);
1550 int X509v3_asid_canonize(ASIdentifiers* asid);
1551 int X509v3_addr_canonize(IPAddrBlocks* addr);
1552 
1553 /*
1554  * Tests for inheritance and containment.
1555  */
1556 int X509v3_asid_inherits(ASIdentifiers* asid);
1557 int X509v3_addr_inherits(IPAddrBlocks* addr);
1558 int X509v3_asid_subset(ASIdentifiers* a, ASIdentifiers* b);
1559 int X509v3_addr_subset(IPAddrBlocks* a, IPAddrBlocks* b);
1560 
1561 /*
1562  * Check whether RFC 3779 extensions nest properly in chains.
1563  */
1564 int X509v3_asid_validate_path(X509_STORE_CTX*);
1565 int X509v3_addr_validate_path(X509_STORE_CTX*);
1566 int X509v3_asid_validate_resource_set(
1567     stack_st_X509* chain,
1568     ASIdentifiers* ext,
1569     int allow_inheritance);
1570 int X509v3_addr_validate_resource_set(
1571     stack_st_X509* chain,
1572     IPAddrBlocks* ext,
1573     int allow_inheritance);
1574 
1575 }  /* OPENSSL_NO_RFC3779 */
1576 
1577 /* BEGIN ERROR CODES */
1578 /*
1579  * The following lines are auto generated by the script mkerr.pl. Any changes
1580  * made after this point may be overwritten when the script is next run.
1581  */
1582 
1583 int ERR_load_X509V3_strings();
1584 
1585 /* Error codes for the X509V3 functions. */
1586 
1587 /* Function codes. */
1588 enum X509V3_F_A2I_GENERAL_NAME = 164;
1589 enum X509V3_F_ADDR_VALIDATE_PATH_INTERNAL = 166;
1590 enum X509V3_F_ASIDENTIFIERCHOICE_CANONIZE = 161;
1591 enum X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL = 162;
1592 enum X509V3_F_BIGNUM_TO_STRING = 167;
1593 enum X509V3_F_COPY_EMAIL = 122;
1594 enum X509V3_F_COPY_ISSUER = 123;
1595 enum X509V3_F_DO_DIRNAME = 144;
1596 enum X509V3_F_DO_EXT_I2D = 135;
1597 enum X509V3_F_DO_EXT_NCONF = 151;
1598 enum X509V3_F_GNAMES_FROM_SECTNAME = 156;
1599 enum X509V3_F_I2S_ASN1_ENUMERATED = 121;
1600 enum X509V3_F_I2S_ASN1_IA5STRING = 149;
1601 enum X509V3_F_I2S_ASN1_INTEGER = 120;
1602 enum X509V3_F_I2V_AUTHORITY_INFO_ACCESS = 138;
1603 enum X509V3_F_NOTICE_SECTION = 132;
1604 enum X509V3_F_NREF_NOS = 133;
1605 enum X509V3_F_POLICY_SECTION = 131;
1606 enum X509V3_F_PROCESS_PCI_VALUE = 150;
1607 enum X509V3_F_R2I_CERTPOL = 130;
1608 enum X509V3_F_R2I_PCI = 155;
1609 enum X509V3_F_S2I_ASN1_IA5STRING = 100;
1610 enum X509V3_F_S2I_ASN1_INTEGER = 108;
1611 enum X509V3_F_S2I_ASN1_OCTET_STRING = 112;
1612 enum X509V3_F_S2I_SKEY_ID = 115;
1613 enum X509V3_F_SET_DIST_POINT_NAME = 158;
1614 enum X509V3_F_SXNET_ADD_ID_ASC = 125;
1615 enum X509V3_F_SXNET_ADD_ID_INTEGER = 126;
1616 enum X509V3_F_SXNET_ADD_ID_ULONG = 127;
1617 enum X509V3_F_SXNET_GET_ID_ASC = 128;
1618 enum X509V3_F_SXNET_GET_ID_ULONG = 129;
1619 enum X509V3_F_V2I_ASIDENTIFIERS = 163;
1620 enum X509V3_F_V2I_ASN1_BIT_STRING = 101;
1621 enum X509V3_F_V2I_AUTHORITY_INFO_ACCESS = 139;
1622 enum X509V3_F_V2I_AUTHORITY_KEYID = 119;
1623 enum X509V3_F_V2I_BASIC_CONSTRAINTS = 102;
1624 enum X509V3_F_V2I_CRLD = 134;
1625 enum X509V3_F_V2I_EXTENDED_KEY_USAGE = 103;
1626 enum X509V3_F_V2I_GENERAL_NAMES = 118;
1627 enum X509V3_F_V2I_GENERAL_NAME_EX = 117;
1628 enum X509V3_F_V2I_IDP = 157;
1629 enum X509V3_F_V2I_IPADDRBLOCKS = 159;
1630 enum X509V3_F_V2I_ISSUER_ALT = 153;
1631 enum X509V3_F_V2I_NAME_CONSTRAINTS = 147;
1632 enum X509V3_F_V2I_POLICY_CONSTRAINTS = 146;
1633 enum X509V3_F_V2I_POLICY_MAPPINGS = 145;
1634 enum X509V3_F_V2I_SUBJECT_ALT = 154;
1635 enum X509V3_F_V2I_TLS_FEATURE = 165;
1636 enum X509V3_F_V3_GENERIC_EXTENSION = 116;
1637 enum X509V3_F_X509V3_ADD1_I2D = 140;
1638 enum X509V3_F_X509V3_ADD_VALUE = 105;
1639 enum X509V3_F_X509V3_EXT_ADD = 104;
1640 enum X509V3_F_X509V3_EXT_ADD_ALIAS = 106;
1641 enum X509V3_F_X509V3_EXT_I2D = 136;
1642 enum X509V3_F_X509V3_EXT_NCONF = 152;
1643 enum X509V3_F_X509V3_GET_SECTION = 142;
1644 enum X509V3_F_X509V3_GET_STRING = 143;
1645 enum X509V3_F_X509V3_GET_VALUE_BOOL = 110;
1646 enum X509V3_F_X509V3_PARSE_LIST = 109;
1647 enum X509V3_F_X509_PURPOSE_ADD = 137;
1648 enum X509V3_F_X509_PURPOSE_SET = 141;
1649 
1650 /* Reason codes. */
1651 enum X509V3_R_BAD_IP_ADDRESS = 118;
1652 enum X509V3_R_BAD_OBJECT = 119;
1653 enum X509V3_R_BN_DEC2BN_ERROR = 100;
1654 enum X509V3_R_BN_TO_ASN1_INTEGER_ERROR = 101;
1655 enum X509V3_R_DIRNAME_ERROR = 149;
1656 enum X509V3_R_DISTPOINT_ALREADY_SET = 160;
1657 enum X509V3_R_DUPLICATE_ZONE_ID = 133;
1658 enum X509V3_R_ERROR_CONVERTING_ZONE = 131;
1659 enum X509V3_R_ERROR_CREATING_EXTENSION = 144;
1660 enum X509V3_R_ERROR_IN_EXTENSION = 128;
1661 enum X509V3_R_EXPECTED_A_SECTION_NAME = 137;
1662 enum X509V3_R_EXTENSION_EXISTS = 145;
1663 enum X509V3_R_EXTENSION_NAME_ERROR = 115;
1664 enum X509V3_R_EXTENSION_NOT_FOUND = 102;
1665 enum X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED = 103;
1666 enum X509V3_R_EXTENSION_VALUE_ERROR = 116;
1667 enum X509V3_R_ILLEGAL_EMPTY_EXTENSION = 151;
1668 enum X509V3_R_INCORRECT_POLICY_SYNTAX_TAG = 152;
1669 enum X509V3_R_INVALID_ASNUMBER = 162;
1670 enum X509V3_R_INVALID_ASRANGE = 163;
1671 enum X509V3_R_INVALID_BOOLEAN_STRING = 104;
1672 enum X509V3_R_INVALID_EXTENSION_STRING = 105;
1673 enum X509V3_R_INVALID_INHERITANCE = 165;
1674 enum X509V3_R_INVALID_IPADDRESS = 166;
1675 enum X509V3_R_INVALID_MULTIPLE_RDNS = 161;
1676 enum X509V3_R_INVALID_NAME = 106;
1677 enum X509V3_R_INVALID_NULL_ARGUMENT = 107;
1678 enum X509V3_R_INVALID_NULL_NAME = 108;
1679 enum X509V3_R_INVALID_NULL_VALUE = 109;
1680 enum X509V3_R_INVALID_NUMBER = 140;
1681 enum X509V3_R_INVALID_NUMBERS = 141;
1682 enum X509V3_R_INVALID_OBJECT_IDENTIFIER = 110;
1683 enum X509V3_R_INVALID_OPTION = 138;
1684 enum X509V3_R_INVALID_POLICY_IDENTIFIER = 134;
1685 enum X509V3_R_INVALID_PROXY_POLICY_SETTING = 153;
1686 enum X509V3_R_INVALID_PURPOSE = 146;
1687 enum X509V3_R_INVALID_SAFI = 164;
1688 enum X509V3_R_INVALID_SECTION = 135;
1689 enum X509V3_R_INVALID_SYNTAX = 143;
1690 enum X509V3_R_ISSUER_DECODE_ERROR = 126;
1691 enum X509V3_R_MISSING_VALUE = 124;
1692 enum X509V3_R_NEED_ORGANIZATION_AND_NUMBERS = 142;
1693 enum X509V3_R_NO_CONFIG_DATABASE = 136;
1694 enum X509V3_R_NO_ISSUER_CERTIFICATE = 121;
1695 enum X509V3_R_NO_ISSUER_DETAILS = 127;
1696 enum X509V3_R_NO_POLICY_IDENTIFIER = 139;
1697 enum X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED = 154;
1698 enum X509V3_R_NO_PUBLIC_KEY = 114;
1699 enum X509V3_R_NO_SUBJECT_DETAILS = 125;
1700 enum X509V3_R_OPERATION_NOT_DEFINED = 148;
1701 enum X509V3_R_OTHERNAME_ERROR = 147;
1702 enum X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED = 155;
1703 enum X509V3_R_POLICY_PATH_LENGTH = 156;
1704 enum X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED = 157;
1705 enum X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY = 159;
1706 enum X509V3_R_SECTION_NOT_FOUND = 150;
1707 enum X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS = 122;
1708 enum X509V3_R_UNABLE_TO_GET_ISSUER_KEYID = 123;
1709 enum X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT = 111;
1710 enum X509V3_R_UNKNOWN_EXTENSION = 129;
1711 enum X509V3_R_UNKNOWN_EXTENSION_NAME = 130;
1712 enum X509V3_R_UNKNOWN_OPTION = 120;
1713 enum X509V3_R_UNSUPPORTED_OPTION = 117;
1714 enum X509V3_R_UNSUPPORTED_TYPE = 167;
1715 enum X509V3_R_USER_TOO_LONG = 132;
1716