X509_REQ_GET_EXTENSIONS(3SSL)

πŸ’– X509_REQ_GET_EXTENSIONS πŸ’–

okay so bestie, this is the X509_REQ_GET_EXTENSIONS(3SSL) page straight outta the OpenSSL manual, and it's all about ✨the extension attributes of a Certificate Signing Request (CSR)✨ β€” like, the little bonus vibes you attach to a CSR before anyone signs it. three functions, one very specific job. let's get into it 🫢


🌸 NAME 🌸

X509_REQ_get_extensions, X509_REQ_add_extensions, X509_REQ_add_extensions_nid β€” the girls that handle X.509 extension attributes of a CSR πŸ’…


✨ SYNOPSIS ✨

#include <openssl/x509.h>

STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(const X509_REQ *req);
int X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *exts);
int X509_REQ_add_extensions_nid(X509_REQ *req,
                                const STACK_OF(X509_EXTENSION) *exts, int nid);

πŸ¦‹ DESCRIPTION πŸ¦‹

X509_REQ_get_extensions() is your lil reader πŸ“– β€” it returns the first list of X.509 extensions it finds in the attributes of req. and if req has no such extensions? you get an empty list, no drama. but heads up, the caller is responsible for freeing the list it gets back β€” that stack is yours now, bestie, don't just leave it lying around 😭

X509_REQ_add_extensions_nid() is the writer πŸ’… it adds a list of X.509 extensions, exts, onto req, using nid to identify which extensions attribute this is. and if exts is NULL or an empty list? req stays exactly how it was, untouched, not a single hair out of place πŸŽ€

here's the cute part: you can call this function more than once on the same req and the same nid. when you do that, the previous extensions get augmented β€” so new stuff gets layered on top of the old stuff. and if an extension you're adding has the same OID as one that already existed? it replaces the earlier one. same OID = old one is gone, new one is the moment. girlboss behavior, honestly πŸ‘‘

X509_REQ_add_extensions() is literally just X509_REQ_add_extensions_nid() but with the default NID_ext_req used instead of you passing a nid. same energy, less typing ✨


πŸŽ€ RETURN VALUES πŸŽ€

  • X509_REQ_get_extensions() β€” hands you a pointer to STACK_OF(X509_EXTENSION), or NULL if something went wrong 😭
  • X509_REQ_add_extensions() and X509_REQ_add_extensions_nid() β€” 1 on success, 0 on error. that's it, that's the whole vibe βœ“

πŸ‘‘ HISTORY πŸ‘‘

X509_REQ_get_extensions() was constified in OpenSSL 4.0. periodt πŸ’…


Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.


and that's the whole page, bestie 🫢 thanks for reading my little manpage moment β€” this was OpenSSL 4.0.3, dated 2026-09-29, and I'm X509_REQ_GET_EXTENSIONS(3SSL) signing off πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from