GENERAL_NAME_NEW(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’– GENERAL_NAME_NEW(3) β€” names for use in X.509 extensions πŸ’–

okay so bestie, this is the GENERAL_NAME_NEW(3) page from the libcrypto library manual β€” yes, that libcrypto, the OpenSSL one β€” and it's literally all about the name structures you use inside X.509 extensions. buckle up, it's actually cute once you get it πŸŽ€


✨ SYNOPSIS ✨

link against the β€œlibcrypto” library and pull in the header like this:

#include <openssl/x509v3.h>

then you've got these four little constructor/destructor pairs, and honestly they're all the same shape:

GENERAL_NAME *
GENERAL_NAME_new(void);

void
GENERAL_NAME_free(GENERAL_NAME *name);

GENERAL_NAMES *
GENERAL_NAMES_new(void);

void
GENERAL_NAMES_free(GENERAL_NAMES *names);

EDIPARTYNAME *
EDIPARTYNAME_new(void);

void
EDIPARTYNAME_free(EDIPARTYNAME *name);

OTHERNAME *
OTHERNAME_new(void);

void
OTHERNAME_free(OTHERNAME *name);

see? same energy every time. make one, free one. slay πŸ’…


🌸 DESCRIPTION 🌸

okay so here's the lore. there's this thing called an X.501 Name (documented over in X509_NAME_new(3)), and it is a lot β€” a whole complicated multi-layered structure. but here's the tea: even though it's huge and elaborate, it's also super rigid, and it's just not flexible enough to represent all the various entities people want to use as names in certificates 😭

so for that reason, X.509 extensions use the X.509 GeneralName wrapper structure instead of using the X.501 Name structure directly β€” and yeah, that costs you one or two additional layers of indirection, but honestly? worth it. main character tradeoff.

πŸ’« GENERAL_NAME_new() allocates and initializes an empty GENERAL_NAME object, representing the ASN.1 GeneralName structure defined in RFC 5280 section 4.2.1.6. it can for example hold an X509_name object, an IP address, a DNS host name, a uniform resource identifier, an email address, or an EDIPARTYNAME or OTHERNAME object described below. GENERAL_NAME_free() frees name.

πŸ’« GENERAL_NAMES_new() allocates and initializes an empty GENERAL_NAMES object, which is a STACK_OF(GENERAL_NAME) and represents the ASN.1 GeneralNames structure defined in RFC 5280 section 4.2.1.6. it's used by extension structures that can contain multiple names β€” for example key identifier, alternative name, and distribution point extensions. GENERAL_NAMES_free() frees names.

πŸ’« EDIPARTYNAME_new() allocates and initializes an empty EDIPARTYNAME object, representing the ASN.1 EDIPartyName structure defined in RFC 5280 section 4.2.1.6, where β€œEDI” stands for β€œelectronic data identifier”. it can hold two strings: the name itself, and the name of the authority that assigned that name. EDIPARTYNAME_free() frees name.

πŸ’« OTHERNAME_new() allocates and initializes an empty OTHERNAME object, representing the ASN.1 OtherName structure defined in RFC 5280 section 4.2.1.6. it can hold data of any ASN1_TYPE together with a type identifier. OTHERNAME_free() frees name.


πŸ¦‹ RETURN VALUES πŸ¦‹

GENERAL_NAME_new(), GENERAL_NAMES_new(), EDIPARTYNAME_new(), and OTHERNAME_new() return a new GENERAL_NAME, GENERAL_NAMES, EDIPARTYNAME, or OTHERNAME object β€” or NULL if an error occurs πŸ’€

ngl, always check for that NULL, bestie. it's giving "i forgot to vibe check the return value" and that's not the move πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ


🌈 STANDARDS 🌈

RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile, section 4.2: Certificate Extensions ✨


πŸ‘‘ HISTORY πŸ‘‘

the timeline, periodt:

  • GENERAL_NAME_new(), GENERAL_NAME_free(), GENERAL_NAMES_new(), and GENERAL_NAMES_free() first appeared in OpenSSL 0.9.2b and have been available since OpenBSD 2.6.
  • OTHERNAME_new() and OTHERNAME_free() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.
  • EDIPARTYNAME_new() and EDIPARTYNAME_free() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.

like, they've been iconic since before some of us were born fr fr 🫢


aaaand that's the whole page, bestie πŸ“ this one's the Debian build, dated June 8, 2025, filed under GENERAL_NAME_NEW(3) β€” go forth and name things responsibly πŸ’–πŸ§š

πŸ“¦ where this page comes from