X509_REQ_GET_EXTENSIONS(3ossl)
π X509_REQ_GET_EXTENSIONS π
okay so bestie, this is a page from the OpenSSL 3ossl manual family β it's all about the X.509 extension attributes of a CSR (y'know, a Certificate Signing Request, the little application form you send off begging a CA to sign your cert π₯Ί). Three functions, one very specific job. Let's get into it β¨
πΈ 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);
three little icons, all lined up π
π DESCRIPTION π
π¦ X509_REQ_get_extensions()
this one returns the first list of X.509 extensions it can find in the attributes of req. literally just hands you the list, no cap π«΄β¨
and if req has no such extensions? you get an empty list, not a sad error β it's fine, she's just empty π
β οΈ bestie listen to me: the caller is responsible for freeing the list obtained. that's you. you free it. not her problem. own your memory π«Ά
π§ X509_REQ_add_extensions_nid()
this one adds a list of X.509 extensions, exts, to req β and it uses nid to identify which extensions attribute it is π·οΈ
couple of rules, iykyk:
- if
extsisNULL, or it's an empty list, thenreqstays unchanged β nothing happens, we move on π - you can call this more than once on the same
reqand the samenid. iconic, honestly. - when you do that, any previous extensions get augmented β and here's the spicy bit: if an extension you're adding has the same OID as one that already exists, it replaces the earlier one. new one ate, periodt π₯
π X509_REQ_add_extensions()
same energy as X509_REQ_add_extensions_nid(), except it just uses the default NID_ext_req for you. lowkey convenient π
π RETURN VALUES π
X509_REQ_get_extensions()β returns a pointer toSTACK_OF(X509_EXTENSION), orNULLon error πX509_REQ_add_extensions()andX509_REQ_add_extensions_nid()β return1on success,0on error. yes bestie,1is the good one, don't get it twisted π
π COPYRIGHT π
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>.
fr fr read the license, it's the main character of legal text π
and that's the whole vibe check, bestie π¦ this page was serving OpenSSL 3.5.6, dated 2026-04-07 β X509_REQ_GET_EXTENSIONS(3ossl), signing off with a lil sparkle β¨ππ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms