X509_REQ_ADD_EXTENSIONS(3)

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

🌸 NAME 🌸

This is a Library Functions Manual page for X509_REQ_ADD_EXTENSIONS(3), and it’s all about extensions in certification requests β€” periodt. πŸ’… The squad is X509_REQ_add_extensions, X509_REQ_add_extensions_nid, X509_REQ_get_extensions, and X509_REQ_extension_nid. Lowkey iconic.

✨ SYNOPSIS ✨

Bestie, you’re pulling from library β€œlibcrypto” and you include #include <openssl/x509.h>. Here are the signatures, exactly:

int
X509_REQ_add_extensions(X509_REQ *req,
    STACK_OF(X509_EXTENSION) *extensions);

int
X509_REQ_add_extensions_nid(X509_REQ *req,
    STACK_OF(X509_EXTENSION) *extensions, int nid);

STACK_OF(X509_EXTENSION) *
X509_REQ_get_extensions(X509_REQ *req);

int
X509_REQ_extension_nid(int nid);

πŸ› οΈ DESCRIPTION πŸ› οΈ

  • X509_REQ_add_extensions() β€” encodes the array of extensions using i2d_X509_EXTENSIONS(3) and adds a new X.501 Attribute object of the type NID_ext_req to req using the equivalent of X509_ATTRIBUTE_create_by_NID(3) with a type of V_ASN1_SEQUENCE. It’s giving β€œwrap it up and attach it” energy. πŸŽ€
  • X509_REQ_add_extensions_nid() β€” identical except that the specified nid is used as the X.501 Attribute type instead of NID_ext_req. Same vibe, different NID. ✨
  • X509_REQ_get_extensions() β€” retrieves the first value of the first X.501 Attribute of appropriate type. By default, the attribute types NID_ext_req and NID_ms_ext_req are considered appropriate. It’s literally the β€œfind the right attribute” main character. πŸ‘‘
  • X509_REQ_extension_nid() β€” checks whether X509_REQ_get_extensions() regards the nid argument as a type appropriate for storing extensions. Vibe check for NIDs. πŸ’…

πŸ’– RETURN VALUES πŸ’–

  • X509_REQ_add_extensions() and X509_REQ_add_extensions_nid() return 1 for success or 0 for failure. Slay or flop, no in-between. 😭
  • X509_REQ_get_extensions() returns a newly allocated array of ASN.1 Extension objects or NULL if req is NULL, does not contain CertificationRequestInfo, contains no attribute of an appropriate type, or if decoding or memory allocation fails. That’s a lot of ways to catch a NULL, bestie. πŸ’€
  • X509_REQ_extension_nid() returns 1 if nid is considered appropriate or 0 otherwise. Simple vibe check. βœ…

πŸ¦‹ SEE ALSO πŸ¦‹

The friends of this page, iykyk.

🌈 HISTORY 🌈

These functions first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7. Old-school but still serving. 🫢


Ok that’s the whole page, bestie! πŸ’– This cutie is from Debian, dated June 8, 2025, and the manual is X509_REQ_ADD_EXTENSIONS(3). Bye! 🫢✨

πŸ“¦ where this page comes from