Debian Codegraph @

upstream/debian-unstable/man3/d2i_X509.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "D2I_X509 3SSL"
58 .TH D2I_X509 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 d2i_ACCESS_DESCRIPTION,
65 d2i_ADMISSIONS,
66 d2i_ADMISSION_SYNTAX,
67 d2i_ASIdOrRange,
68 d2i_ASIdentifierChoice,
69 d2i_ASIdentifiers,
70 d2i_ASN1_BIT_STRING,
71 d2i_ASN1_BMPSTRING,
72 d2i_ASN1_ENUMERATED,
73 d2i_ASN1_GENERALIZEDTIME,
74 d2i_ASN1_GENERALSTRING,
75 d2i_ASN1_IA5STRING,
76 d2i_ASN1_INTEGER,
77 d2i_ASN1_NULL,
78 d2i_ASN1_OBJECT,
79 d2i_ASN1_OCTET_STRING,
80 d2i_ASN1_PRINTABLE,
81 d2i_ASN1_PRINTABLESTRING,
82 d2i_ASN1_SEQUENCE_ANY,
83 d2i_ASN1_SET_ANY,
84 d2i_ASN1_T61STRING,
85 d2i_ASN1_TIME,
86 d2i_ASN1_TYPE,
87 d2i_ASN1_UINTEGER,
88 d2i_ASN1_UNIVERSALSTRING,
89 d2i_ASN1_UTCTIME,
90 d2i_ASN1_UTF8STRING,
91 d2i_ASN1_VISIBLESTRING,
92 d2i_ASRange,
93 d2i_AUTHORITY_INFO_ACCESS,
94 d2i_AUTHORITY_KEYID,
95 d2i_BASIC_CONSTRAINTS,
96 d2i_CERTIFICATEPOLICIES,
97 d2i_CMS_ContentInfo,
98 d2i_CMS_ReceiptRequest,
99 d2i_CMS_bio,
100 d2i_CRL_DIST_POINTS,
101 d2i_DHxparams,
102 d2i_DIRECTORYSTRING,
103 d2i_DISPLAYTEXT,
104 d2i_DIST_POINT,
105 d2i_DIST_POINT_NAME,
106 d2i_DSA_SIG,
107 d2i_ECDSA_SIG,
108 d2i_ECPKParameters,
109 d2i_EDIPARTYNAME,
110 d2i_ESS_CERT_ID,
111 d2i_ESS_CERT_ID_V2,
112 d2i_ESS_ISSUER_SERIAL,
113 d2i_ESS_SIGNING_CERT,
114 d2i_ESS_SIGNING_CERT_V2,
115 d2i_EXTENDED_KEY_USAGE,
116 d2i_GENERAL_NAME,
117 d2i_GENERAL_NAMES,
118 d2i_IPAddressChoice,
119 d2i_IPAddressFamily,
120 d2i_IPAddressOrRange,
121 d2i_IPAddressRange,
122 d2i_ISSUER_SIGN_TOOL,
123 d2i_ISSUING_DIST_POINT,
124 d2i_NAMING_AUTHORITY,
125 d2i_NETSCAPE_CERT_SEQUENCE,
126 d2i_NETSCAPE_SPKAC,
127 d2i_NETSCAPE_SPKI,
128 d2i_NOTICEREF,
129 d2i_OCSP_BASICRESP,
130 d2i_OCSP_CERTID,
131 d2i_OCSP_CERTSTATUS,
132 d2i_OCSP_CRLID,
133 d2i_OCSP_ONEREQ,
134 d2i_OCSP_REQINFO,
135 d2i_OCSP_REQUEST,
136 d2i_OCSP_RESPBYTES,
137 d2i_OCSP_RESPDATA,
138 d2i_OCSP_RESPID,
139 d2i_OCSP_RESPONSE,
140 d2i_OCSP_REVOKEDINFO,
141 d2i_OCSP_SERVICELOC,
142 d2i_OCSP_SIGNATURE,
143 d2i_OCSP_SINGLERESP,
144 d2i_OSSL_AA_DIST_POINT,
145 d2i_OSSL_ALLOWED_ATTRIBUTES_CHOICE,
146 d2i_OSSL_ALLOWED_ATTRIBUTES_ITEM,
147 d2i_OSSL_ALLOWED_ATTRIBUTES_SYNTAX,
148 d2i_OSSL_ATAV,
149 d2i_OSSL_ATTRIBUTE_DESCRIPTOR,
150 d2i_OSSL_ATTRIBUTE_MAPPING,
151 d2i_OSSL_ATTRIBUTE_MAPPINGS,
152 d2i_OSSL_ATTRIBUTE_TYPE_MAPPING,
153 d2i_OSSL_ATTRIBUTE_VALUE_MAPPING,
154 d2i_OSSL_ATTRIBUTES_SYNTAX,
155 d2i_OSSL_AUTHORITY_ATTRIBUTE_ID_SYNTAX,
156 d2i_OSSL_BASIC_ATTR_CONSTRAINTS,
157 d2i_OSSL_CMP_ATAVS,
158 d2i_OSSL_CMP_MSG,
159 d2i_OSSL_CMP_PKIHEADER,
160 d2i_OSSL_CMP_PKISI,
161 d2i_OSSL_CRMF_CERTID,
162 d2i_OSSL_CRMF_CERTTEMPLATE,
163 d2i_OSSL_CRMF_ENCRYPTEDKEY,
164 d2i_OSSL_CRMF_ENCRYPTEDVALUE,
165 d2i_OSSL_CRMF_MSG,
166 d2i_OSSL_CRMF_MSGS,
167 d2i_OSSL_CRMF_PBMPARAMETER,
168 d2i_OSSL_CRMF_PKIPUBLICATIONINFO,
169 d2i_OSSL_CRMF_SINGLEPUBINFO,
170 d2i_OSSL_DAY_TIME,
171 d2i_OSSL_DAY_TIME_BAND,
172 d2i_OSSL_HASH,
173 d2i_OSSL_IETF_ATTR_SYNTAX,
174 d2i_OSSL_INFO_SYNTAX,
175 d2i_OSSL_INFO_SYNTAX_POINTER,
176 d2i_OSSL_ISSUER_SERIAL,
177 d2i_OSSL_NAMED_DAY,
178 d2i_OSSL_OBJECT_DIGEST_INFO,
179 d2i_OSSL_PRIVILEGE_POLICY_ID,
180 d2i_OSSL_ROLE_SPEC_CERT_ID,
181 d2i_OSSL_ROLE_SPEC_CERT_ID_SYNTAX,
182 d2i_OSSL_TARGET_CERT,
183 d2i_OSSL_TARGET,
184 d2i_OSSL_TARGETING_INFORMATION,
185 d2i_OSSL_TARGETS,
186 d2i_OSSL_TIME_PERIOD,
187 d2i_OSSL_TIME_SPEC,
188 d2i_OSSL_TIME_SPEC_ABSOLUTE,
189 d2i_OSSL_TIME_SPEC_DAY,
190 d2i_OSSL_TIME_SPEC_MONTH,
191 d2i_OSSL_TIME_SPEC_TIME,
192 d2i_OSSL_TIME_SPEC_WEEKS,
193 d2i_OSSL_TIME_SPEC_X_DAY_OF,
194 d2i_OSSL_USER_NOTICE_SYNTAX,
195 d2i_OTHERNAME,
196 d2i_PBE2PARAM,
197 d2i_PBEPARAM,
198 d2i_PBKDF2PARAM,
199 d2i_PBMAC1PARAM,
200 d2i_PKCS12,
201 d2i_PKCS12_BAGS,
202 d2i_PKCS12_MAC_DATA,
203 d2i_PKCS12_SAFEBAG,
204 d2i_PKCS12_bio,
205 d2i_PKCS12_fp,
206 d2i_PKCS7,
207 d2i_PKCS7_DIGEST,
208 d2i_PKCS7_ENCRYPT,
209 d2i_PKCS7_ENC_CONTENT,
210 d2i_PKCS7_ENVELOPE,
211 d2i_PKCS7_ISSUER_AND_SERIAL,
212 d2i_PKCS7_RECIP_INFO,
213 d2i_PKCS7_SIGNED,
214 d2i_PKCS7_SIGNER_INFO,
215 d2i_PKCS7_SIGN_ENVELOPE,
216 d2i_PKCS7_bio,
217 d2i_PKCS7_fp,
218 d2i_PKCS8_PRIV_KEY_INFO,
219 d2i_PKCS8_PRIV_KEY_INFO_bio,
220 d2i_PKCS8_PRIV_KEY_INFO_fp,
221 d2i_PKCS8_bio,
222 d2i_PKCS8_fp,
223 d2i_PKEY_USAGE_PERIOD,
224 d2i_POLICYINFO,
225 d2i_POLICYQUALINFO,
226 d2i_PROFESSION_INFO,
227 d2i_PROXY_CERT_INFO_EXTENSION,
228 d2i_PROXY_POLICY,
229 d2i_RSA_OAEP_PARAMS,
230 d2i_RSA_PSS_PARAMS,
231 d2i_SCRYPT_PARAMS,
232 d2i_SCT_LIST,
233 d2i_SXNET,
234 d2i_SXNETID,
235 d2i_TS_ACCURACY,
236 d2i_TS_MSG_IMPRINT,
237 d2i_TS_MSG_IMPRINT_bio,
238 d2i_TS_MSG_IMPRINT_fp,
239 d2i_TS_REQ,
240 d2i_TS_REQ_bio,
241 d2i_TS_REQ_fp,
242 d2i_TS_RESP,
243 d2i_TS_RESP_bio,
244 d2i_TS_RESP_fp,
245 d2i_TS_STATUS_INFO,
246 d2i_TS_TST_INFO,
247 d2i_TS_TST_INFO_bio,
248 d2i_TS_TST_INFO_fp,
249 d2i_USERNOTICE,
250 d2i_X509,
251 d2i_X509_bio,
252 d2i_X509_fp,
253 d2i_X509_ACERT,
254 d2i_X509_ACERT_bio,
255 d2i_X509_ACERT_fp,
256 d2i_X509_ALGOR,
257 d2i_X509_ALGORS,
258 d2i_X509_ATTRIBUTE,
259 d2i_X509_CERT_AUX,
260 d2i_X509_CINF,
261 d2i_X509_CRL,
262 d2i_X509_CRL_INFO,
263 d2i_X509_CRL_bio,
264 d2i_X509_CRL_fp,
265 d2i_X509_EXTENSION,
266 d2i_X509_EXTENSIONS,
267 d2i_X509_NAME,
268 d2i_X509_NAME_ENTRY,
269 d2i_X509_PUBKEY,
270 d2i_X509_PUBKEY_bio,
271 d2i_X509_PUBKEY_fp,
272 d2i_X509_REQ,
273 d2i_X509_REQ_INFO,
274 d2i_X509_REQ_bio,
275 d2i_X509_REQ_fp,
276 d2i_X509_REVOKED,
277 d2i_X509_SIG,
278 d2i_X509_VAL,
279 i2d_ACCESS_DESCRIPTION,
280 i2d_ADMISSIONS,
281 i2d_ADMISSION_SYNTAX,
282 i2d_ASIdOrRange,
283 i2d_ASIdentifierChoice,
284 i2d_ASIdentifiers,
285 i2d_ASN1_BIT_STRING,
286 i2d_ASN1_BMPSTRING,
287 i2d_ASN1_ENUMERATED,
288 i2d_ASN1_GENERALIZEDTIME,
289 i2d_ASN1_GENERALSTRING,
290 i2d_ASN1_IA5STRING,
291 i2d_ASN1_INTEGER,
292 i2d_ASN1_NULL,
293 i2d_ASN1_OBJECT,
294 i2d_ASN1_OCTET_STRING,
295 i2d_ASN1_PRINTABLE,
296 i2d_ASN1_PRINTABLESTRING,
297 i2d_ASN1_SEQUENCE_ANY,
298 i2d_ASN1_SET_ANY,
299 i2d_ASN1_T61STRING,
300 i2d_ASN1_TIME,
301 i2d_ASN1_TYPE,
302 i2d_ASN1_UNIVERSALSTRING,
303 i2d_ASN1_UTCTIME,
304 i2d_ASN1_UTF8STRING,
305 i2d_ASN1_VISIBLESTRING,
306 i2d_ASN1_bio_stream,
307 i2d_ASRange,
308 i2d_AUTHORITY_INFO_ACCESS,
309 i2d_AUTHORITY_KEYID,
310 i2d_BASIC_CONSTRAINTS,
311 i2d_CERTIFICATEPOLICIES,
312 i2d_CMS_ContentInfo,
313 i2d_CMS_ReceiptRequest,
314 i2d_CMS_bio,
315 i2d_CRL_DIST_POINTS,
316 i2d_DHxparams,
317 i2d_DIRECTORYSTRING,
318 i2d_DISPLAYTEXT,
319 i2d_DIST_POINT,
320 i2d_DIST_POINT_NAME,
321 i2d_DSA_SIG,
322 i2d_ECDSA_SIG,
323 i2d_ECPKParameters,
324 i2d_EDIPARTYNAME,
325 i2d_ESS_CERT_ID,
326 i2d_ESS_CERT_ID_V2,
327 i2d_ESS_ISSUER_SERIAL,
328 i2d_ESS_SIGNING_CERT,
329 i2d_ESS_SIGNING_CERT_V2,
330 i2d_EXTENDED_KEY_USAGE,
331 i2d_GENERAL_NAME,
332 i2d_GENERAL_NAMES,
333 i2d_IPAddressChoice,
334 i2d_IPAddressFamily,
335 i2d_IPAddressOrRange,
336 i2d_IPAddressRange,
337 i2d_ISSUER_SIGN_TOOL,
338 i2d_ISSUING_DIST_POINT,
339 i2d_NAMING_AUTHORITY,
340 i2d_NETSCAPE_CERT_SEQUENCE,
341 i2d_NETSCAPE_SPKAC,
342 i2d_NETSCAPE_SPKI,
343 i2d_NOTICEREF,
344 i2d_OCSP_BASICRESP,
345 i2d_OCSP_CERTID,
346 i2d_OCSP_CERTSTATUS,
347 i2d_OCSP_CRLID,
348 i2d_OCSP_ONEREQ,
349 i2d_OCSP_REQINFO,
350 i2d_OCSP_REQUEST,
351 i2d_OCSP_RESPBYTES,
352 i2d_OCSP_RESPDATA,
353 i2d_OCSP_RESPID,
354 i2d_OCSP_RESPONSE,
355 i2d_OCSP_REVOKEDINFO,
356 i2d_OCSP_SERVICELOC,
357 i2d_OCSP_SIGNATURE,
358 i2d_OCSP_SINGLERESP,
359 i2d_OSSL_AA_DIST_POINT,
360 i2d_OSSL_ALLOWED_ATTRIBUTES_CHOICE,
361 i2d_OSSL_ALLOWED_ATTRIBUTES_ITEM,
362 i2d_OSSL_ALLOWED_ATTRIBUTES_SYNTAX,
363 i2d_OSSL_ATAV,
364 i2d_OSSL_ATTRIBUTE_DESCRIPTOR,
365 i2d_OSSL_ATTRIBUTE_MAPPING,
366 i2d_OSSL_ATTRIBUTE_MAPPINGS,
367 i2d_OSSL_ATTRIBUTE_TYPE_MAPPING,
368 i2d_OSSL_ATTRIBUTE_VALUE_MAPPING,
369 i2d_OSSL_ATTRIBUTES_SYNTAX,
370 i2d_OSSL_AUTHORITY_ATTRIBUTE_ID_SYNTAX,
371 i2d_OSSL_BASIC_ATTR_CONSTRAINTS,
372 i2d_OSSL_CMP_ATAVS,
373 i2d_OSSL_CMP_MSG,
374 i2d_OSSL_CMP_PKIHEADER,
375 i2d_OSSL_CMP_PKISI,
376 i2d_OSSL_CRMF_CERTID,
377 i2d_OSSL_CRMF_CERTTEMPLATE,
378 i2d_OSSL_CRMF_ENCRYPTEDKEY,
379 i2d_OSSL_CRMF_ENCRYPTEDVALUE,
380 i2d_OSSL_CRMF_MSG,
381 i2d_OSSL_CRMF_MSGS,
382 i2d_OSSL_CRMF_PBMPARAMETER,
383 i2d_OSSL_CRMF_PKIPUBLICATIONINFO,
384 i2d_OSSL_CRMF_SINGLEPUBINFO,
385 i2d_OSSL_HASH,
386 i2d_OSSL_DAY_TIME,
387 i2d_OSSL_DAY_TIME_BAND,
388 i2d_OSSL_IETF_ATTR_SYNTAX,
389 i2d_OSSL_INFO_SYNTAX,
390 i2d_OSSL_INFO_SYNTAX_POINTER,
391 i2d_OSSL_ISSUER_SERIAL,
392 i2d_OSSL_NAMED_DAY,
393 i2d_OSSL_OBJECT_DIGEST_INFO,
394 i2d_OSSL_PRIVILEGE_POLICY_ID,
395 i2d_OSSL_ROLE_SPEC_CERT_ID,
396 i2d_OSSL_ROLE_SPEC_CERT_ID_SYNTAX,
397 i2d_OSSL_TARGET_CERT,
398 i2d_OSSL_TARGET,
399 i2d_OSSL_TARGETING_INFORMATION,
400 i2d_OSSL_TARGETS,
401 i2d_OSSL_TIME_PERIOD,
402 i2d_OSSL_TIME_SPEC,
403 i2d_OSSL_TIME_SPEC_ABSOLUTE,
404 i2d_OSSL_TIME_SPEC_DAY,
405 i2d_OSSL_TIME_SPEC_MONTH,
406 i2d_OSSL_TIME_SPEC_TIME,
407 i2d_OSSL_TIME_SPEC_WEEKS,
408 i2d_OSSL_TIME_SPEC_X_DAY_OF,
409 i2d_OSSL_USER_NOTICE_SYNTAX,
410 i2d_OTHERNAME,
411 i2d_PBE2PARAM,
412 i2d_PBEPARAM,
413 i2d_PBKDF2PARAM,
414 i2d_PBMAC1PARAM,
415 i2d_PKCS12,
416 i2d_PKCS12_BAGS,
417 i2d_PKCS12_MAC_DATA,
418 i2d_PKCS12_SAFEBAG,
419 i2d_PKCS12_bio,
420 i2d_PKCS12_fp,
421 i2d_PKCS7,
422 i2d_PKCS7_DIGEST,
423 i2d_PKCS7_ENCRYPT,
424 i2d_PKCS7_ENC_CONTENT,
425 i2d_PKCS7_ENVELOPE,
426 i2d_PKCS7_ISSUER_AND_SERIAL,
427 i2d_PKCS7_NDEF,
428 i2d_PKCS7_RECIP_INFO,
429 i2d_PKCS7_SIGNED,
430 i2d_PKCS7_SIGNER_INFO,
431 i2d_PKCS7_SIGN_ENVELOPE,
432 i2d_PKCS7_bio,
433 i2d_PKCS7_fp,
434 i2d_PKCS8PrivateKeyInfo_bio,
435 i2d_PKCS8PrivateKeyInfo_fp,
436 i2d_PKCS8_PRIV_KEY_INFO,
437 i2d_PKCS8_PRIV_KEY_INFO_bio,
438 i2d_PKCS8_PRIV_KEY_INFO_fp,
439 i2d_PKCS8_bio,
440 i2d_PKCS8_fp,
441 i2d_PKEY_USAGE_PERIOD,
442 i2d_POLICYINFO,
443 i2d_POLICYQUALINFO,
444 i2d_PROFESSION_INFO,
445 i2d_PROXY_CERT_INFO_EXTENSION,
446 i2d_PROXY_POLICY,
447 i2d_RSA_OAEP_PARAMS,
448 i2d_RSA_PSS_PARAMS,
449 i2d_SCRYPT_PARAMS,
450 i2d_SCT_LIST,
451 i2d_SXNET,
452 i2d_SXNETID,
453 i2d_TS_ACCURACY,
454 i2d_TS_MSG_IMPRINT,
455 i2d_TS_MSG_IMPRINT_bio,
456 i2d_TS_MSG_IMPRINT_fp,
457 i2d_TS_REQ,
458 i2d_TS_REQ_bio,
459 i2d_TS_REQ_fp,
460 i2d_TS_RESP,
461 i2d_TS_RESP_bio,
462 i2d_TS_RESP_fp,
463 i2d_TS_STATUS_INFO,
464 i2d_TS_TST_INFO,
465 i2d_TS_TST_INFO_bio,
466 i2d_TS_TST_INFO_fp,
467 i2d_USERNOTICE,
468 i2d_X509,
469 i2d_X509_bio,
470 i2d_X509_fp,
471 i2d_X509_ACERT,
472 i2d_X509_ACERT_bio,
473 i2d_X509_ACERT_fp,
474 i2d_X509_ALGOR,
475 i2d_X509_ALGORS,
476 i2d_X509_ATTRIBUTE,
477 i2d_X509_CERT_AUX,
478 i2d_X509_CINF,
479 i2d_X509_CRL,
480 i2d_X509_CRL_INFO,
481 i2d_X509_CRL_bio,
482 i2d_X509_CRL_fp,
483 i2d_X509_EXTENSION,
484 i2d_X509_EXTENSIONS,
485 i2d_X509_NAME,
486 i2d_X509_NAME_ENTRY,
487 i2d_X509_PUBKEY,
488 i2d_X509_PUBKEY_bio,
489 i2d_X509_PUBKEY_fp,
490 i2d_X509_REQ,
491 i2d_X509_REQ_INFO,
492 i2d_X509_REQ_bio,
493 i2d_X509_REQ_fp,
494 i2d_X509_REVOKED,
495 i2d_X509_SIG,
496 i2d_X509_VAL,
497 \&\- convert objects from/to ASN.1/DER representation
498 .SH SYNOPSIS
499 .IX Header "SYNOPSIS"
500 .Vb 3
501 \& TYPE *d2i_TYPE(TYPE **a, const unsigned char **ppin, long length);
502 \& TYPE *d2i_TYPE_bio(BIO *bp, TYPE **a);
503 \& TYPE *d2i_TYPE_fp(FILE *fp, TYPE **a);
504 \&
505 \& int i2d_TYPE(const TYPE *a, unsigned char **ppout);
506 \& int i2d_TYPE(TYPE *a, unsigned char **ppout);
507 \& int i2d_TYPE_fp(FILE *fp, const TYPE *a);
508 \& int i2d_TYPE_fp(FILE *fp, TYPE *a);
509 \& int i2d_TYPE_bio(BIO *bp, const TYPE *a);
510 \& int i2d_TYPE_bio(BIO *bp, TYPE *a);
511 .Ve
512 .SH DESCRIPTION
513 .IX Header "DESCRIPTION"
514 In the description here, \fR\f(BITYPE\fR\fB\fR is used a placeholder
515 for any of the OpenSSL datatypes, such as \fBX509_CRL\fR.
516 The function parameters \fIppin\fR and \fIppout\fR are generally
517 either both named \fIpp\fR in the headers, or \fIin\fR and \fIout\fR.
518 .PP
519 These functions convert OpenSSL objects to and from their ASN.1/DER
520 encoding. Unlike the C structures which can have pointers to sub-objects
521 within, the DER is a serialized encoding, suitable for sending over the
522 network, writing to a file, and so on.
523 .PP
524 \&\fBd2i_\fR\f(BITYPE\fR() attempts to decode \fIlen\fR bytes at \fI*ppin\fR. If successful a
525 pointer to the \fB\fR\f(BITYPE\fR\fB\fR structure is returned and \fI*ppin\fR is incremented to
526 the byte following the parsed data. If \fIa\fR is not NULL then a pointer
527 to the returned structure is also written to \fI*a\fR. If an error occurred
528 then NULL is returned. The caller retains ownership of the
529 returned object and needs to free it when it is no longer needed, e.g.
530 using \fBX509_free()\fR for X509 objects or \fBDSA_SIG_free()\fR for DSA_SIG objects.
531 .PP
532 On a successful return, if \fI*a\fR is not NULL then it is assumed that \fI*a\fR
533 contains a valid \fR\f(BITYPE\fR\fB\fR structure and an attempt is made to reuse it.
534 For \fB\fR\f(BITYPE\fR\fB\fR structures where it matters it is possible to set up a library
535 context on the decoded structure this way (see the \fBEXAMPLES\fR section).
536 However using the "reuse" capability for other purposes is \fBstrongly
537 discouraged\fR (see \fBBUGS\fR below, and the discussion in the \fBRETURN VALUES\fR
538 section).
539 .PP
540 \&\fBd2i_\fR\f(BITYPE\fR\fB_bio\fR() is similar to \fBd2i_\fR\f(BITYPE\fR() except it attempts
541 to parse data from BIO \fIbp\fR.
542 .PP
543 \&\fBd2i_\fR\f(BITYPE\fR\fB_fp\fR() is similar to \fBd2i_\fR\f(BITYPE\fR() except it attempts
544 to parse data from FILE pointer \fIfp\fR.
545 .PP
546 \&\fBi2d_\fR\f(BITYPE\fR() encodes the structure pointed to by \fIa\fR into DER format.
547 If \fIppout\fR is not NULL, it writes the DER encoded data to the buffer
548 at \fI*ppout\fR, and increments it to point after the data just written.
549 If the return value is negative an error occurred, otherwise it
550 returns the length of the encoded data.
551 .PP
552 If \fI*ppout\fR is NULL memory will be allocated for a buffer and the encoded
553 data written to it. In this case \fI*ppout\fR is not incremented and it points
554 to the start of the data just written.
555 .PP
556 \&\fBi2d_\fR\f(BITYPE\fR\fB_bio\fR() is similar to \fBi2d_\fR\f(BITYPE\fR() except it writes
557 the encoding of the structure \fIa\fR to BIO \fIbp\fR and it
558 returns 1 for success and 0 for failure.
559 .PP
560 \&\fBi2d_\fR\f(BITYPE\fR\fB_fp\fR() is similar to \fBi2d_\fR\f(BITYPE\fR() except it writes
561 the encoding of the structure \fIa\fR to FILE pointer \fIfp\fR and it
562 returns 1 for success and 0 for failure.
563 .PP
564 These routines do not encrypt private keys and therefore offer no
565 security; use \fBPEM_write_PrivateKey\fR\|(3) or similar for writing to files.
566 .SH NOTES
567 .IX Header "NOTES"
568 The letters \fBi\fR and \fBd\fR in \fBi2d_\fR\f(BITYPE\fR() stand for
569 "internal" (that is, an internal C structure) and "DER" respectively.
570 So \fBi2d_\fR\f(BITYPE\fR\fB\fR() converts from internal to DER.
571 .PP
572 The functions can also understand \fBBER\fR forms.
573 .PP
574 The actual TYPE structure passed to \fBi2d_\fR\f(BITYPE\fR() must be a valid
575 populated \fB\fR\f(BITYPE\fR\fB\fR structure \-\- it \fBcannot\fR simply be fed with an
576 empty structure such as that returned by \fBTYPE_new()\fR.
577 .PP
578 The encoded data is in binary form and may contain embedded zeros.
579 Therefore, any FILE pointers or BIOs should be opened in binary mode.
580 Functions such as \fBstrlen()\fR will \fBnot\fR return the correct length
581 of the encoded structure.
582 .PP
583 The ways that \fI*ppin\fR and \fI*ppout\fR are incremented after the operation
584 can trap the unwary. See the \fBWARNINGS\fR section for some common
585 errors.
586 The reason for this-auto increment behaviour is to reflect a typical
587 usage of ASN1 functions: after one structure is encoded or decoded
588 another will be processed after it.
589 .PP
590 The following points about the data types might be useful:
591 .IP \fBASN1_OBJECT\fR 4
592 .IX Item "ASN1_OBJECT"
593 Represents an ASN1 OBJECT IDENTIFIER.
594 .IP \fBDHparams\fR 4
595 .IX Item "DHparams"
596 Represents a PKCS#3 DH parameters structure.
597 .IP \fBDHxparams\fR 4
598 .IX Item "DHxparams"
599 Represents an ANSI X9.42 DH parameters structure.
600 .IP \fBECDSA_SIG\fR 4
601 .IX Item "ECDSA_SIG"
602 Represents an ECDSA signature.
603 .IP \fBX509_ALGOR\fR 4
604 .IX Item "X509_ALGOR"
605 Represents an \fBAlgorithmIdentifier\fR structure as used in IETF RFC 6960 and
606 elsewhere.
607 .IP \fBX509_NAME\fR 4
608 .IX Item "X509_NAME"
609 Represents a \fBName\fR type as used for subject and issuer names in
610 IETF RFC 6960 and elsewhere.
611 .IP \fBX509_REQ\fR 4
612 .IX Item "X509_REQ"
613 Represents a PKCS#10 certificate request.
614 .IP \fBX509_SIG\fR 4
615 .IX Item "X509_SIG"
616 Represents the \fBDigestInfo\fR structure defined in PKCS#1 and PKCS#7.
617 .SH "RETURN VALUES"
618 .IX Header "RETURN VALUES"
619 \&\fBd2i_\fR\f(BITYPE\fR(), \fBd2i_\fR\f(BITYPE\fR\fB_bio\fR() and \fBd2i_\fR\f(BITYPE\fR\fB_fp\fR() return a valid
620 \&\fB\fR\f(BITYPE\fR\fB\fR structure or NULL if an error occurs. If the "reuse" capability has
621 been used with a valid structure being passed in via \fIa\fR, then the object is
622 freed in the event of error and \fI*a\fR is set to NULL.
623 .PP
624 \&\fBi2d_\fR\f(BITYPE\fR() returns the number of bytes successfully encoded or a negative
625 value if an error occurs.
626 .PP
627 \&\fBi2d_\fR\f(BITYPE\fR\fB_bio\fR() and \fBi2d_\fR\f(BITYPE\fR\fB_fp\fR(),
628 as well as \fBi2d_ASN1_bio_stream()\fR,
629 return 1 for success and 0 if an error occurs.
630 .PP
631 On error, these functions may record the error in the OpenSSL error queue.
632 That error queue can be inspected with the \fBERR\fR family of functions, such as
633 \&\fBERR_print_errors\fR\|(3) and \fBERR_peek_last_error_all\fR\|(3).
634 .SH EXAMPLES
635 .IX Header "EXAMPLES"
636 Allocate and encode the DER encoding of an X509 structure:
637 .PP
638 .Vb 2
639 \& int len;
640 \& unsigned char *buf;
641 \&
642 \& buf = NULL;
643 \& len = i2d_X509(x, &buf);
644 \& if (len < 0)
645 \& /* error */
646 .Ve
647 .PP
648 Attempt to decode a buffer:
649 .PP
650 .Vb 4
651 \& X509 *x;
652 \& unsigned char *buf;
653 \& const unsigned char *p;
654 \& int len;
655 \&
656 \& /* Set up buf and len to point to the input buffer. */
657 \& p = buf;
658 \& x = d2i_X509(NULL, &p, len);
659 \& if (x == NULL)
660 \& /* error */
661 .Ve
662 .PP
663 Alternative technique:
664 .PP
665 .Vb 4
666 \& X509 *x;
667 \& unsigned char *buf;
668 \& const unsigned char *p;
669 \& int len;
670 \&
671 \& /* Set up buf and len to point to the input buffer. */
672 \& p = buf;
673 \& x = NULL;
674 \&
675 \& if (d2i_X509(&x, &p, len) == NULL)
676 \& /* error */
677 .Ve
678 .PP
679 Setting up a library context and property query:
680 .PP
681 .Vb 6
682 \& X509 *x;
683 \& unsigned char *buf;
684 \& const unsigned char *p;
685 \& int len;
686 \& OSSL_LIB_CTX *libctx = ....;
687 \& const char *propq = ....;
688 \&
689 \& /* Set up buf and len to point to the input buffer. */
690 \& p = buf;
691 \& x = X509_new_ex(libctx, propq);
692 \&
693 \& if (d2i_X509(&x, &p, len) == NULL)
694 \& /* error, x was freed and NULL assigned to it (see RETURN VALUES) */
695 .Ve
696 .SH WARNINGS
697 .IX Header "WARNINGS"
698 Using a temporary variable is mandatory. A common
699 mistake is to attempt to use a buffer directly as follows:
700 .PP
701 .Vb 2
702 \& int len;
703 \& unsigned char *buf;
704 \&
705 \& len = i2d_X509(x, NULL);
706 \& buf = OPENSSL_malloc(len);
707 \& ...
708 \& i2d_X509(x, &buf);
709 \& ...
710 \& OPENSSL_free(buf);
711 .Ve
712 .PP
713 This code will result in \fIbuf\fR apparently containing garbage because
714 it was incremented after the call to point after the data just written.
715 Also \fIbuf\fR will no longer contain the pointer allocated by \fBOPENSSL_malloc()\fR
716 and the subsequent call to \fBOPENSSL_free()\fR is likely to crash.
717 .PP
718 Another trap to avoid is misuse of the \fIa\fR argument to \fBd2i_\fR\f(BITYPE\fR():
719 .PP
720 .Vb 1
721 \& X509 *x;
722 \&
723 \& if (d2i_X509(&x, &p, len) == NULL)
724 \& /* error */
725 .Ve
726 .PP
727 This will probably crash somewhere in \fBd2i_X509()\fR. The reason for this
728 is that the variable \fIx\fR is uninitialized and an attempt will be made to
729 interpret its (invalid) value as an \fBX509\fR structure, typically causing
730 a segmentation violation. If \fIx\fR is set to NULL first then this will not
731 happen.
732 .SH BUGS
733 .IX Header "BUGS"
734 In some versions of OpenSSL the "reuse" behaviour of \fBd2i_\fR\f(BITYPE\fR() when
735 \&\fI*a\fR is valid is broken and some parts of the reused structure may
736 persist if they are not present in the new one. Additionally, in versions of
737 OpenSSL prior to 1.1.0, when the "reuse" behaviour is used and an error occurs
738 the behaviour is inconsistent. Some functions behaved as described here, while
739 some did not free \fI*a\fR on error and did not set \fI*a\fR to NULL.
740 .PP
741 As a result of the above issues the "reuse" behaviour is strongly discouraged.
742 .PP
743 \&\fBi2d_\fR\f(BITYPE\fR() will not return an error in many versions of OpenSSL,
744 if mandatory fields are not initialized due to a programming error
745 then the encoded structure may contain invalid data or omit the
746 fields entirely and will not be parsed by \fBd2i_\fR\f(BITYPE\fR\fB\fR(). This may be
747 fixed in future so code should not assume that \fBi2d_\fR\f(BITYPE\fR\fB\fR() will
748 always succeed.
749 .PP
750 Any function which encodes a structure (\fBi2d_\fR\f(BITYPE\fR(),
751 \&\fBi2d_\fR\f(BITYPE\fR\fB_bio\fR() or \fBi2d_\fR\f(BITYPE\fR\fB_fp\fR()) may return a stale encoding if the
752 structure has been modified after deserialization or previous
753 serialization. This is because some objects cache the encoding for
754 efficiency reasons.
755 .SH "SEE ALSO"
756 .IX Header "SEE ALSO"
757 \&\fBERR_print_errors\fR\|(3), \fBERR_peek_last_error_all\fR\|(3)
758 .SH HISTORY
759 .IX Header "HISTORY"
760 \&\fBd2i_OSSL_ATTRIBUTES_SYNTAX()\fR, \fBd2i_OSSL_BASIC_ATTR_CONSTRAINTS()\fR,
761 \&\fBd2i_OSSL_CMP_ATAVS()\fR, \fBd2i_OSSL_IETF_ATTR_SYNTAX()\fR,
762 \&\fBd2i_OSSL_TARGET()\fR, \fBd2i_OSSL_TARGETING_INFORMATION()\fR,
763 \&\fBd2i_OSSL_TARGETS()\fR, \fBd2i_OSSL_USER_NOTICE_SYNTAX()\fR,
764 \&\fBd2i_PBMAC1PARAM()\fR, \fBd2i_X509_ACERT()\fR, \fBd2i_X509_ACERT_bio()\fR,
765 \&\fBd2i_X509_ACERT_fp()\fR, \fBi2d_OSSL_ATTRIBUTES_SYNTAX()\fR,
766 \&\fBi2d_OSSL_BASIC_ATTR_CONSTRAINTS()\fR, \fBi2d_OSSL_CMP_ATAVS()\fR,
767 \&\fBi2d_OSSL_IETF_ATTR_SYNTAX()\fR, \fBi2d_OSSL_TARGET()\fR,
768 \&\fBi2d_OSSL_TARGETING_INFORMATION()\fR, \fBi2d_OSSL_TARGETS()\fR,
769 \&\fBi2d_OSSL_USER_NOTICE_SYNTAX()\fR, \fBi2d_PBMAC1PARAM()\fR, \fBi2d_X509_ACERT()\fR,
770 \&\fBi2d_X509_ACERT_bio()\fR, \fBi2d_X509_ACERT_fp()\fR
771 were added in OpenSSL 3.4.
772 .PP
773 \&\fBd2i_OSSL_AA_DIST_POINT()\fR,
774 \&\fBd2i_OSSL_ALLOWED_ATTRIBUTES_CHOICE()\fR, \fBd2i_OSSL_ALLOWED_ATTRIBUTES_ITEM()\fR,
775 \&\fBd2i_OSSL_ALLOWED_ATTRIBUTES_SYNTAX()\fR,
776 \&\fBd2i_OSSL_ATAV()\fR, \fBd2i_OSSL_ATTRIBUTE_DESCRIPTOR()\fR, \fBd2i_OSSL_ATTRIBUTE_MAPPING()\fR,
777 \&\fBd2i_OSSL_ATTRIBUTE_MAPPINGS()\fR, \fBd2i_OSSL_ATTRIBUTE_TYPE_MAPPING()\fR,
778 \&\fBd2i_OSSL_ATTRIBUTE_VALUE_MAPPING()\fR, \fBd2i_OSSL_AUTHORITY_ATTRIBUTE_ID_SYNTAX()\fR,
779 \&\fBd2i_OSSL_HASH()\fR, \fBd2i_OSSL_INFO_SYNTAX()\fR,
780 \&\fBd2i_OSSL_INFO_SYNTAX_POINTER()\fR, \fBd2i_OSSL_PRIVILEGE_POLICY_ID()\fR,
781 \&\fBd2i_OSSL_ROLE_SPEC_CERT_ID()\fR, \fBd2i_OSSL_ROLE_SPEC_CERT_ID_SYNTAX()\fR,
782 \&\fBi2d_OSSL_AA_DIST_POINT()\fR,
783 \&\fBi2d_OSSL_ALLOWED_ATTRIBUTES_CHOICE()\fR, \fBi2d_OSSL_ALLOWED_ATTRIBUTES_ITEM()\fR,
784 \&\fBi2d_OSSL_ALLOWED_ATTRIBUTES_SYNTAX()\fR,
785 \&\fBi2d_OSSL_ATAV()\fR, \fBi2d_OSSL_ATTRIBUTE_DESCRIPTOR()\fR, \fBi2d_OSSL_ATTRIBUTE_MAPPING()\fR,
786 \&\fBi2d_OSSL_ATTRIBUTE_MAPPINGS()\fR, \fBi2d_OSSL_ATTRIBUTE_TYPE_MAPPING()\fR,
787 \&\fBi2d_OSSL_ATTRIBUTE_VALUE_MAPPING()\fR, \fBi2d_OSSL_AUTHORITY_ATTRIBUTE_ID_SYNTAX()\fR,
788 \&\fBi2d_OSSL_HASH()\fR, \fBi2d_OSSL_INFO_SYNTAX()\fR,
789 \&\fBi2d_OSSL_INFO_SYNTAX_POINTER()\fR, \fBi2d_OSSL_PRIVILEGE_POLICY_ID()\fR,
790 \&\fBi2d_OSSL_ROLE_SPEC_CERT_ID()\fR, \fBi2d_OSSL_ROLE_SPEC_CERT_ID_SYNTAX()\fR,
791 \&\fBd2i_OSSL_CRMF_ENCRYPTEDKEY()\fR, \fBi2d_OSSL_CRMF_ENCRYPTEDKEY()\fR,
792 \&\fBd2i_OSSL_DAY_TIME()\fR, \fBd2i_OSSL_DAY_TIME_BAND()\fR, \fBd2i_OSSL_NAMED_DAY()\fR,
793 \&\fBd2i_OSSL_TIME_PERIOD()\fR, \fBd2i_OSSL_TIME_SPEC()\fR,
794 \&\fBd2i_OSSL_TIME_SPEC_ABSOLUTE()\fR, \fBd2i_OSSL_TIME_SPEC_DAY()\fR,
795 \&\fBd2i_OSSL_TIME_SPEC_MONTH()\fR, \fBd2i_OSSL_TIME_SPEC_TIME()\fR,
796 \&\fBd2i_OSSL_TIME_SPEC_WEEKS()\fR, \fBd2i_OSSL_TIME_SPEC_X_DAY_OF()\fR,
797 \&\fBi2d_OSSL_DAY_TIME()\fR, \fBi2d_OSSL_DAY_TIME_BAND()\fR,
798 \&\fBi2d_OSSL_NAMED_DAY()\fR, \fBi2d_OSSL_TIME_PERIOD()\fR,
799 \&\fBi2d_OSSL_TIME_SPEC()\fR, \fBi2d_OSSL_TIME_SPEC_ABSOLUTE()\fR,
800 \&\fBi2d_OSSL_TIME_SPEC_DAY()\fR, \fBi2d_OSSL_TIME_SPEC_MONTH()\fR,
801 \&\fBi2d_OSSL_TIME_SPEC_TIME()\fR, \fBi2d_OSSL_TIME_SPEC_WEEKS()\fR,
802 \&\fBi2d_OSSL_TIME_SPEC_X_DAY_OF()\fR
803 were added in OpenSSL 3.5.
804 .SH COPYRIGHT
805 .IX Header "COPYRIGHT"
806 Copyright 1998\-2025 The OpenSSL Project Authors. All Rights Reserved.
807 .PP
808 Licensed under the Apache License 2.0 (the "License"). You may not use
809 this file except in compliance with the License. You can obtain a copy
810 in the file LICENSE in the source distribution or at
811 <https://www.openssl.org/source/license.html>.