NAME_CONSTRAINTS_NEW(3)
π NAME_CONSTRAINTS_NEW(3) β your girl's guide to the X.509 CA name constraints extension π
okay so this is page 3 of the Library Functions Manual, and it lives in libcrypto (the OpenSSL crypto library), so bestie, you're in the right place if you're messing with certs β¨
β¨ NAME β¨
NAME_CONSTRAINTS_new, NAME_CONSTRAINTS_free, GENERAL_SUBTREE_new, GENERAL_SUBTREE_free β it's giving X.509 CA name constraints extension energy, and honestly? iconic π«Ά
πΈ SYNOPSIS πΈ
library βlibcryptoβ #include <openssl/x509v3.h>
NAME_CONSTRAINTS *
NAME_CONSTRAINTS_new(void);
void
NAME_CONSTRAINTS_free(NAME_CONSTRAINTS *names);
GENERAL_SUBTREE *
GENERAL_SUBTREE_new(void);
void
GENERAL_SUBTREE_free(GENERAL_SUBTREE *name);
π¦ DESCRIPTION π¦
so X.509 CA certificates can use the name constraints extension to restrict the subject names of subsequent certificates in a certification path. like, gatekeeping but make it PKI π
NAME_CONSTRAINTS_new() allocates and initializes an empty NAME_CONSTRAINTS object, representing an ASN.1 NameConstraints structure defined in RFC 5280 section 4.2.1.10. and what even is that inside? literally two STACK_OF(GENERAL_SUBTREE) objects β one specifying permitted names, the other excluded names. one stack says "yes bestie come in," the other says "not you π." and NAME_CONSTRAINTS_free() frees names. periodt π
GENERAL_SUBTREE_new() allocates and initializes an empty GENERAL_SUBTREE object, representing an ASN.1 GeneralSubtree structure defined in RFC 5280 section 4.2.1.10. it's a trivial wrapper around the GENERAL_NAME object documented in GENERAL_NAME_new(3) β lowkey just a little bestie holding a GENERAL_NAME's hand π₯Ί and heads up: the standard requires the other fields of GENERAL_SUBTREE to be ignored. not me telling you to ignore them, the standard is, I'm just the messenger π§ and GENERAL_SUBTREE_free() frees name.
π RETURN VALUES π
NAME_CONSTRAINTS_new() and GENERAL_SUBTREE_new() return the new NAME_CONSTRAINTS or GENERAL_SUBTREE object, respectively, or NULL if an error occurs. so like, check for NULL, always, no cap π
π₯ SEE ALSO π₯
go read your siblings, iykyk π
π STANDARDS π
RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile, section 4.2.1.10: Name Constraints β yes, the whole title, we're being thorough π
β HISTORY β
NAME_CONSTRAINTS_new(), NAME_CONSTRAINTS_free(), GENERAL_SUBTREE_new(), and GENERAL_SUBTREE_free() first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5. vintage, but in a cute way π
k that's the whole vibe check β this page brought to you by the Debian crew, dated June 8, 2025, and yes it's still NAME_CONSTRAINTS_NEW(3) at the bottom too, we love a consistent footer π slay, go constrain some names, ily π«Άβ¨
π¦ 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