X509_REQ_GET_EXTENSIONS(3ossl)
π X509_REQ_GET_EXTENSIONS π
okay bestie, gather round, because we're about to talk about X509_REQ_get_extensions, X509_REQ_add_extensions, and X509_REQ_add_extensions_nid β the trio that handles the X.509 extension attributes of a CSR π
(this is from the 3ossl manual, OpenSSL's own lil corner of the docs, iykyk β¨)
β¨ 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);
like, just three lil functions, no big deal π
πΈ DESCRIPTION πΈ
X509_REQ_get_extensions()
she returns the first list of X.509 extensions she can find in the attributes of req π¦
if there are literally no such extensions in req? the returned list is just empty. no drama, no tears. π
β οΈ okay but listen β the caller is responsible for freeing the list obtained. that's you. you're the caller. it's giving "you break it you buy it" but for memory. no cap. π«Ά
X509_REQ_add_extensions_nid()
this one adds a list of X.509 extensions exts to req, using nid to identify the extensions attribute β¨
- if
extsisNULL, or it's an empty list βreqis unchanged. she said "not today" π - you can call this function more than once on the same
reqandnid! in that case any previous extensions get augmented β and here's the tea: if an extension you're adding has the same OID as one that's already there, the new one replaces the earlier one π
X509_REQ_add_extensions()
she's exactly like X509_REQ_add_extensions_nid() except that the default NID_ext_req is used π
simple. iconic. no notes. π
β 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 π
so like, check your return values bestie. NULL and 0 are not the vibe. π₯
π 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>.
and that's the whole page, bestie!! π§ this was OpenSSL 3.5.9, dated 2026-09-29, filed under X509_REQ_GET_EXTENSIONS(3ossl) β mwah, go forth and handle those CSR extension attributes responsibly π
β¨π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms