X509_NAME_NEW(3)
π X509_NAME_NEW β X.501 Name object
Okay bestie, so this one lives in the Library Functions Manual (yes, the libcrypto girlies, we're back at it again) and it's all about the X509_NAME glow-up: creating one, and freeing one. Let's get into it π
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/x509.h>
X509_NAME *
X509_NAME_new(void);
void
X509_NAME_free(X509_NAME *name);
πΈ DESCRIPTION πΈ
So picture this: an X.501 Name is literally just an ordered sequence of relative distinguished names. And a relative distinguished name? It's a set of key-value pairs β like the most organized little group chat ever. See X509_NAME_ENTRY_new(3) for the deets on those π
Various X.509 structures have X.501 Name substructures living inside them. Where at? For example: the issuers of certificates and certificate revocation lists, and the subjects of certificates and certificate requests. So like, everywhere. Main character energy honestly π
X509_NAME_new() allocates and initializes an empty X509_NAME object, which represents an ASN.1 Name structure defined in RFC 5280 section 4.1.2.4. Think of it as a fresh new empty profile page β¨ You can add data to these objects with the functions described in X509_NAME_add_entry_by_txt(3), and you can inspect them with the functions described in X509_NAME_get_index_by_NID(3). So cute, so useful π¦
X509_NAME_free() frees name and all the X509_NAME_ENTRY objects contained in it. Like, every single one, no leftovers π And if name is a NULL pointer, no action occurs β nothing happens, we simply move on, periodt π
π«Ά RETURN VALUES π«Ά
X509_NAME_new() returns a new X509_NAME object, or NULL if an error occurred. So always check, bestie β NULL is the vibe check failing π
π₯ SEE ALSO π₯
d2i_X509_NAME(3)GENERAL_NAME_new(3)NAME_CONSTRAINTS_new(3)SSL_load_client_CA_file(3)X509_get_subject_name(3)X509_NAME_add_entry_by_txt(3)X509_NAME_cmp(3)X509_NAME_digest(3)X509_NAME_ENTRY_new(3)X509_NAME_get_index_by_NID(3)X509_NAME_hash(3)X509_NAME_print_ex(3)X509_new(3)
π STANDARDS π
- RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile
- ITU-T Recommendation X.501, also known as ISO/IEC 9594-2: Information Technology β Open Systems Interconnection β The Directory: Models, section 9: Names
π§ HISTORY π§
X509_NAME_new() and X509_NAME_free() appeared in SSLeay 0.4 or earlier β like, ancient. Iconic longevity honestly. And they've been available since OpenBSD 2.4. Fr fr, elder statesmen of the crypto world β
and that's the whole page, bestie β go forth and name things πβ¨ππ¦πΈπ π«Ά
This one came to you from Debian, dated June 8, 2025 β X509_NAME_NEW(3), signing off ππ
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms