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