X509V3_SET_CTX(3ossl)
β¨ X509V3_set_ctx β the OpenSSL manual page, bestie edition β¨
okay so you found X509V3_SET_CTX(3ossl) in the OpenSSL docs and you're like "what is this" β don't worry, I got you. This is the page for X.509 v3 extension generation utilities, and it's lowkey the backstage pass for how certs get their extensions. Let's get into it π
πΈ NAME πΈ
X509V3_set_ctx, X509V3_set_issuer_pkey β X.509 v3 extension generation utilities
π SYNOPSIS π
#include <openssl/x509v3.h>
void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
X509_REQ *req, X509_CRL *crl, int flags);
int X509V3_set_issuer_pkey(X509V3_CTX *ctx, EVP_PKEY *pkey);
π¦ DESCRIPTION π¦
the main character: X509V3_set_ctx()
X509V3_set_ctx() fills in the basic fields of ctx (which is of type X509V3_CTX, obviously π
), giving it all the deets that functions producing X509 v3 extensions might need. Think of it as handing your bestie the context before they go make extensions for you. slay.
These functions might make use of fields of:
- the certificate subject
- the certification request req
- the certificate revocation list crl
β οΈ At most one of these three parameters can be non-NULL. pick one, bestie, not all three. it's giving monogamy.
When constructing the subject key identifier of a certificate by computing a hash value of its public key, the public key is taken from subject or req. And similarly, when constructing subject alternative names from any email addresses contained in a subject DN, the subject DN is taken from subject or req.
If subject or crl is provided, issuer should point to its issuer β for instance, as a reference for generating the authority key identifier extension. ngl that's a vibe.
issuer may be the same pointer value as subject (which usually is an indication that the subject certificate is self-issued or even self-signed β main character energy honestly π). In this case the fallback source for generating the authority key identifier extension will be taken from any value provided using X509V3_set_issuer_pkey().
Now, flags: it can be 0, or it can contain:
X509V3_CTX_TESTβ which means that just the syntax of extension definitions is to be checked, without actually producing any extension. a little dry run moment β¨X509V3_CTX_REPLACEβ which means that each X.509v3 extension added as defined in some configuration section shall replace any already existing extension with the same OID. out with the old, in with the new π
the sidekick: X509V3_set_issuer_pkey()
X509V3_set_issuer_pkey() explicitly sets the issuer private key of the subject certificate that has been provided in ctx. This should be done in case the issuer and subject arguments to X509V3_set_ctx() have the same pointer value, so it can provide fallback data for the authority key identifier extension. like, "hey, you two are the same person, here's the key just in case" π«Ά
π RETURN VALUES π
X509V3_set_issuer_pkey() returns 1 on success and 0 on error. that's it. that's the whole vibe check.
β SEE ALSO β
π HISTORY π
X509V3_set_issuer_pkey()was added in OpenSSL 3.0.CTX_TESTwas deprecated in OpenSSL 3.0; useX509V3_CTX_TESTinstead. (iykyk β the old name is giving legacy π)
π COPYRIGHT π
Copyright 2015-2025 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 π tysm for reading, this was X509V3_SET_CTX(3ossl) from the OpenSSL 3.5.9 manual, dated 2026-09-29 β go forth and generate extensions responsibly, mwah πβ¨
π¦ 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