X509_dup.pod 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. =pod
  2. =head1 NAME
  3. DECLARE_ASN1_FUNCTIONS,
  4. IMPLEMENT_ASN1_FUNCTIONS,
  5. ASN1_ITEM,
  6. ACCESS_DESCRIPTION_free,
  7. ACCESS_DESCRIPTION_new,
  8. ADMISSIONS_free,
  9. ADMISSIONS_new,
  10. ADMISSION_SYNTAX_free,
  11. ADMISSION_SYNTAX_new,
  12. ASIdOrRange_free,
  13. ASIdOrRange_new,
  14. ASIdentifierChoice_free,
  15. ASIdentifierChoice_new,
  16. ASIdentifiers_free,
  17. ASIdentifiers_new,
  18. ASRange_free,
  19. ASRange_new,
  20. AUTHORITY_INFO_ACCESS_free,
  21. AUTHORITY_INFO_ACCESS_new,
  22. AUTHORITY_KEYID_free,
  23. AUTHORITY_KEYID_new,
  24. BASIC_CONSTRAINTS_free,
  25. BASIC_CONSTRAINTS_new,
  26. CERTIFICATEPOLICIES_free,
  27. CERTIFICATEPOLICIES_new,
  28. CMS_ContentInfo_free,
  29. CMS_ContentInfo_new,
  30. CMS_ContentInfo_new_ex,
  31. CMS_ContentInfo_print_ctx,
  32. CMS_EnvelopedData_it,
  33. CMS_ReceiptRequest_free,
  34. CMS_ReceiptRequest_new,
  35. CMS_SignedData_free,
  36. CMS_SignedData_new,
  37. CRL_DIST_POINTS_free,
  38. CRL_DIST_POINTS_new,
  39. DIRECTORYSTRING_free,
  40. DIRECTORYSTRING_new,
  41. DISPLAYTEXT_free,
  42. DISPLAYTEXT_new,
  43. DIST_POINT_NAME_free,
  44. DIST_POINT_NAME_new,
  45. DIST_POINT_free,
  46. DIST_POINT_new,
  47. DSAparams_dup,
  48. ECPARAMETERS_free,
  49. ECPARAMETERS_new,
  50. ECPKPARAMETERS_free,
  51. ECPKPARAMETERS_new,
  52. EDIPARTYNAME_free,
  53. EDIPARTYNAME_new,
  54. ESS_CERT_ID_dup,
  55. ESS_CERT_ID_free,
  56. ESS_CERT_ID_new,
  57. ESS_CERT_ID_V2_dup,
  58. ESS_CERT_ID_V2_free,
  59. ESS_CERT_ID_V2_new,
  60. ESS_ISSUER_SERIAL_dup,
  61. ESS_ISSUER_SERIAL_free,
  62. ESS_ISSUER_SERIAL_new,
  63. ESS_SIGNING_CERT_dup,
  64. ESS_SIGNING_CERT_free,
  65. ESS_SIGNING_CERT_it,
  66. ESS_SIGNING_CERT_new,
  67. ESS_SIGNING_CERT_V2_dup,
  68. ESS_SIGNING_CERT_V2_free,
  69. ESS_SIGNING_CERT_V2_it,
  70. ESS_SIGNING_CERT_V2_new,
  71. EXTENDED_KEY_USAGE_free,
  72. EXTENDED_KEY_USAGE_new,
  73. GENERAL_NAMES_free,
  74. GENERAL_NAMES_new,
  75. GENERAL_NAME_dup,
  76. GENERAL_NAME_free,
  77. GENERAL_NAME_new,
  78. GENERAL_SUBTREE_free,
  79. GENERAL_SUBTREE_new,
  80. IPAddressChoice_free,
  81. IPAddressChoice_new,
  82. IPAddressFamily_free,
  83. IPAddressFamily_new,
  84. IPAddressOrRange_free,
  85. IPAddressOrRange_new,
  86. IPAddressRange_free,
  87. IPAddressRange_new,
  88. ISSUER_SIGN_TOOL_free,
  89. ISSUER_SIGN_TOOL_it,
  90. ISSUER_SIGN_TOOL_new,
  91. ISSUING_DIST_POINT_free,
  92. ISSUING_DIST_POINT_it,
  93. ISSUING_DIST_POINT_new,
  94. NAME_CONSTRAINTS_free,
  95. NAME_CONSTRAINTS_new,
  96. NAMING_AUTHORITY_free,
  97. NAMING_AUTHORITY_new,
  98. NETSCAPE_CERT_SEQUENCE_free,
  99. NETSCAPE_CERT_SEQUENCE_new,
  100. NETSCAPE_SPKAC_free,
  101. NETSCAPE_SPKAC_new,
  102. NETSCAPE_SPKI_free,
  103. NETSCAPE_SPKI_new,
  104. NOTICEREF_free,
  105. NOTICEREF_new,
  106. OCSP_BASICRESP_free,
  107. OCSP_BASICRESP_new,
  108. OCSP_CERTID_dup,
  109. OCSP_CERTID_new,
  110. OCSP_CERTSTATUS_free,
  111. OCSP_CERTSTATUS_new,
  112. OCSP_CRLID_free,
  113. OCSP_CRLID_new,
  114. OCSP_ONEREQ_free,
  115. OCSP_ONEREQ_new,
  116. OCSP_REQINFO_free,
  117. OCSP_REQINFO_new,
  118. OCSP_RESPBYTES_free,
  119. OCSP_RESPBYTES_new,
  120. OCSP_RESPDATA_free,
  121. OCSP_RESPDATA_new,
  122. OCSP_RESPID_free,
  123. OCSP_RESPID_new,
  124. OCSP_RESPONSE_new,
  125. OCSP_REVOKEDINFO_free,
  126. OCSP_REVOKEDINFO_new,
  127. OCSP_SERVICELOC_free,
  128. OCSP_SERVICELOC_new,
  129. OCSP_SIGNATURE_free,
  130. OCSP_SIGNATURE_new,
  131. OCSP_SINGLERESP_free,
  132. OCSP_SINGLERESP_new,
  133. OSSL_CMP_ITAV_dup,
  134. OSSL_CMP_ITAV_free,
  135. OSSL_CMP_MSG_dup,
  136. OSSL_CMP_MSG_it,
  137. OSSL_CMP_MSG_free,
  138. OSSL_CMP_PKIHEADER_free,
  139. OSSL_CMP_PKIHEADER_it,
  140. OSSL_CMP_PKIHEADER_new,
  141. OSSL_CMP_PKISI_dup,
  142. OSSL_CMP_PKISI_free,
  143. OSSL_CMP_PKISI_it,
  144. OSSL_CMP_PKISI_new,
  145. OSSL_CMP_PKISTATUS_it,
  146. OSSL_CRMF_CERTID_dup,
  147. OSSL_CRMF_CERTID_free,
  148. OSSL_CRMF_CERTID_it,
  149. OSSL_CRMF_CERTID_new,
  150. OSSL_CRMF_CERTTEMPLATE_free,
  151. OSSL_CRMF_CERTTEMPLATE_it,
  152. OSSL_CRMF_CERTTEMPLATE_new,
  153. OSSL_CRMF_ENCRYPTEDVALUE_free,
  154. OSSL_CRMF_ENCRYPTEDVALUE_it,
  155. OSSL_CRMF_ENCRYPTEDVALUE_new,
  156. OSSL_CRMF_MSGS_free,
  157. OSSL_CRMF_MSGS_it,
  158. OSSL_CRMF_MSGS_new,
  159. OSSL_CRMF_MSG_dup,
  160. OSSL_CRMF_MSG_free,
  161. OSSL_CRMF_MSG_it,
  162. OSSL_CRMF_MSG_new,
  163. OSSL_CRMF_PBMPARAMETER_free,
  164. OSSL_CRMF_PBMPARAMETER_it,
  165. OSSL_CRMF_PBMPARAMETER_new,
  166. OSSL_CRMF_PKIPUBLICATIONINFO_free,
  167. OSSL_CRMF_PKIPUBLICATIONINFO_it,
  168. OSSL_CRMF_PKIPUBLICATIONINFO_new,
  169. OSSL_CRMF_SINGLEPUBINFO_free,
  170. OSSL_CRMF_SINGLEPUBINFO_it,
  171. OSSL_CRMF_SINGLEPUBINFO_new,
  172. OTHERNAME_free,
  173. OTHERNAME_new,
  174. PBE2PARAM_free,
  175. PBE2PARAM_new,
  176. PBEPARAM_free,
  177. PBEPARAM_new,
  178. PBKDF2PARAM_free,
  179. PBKDF2PARAM_new,
  180. PKCS12_BAGS_free,
  181. PKCS12_BAGS_new,
  182. PKCS12_MAC_DATA_free,
  183. PKCS12_MAC_DATA_new,
  184. PKCS12_SAFEBAG_free,
  185. PKCS12_SAFEBAG_new,
  186. PKCS12_free,
  187. PKCS12_new,
  188. PKCS7_DIGEST_free,
  189. PKCS7_DIGEST_new,
  190. PKCS7_ENCRYPT_free,
  191. PKCS7_ENCRYPT_new,
  192. PKCS7_ENC_CONTENT_free,
  193. PKCS7_ENC_CONTENT_new,
  194. PKCS7_ENVELOPE_free,
  195. PKCS7_ENVELOPE_new,
  196. PKCS7_ISSUER_AND_SERIAL_free,
  197. PKCS7_ISSUER_AND_SERIAL_new,
  198. PKCS7_RECIP_INFO_free,
  199. PKCS7_RECIP_INFO_new,
  200. PKCS7_SIGNED_free,
  201. PKCS7_SIGNED_new,
  202. PKCS7_SIGNER_INFO_free,
  203. PKCS7_SIGNER_INFO_new,
  204. PKCS7_SIGN_ENVELOPE_free,
  205. PKCS7_SIGN_ENVELOPE_new,
  206. PKCS7_dup,
  207. PKCS7_free,
  208. PKCS7_new_ex,
  209. PKCS7_new,
  210. PKCS7_print_ctx,
  211. PKCS8_PRIV_KEY_INFO_free,
  212. PKCS8_PRIV_KEY_INFO_new,
  213. PKEY_USAGE_PERIOD_free,
  214. PKEY_USAGE_PERIOD_new,
  215. POLICYINFO_free,
  216. POLICYINFO_new,
  217. POLICYQUALINFO_free,
  218. POLICYQUALINFO_new,
  219. POLICY_CONSTRAINTS_free,
  220. POLICY_CONSTRAINTS_new,
  221. POLICY_MAPPING_free,
  222. POLICY_MAPPING_new,
  223. PROFESSION_INFOS_free,
  224. PROFESSION_INFOS_new,
  225. PROFESSION_INFO_free,
  226. PROFESSION_INFO_new,
  227. PROXY_CERT_INFO_EXTENSION_free,
  228. PROXY_CERT_INFO_EXTENSION_new,
  229. PROXY_POLICY_free,
  230. PROXY_POLICY_new,
  231. RSAPrivateKey_dup,
  232. RSAPublicKey_dup,
  233. RSA_OAEP_PARAMS_free,
  234. RSA_OAEP_PARAMS_new,
  235. RSA_PSS_PARAMS_free,
  236. RSA_PSS_PARAMS_new,
  237. RSA_PSS_PARAMS_dup,
  238. SCRYPT_PARAMS_free,
  239. SCRYPT_PARAMS_new,
  240. SXNETID_free,
  241. SXNETID_new,
  242. SXNET_free,
  243. SXNET_new,
  244. TLS_FEATURE_free,
  245. TLS_FEATURE_new,
  246. TS_ACCURACY_dup,
  247. TS_ACCURACY_free,
  248. TS_ACCURACY_new,
  249. TS_MSG_IMPRINT_dup,
  250. TS_MSG_IMPRINT_free,
  251. TS_MSG_IMPRINT_new,
  252. TS_REQ_dup,
  253. TS_REQ_free,
  254. TS_REQ_new,
  255. TS_RESP_dup,
  256. TS_RESP_free,
  257. TS_RESP_new,
  258. TS_STATUS_INFO_dup,
  259. TS_STATUS_INFO_free,
  260. TS_STATUS_INFO_new,
  261. TS_TST_INFO_dup,
  262. TS_TST_INFO_free,
  263. TS_TST_INFO_new,
  264. USERNOTICE_free,
  265. USERNOTICE_new,
  266. X509_ALGOR_free,
  267. X509_ALGOR_it,
  268. X509_ALGOR_new,
  269. X509_ATTRIBUTE_dup,
  270. X509_ATTRIBUTE_free,
  271. X509_ATTRIBUTE_new,
  272. X509_CERT_AUX_free,
  273. X509_CERT_AUX_new,
  274. X509_CINF_free,
  275. X509_CINF_new,
  276. X509_CRL_INFO_free,
  277. X509_CRL_INFO_new,
  278. X509_CRL_dup,
  279. X509_CRL_free,
  280. X509_CRL_new_ex,
  281. X509_CRL_new,
  282. X509_EXTENSION_dup,
  283. X509_EXTENSION_free,
  284. X509_EXTENSION_new,
  285. X509_NAME_ENTRY_dup,
  286. X509_NAME_ENTRY_free,
  287. X509_NAME_ENTRY_new,
  288. X509_NAME_dup,
  289. X509_NAME_free,
  290. X509_NAME_new,
  291. X509_REQ_INFO_free,
  292. X509_REQ_INFO_new,
  293. X509_REQ_dup,
  294. X509_REQ_free,
  295. X509_REQ_new,
  296. X509_REQ_new_ex,
  297. X509_REVOKED_dup,
  298. X509_REVOKED_free,
  299. X509_REVOKED_new,
  300. X509_SIG_free,
  301. X509_SIG_new,
  302. X509_VAL_free,
  303. X509_VAL_new,
  304. X509_dup,
  305. - ASN1 object utilities
  306. =head1 SYNOPSIS
  307. =for openssl generic
  308. #include <openssl/asn1t.h>
  309. DECLARE_ASN1_FUNCTIONS(type)
  310. IMPLEMENT_ASN1_FUNCTIONS(stname)
  311. typedef struct ASN1_ITEM_st ASN1_ITEM;
  312. extern const ASN1_ITEM TYPE_it;
  313. TYPE *TYPE_new(void);
  314. TYPE *TYPE_dup(const TYPE *a);
  315. void TYPE_free(TYPE *a);
  316. int TYPE_print_ctx(BIO *out, TYPE *a, int indent, const ASN1_PCTX *pctx);
  317. The following functions have been deprecated since OpenSSL 3.0, and can be
  318. hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
  319. see L<openssl_user_macros(7)>:
  320. DSA *DSAparams_dup(const DSA *dsa);
  321. RSA *RSAPrivateKey_dup(const RSA *rsa);
  322. RSA *RSAPublicKey_dup(const RSA *rsa);
  323. =head1 DESCRIPTION
  324. In the description below, B<I<TYPE>> is used
  325. as a placeholder for any of the OpenSSL datatypes, such as B<X509>.
  326. The OpenSSL ASN1 parsing library templates are like a data-driven bytecode
  327. interpreter.
  328. Every ASN1 object as a global variable, TYPE_it, that describes the item
  329. such as its fields. (On systems which cannot export variables from shared
  330. libraries, the global is instead a function which returns a pointer to a
  331. static variable.
  332. The macro DECLARE_ASN1_FUNCTIONS() is typically used in header files
  333. to generate the function declarations.
  334. The macro IMPLEMENT_ASN1_FUNCTIONS() is used once in a source file
  335. to generate the function bodies.
  336. B<I<TYPE>_new>() allocates an empty object of the indicated type.
  337. The object returned must be released by calling B<I<TYPE>_free>().
  338. B<I<TYPE>_new_ex>() is similar to B<I<TYPE>_new>() but also passes the
  339. library context I<libctx> and the property query I<propq> to use when retrieving
  340. algorithms from providers. This created object can then be used when loading
  341. binary data using B<d2i_I<TYPE>>().
  342. B<I<TYPE>_dup>() copies an existing object, leaving it untouched.
  343. Note, however, that the internal representation of the object
  344. may contain (besides the ASN.1 structure) further data, which is not copied.
  345. For instance, an B<X509> object usually is augmented by cached information
  346. on X.509v3 extensions, etc., and losing it can lead to wrong validation results.
  347. To avoid such situations, better use B<I<TYPE>_up_ref>() if available.
  348. For the case of B<X509> objects, an alternative to using L<X509_up_ref(3)>
  349. may be to still call B<I<TYPE>_dup>(), e.g., I<copied_cert = X509_dup(cert)>,
  350. followed by I<X509_check_purpose(copied_cert, -1, 0)>,
  351. which re-builds the cached data.
  352. B<I<TYPE>_free>() releases the object and all pointers and sub-objects
  353. within it.
  354. B<I<TYPE>_print_ctx>() prints the object I<a> on the specified BIO I<out>.
  355. Each line will be prefixed with I<indent> spaces.
  356. The I<pctx> specifies the printing context and is for internal
  357. use; use NULL to get the default behavior. If a print function is
  358. user-defined, then pass in any I<pctx> down to any nested calls.
  359. =head1 RETURN VALUES
  360. B<I<TYPE>_new>(), B<I<TYPE>_new_ex>() and B<I<TYPE>_dup>() return a pointer to
  361. the object or NULL on failure.
  362. B<I<TYPE>_print_ctx>() returns 1 on success or zero on failure.
  363. =head1 SEE ALSO
  364. L<X509_up_ref(3)>
  365. =head1 HISTORY
  366. The functions X509_REQ_new_ex(), X509_CRL_new_ex(), PKCS7_new_ex() and
  367. CMS_ContentInfo_new_ex() were added in OpenSSL 3.0.
  368. The functions DSAparams_dup(), RSAPrivateKey_dup() and RSAPublicKey_dup() were
  369. deprecated in 3.0.
  370. =head1 COPYRIGHT
  371. Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
  372. Licensed under the Apache License 2.0 (the "License"). You may not use
  373. this file except in compliance with the License. You can obtain a copy
  374. in the file LICENSE in the source distribution or at
  375. L<https://www.openssl.org/source/license.html>.
  376. =cut