X509_SUPPORTED_EXTENSION(3ssl)
π
X509_EXTENSION_SET_OBJEC(3) / X509_supported_extension(3ssl) β Library Functions Manual vibes β¨
okay so bestie, welcome to the Library Functions Manual corner of the group chat π. This is the X509_EXTENSION_SET_OBJEC(3) page, and the whole X509_supported_extension() crew is here too. No cap, it's all about creating, changing, and inspecting X.509 Extension objects.
πΈ NAME πΈ
This page is about the whole squad: X509_EXTENSION_new, X509_EXTENSION_dup, X509_EXTENSION_free, X509_EXTENSION_create_by_NID, X509_EXTENSION_create_by_OBJ, X509_EXTENSION_set_object, X509_EXTENSION_set_critical, X509_EXTENSION_set_data, X509_EXTENSION_get_object, X509_EXTENSION_get_critical, X509_EXTENSION_get_data, and X509_supported_extension β all here to create, change, and inspect X.509 Extension objects. Periodt π
.
β¨ SYNOPSIS β¨
#include <openssl/x509.h>
X509_EXTENSION *
X509_EXTENSION_new(void);
X509_EXTENSION *
X509_EXTENSION_dup(X509_EXTENSION *ex);
void
X509_EXTENSION_free(X509_EXTENSION *ex);
X509_EXTENSION *
X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, int nid, int crit,
ASN1_OCTET_STRING *data);
X509_EXTENSION *
X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
const ASN1_OBJECT *obj, int crit, ASN1_OCTET_STRING *data);
int
X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj);
int
X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
int
X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);
ASN1_OBJECT *
X509_EXTENSION_get_object(X509_EXTENSION *ex);
int
X509_EXTENSION_get_critical(const X509_EXTENSION *ex);
ASN1_OCTET_STRING *
X509_EXTENSION_get_data(X509_EXTENSION *ex);
int
X509_supported_extension(X509_EXTENSION *ex);
π¦ DESCRIPTION π¦
X509_EXTENSION_new() allocates and initializes an empty X509_EXTENSION object, representing an ASN.1 Extension structure defined in RFC 5280 section 4.1. It is a wrapper object around specific extension objects of different types and stores an extension type identifier and a criticality flag in addition to the DER-encoded form of the wrapped object. X509_EXTENSION objects can be used for X.509 v3 certificates inside X509_CINF objects and for X.509 v2 certificate revocation lists inside X509_CRL_INFO and X509_REVOKED objects. iconic behavior honestly π
Here's the function-by-function tea:
X509_EXTENSION_dup()β creates a deep copy of ex usingASN1_item_dup(3).X509_EXTENSION_free()β frees ex and all objects it is using.X509_EXTENSION_create_by_NID()β creates an extension of type nid and criticality crit using thedataargument as its data. The created extension is returned and written to*ex, reusing or allocating a new extension if necessary, so*exshould either beNULLor a validX509_EXTENSIONstructure. It must not be an uninitialised pointer. bestie please do not hand her an uninitialised pointer, that's not the vibe πX509_EXTENSION_create_by_OBJ()β identical toX509_EXTENSION_create_by_NID()except that it creates an extension using obj instead of a NID.X509_EXTENSION_set_object()β sets the extension type of ex to obj. The obj pointer is duplicated internally so obj should be freed up after use.X509_EXTENSION_set_critical()β sets the criticality of ex to crit. If crit is zero, the extension is non-critical, otherwise it is critical.X509_EXTENSION_set_data()β sets the data in extension ex to data. The data pointer is duplicated internally.X509_EXTENSION_get_object()β returns the extension type of ex as anASN1_OBJECTpointer. The returned pointer is an internal value which must not be freed up.X509_EXTENSION_get_critical()β tests whether ex is critical.X509_EXTENSION_get_data()β returns the data of extension ex. The returned pointer is an internal value which must not be freed up.X509_supported_extension()β checks whether ex is of a type supported by the verifier. The list of supported extension types is hardcoded into the library. If an extension is critical but unsupported, the certificate will normally be rejected.
π¨ warning bestie: these functions manipulate the contents of an extension directly. Most applications will want to parse or encode and add an extension: they should use the extension encode and decode functions instead such asX509_add1_ext_i2d(3)andX509_get_ext_d2i(3).
The data associated with an extension is the extension encoding in an ASN1_OCTET_STRING structure. literally the whole plot π
π RETURN VALUES π
X509_EXTENSION_new(),X509_EXTENSION_dup(),X509_EXTENSION_create_by_NID(), andX509_EXTENSION_create_by_OBJ()β return anX509_EXTENSIONpointer orNULLif an error occurs.X509_EXTENSION_set_object(),X509_EXTENSION_set_critical(), andX509_EXTENSION_set_data()β return1for success or0for failure.X509_EXTENSION_get_object()β returns anASN1_OBJECTpointer.X509_EXTENSION_get_critical()β returns0for non-critical or1for critical.X509_EXTENSION_get_data()β returns anASN1_OCTET_STRINGpointer.X509_supported_extension()β returns1if the type of ex is supported by the verifier or0otherwise.
π SEE ALSO π
ACCESS_DESCRIPTION_new(3), AUTHORITY_KEYID_new(3), BASIC_CONSTRAINTS_new(3), d2i_X509_EXTENSION(3), DIST_POINT_new(3), ESS_SIGNING_CERT_new(3), EXTENDED_KEY_USAGE_new(3), GENERAL_NAME_new(3), NAME_CONSTRAINTS_new(3), OCSP_CRLID_new(3), OCSP_SERVICELOC_new(3), PKEY_USAGE_PERIOD_new(3), POLICYINFO_new(3), TS_REQ_new(3), X509_check_ca(3), X509_check_host(3), X509_check_issued(3), X509_get_extension_flags(3), X509_REQ_add_extensions(3), X509V3_EXT_get_nid(3), X509V3_EXT_print(3), X509V3_extensions_print(3), X509V3_get_d2i(3), X509v3_get_ext_by_NID(3)
β STANDARDS β
RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile
π HISTORY π
X509_EXTENSION_new() and X509_EXTENSION_free() first appeared in SSLeay 0.6.2, X509_EXTENSION_dup() in SSLeay 0.6.5, and X509_EXTENSION_create_by_NID(), X509_EXTENSION_create_by_OBJ(), X509_EXTENSION_set_object(), X509_EXTENSION_set_critical(), X509_EXTENSION_set_data(), X509_EXTENSION_get_object(), X509_EXTENSION_get_critical(), and X509_EXTENSION_get_data() in SSLeay 0.8.0. These functions have been available since OpenBSD 2.4.
X509_supported_extension() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2.
mwah π β this cutie came from Debian, dated December 28, 2024, and the footer says X509_EXTENSION_SET_OBJECT(3) while the header says X509_EXTENSION_SET_OBJEC(3). we love a little header-to-footer glow-up, fr fr π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2016, 2021, 2024 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2015 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms