X509_REQ_GET_EXTENSIONS(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

🌸 NAME 🌸

okay so this whole page is about the extension attributes of a CSR (that's a Certificate Signing Request, bestie πŸ’…), and it covers three functions:

  • X509_REQ_get_extensions
  • X509_REQ_add_extensions
  • X509_REQ_add_extensions_nid

they handle X.509 extension attributes of a CSR. that's the vibe. πŸŽ€


✨ 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, three little lines and you're in. iconic. πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

πŸŽ€ X509_REQ_get_extensions()

this one returns the first list of X.509 extensions it finds in the attributes of req. lowkey does exactly what it says on the tin.

if there are no such extensions in req, the returned list is just empty β€” not a whole crisis, just an empty list. πŸ™ˆ

⚠️ bestie, listen: the caller is responsible for freeing the list obtained. that's you. you free it. not me. don't leave it hanging, that's so not main character energy. πŸ’€

🧚 X509_REQ_add_extensions_nid()

this one adds to req a list of X.509 extensions called exts, using nid to identify the extensions attribute (iykyk 🫢).

the details, fr fr:

  • req stays unchanged if exts is NULL or an empty list. no notes. nothing happens. slay.
  • you can call this function more than once on the same req and nid. and in that case any previous extensions are augmented β€” meaning you're adding to what's already there.
  • and when an extension you're adding has the same OID as a pre-existing one? it replaces that earlier one. periodt. πŸ‘‘

🌈 X509_REQ_add_extensions()

this is literally like X509_REQ_add_extensions_nid() except the default NID_ext_req is used. that's the whole difference. cute, right? πŸ’œ


πŸ”₯ RETURN VALUES πŸ”₯

  • X509_REQ_get_extensions() β€” returns a pointer to STACK_OF(X509_EXTENSION), or NULL on error. 😭
  • X509_REQ_add_extensions() and X509_REQ_add_extensions_nid() β€” return 1 on success, 0 on error. so like, check it. please. πŸ™

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>.


okay that's the whole page, bestie πŸ’– this was OpenSSL 3.5.0, dated 2026-09-25, and the manual is X509_REQ_GET_EXTENSIONS(3ossl) β€” go forth and free your stacks. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from