aboutsummaryrefslogtreecommitdiff
path: root/secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3
diff options
context:
space:
mode:
Diffstat (limited to 'secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3')
-rw-r--r--secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3175
1 files changed, 114 insertions, 61 deletions
diff --git a/secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3 b/secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3
index 686e1266f725..29a519f2d05a 100644
--- a/secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3
+++ b/secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)
+.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -68,8 +68,6 @@
. \}
.\}
.rr rF
-.\"
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
@@ -132,42 +130,56 @@
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
-.IX Title "X509_STORE_CTX_NEW 3"
-.TH X509_STORE_CTX_NEW 3 "2022-07-05" "1.1.1q" "OpenSSL"
+.IX Title "X509_STORE_CTX_NEW 3ossl"
+.TH X509_STORE_CTX_NEW 3ossl "2023-09-19" "3.0.11" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
-X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STORE_CTX_init, X509_STORE_CTX_set0_trusted_stack, X509_STORE_CTX_set_cert, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_chain, X509_STORE_CTX_set0_verified_chain, X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param, X509_STORE_CTX_get0_untrusted, X509_STORE_CTX_set0_untrusted, X509_STORE_CTX_get_num_untrusted, X509_STORE_CTX_set_default, X509_STORE_CTX_set_verify, X509_STORE_CTX_verify_fn, X509_STORE_CTX_set_purpose, X509_STORE_CTX_set_trust, X509_STORE_CTX_purpose_inherit \&\- X509_STORE_CTX initialisation
+X509_STORE_CTX_new_ex, X509_STORE_CTX_new, X509_STORE_CTX_cleanup,
+X509_STORE_CTX_free, X509_STORE_CTX_init, X509_STORE_CTX_set0_trusted_stack,
+X509_STORE_CTX_set_cert, X509_STORE_CTX_set0_crls,
+X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param,
+X509_STORE_CTX_get0_untrusted, X509_STORE_CTX_set0_untrusted,
+X509_STORE_CTX_get_num_untrusted,
+X509_STORE_CTX_get0_chain, X509_STORE_CTX_set0_verified_chain,
+X509_STORE_CTX_set_default,
+X509_STORE_CTX_set_verify,
+X509_STORE_CTX_verify_fn,
+X509_STORE_CTX_set_purpose,
+X509_STORE_CTX_set_trust,
+X509_STORE_CTX_purpose_inherit
+\&\- X509_STORE_CTX initialisation
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& #include <openssl/x509_vfy.h>
\&
+\& X509_STORE_CTX *X509_STORE_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
\& X509_STORE_CTX *X509_STORE_CTX_new(void);
\& void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
\& void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
\&
-\& int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
-\& X509 *x509, STACK_OF(X509) *chain);
+\& int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *trust_store,
+\& X509 *target, STACK_OF(X509) *untrusted);
\&
\& void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
\&
-\& void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x);
-\& STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx);
-\& void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *chain);
+\& void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *target);
\& void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk);
\&
-\& X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
+\& X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(const X509_STORE_CTX *ctx);
\& void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
-\& int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
\&
-\& STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx);
+\& STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(const X509_STORE_CTX *ctx);
\& void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
\&
-\& int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx);
+\& int X509_STORE_CTX_get_num_untrusted(const X509_STORE_CTX *ctx);
+\& STACK_OF(X509) *X509_STORE_CTX_get0_chain(const X509_STORE_CTX *ctx);
+\& void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *chain);
\&
+\& int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
\& typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *);
\& void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, X509_STORE_CTX_verify_fn verify);
\&
@@ -179,66 +191,100 @@ X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STORE_CTX_
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
These functions initialise an \fBX509_STORE_CTX\fR structure for subsequent use
-by \fBX509_verify_cert()\fR.
+by \fBX509_verify_cert\fR\|(3) or \fBX509_STORE_CTX_verify\fR\|(3).
+.PP
+\&\fBX509_STORE_CTX_new_ex()\fR returns a newly initialised \fBX509_STORE_CTX\fR
+structure associated with the specified library context \fIlibctx\fR and property
+query string \fIpropq\fR. Any cryptographic algorithms fetched while performing
+processing with the X509_STORE_CTX will use that library context and property
+query string.
.PP
-\&\fBX509_STORE_CTX_new()\fR returns a newly initialised \fBX509_STORE_CTX\fR structure.
+\&\fBX509_STORE_CTX_new()\fR is the same as \fBX509_STORE_CTX_new_ex()\fR except that
+the default library context and a \s-1NULL\s0 property query string are used.
.PP
\&\fBX509_STORE_CTX_cleanup()\fR internally cleans up an \fBX509_STORE_CTX\fR structure.
-The context can then be reused with a new call to \fBX509_STORE_CTX_init()\fR.
+It is used by \fBX509_STORE_CTX_init()\fR and \fBX509_STORE_CTX_free()\fR.
.PP
-\&\fBX509_STORE_CTX_free()\fR completely frees up \fBctx\fR. After this call \fBctx\fR
+\&\fBX509_STORE_CTX_free()\fR completely frees up \fIctx\fR. After this call \fIctx\fR
is no longer valid.
-If \fBctx\fR is \s-1NULL\s0 nothing is done.
-.PP
-\&\fBX509_STORE_CTX_init()\fR sets up \fBctx\fR for a subsequent verification operation.
-It must be called before each call to \fBX509_verify_cert()\fR, i.e. a \fBctx\fR is only
-good for one call to \fBX509_verify_cert()\fR; if you want to verify a second
-certificate with the same \fBctx\fR then you must call \fBX509_STORE_CTX_cleanup()\fR
-and then \fBX509_STORE_CTX_init()\fR again before the second call to
-\&\fBX509_verify_cert()\fR. The trusted certificate store is set to \fBstore\fR, the end
-entity certificate to be verified is set to \fBx509\fR and a set of additional
-certificates (which will be untrusted but may be used to build the chain) in
-\&\fBchain\fR. Any or all of the \fBstore\fR, \fBx509\fR and \fBchain\fR parameters can be
-\&\fB\s-1NULL\s0\fR.
+If \fIctx\fR is \s-1NULL\s0 nothing is done.
+.PP
+It must be called before each call to \fBX509_verify_cert\fR\|(3) or
+\&\fBX509_STORE_CTX_verify\fR\|(3), i.e., a context is only good for one verification.
+If you want to verify a further certificate or chain with the same \fIctx\fR
+then you must call \fBX509_STORE_CTX_init()\fR again.
+The trusted certificate store is set to \fItrust_store\fR of type \fBX509_STORE\fR.
+This may be \s-1NULL\s0 because there are no trusted certificates or because
+they are provided simply as a list using \fBX509_STORE_CTX_set0_trusted_stack()\fR.
+The certificate to be verified is set to \fItarget\fR,
+and a list of additional certificates may be provided in \fIuntrusted\fR,
+which will be untrusted but may be used to build the chain.
+Each of the \fItrust_store\fR, \fItarget\fR and \fIuntrusted\fR parameters can be \s-1NULL.\s0
+Yet note that \fBX509_verify_cert\fR\|(3) and \fBX509_STORE_CTX_verify\fR\|(3)
+will need a verification target.
+This can also be set using \fBX509_STORE_CTX_set_cert()\fR.
+For \fBX509_STORE_CTX_verify\fR\|(3), which takes by default the first element of the
+list of untrusted certificates as its verification target,
+this can be also set indirectly using \fBX509_STORE_CTX_set0_untrusted()\fR.
.PP
\&\fBX509_STORE_CTX_set0_trusted_stack()\fR sets the set of trusted certificates of
-\&\fBctx\fR to \fBsk\fR. This is an alternative way of specifying trusted certificates
-instead of using an \fBX509_STORE\fR.
+\&\fIctx\fR to \fIsk\fR. This is an alternative way of specifying trusted certificates
+instead of using an \fBX509_STORE\fR where its complexity is not needed
+or to make sure that only the given set \fIsk\fR of certificates are trusted.
.PP
-\&\fBX509_STORE_CTX_set_cert()\fR sets the certificate to be verified in \fBctx\fR to
-\&\fBx\fR.
+\&\fBX509_STORE_CTX_set_cert()\fR sets the target certificate to be verified in \fIctx\fR
+to \fItarget\fR.
+.PP
+\&\fBX509_STORE_CTX_set0_verified_chain()\fR sets the validated chain to \fIchain\fR.
+Ownership of the chain is transferred to \fIctx\fR,
+and so it should not be free'd by the caller.
.PP
-\&\fBX509_STORE_CTX_set0_verified_chain()\fR sets the validated chain used
-by \fBctx\fR to be \fBchain\fR.
-Ownership of the chain is transferred to \fBctx\fR and should not be
-free'd by the caller.
\&\fBX509_STORE_CTX_get0_chain()\fR returns the internal pointer used by the
-\&\fBctx\fR that contains the validated chain.
+\&\fIctx\fR that contains the constructed (output) chain.
.PP
\&\fBX509_STORE_CTX_set0_crls()\fR sets a set of CRLs to use to aid certificate
-verification to \fBsk\fR. These CRLs will only be used if \s-1CRL\s0 verification is
+verification to \fIsk\fR. These CRLs will only be used if \s-1CRL\s0 verification is
enabled in the associated \fBX509_VERIFY_PARAM\fR structure. This might be
used where additional \*(L"useful\*(R" CRLs are supplied as part of a protocol,
for example in a PKCS#7 structure.
.PP
\&\fBX509_STORE_CTX_get0_param()\fR retrieves an internal pointer
-to the verification parameters associated with \fBctx\fR.
+to the verification parameters associated with \fIctx\fR.
+.PP
+\&\fBX509_STORE_CTX_set0_param()\fR sets the internal verification parameter pointer
+to \fIparam\fR. After this call \fBparam\fR should not be used.
.PP
\&\fBX509_STORE_CTX_get0_untrusted()\fR retrieves an internal pointer to the
-stack of untrusted certificates associated with \fBctx\fR.
+stack of untrusted certificates associated with \fIctx\fR.
.PP
-\&\fBX509_STORE_CTX_set0_untrusted()\fR sets the internal point to the stack
-of untrusted certificates associated with \fBctx\fR to \fBsk\fR.
+\&\fBX509_STORE_CTX_set0_untrusted()\fR sets the internal pointer to the stack
+of untrusted certificates associated with \fIctx\fR to \fIsk\fR.
+\&\fBX509_STORE_CTX_verify()\fR will take the first element, if any,
+as its default target if the target certificate is not set explicitly.
.PP
-\&\fBX509_STORE_CTX_set0_param()\fR sets the internal verification parameter pointer
-to \fBparam\fR. After this call \fBparam\fR should not be used.
+\&\fBX509_STORE_CTX_get_num_untrusted()\fR returns the number of untrusted certificates
+that were used in building the chain.
+This is can be used after calling \fBX509_verify_cert\fR\|(3) and similar functions.
+With \fBX509_STORE_CTX_verify\fR\|(3), this does not count the first chain element.
.PP
-\&\fBX509_STORE_CTX_set_default()\fR looks up and sets the default verification
-method to \fBname\fR. This uses the function \fBX509_VERIFY_PARAM_lookup()\fR to
-find an appropriate set of parameters from \fBname\fR.
+\&\fBX509_STORE_CTX_get0_chain()\fR returns the internal pointer used by the
+\&\fIctx\fR that contains the validated chain.
.PP
-\&\fBX509_STORE_CTX_get_num_untrusted()\fR returns the number of untrusted certificates
-that were used in building the chain following a call to \fBX509_verify_cert()\fR.
+Details of the chain building and checking process are described in
+\&\*(L"Certification Path Building\*(R" in \fBopenssl\-verification\-options\fR\|(1) and
+\&\*(L"Certification Path Validation\*(R" in \fBopenssl\-verification\-options\fR\|(1).
+.PP
+\&\fBX509_STORE_CTX_set0_verified_chain()\fR sets the validated chain used
+by \fIctx\fR to be \fIchain\fR.
+Ownership of the chain is transferred to \fIctx\fR,
+and so it should not be free'd by the caller.
+.PP
+\&\fBX509_STORE_CTX_set_default()\fR looks up and sets the default verification
+method to \fIname\fR. This uses the function \fBX509_VERIFY_PARAM_lookup()\fR to
+find an appropriate set of parameters from the purpose identifier \fIname\fR.
+Currently defined purposes are \f(CW\*(C`sslclient\*(C'\fR, \f(CW\*(C`sslserver\*(C'\fR, \f(CW\*(C`nssslserver\*(C'\fR,
+\&\f(CW\*(C`smimesign\*(C'\fR, \f(CW\*(C`smimeencrypt\*(C'\fR, \f(CW\*(C`crlsign\*(C'\fR, \f(CW\*(C`ocsphelper\*(C'\fR, \f(CW\*(C`timestampsign\*(C'\fR,
+and \f(CW\*(C`any\*(C'\fR.
.PP
\&\fBX509_STORE_CTX_set_verify()\fR provides the capability for overriding the default
verify function. This function is responsible for verifying chain signatures and
@@ -268,7 +314,7 @@ administrator might only trust it for the former. An X.509 certificate extension
exists that can record extended key usage information to supplement the purpose
information described above. This extended mechanism is arbitrarily extensible
and not well suited for a generic library \s-1API\s0; applications that need to
-validate extended key usage information in certifiates will need to define a
+validate extended key usage information in certificates will need to define a
custom \*(L"purpose\*(R" (see below) or supply a nondefault verification callback
(\fBX509_STORE_set_verify_cb_func\fR\|(3)).
.PP
@@ -301,14 +347,18 @@ It should not normally be necessary for end user applications to call
\&\fBX509_STORE_CTX_purpose_inherit()\fR directly. Typically applications should call
\&\fBX509_STORE_CTX_set_purpose()\fR or \fBX509_STORE_CTX_set_trust()\fR instead. Using this
function it is possible to set the purpose and trust values for the \fIctx\fR at
-the same time. The \fIdef_purpose\fR and \fIpurpose\fR arguments can have the same
+the same time.
+Both \fIctx\fR and its internal verification parameter pointer must not be \s-1NULL.\s0
+The \fIdef_purpose\fR and \fIpurpose\fR arguments can have the same
purpose values as described for \fBX509_STORE_CTX_set_purpose()\fR above. The \fItrust\fR
argument can have the same trust values as described in
\&\fBX509_STORE_CTX_set_trust()\fR above. Any of the \fIdef_purpose\fR, \fIpurpose\fR or
\&\fItrust\fR values may also have the value 0 to indicate that the supplied
parameter should be ignored. After calling this function the purpose to be used
-for verification is set from the \fIpurpose\fR argument, and the trust is set from
-the \fItrust\fR argument. If \fItrust\fR is 0 then the trust value will be set from
+for verification is set from the \fIpurpose\fR argument unless the purpose was
+already set in \fIctx\fR before, and the trust is set from the \fItrust\fR argument
+unless the trust was already set in \fIctx\fR before.
+If \fItrust\fR is 0 then the trust value will be set from
the default trust value for \fIpurpose\fR. If the default trust value for the
purpose is \fIX509_TRUST_DEFAULT\fR and \fItrust\fR is 0 then the default trust value
associated with the \fIdef_purpose\fR value is used for the trust setting instead.
@@ -323,13 +373,13 @@ be freed up until after the associated \fBX509_STORE_CTX\fR is freed. Copies
should be made or reference counts increased instead.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
-\&\fBX509_STORE_CTX_new()\fR returns a newly allocated context or \fB\s-1NULL\s0\fR if an
+\&\fBX509_STORE_CTX_new()\fR returns a newly allocated context or \s-1NULL\s0 if an
error occurred.
.PP
\&\fBX509_STORE_CTX_init()\fR returns 1 for success or 0 if an error occurred.
.PP
\&\fBX509_STORE_CTX_get0_param()\fR returns a pointer to an \fBX509_VERIFY_PARAM\fR
-structure or \fB\s-1NULL\s0\fR if an error occurred.
+structure or \s-1NULL\s0 if an error occurred.
.PP
\&\fBX509_STORE_CTX_cleanup()\fR, \fBX509_STORE_CTX_free()\fR,
\&\fBX509_STORE_CTX_set0_trusted_stack()\fR,
@@ -343,17 +393,20 @@ values.
used.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
-\&\fBX509_verify_cert\fR\|(3)
+\&\fBX509_verify_cert\fR\|(3), \fBX509_STORE_CTX_verify\fR\|(3),
\&\fBX509_VERIFY_PARAM_set_flags\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
The \fBX509_STORE_CTX_set0_crls()\fR function was added in OpenSSL 1.0.0.
The \fBX509_STORE_CTX_get_num_untrusted()\fR function was added in OpenSSL 1.1.0.
+The \fBX509_STORE_CTX_new_ex()\fR function was added in OpenSSL 3.0.
+.PP
+There is no need to call \fBX509_STORE_CTX_cleanup()\fR explicitly since OpenSSL 3.0.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
-Copyright 2009\-2022 The OpenSSL Project Authors. All Rights Reserved.
+Copyright 2009\-2023 The OpenSSL Project Authors. All Rights Reserved.
.PP
-Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use
+Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file \s-1LICENSE\s0 in the source distribution or at
<https://www.openssl.org/source/license.html>.