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