d2i_X509.3ossl 21 KB

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