| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "X509_STORE_CTX_NEW 3SSL" |
| 58 |
.TH X509_STORE_CTX_NEW 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
X509_STORE_CTX_new_ex, X509_STORE_CTX_new, X509_STORE_CTX_cleanup, |
| 65 |
X509_STORE_CTX_free, X509_STORE_CTX_init, |
| 66 |
X509_STORE_CTX_init_rpk, |
| 67 |
X509_STORE_CTX_set0_trusted_stack, |
| 68 |
X509_STORE_CTX_set_cert, X509_STORE_CTX_set0_crls, |
| 69 |
X509_STORE_CTX_set0_rpk, |
| 70 |
X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param, |
| 71 |
X509_STORE_CTX_get0_untrusted, X509_STORE_CTX_set0_untrusted, |
| 72 |
X509_STORE_CTX_get_num_untrusted, |
| 73 |
X509_STORE_CTX_get0_chain, X509_STORE_CTX_set0_verified_chain, |
| 74 |
X509_STORE_CTX_get0_rpk, |
| 75 |
X509_STORE_CTX_set_default, |
| 76 |
X509_STORE_CTX_set_verify, |
| 77 |
X509_STORE_CTX_verify_fn, |
| 78 |
X509_STORE_CTX_set_ocsp_resp, |
| 79 |
X509_STORE_CTX_set_purpose, |
| 80 |
X509_STORE_CTX_set_trust, |
| 81 |
X509_STORE_CTX_purpose_inherit |
| 82 |
\&\- X509_STORE_CTX initialisation |
| 83 |
.SH SYNOPSIS |
| 84 |
.IX Header "SYNOPSIS" |
| 85 |
.Vb 1 |
| 86 |
\& #include <openssl/x509_vfy.h> |
| 87 |
\& |
| 88 |
\& X509_STORE_CTX *X509_STORE_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq); |
| 89 |
\& X509_STORE_CTX *X509_STORE_CTX_new(void); |
| 90 |
\& void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); |
| 91 |
\& void X509_STORE_CTX_free(X509_STORE_CTX *ctx); |
| 92 |
\& |
| 93 |
\& int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *trust_store, |
| 94 |
\& X509 *target, STACK_OF(X509) *untrusted); |
| 95 |
\& int X509_STORE_CTX_init_rpk(X509_STORE_CTX *ctx, X509_STORE *trust_store, |
| 96 |
\& EVP_PKEY *rpk); |
| 97 |
\& |
| 98 |
\& void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); |
| 99 |
\& |
| 100 |
\& void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *target); |
| 101 |
\& void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk); |
| 102 |
\& void X509_STORE_CTX_set0_rpk(X509_STORE_CTX *ctx, EVP_PKEY *target); |
| 103 |
\& |
| 104 |
\& X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(const X509_STORE_CTX *ctx); |
| 105 |
\& void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); |
| 106 |
\& |
| 107 |
\& STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(const X509_STORE_CTX *ctx); |
| 108 |
\& void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); |
| 109 |
\& |
| 110 |
\& int X509_STORE_CTX_get_num_untrusted(const X509_STORE_CTX *ctx); |
| 111 |
\& STACK_OF(X509) *X509_STORE_CTX_get0_chain(const X509_STORE_CTX *ctx); |
| 112 |
\& void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *chain); |
| 113 |
\& EVP_PKEY *X509_STORE_CTX_get0_rpk(const X509_STORE_CTX *ctx); |
| 114 |
\& |
| 115 |
\& int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); |
| 116 |
\& typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); |
| 117 |
\& void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, X509_STORE_CTX_verify_fn verify); |
| 118 |
\& |
| 119 |
\& void X509_STORE_CTX_set_ocsp_resp(X509_STORE_CTX *ctx, STACK_OF(OCSP_RESPONSE) *sk); |
| 120 |
\& int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); |
| 121 |
\& int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); |
| 122 |
\& int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, |
| 123 |
\& int purpose, int trust); |
| 124 |
.Ve |
| 125 |
.SH DESCRIPTION |
| 126 |
.IX Header "DESCRIPTION" |
| 127 |
These functions initialise an \fBX509_STORE_CTX\fR structure for subsequent use |
| 128 |
by \fBX509_verify_cert\fR\|(3) or \fBX509_STORE_CTX_verify\fR\|(3). |
| 129 |
.PP |
| 130 |
\&\fBX509_STORE_CTX_new_ex()\fR returns a newly initialised \fBX509_STORE_CTX\fR |
| 131 |
structure associated with the specified library context \fIlibctx\fR and property |
| 132 |
query string \fIpropq\fR. Any cryptographic algorithms fetched while performing |
| 133 |
processing with the X509_STORE_CTX will use that library context and property |
| 134 |
query string. |
| 135 |
.PP |
| 136 |
\&\fBX509_STORE_CTX_new()\fR is the same as \fBX509_STORE_CTX_new_ex()\fR except that |
| 137 |
the default library context and a NULL property query string are used. |
| 138 |
.PP |
| 139 |
\&\fBX509_STORE_CTX_cleanup()\fR internally cleans up an \fBX509_STORE_CTX\fR structure. |
| 140 |
It is used by \fBX509_STORE_CTX_init()\fR and \fBX509_STORE_CTX_free()\fR. |
| 141 |
.PP |
| 142 |
\&\fBX509_STORE_CTX_free()\fR completely frees up \fIctx\fR. After this call \fIctx\fR |
| 143 |
is no longer valid. |
| 144 |
If \fIctx\fR is NULL nothing is done. |
| 145 |
.PP |
| 146 |
\&\fBX509_STORE_CTX_init()\fR sets up \fIctx\fR for a subsequent verification operation. |
| 147 |
.PP |
| 148 |
\&\fBX509_STORE_CTX_init()\fR initializes the internal state and resources of the |
| 149 |
given \fIctx\fR. Among others, it sets the verification parameters associated |
| 150 |
with the method name \f(CW\*(C`default\*(C'\fR, which includes the \f(CW\*(C`any\*(C'\fR purpose, |
| 151 |
and takes over callback function pointers from \fItrust_store\fR (unless NULL). |
| 152 |
It must be called before each call to \fBX509_verify_cert\fR\|(3) or |
| 153 |
\&\fBX509_STORE_CTX_verify\fR\|(3), i.e., a context is only good for one verification. |
| 154 |
If you want to verify a further certificate or chain with the same \fIctx\fR |
| 155 |
then you must call \fBX509_STORE_CTX_init()\fR again. |
| 156 |
The trusted certificate store is set to \fItrust_store\fR of type \fBX509_STORE\fR. |
| 157 |
This may be NULL because there are no trusted certificates or because |
| 158 |
they are provided simply as a list using \fBX509_STORE_CTX_set0_trusted_stack()\fR. |
| 159 |
The certificate to be verified is set to \fItarget\fR, |
| 160 |
and a list of additional certificates may be provided in \fIuntrusted\fR, |
| 161 |
which will be untrusted but may be used to build the chain. |
| 162 |
The \fItarget\fR certificate is not copied (its reference count is not updated), |
| 163 |
and the caller must not free it before verification is complete. |
| 164 |
Each of the \fItrust_store\fR, \fItarget\fR and \fIuntrusted\fR parameters can be NULL. |
| 165 |
Yet note that \fBX509_verify_cert\fR\|(3) and \fBX509_STORE_CTX_verify\fR\|(3) |
| 166 |
will need a verification target. |
| 167 |
This can also be set using \fBX509_STORE_CTX_set_cert()\fR. |
| 168 |
For \fBX509_STORE_CTX_verify\fR\|(3), which takes by default the first element of the |
| 169 |
list of untrusted certificates as its verification target, |
| 170 |
this can be also set indirectly using \fBX509_STORE_CTX_set0_untrusted()\fR. |
| 171 |
.PP |
| 172 |
\&\fBX509_STORE_CTX_init_rpk()\fR sets up \fIctx\fR for a subsequent verification |
| 173 |
operation for the \fItarget\fR raw public key. |
| 174 |
It behaves similarly to \fBX509_STORE_CTX_init()\fR. |
| 175 |
The \fItarget\fR raw public key can also be supplied separately, via |
| 176 |
\&\fBX509_STORE_CTX_set0_rpk()\fR. |
| 177 |
The \fItarget\fR public key is not copied (its reference count is not updated), |
| 178 |
and the caller must not free it before verification is complete. |
| 179 |
.PP |
| 180 |
\&\fBX509_STORE_CTX_set0_trusted_stack()\fR sets the set of trusted certificates of |
| 181 |
\&\fIctx\fR to \fIsk\fR. This is an alternative way of specifying trusted certificates |
| 182 |
instead of using an \fBX509_STORE\fR where its complexity is not needed |
| 183 |
or to make sure that only the given set \fIsk\fR of certificates are trusted. |
| 184 |
.PP |
| 185 |
\&\fBX509_STORE_CTX_set_cert()\fR sets the target certificate to be verified in \fIctx\fR |
| 186 |
to \fItarget\fR. |
| 187 |
The target certificate is not copied (its reference count is not updated), |
| 188 |
and the caller must not free it before verification is complete. |
| 189 |
.PP |
| 190 |
\&\fBX509_STORE_CTX_set0_rpk()\fR sets the target raw public key to be verified in \fIctx\fR |
| 191 |
to \fItarget\fR, a non-NULL raw public key preempts any target certificate, which |
| 192 |
is then ignored. |
| 193 |
The \fItarget\fR public key is not copied (its reference count is not updated), |
| 194 |
and the caller must not free it before verification is complete. |
| 195 |
.PP |
| 196 |
\&\fBX509_STORE_CTX_set0_verified_chain()\fR sets the validated chain to \fIchain\fR. |
| 197 |
Ownership of the chain is transferred to \fIctx\fR, |
| 198 |
and so it should not be free'd by the caller. |
| 199 |
.PP |
| 200 |
\&\fBX509_STORE_CTX_get0_chain()\fR returns the internal pointer used by the |
| 201 |
\&\fIctx\fR that contains the constructed (output) chain. |
| 202 |
.PP |
| 203 |
\&\fBX509_STORE_CTX_get0_rpk()\fR returns the internal pointer used by the |
| 204 |
\&\fIctx\fR that contains the raw public key. |
| 205 |
.PP |
| 206 |
\&\fBX509_STORE_CTX_set0_crls()\fR sets a set of CRLs to use to aid certificate |
| 207 |
verification to \fIsk\fR. These CRLs will only be used if CRL verification is |
| 208 |
enabled in the associated \fBX509_VERIFY_PARAM\fR structure. This might be |
| 209 |
used where additional "useful" CRLs are supplied as part of a protocol, |
| 210 |
for example in a PKCS#7 structure. |
| 211 |
.PP |
| 212 |
\&\fBX509_STORE_CTX_get0_param()\fR retrieves an internal pointer |
| 213 |
to the verification parameters associated with \fIctx\fR. |
| 214 |
.PP |
| 215 |
\&\fBX509_STORE_CTX_set0_param()\fR sets the internal verification parameter pointer |
| 216 |
to \fIparam\fR. After this call \fBparam\fR should not be used. |
| 217 |
.PP |
| 218 |
\&\fBX509_STORE_CTX_get0_untrusted()\fR retrieves an internal pointer to the |
| 219 |
stack of untrusted certificates associated with \fIctx\fR. |
| 220 |
.PP |
| 221 |
\&\fBX509_STORE_CTX_set0_untrusted()\fR sets the internal pointer to the stack |
| 222 |
of untrusted certificates associated with \fIctx\fR to \fIsk\fR. |
| 223 |
\&\fBX509_STORE_CTX_verify()\fR will take the first element, if any, |
| 224 |
as its default target if the target certificate is not set explicitly. |
| 225 |
.PP |
| 226 |
\&\fBX509_STORE_CTX_get_num_untrusted()\fR returns the number of untrusted certificates |
| 227 |
that were used in building the chain. |
| 228 |
This is can be used after calling \fBX509_verify_cert\fR\|(3) and similar functions. |
| 229 |
With \fBX509_STORE_CTX_verify\fR\|(3), this does not count the first chain element. |
| 230 |
.PP |
| 231 |
\&\fBX509_STORE_CTX_get0_chain()\fR returns the internal pointer used by the |
| 232 |
\&\fIctx\fR that contains the validated chain. |
| 233 |
.PP |
| 234 |
Details of the chain building and checking process are described in |
| 235 |
"Certification Path Building" in \fBopenssl\-verification\-options\fR\|(1) and |
| 236 |
"Certification Path Validation" in \fBopenssl\-verification\-options\fR\|(1). |
| 237 |
.PP |
| 238 |
\&\fBX509_STORE_CTX_set0_verified_chain()\fR sets the validated chain used |
| 239 |
by \fIctx\fR to be \fIchain\fR. |
| 240 |
Ownership of the chain is transferred to \fIctx\fR, |
| 241 |
and so it should not be free'd by the caller. |
| 242 |
.PP |
| 243 |
\&\fBX509_STORE_CTX_set_default()\fR looks up and sets the default verification method. |
| 244 |
This uses the function \fBX509_VERIFY_PARAM_lookup()\fR to find |
| 245 |
the set of parameters associated with the given verification method \fIname\fR. |
| 246 |
Among others, the parameters determine the trust model and verification purpose. |
| 247 |
More detail, including the list of currently predefined methods, |
| 248 |
is described for the \fB\-verify_name\fR command-line option |
| 249 |
in "Verification Options" in \fBopenssl\-verification\-options\fR\|(1). |
| 250 |
.PP |
| 251 |
\&\fBX509_STORE_CTX_set_verify()\fR provides the capability for overriding the default |
| 252 |
verify function. This function is responsible for verifying chain signatures and |
| 253 |
expiration times. |
| 254 |
.PP |
| 255 |
A verify function is defined as an X509_STORE_CTX_verify type which has the |
| 256 |
following signature: |
| 257 |
.PP |
| 258 |
.Vb 1 |
| 259 |
\& int (*verify)(X509_STORE_CTX *); |
| 260 |
.Ve |
| 261 |
.PP |
| 262 |
This function should receive the current X509_STORE_CTX as a parameter and |
| 263 |
return 1 on success or 0 on failure. |
| 264 |
.PP |
| 265 |
X509 certificates may contain information about what purposes keys contained |
| 266 |
within them can be used for. For example "TLS WWW Server Authentication" or |
| 267 |
"Email Protection". This "key usage" information is held internally to the |
| 268 |
certificate itself. In addition the trust store containing trusted certificates |
| 269 |
can declare what purposes we trust different certificates for. This "trust" |
| 270 |
information is not held within the certificate itself but is "meta" information |
| 271 |
held alongside it. This "meta" information is associated with the certificate |
| 272 |
after it is issued and could be determined by a system administrator. For |
| 273 |
example a certificate might declare that it is suitable for use for both |
| 274 |
"TLS WWW Server Authentication" and "TLS Client Authentication", but a system |
| 275 |
administrator might only trust it for the former. An X.509 certificate extension |
| 276 |
exists that can record extended key usage information to supplement the purpose |
| 277 |
information described above. This extended mechanism is arbitrarily extensible |
| 278 |
and not well suited for a generic library API; applications that need to |
| 279 |
validate extended key usage information in certificates will need to define a |
| 280 |
custom "purpose" (see below) or supply a nondefault verification callback |
| 281 |
(\fBX509_STORE_set_verify_cb_func\fR\|(3)). |
| 282 |
.PP |
| 283 |
\&\fBX509_STORE_CTX_set_ocsp_resp()\fR sets the OCSP response(s) for the verification |
| 284 |
of a certificate chain or for including in the TLS handshake, when the client |
| 285 |
requests OCSP stapling. The stack of OCSP responses \fIsk\fR is not copied but |
| 286 |
just stored to the context. |
| 287 |
\&\fIctx\fR holds a pointer to the stack, so the stack must outlive the \fIctx\fR. |
| 288 |
.PP |
| 289 |
\&\fBX509_STORE_CTX_set_purpose()\fR sets the purpose for the target certificate being |
| 290 |
verified in the \fIctx\fR. Built-in available values for the \fIpurpose\fR argument |
| 291 |
are \fBX509_PURPOSE_SSL_CLIENT\fR, \fBX509_PURPOSE_SSL_SERVER\fR, |
| 292 |
\&\fBX509_PURPOSE_NS_SSL_SERVER\fR, \fBX509_PURPOSE_SMIME_SIGN\fR, |
| 293 |
\&\fBX509_PURPOSE_SMIME_ENCRYPT\fR, \fBX509_PURPOSE_CRL_SIGN\fR, \fBX509_PURPOSE_ANY\fR, |
| 294 |
\&\fBX509_PURPOSE_OCSP_HELPER\fR, \fBX509_PURPOSE_TIMESTAMP_SIGN\fR and |
| 295 |
\&\fBX509_PURPOSE_CODE_SIGN\fR. It is also |
| 296 |
possible to create a custom purpose value. Setting a purpose requests that |
| 297 |
the key usage and extended key usage (EKU) extensions optionally declared within |
| 298 |
the certificate and its chain are verified to be consistent with that purpose. |
| 299 |
For SSL client, SSL server, and S/MIME purposes, the EKU is checked also for the |
| 300 |
CA certificates along the chain, including any given trust anchor certificate. |
| 301 |
Potentially also further checks are done (depending on the purpose given). |
| 302 |
Every purpose also has an associated default trust value, which will also be set |
| 303 |
at the same time. During verification, this trust setting will be verified |
| 304 |
to check whether it is consistent with the trust set by the system administrator |
| 305 |
for certificates in the chain. |
| 306 |
.PP |
| 307 |
\&\fBX509_STORE_CTX_set_trust()\fR sets the trust value for the target certificate |
| 308 |
being verified in the \fIctx\fR. Built-in available values for the \fItrust\fR |
| 309 |
argument are \fBX509_TRUST_COMPAT\fR, \fBX509_TRUST_SSL_CLIENT\fR, |
| 310 |
\&\fBX509_TRUST_SSL_SERVER\fR, \fBX509_TRUST_EMAIL\fR, \fBX509_TRUST_OBJECT_SIGN\fR, |
| 311 |
\&\fBX509_TRUST_OCSP_SIGN\fR, \fBX509_TRUST_OCSP_REQUEST\fR and \fBX509_TRUST_TSA\fR. It is |
| 312 |
also possible to create a custom trust value. Since \fBX509_STORE_CTX_set_purpose()\fR |
| 313 |
also sets the trust value it is normally sufficient to only call that function. |
| 314 |
If both are called then \fBX509_STORE_CTX_set_trust()\fR should be called after |
| 315 |
\&\fBX509_STORE_CTX_set_purpose()\fR since the trust setting of the last call will be |
| 316 |
used. |
| 317 |
.PP |
| 318 |
It should not normally be necessary for end user applications to call |
| 319 |
\&\fBX509_STORE_CTX_purpose_inherit()\fR directly. Typically applications should call |
| 320 |
\&\fBX509_STORE_CTX_set_purpose()\fR or \fBX509_STORE_CTX_set_trust()\fR instead. Using this |
| 321 |
function it is possible to set the purpose and trust values for the \fIctx\fR at |
| 322 |
the same time. |
| 323 |
Both \fIctx\fR and its internal verification parameter pointer must not be NULL. |
| 324 |
The \fIdef_purpose\fR and \fIpurpose\fR arguments can have the same |
| 325 |
purpose values as described for \fBX509_STORE_CTX_set_purpose()\fR above. The \fItrust\fR |
| 326 |
argument can have the same trust values as described in |
| 327 |
\&\fBX509_STORE_CTX_set_trust()\fR above. Any of the \fIdef_purpose\fR, \fIpurpose\fR or |
| 328 |
\&\fItrust\fR values may also have the value 0 to indicate that the supplied |
| 329 |
parameter should be ignored. After calling this function the purpose to be used |
| 330 |
for verification is set from the \fIpurpose\fR argument unless the purpose was |
| 331 |
already set in \fIctx\fR before, and the trust is set from the \fItrust\fR argument |
| 332 |
unless the trust was already set in \fIctx\fR before. |
| 333 |
If \fItrust\fR is 0 then the trust value will be set from |
| 334 |
the default trust value for \fIpurpose\fR. If the default trust value for the |
| 335 |
purpose is \fIX509_TRUST_DEFAULT\fR and \fItrust\fR is 0 then the default trust value |
| 336 |
associated with the \fIdef_purpose\fR value is used for the trust setting instead. |
| 337 |
.SH NOTES |
| 338 |
.IX Header "NOTES" |
| 339 |
The certificates and CRLs in a store are used internally and should \fBnot\fR |
| 340 |
be freed up until after the associated \fBX509_STORE_CTX\fR is freed. |
| 341 |
.SH BUGS |
| 342 |
.IX Header "BUGS" |
| 343 |
The certificates and CRLs in a context are used internally and should \fBnot\fR |
| 344 |
be freed up until after the associated \fBX509_STORE_CTX\fR is freed. Copies |
| 345 |
should be made or reference counts increased instead. |
| 346 |
.SH "RETURN VALUES" |
| 347 |
.IX Header "RETURN VALUES" |
| 348 |
\&\fBX509_STORE_CTX_new()\fR returns a newly allocated context or NULL if an |
| 349 |
error occurred. |
| 350 |
.PP |
| 351 |
\&\fBX509_STORE_CTX_init()\fR and \fBX509_STORE_CTX_init_rpk()\fR return 1 for success |
| 352 |
or 0 if an error occurred. |
| 353 |
.PP |
| 354 |
\&\fBX509_STORE_CTX_get0_param()\fR returns a pointer to an \fBX509_VERIFY_PARAM\fR |
| 355 |
structure or NULL if an error occurred. |
| 356 |
.PP |
| 357 |
\&\fBX509_STORE_CTX_get0_rpk()\fR returns a pointer to an \fBEVP_PKEY\fR structure if |
| 358 |
present, or NULL if absent. |
| 359 |
.PP |
| 360 |
\&\fBX509_STORE_CTX_cleanup()\fR, \fBX509_STORE_CTX_free()\fR, |
| 361 |
\&\fBX509_STORE_CTX_set0_trusted_stack()\fR, |
| 362 |
\&\fBX509_STORE_CTX_set_cert()\fR, |
| 363 |
\&\fBX509_STORE_CTX_set0_crls()\fR and \fBX509_STORE_CTX_set0_param()\fR do not return |
| 364 |
values. |
| 365 |
.PP |
| 366 |
\&\fBX509_STORE_CTX_set_default()\fR returns 1 for success or 0 if an error occurred. |
| 367 |
.PP |
| 368 |
\&\fBX509_STORE_CTX_get_num_untrusted()\fR returns the number of untrusted certificates |
| 369 |
used. |
| 370 |
.SH "SEE ALSO" |
| 371 |
.IX Header "SEE ALSO" |
| 372 |
\&\fBX509_verify_cert\fR\|(3), \fBX509_STORE_CTX_verify\fR\|(3), |
| 373 |
\&\fBX509_VERIFY_PARAM_set_flags\fR\|(3) |
| 374 |
.SH HISTORY |
| 375 |
.IX Header "HISTORY" |
| 376 |
The \fBX509_STORE_CTX_set0_crls()\fR function was added in OpenSSL 1.0.0. |
| 377 |
The \fBX509_STORE_CTX_get_num_untrusted()\fR function was added in OpenSSL 1.1.0. |
| 378 |
The \fBX509_STORE_CTX_new_ex()\fR function was added in OpenSSL 3.0. |
| 379 |
The \fBX509_STORE_CTX_init_rpk()\fR, \fBX509_STORE_CTX_get0_rpk()\fR, and |
| 380 |
\&\fBX509_STORE_CTX_set0_rpk()\fR functions were added in OpenSSL 3.2. |
| 381 |
\&\fBX509_STORE_CTX_set_ocsp_resp()\fR function was added in OpenSSL 3.6. |
| 382 |
.PP |
| 383 |
There is no need to call \fBX509_STORE_CTX_cleanup()\fR explicitly since OpenSSL 3.0. |
| 384 |
.SH COPYRIGHT |
| 385 |
.IX Header "COPYRIGHT" |
| 386 |
Copyright 2009\-2025 The OpenSSL Project Authors. All Rights Reserved. |
| 387 |
.PP |
| 388 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 389 |
this file except in compliance with the License. You can obtain a copy |
| 390 |
in the file LICENSE in the source distribution or at |
| 391 |
<https://www.openssl.org/source/license.html>. |