xref: /openbsd-src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 (revision a9630e5b24317a53917fa45a98e81ddf0d77dd5f)
1*a9630e5bSschwarze.\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.28 2023/06/06 16:20:13 schwarze Exp $
2d3125e1cSschwarze.\" full merge up to:
3b543445eSschwarze.\" OpenSSL man3/X509_STORE_CTX_get_error 24a535ea Sep 22 13:14:20 2020 +0100
4b543445eSschwarze.\" OpenSSL man3/X509_STORE_CTX_new 24a535ea Sep 22 13:14:20 2020 +0100
58974101aSjmc.\"
6eb922cd1Sschwarze.\" This file is a derived work.
7eb922cd1Sschwarze.\" The changes are covered by the following Copyright and license:
8eb922cd1Sschwarze.\"
9eb922cd1Sschwarze.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
10eb922cd1Sschwarze.\"
11eb922cd1Sschwarze.\" Permission to use, copy, modify, and distribute this software for any
12eb922cd1Sschwarze.\" purpose with or without fee is hereby granted, provided that the above
13eb922cd1Sschwarze.\" copyright notice and this permission notice appear in all copies.
14eb922cd1Sschwarze.\"
15eb922cd1Sschwarze.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
16eb922cd1Sschwarze.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17eb922cd1Sschwarze.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
18eb922cd1Sschwarze.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19eb922cd1Sschwarze.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20eb922cd1Sschwarze.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21eb922cd1Sschwarze.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22eb922cd1Sschwarze.\"
23eb922cd1Sschwarze.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>
244a763290Sschwarze.\" and Rich Salz <rsalz@openssl.org>.
254a763290Sschwarze.\" Copyright (c) 2009, 2016 The OpenSSL Project.  All rights reserved.
262d281ab4Sschwarze.\"
272d281ab4Sschwarze.\" Redistribution and use in source and binary forms, with or without
282d281ab4Sschwarze.\" modification, are permitted provided that the following conditions
292d281ab4Sschwarze.\" are met:
302d281ab4Sschwarze.\"
312d281ab4Sschwarze.\" 1. Redistributions of source code must retain the above copyright
322d281ab4Sschwarze.\"    notice, this list of conditions and the following disclaimer.
332d281ab4Sschwarze.\"
342d281ab4Sschwarze.\" 2. Redistributions in binary form must reproduce the above copyright
352d281ab4Sschwarze.\"    notice, this list of conditions and the following disclaimer in
362d281ab4Sschwarze.\"    the documentation and/or other materials provided with the
372d281ab4Sschwarze.\"    distribution.
382d281ab4Sschwarze.\"
392d281ab4Sschwarze.\" 3. All advertising materials mentioning features or use of this
402d281ab4Sschwarze.\"    software must display the following acknowledgment:
412d281ab4Sschwarze.\"    "This product includes software developed by the OpenSSL Project
422d281ab4Sschwarze.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
432d281ab4Sschwarze.\"
442d281ab4Sschwarze.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
452d281ab4Sschwarze.\"    endorse or promote products derived from this software without
462d281ab4Sschwarze.\"    prior written permission. For written permission, please contact
472d281ab4Sschwarze.\"    openssl-core@openssl.org.
482d281ab4Sschwarze.\"
492d281ab4Sschwarze.\" 5. Products derived from this software may not be called "OpenSSL"
502d281ab4Sschwarze.\"    nor may "OpenSSL" appear in their names without prior written
512d281ab4Sschwarze.\"    permission of the OpenSSL Project.
522d281ab4Sschwarze.\"
532d281ab4Sschwarze.\" 6. Redistributions of any form whatsoever must retain the following
542d281ab4Sschwarze.\"    acknowledgment:
552d281ab4Sschwarze.\"    "This product includes software developed by the OpenSSL Project
562d281ab4Sschwarze.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
572d281ab4Sschwarze.\"
582d281ab4Sschwarze.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
592d281ab4Sschwarze.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
602d281ab4Sschwarze.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
612d281ab4Sschwarze.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
622d281ab4Sschwarze.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
632d281ab4Sschwarze.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
642d281ab4Sschwarze.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
652d281ab4Sschwarze.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
662d281ab4Sschwarze.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
672d281ab4Sschwarze.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
682d281ab4Sschwarze.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
692d281ab4Sschwarze.\" OF THE POSSIBILITY OF SUCH DAMAGE.
702d281ab4Sschwarze.\"
71*a9630e5bSschwarze.Dd $Mdocdate: June 6 2023 $
72b7f7f640Sschwarze.Dt X509_STORE_CTX_GET_ERROR 3
73b7f7f640Sschwarze.Os
74b7f7f640Sschwarze.Sh NAME
75b7f7f640Sschwarze.Nm X509_STORE_CTX_get_error ,
76b7f7f640Sschwarze.Nm X509_STORE_CTX_set_error ,
77b7f7f640Sschwarze.Nm X509_STORE_CTX_get_error_depth ,
781798df84Sschwarze.Nm X509_STORE_CTX_set_error_depth ,
79b7f7f640Sschwarze.Nm X509_STORE_CTX_get_current_cert ,
801798df84Sschwarze.Nm X509_STORE_CTX_set_current_cert ,
81eb922cd1Sschwarze.Nm X509_STORE_CTX_get0_current_issuer ,
82eb922cd1Sschwarze.Nm X509_STORE_CTX_get0_current_crl ,
83295c5934Sschwarze.Nm X509_STORE_CTX_get0_parent_ctx ,
841798df84Sschwarze.Nm X509_STORE_CTX_get_num_untrusted ,
85d3125e1cSschwarze.Nm X509_STORE_CTX_get0_chain ,
86b543445eSschwarze.Nm X509_STORE_CTX_get_chain ,
87b7f7f640Sschwarze.Nm X509_STORE_CTX_get1_chain ,
881798df84Sschwarze.Nm X509_STORE_CTX_set0_verified_chain ,
89b7f7f640Sschwarze.Nm X509_verify_cert_error_string
90b7f7f640Sschwarze.Nd get or set certificate verification status information
91b7f7f640Sschwarze.Sh SYNOPSIS
923a034298Sschwarze.In openssl/x509_vfy.h
93b7f7f640Sschwarze.Ft int
94b7f7f640Sschwarze.Fo X509_STORE_CTX_get_error
95b7f7f640Sschwarze.Fa "X509_STORE_CTX *ctx"
96b7f7f640Sschwarze.Fc
97b7f7f640Sschwarze.Ft void
98b7f7f640Sschwarze.Fo X509_STORE_CTX_set_error
99b7f7f640Sschwarze.Fa "X509_STORE_CTX *ctx"
100b7f7f640Sschwarze.Fa "int s"
101b7f7f640Sschwarze.Fc
102b7f7f640Sschwarze.Ft int
103b7f7f640Sschwarze.Fo X509_STORE_CTX_get_error_depth
104b7f7f640Sschwarze.Fa "X509_STORE_CTX *ctx"
105b7f7f640Sschwarze.Fc
1061798df84Sschwarze.Ft void
1071798df84Sschwarze.Fo X509_STORE_CTX_set_error_depth
1081798df84Sschwarze.Fa "X509_STORE_CTX *ctx"
1091798df84Sschwarze.Fa "int depth"
1101798df84Sschwarze.Fc
111b7f7f640Sschwarze.Ft X509 *
112b7f7f640Sschwarze.Fo X509_STORE_CTX_get_current_cert
113b7f7f640Sschwarze.Fa "X509_STORE_CTX *ctx"
114b7f7f640Sschwarze.Fc
1151798df84Sschwarze.Ft void
1161798df84Sschwarze.Fo X509_STORE_CTX_set_current_cert
1171798df84Sschwarze.Fa "X509_STORE_CTX *ctx"
1181798df84Sschwarze.Fa "X509 *cert"
1191798df84Sschwarze.Fc
120eb922cd1Sschwarze.Ft X509 *
121eb922cd1Sschwarze.Fo X509_STORE_CTX_get0_current_issuer
122eb922cd1Sschwarze.Fa "X509_STORE_CTX *ctx"
123eb922cd1Sschwarze.Fc
124eb922cd1Sschwarze.Ft X509_CRL *
125eb922cd1Sschwarze.Fo X509_STORE_CTX_get0_current_crl
126eb922cd1Sschwarze.Fa "X509_STORE_CTX *ctx"
127eb922cd1Sschwarze.Fc
128295c5934Sschwarze.Ft X509_STORE_CTX *
129295c5934Sschwarze.Fo X509_STORE_CTX_get0_parent_ctx
130295c5934Sschwarze.Fa "X509_STORE_CTX *ctx"
131295c5934Sschwarze.Fc
1321798df84Sschwarze.Ft int
1331798df84Sschwarze.Fo X509_STORE_CTX_get_num_untrusted
1341798df84Sschwarze.Fa "X509_STORE_CTX *ctx"
1351798df84Sschwarze.Fc
136b7f7f640Sschwarze.Ft STACK_OF(X509) *
137d3125e1cSschwarze.Fo X509_STORE_CTX_get0_chain
138d3125e1cSschwarze.Fa "X509_STORE_CTX *ctx"
139d3125e1cSschwarze.Fc
140d3125e1cSschwarze.Ft STACK_OF(X509) *
141b543445eSschwarze.Fo X509_STORE_CTX_get_chain
142b543445eSschwarze.Fa "X509_STORE_CTX *ctx"
143b543445eSschwarze.Fc
144b543445eSschwarze.Ft STACK_OF(X509) *
145b7f7f640Sschwarze.Fo X509_STORE_CTX_get1_chain
146b7f7f640Sschwarze.Fa "X509_STORE_CTX *ctx"
147b7f7f640Sschwarze.Fc
1481798df84Sschwarze.Ft void
1491798df84Sschwarze.Fo X509_STORE_CTX_set0_verified_chain
1501798df84Sschwarze.Fa "X509_STORE_CTX *ctx"
1511798df84Sschwarze.Fa "STACK_OF(X509) *chain"
1521798df84Sschwarze.Fc
1533a034298Sschwarze.In openssl/x509.h
154b7f7f640Sschwarze.Ft const char *
155b7f7f640Sschwarze.Fo X509_verify_cert_error_string
156b7f7f640Sschwarze.Fa "long n"
157b7f7f640Sschwarze.Fc
158b7f7f640Sschwarze.Sh DESCRIPTION
159862ef20aSschwarzeMost of these functions are typically called after
160b7f7f640Sschwarze.Xr X509_verify_cert 3
161862ef20aSschwarzeto inspect status information related to certificate verification.
162862ef20aSschwarzeSome may also be called in a verification callback to determine the
163b7f7f640Sschwarzenature of an error.
164b7f7f640Sschwarze.Pp
165b7f7f640Sschwarze.Fn X509_STORE_CTX_get_error
166b7f7f640Sschwarzereturns the error code of
167b7f7f640Sschwarze.Fa ctx .
168b7f7f640SschwarzeSee the
169b7f7f640Sschwarze.Sy ERROR CODES
170b7f7f640Sschwarzesection for a full description of all error codes.
171b7f7f640Sschwarze.Pp
172b7f7f640Sschwarze.Fn X509_STORE_CTX_set_error
173b7f7f640Sschwarzesets the error code of
174b7f7f640Sschwarze.Fa ctx
175b7f7f640Sschwarzeto
176b7f7f640Sschwarze.Fa s .
177b7f7f640SschwarzeFor example it might be used in a verification callback to set an error
178b7f7f640Sschwarzebased on additional checks.
179b7f7f640Sschwarze.Pp
180b7f7f640Sschwarze.Fn X509_STORE_CTX_get_error_depth
181b7f7f640Sschwarzereturns the depth of the error.
182b7f7f640SschwarzeThis is a non-negative integer representing where in the certificate
183b7f7f640Sschwarzechain the error occurred.
184b7f7f640SschwarzeIf it is zero, it occurred in the end entity certificate, one if it is
185b7f7f640Sschwarzethe certificate which signed the end entity certificate, and so on.
186b7f7f640Sschwarze.Pp
1871798df84Sschwarze.Fn X509_STORE_CTX_set_error_depth
1881798df84Sschwarzesets the error depth.
1891798df84SschwarzeThis can be used in combination with
1901798df84Sschwarze.Fn X509_STORE_CTX_set_error
1911798df84Sschwarzeto set the depth at which an error condition was detected.
1921798df84Sschwarze.Pp
193b7f7f640Sschwarze.Fn X509_STORE_CTX_get_current_cert
194b7f7f640Sschwarzereturns the certificate in
195b7f7f640Sschwarze.Fa ctx
196b7f7f640Sschwarzewhich caused the error or
197b7f7f640Sschwarze.Dv NULL
198b7f7f640Sschwarzeif no certificate is relevant.
199b7f7f640Sschwarze.Pp
2001798df84Sschwarze.Fn X509_STORE_CTX_set_current_cert
2011798df84Sschwarzesets the certificate which caused the error in
2021798df84Sschwarze.Fa ctx
2031798df84Sschwarzeto the given
2041798df84Sschwarze.Fa cert .
2051798df84SschwarzeThis value is not intended to remain valid for very long,
2061798df84Sschwarzeand remains owned by the caller.
2071798df84SschwarzeIt may be examined by a verification callback invoked to handle
2081798df84Sschwarzeeach error encountered during chain verification and is no longer
2091798df84Sschwarzerequired after such a callback.
2101798df84SschwarzeIf a callback wishes the save the certificate for use after it returns,
2111798df84Sschwarzeit needs to increment its reference count via
2121798df84Sschwarze.Xr X509_up_ref 3 .
2131798df84SschwarzeOnce such a saved certificate is no longer needed, it can be freed with
2141798df84Sschwarze.Xr X509_free 3 .
2151798df84Sschwarze.Pp
216eb922cd1Sschwarze.Fn X509_STORE_CTX_get0_current_issuer
217eb922cd1Sschwarzereturns the certificate that caused issuer validation to fail or
218eb922cd1Sschwarze.Dv NULL
219eb922cd1Sschwarzeif no CA certificate is relevant.
220eb922cd1Sschwarze.Pp
221eb922cd1Sschwarze.Fn X509_STORE_CTX_get0_current_crl
222eb922cd1Sschwarzereturns the certificate revocation list that caused CRL checking to fail or
223eb922cd1Sschwarze.Dv NULL
224eb922cd1Sschwarzeif no CRL is relevant.
225eb922cd1Sschwarze.Pp
226295c5934SschwarzeWhen, during certification path validation, the need arises to check
227295c5934Sschwarzethe validity of the certification path of a CRL issuer certificate,
228295c5934Sschwarzethe library creates a new, temporary
229295c5934Sschwarze.Vt X509_STORE_CTX
230295c5934Sschwarzeobject.
231295c5934SschwarzeIf
232295c5934Sschwarze.Fn X509_STORE_CTX_get0_parent_ctx
233295c5934Sschwarzeis called on that temporary object, a pointer to the original
234295c5934Sschwarzecertification path validation context is returned.
235295c5934SschwarzeThis may be useful in callback functions called from
236295c5934Sschwarze.Xr X509_verify_cert 3
237295c5934Sschwarzeor from its subroutines to find out whether the callback is called
238295c5934Sschwarzefrom the path validation of the target certificate or from the path
239295c5934Sschwarzevalidation of a related CRL issuer certificate, and if the latter,
240295c5934Sschwarzewhat the target certificate is.
241295c5934Sschwarze.Pp
242d3125e1cSschwarze.Fn X509_STORE_CTX_get0_chain
243d3125e1cSschwarzereturns an internal pointer to a complete validate chain
244d3125e1cSschwarzeif a previous call to
245b7f7f640Sschwarze.Xr X509_verify_cert 3
246d3125e1cSschwarzewas successful.
247b7f7f640SschwarzeIf the call to
248b7f7f640Sschwarze.Xr X509_verify_cert 3
249d3125e1cSschwarzewas not successful, the returned chain may be incomplete or invalid.
250b543445eSschwarze.Fn X509_STORE_CTX_get_chain
251b543445eSschwarzeis a deprecated alias of
252b543445eSschwarze.Fn X509_STORE_CTX_get0_chain .
253d3125e1cSschwarze.Fn X509_STORE_CTX_get1_chain
254d3125e1cSschwarzereturns a deep copy of the same chain which persists even after the
255b7f7f640Sschwarze.Fa ctx
256b7f7f640Sschwarzestructure is freed.
257d3125e1cSschwarzeWhen it is no longer needed, it should be freed using
258b7f7f640Sschwarze.Fn sk_X509_pop_free chain X509_free .
259b7f7f640Sschwarze.Pp
2601798df84Sschwarze.Fn X509_STORE_CTX_set0_verified_chain
2611798df84Sschwarzefrees the validate chain generated by if a previous call to
2621798df84Sschwarze.Xr X509_verify_cert 3 ,
2631798df84Sschwarzeif any, and replaces it with the given
2641798df84Sschwarze.Fa chain .
2651798df84SschwarzeOwnership of the
2661798df84Sschwarze.Fa chain
2671798df84Sschwarzeis transferred to the
2681798df84Sschwarze.Fa ctx ,
2691798df84Sschwarzeso it should not be freed by the caller.
2701798df84Sschwarze.Pp
271b7f7f640Sschwarze.Fn X509_verify_cert_error_string
272b7f7f640Sschwarzereturns a human readable error string for verification error
273b7f7f640Sschwarze.Fa n .
274b7f7f640Sschwarze.Pp
275b7f7f640SschwarzeThe above functions should be used instead of directly referencing the
276b7f7f640Sschwarzefields in the
277b7f7f640Sschwarze.Sy X509_VERIFY_CTX
278b7f7f640Sschwarzestructure.
279b7f7f640Sschwarze.Pp
280b7f7f640SschwarzeIn versions of OpenSSL before 1.0, the current certificate returned by
281b7f7f640Sschwarze.Fn X509_STORE_CTX_get_current_cert
282b7f7f640Sschwarzewas never
283b7f7f640Sschwarze.Dv NULL .
284b7f7f640SschwarzeApplications should check the return value before printing out any
285b7f7f640Sschwarzedebugging information relating to the current certificate.
286b7f7f640Sschwarze.Pp
287b7f7f640SschwarzeIf an unrecognised error code is passed to
288b7f7f640Sschwarze.Fn X509_verify_cert_error_string ,
28904f2b1b8Stb"Unknown certificate verification error"
29004f2b1b8Stbis returned.
29104f2b1b8StbThis should never happen unless an invalid code is passed.
292b7f7f640Sschwarze.Sh RETURN VALUES
293b7f7f640Sschwarze.Fn X509_STORE_CTX_get_error
294b7f7f640Sschwarzereturns
295b7f7f640Sschwarze.Dv X509_V_OK
296b7f7f640Sschwarzeor an error code.
297b7f7f640Sschwarze.Pp
298b7f7f640Sschwarze.Fn X509_STORE_CTX_get_error_depth
299b7f7f640Sschwarzereturns a non-negative error depth.
300b7f7f640Sschwarze.Pp
301eb922cd1Sschwarze.Fn X509_STORE_CTX_get_current_cert ,
302eb922cd1Sschwarze.Fn X509_STORE_CTX_get0_current_issuer ,
303eb922cd1Sschwarzeand
304eb922cd1Sschwarze.Fn X509_STORE_CTX_get0_current_crl
305eb922cd1Sschwarzereturn the object which caused the error or
306b7f7f640Sschwarze.Dv NULL
307eb922cd1Sschwarzeif no object of the requested kind is relevant to the error.
308b7f7f640Sschwarze.Pp
309295c5934Sschwarze.Fn X509_STORE_CTX_get0_parent_ctx
310295c5934Sschwarzereturns the parent context or
311295c5934Sschwarze.Dv NULL
312295c5934Sschwarzeif
313295c5934Sschwarze.Fa ctx
314295c5934Sschwarzeis not a temporary child context
315295c5934Sschwarzeused for path validation of a CRL issuer certificate.
316295c5934Sschwarze.Pp
3171798df84Sschwarze.Fn X509_STORE_CTX_get_num_untrusted
3181798df84Sschwarzereturns the number of untrusted certificates
3191798df84Sschwarzethat were used in building the chain during a call to
3201798df84Sschwarze.Xr X509_verify_cert 3 .
3211798df84Sschwarze.Pp
322b543445eSschwarze.Fn X509_STORE_CTX_get0_chain ,
323b543445eSschwarze.Fn X509_STORE_CTX_get_chain ,
324d3125e1cSschwarzeand
325d3125e1cSschwarze.Fn X509_STORE_CTX_get1_chain
326d3125e1cSschwarzereturn a pointer to a stack of certificates or
327d3125e1cSschwarze.Dv NULL
328d3125e1cSschwarzeif an error occurs.
329d3125e1cSschwarze.Pp
330b7f7f640Sschwarze.Fn X509_verify_cert_error_string
331b7f7f640Sschwarzereturns a human readable error string for verification error
332b7f7f640Sschwarze.Fa n .
333b7f7f640Sschwarze.Sh ERROR CODES
334b7f7f640SschwarzeA list of error codes and messages is shown below.
335b7f7f640SschwarzeSome of the error codes are defined but currently never returned:
336b7f7f640Sschwarzethese are described as "unused".
337b7f7f640Sschwarze.Bl -tag -width Ds
338b7f7f640Sschwarze.It Dv X509_V_OK : No ok
339b7f7f640SschwarzeThe operation was successful.
34004f2b1b8Stb.It Dv X509_V_ERR_UNSPECIFIED : \
34104f2b1b8Stb No Unspecified certificate verification error
34204f2b1b8StbAn error was encountered during certificate verification and
34304f2b1b8Stbthe internal routines failed to set a more specific error.
344b7f7f640Sschwarze.It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT : \
345b7f7f640Sschwarze No unable to get issuer certificate
3461c8a3c4cSschwarzeThe issuer certificate of a locally looked up certificate could not be found.
3471c8a3c4cSschwarzeThis normally means the list of trusted certificates is not complete.
348b7f7f640Sschwarze.It Dv X509_V_ERR_UNABLE_TO_GET_CRL : No unable to get certificate CRL
349b7f7f640SschwarzeThe CRL of a certificate could not be found.
350b7f7f640Sschwarze.It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE : \
351b7f7f640Sschwarze No unable to decrypt certificate's signature
352b7f7f640SschwarzeThe certificate signature could not be decrypted.
353b7f7f640SschwarzeThis means that the actual signature value could not be determined
3541a92b4a1Sjmcrather than it not matching the expected value.
3551a92b4a1SjmcThis is only meaningful for RSA keys.
356b7f7f640Sschwarze.It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE : \
357b7f7f640Sschwarze No unable to decrypt CRL's signature
358b7f7f640SschwarzeThe CRL signature could not be decrypted: this means that the actual
359b7f7f640Sschwarzesignature value could not be determined rather than it not matching the
360b7f7f640Sschwarzeexpected value.
361b7f7f640SschwarzeUnused.
362b7f7f640Sschwarze.It Dv X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY : \
363b7f7f640Sschwarze No unable to decode issuer public key
36456bc162bSschwarzeThe public key in the certificate
36556bc162bSschwarze.Vt SubjectPublicKeyInfo
36656bc162bSschwarzecould not be read.
367b7f7f640Sschwarze.It Dv X509_V_ERR_CERT_SIGNATURE_FAILURE : No certificate signature failure
368b7f7f640SschwarzeThe signature of the certificate is invalid.
369b7f7f640Sschwarze.It Dv X509_V_ERR_CRL_SIGNATURE_FAILURE : No CRL signature failure
37022e5ce20StbThe signature of the CRL is invalid.
371b7f7f640Sschwarze.It Dv X509_V_ERR_CERT_NOT_YET_VALID : No certificate is not yet valid
372b7f7f640SschwarzeThe certificate is not yet valid: the notBefore date is after the
373b7f7f640Sschwarzecurrent time.
374b7f7f640Sschwarze.It Dv X509_V_ERR_CERT_HAS_EXPIRED : No certificate has expired
375b7f7f640SschwarzeThe certificate has expired: that is the notAfter date is before the
376b7f7f640Sschwarzecurrent time.
377b7f7f640Sschwarze.It Dv X509_V_ERR_CRL_NOT_YET_VALID : No CRL is not yet valid
378b7f7f640SschwarzeThe CRL is not yet valid.
379b7f7f640Sschwarze.It Dv X509_V_ERR_CRL_HAS_EXPIRED : No CRL has expired
380b7f7f640SschwarzeThe CRL has expired.
381b7f7f640Sschwarze.It Dv X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD : \
382b7f7f640Sschwarze No format error in certificate's notBefore field
383b7f7f640SschwarzeThe certificate notBefore field contains an invalid time.
384b7f7f640Sschwarze.It Dv X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD : \
385b7f7f640Sschwarze No format error in certificate's notAfter field
386b7f7f640SschwarzeThe certificate notAfter field contains an invalid time.
387b7f7f640Sschwarze.It Dv X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD : \
388b7f7f640Sschwarze No format error in CRL's lastUpdate field
389*a9630e5bSschwarzeThe CRL thisUpdate field (sic!) contains an invalid time.
390*a9630e5bSschwarzeBoth the name of the error constant and the text of the error message
391*a9630e5bSschwarzegive a wrong name for the field that contains the problem.
392b7f7f640Sschwarze.It Dv X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD : \
393b7f7f640Sschwarze No format error in CRL's nextUpdate field
394b7f7f640SschwarzeThe CRL nextUpdate field contains an invalid time.
395b7f7f640Sschwarze.It Dv X509_V_ERR_OUT_OF_MEM : No out of memory
396b7f7f640SschwarzeAn error occurred trying to allocate memory.
397b7f7f640SschwarzeThis should never happen.
398b7f7f640Sschwarze.It Dv X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT : No self signed certificate
399b7f7f640SschwarzeThe passed certificate is self signed and the same certificate cannot be
400b7f7f640Sschwarzefound in the list of trusted certificates.
401b7f7f640Sschwarze.It Dv X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN : \
402b7f7f640Sschwarze No self signed certificate in certificate chain
403b7f7f640SschwarzeThe certificate chain could be built up using the untrusted certificates
404b7f7f640Sschwarzebut the root could not be found locally.
405b7f7f640Sschwarze.It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY : \
406b7f7f640Sschwarze No unable to get local issuer certificate
4071c8a3c4cSschwarzeThe issuer certificate could not be found: this occurs if the issuer
4081c8a3c4cSschwarzecertificate of an untrusted certificate cannot be found.
409b7f7f640Sschwarze.It Dv X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE : \
410b7f7f640Sschwarze No unable to verify the first certificate
411b7f7f640SschwarzeNo signatures could be verified because the chain contains only one
412b7f7f640Sschwarzecertificate and it is not self signed.
413b7f7f640Sschwarze.It Dv X509_V_ERR_CERT_CHAIN_TOO_LONG : No certificate chain too long
414b7f7f640SschwarzeThe certificate chain length is greater than the supplied maximum depth.
415b7f7f640Sschwarze.It Dv X509_V_ERR_CERT_REVOKED : No certificate revoked
416b7f7f640SschwarzeThe certificate has been revoked.
417b7f7f640Sschwarze.It Dv X509_V_ERR_INVALID_CA : No invalid CA certificate
418b7f7f640SschwarzeA CA certificate is invalid.
419b7f7f640SschwarzeEither it is not a CA or its extensions are not consistent with the
420b7f7f640Sschwarzesupplied purpose.
421b7f7f640Sschwarze.It Dv X509_V_ERR_PATH_LENGTH_EXCEEDED : No path length constraint exceeded
4222d281ab4SschwarzeThe basicConstraints path-length parameter has been exceeded.
423b7f7f640Sschwarze.It Dv X509_V_ERR_INVALID_PURPOSE : No unsupported certificate purpose
424b7f7f640SschwarzeThe supplied certificate cannot be used for the specified purpose.
425b7f7f640Sschwarze.It Dv X509_V_ERR_CERT_UNTRUSTED : No certificate not trusted
426b7f7f640SschwarzeThe root CA is not marked as trusted for the specified purpose.
427b7f7f640Sschwarze.It Dv X509_V_ERR_CERT_REJECTED : No certificate rejected
428b7f7f640SschwarzeThe root CA is marked to reject the specified purpose.
429b7f7f640Sschwarze.It Dv X509_V_ERR_SUBJECT_ISSUER_MISMATCH : No subject issuer mismatch
430b7f7f640SschwarzeThe current candidate issuer certificate was rejected because its
431b7f7f640Sschwarzesubject name did not match the issuer name of the current certificate.
4321a92b4a1SjmcThis is only set if issuer check debugging is enabled; it is used for
433b7f7f640Sschwarzestatus notification and is
434b7f7f640Sschwarze.Sy not
435b7f7f640Sschwarzein itself an error.
436b7f7f640Sschwarze.It Dv X509_V_ERR_AKID_SKID_MISMATCH : \
437b7f7f640Sschwarze No authority and subject key identifier mismatch
438b7f7f640SschwarzeThe current candidate issuer certificate was rejected because its
439b7f7f640Sschwarzesubject key identifier was present and did not match the authority key
440b7f7f640Sschwarzeidentifier current certificate.
4411a92b4a1SjmcThis is only set if issuer check debugging is enabled; it is used for
442b7f7f640Sschwarzestatus notification and is
443b7f7f640Sschwarze.Sy not
444b7f7f640Sschwarzein itself an error.
445b7f7f640Sschwarze.It Dv X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH : \
446b7f7f640Sschwarze No authority and issuer serial number mismatch
447b7f7f640SschwarzeThe current candidate issuer certificate was rejected because its issuer
448b7f7f640Sschwarzename and serial number was present and did not match the authority key
449b7f7f640Sschwarzeidentifier of the current certificate.
4501a92b4a1SjmcThis is only set if issuer check debugging is enabled; it is used for
451b7f7f640Sschwarzestatus notification and is
452b7f7f640Sschwarze.Sy not
453b7f7f640Sschwarzein itself an error.
454b7f7f640Sschwarze.It Dv X509_V_ERR_KEYUSAGE_NO_CERTSIGN : \
455b7f7f640Sschwarze No key usage does not include certificate signing
456b7f7f640SschwarzeThe current candidate issuer certificate was rejected because its
457b7f7f640SschwarzekeyUsage extension does not permit certificate signing.
458b7f7f640SschwarzeThis is only set if issuer check debugging is enabled it is used for
459b7f7f640Sschwarzestatus notification and is
460b7f7f640Sschwarze.Sy not
461b7f7f640Sschwarzein itself an error.
462911e7b6aStb.It Dv X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER : \
463911e7b6aStb No unable to get CRL issuer certificate
464911e7b6aStbThe CRL's issuer could not be found:
465911e7b6aStbthere is no alternative CRL issuer set on
466911e7b6aStb.Ar ctx
467911e7b6aStband the last certificate in the chain is not self signed.
468911e7b6aStb.It Dv X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION : \
469911e7b6aStb No unhandled critical extension
470911e7b6aStbThe certificate contains a critical extension that is unsupported
471911e7b6aStbby the library.
472911e7b6aStb.It Dv X509_V_ERR_KEYUSAGE_NO_CRL_SIGN : \
473911e7b6aStb No key usage does not include CRL signing
474911e7b6aStbThe CRL issuer has a key usage extension with unset cRLSign bit.
475911e7b6aStb.It Dv X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION : \
476911e7b6aStb No unhandled critical CRL extension
477911e7b6aStbThe CRL contains a critical extension that is unsupported
478911e7b6aStbby the library.
479911e7b6aStb.\" XXX - The following are unreachable (X509_V_ERR_INVALID_NON_CA) or unused.
480443e243aStb.\" .It Dv X509_V_ERR_INVALID_NON_CA : \
48104f2b1b8Stb.\"  No invalid non-CA certificate (has CA markings)
482443e243aStb.\" .It Dv X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED : \
48304f2b1b8Stb.\"  No proxy path length constraint exceeded
484443e243aStb.\" .It Dv X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE : \
48504f2b1b8Stb.\"  No key usage does not include digital signature
486443e243aStb.\" .It Dv X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED : \
48704f2b1b8Stb.\"  No proxy certificates not allowed, please set the appropriate flag
488b7f7f640Sschwarze.It Dv X509_V_ERR_INVALID_EXTENSION : \
489b7f7f640Sschwarze No invalid or inconsistent certificate extension
490b7f7f640SschwarzeA certificate extension had an invalid value (for example an incorrect
491b7f7f640Sschwarzeencoding) or some value inconsistent with other extensions.
492b7f7f640Sschwarze.It Dv X509_V_ERR_INVALID_POLICY_EXTENSION : \
493b7f7f640Sschwarze No invalid or inconsistent certificate policy extension
494b7f7f640SschwarzeA certificate policies extension had an invalid value (for example an
495b7f7f640Sschwarzeincorrect encoding) or some value inconsistent with other extensions.
496b7f7f640SschwarzeThis error only occurs if policy processing is enabled.
497b7f7f640Sschwarze.It Dv X509_V_ERR_NO_EXPLICIT_POLICY : No no explicit policy
4981a92b4a1SjmcThe verification flags were set to require an explicit policy but none
499b7f7f640Sschwarzewas present.
500b7f7f640Sschwarze.It Dv X509_V_ERR_DIFFERENT_CRL_SCOPE : No different CRL scope
501b7f7f640SschwarzeThe only CRLs that could be found did not match the scope of the
502b7f7f640Sschwarzecertificate.
503b7f7f640Sschwarze.It Dv X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE : \
504b7f7f640Sschwarze No unsupported extension feature
505b7f7f640SschwarzeSome feature of a certificate extension is not supported.
506b7f7f640SschwarzeUnused.
50704f2b1b8Stb.It Dv X509_V_ERR_UNNESTED_RESOURCE : \
508443e243aStb No RFC 3779 resource not subset of parent's resources
50904f2b1b8StbWhen walking up a certificate chain, all resources specified in
51004f2b1b8StbRFC 3779 extensions must be contained in the resources delegated in
51104f2b1b8Stbthe issuer's RFC 3779 extensions.
51204f2b1b8StbThe error indicates that this is not the case or that the trust anchor
51304f2b1b8Stbhas inheritance.
514b7f7f640Sschwarze.It Dv X509_V_ERR_PERMITTED_VIOLATION : No permitted subtree violation
515b7f7f640SschwarzeA name constraint violation occurred in the permitted subtrees.
516b7f7f640Sschwarze.It Dv X509_V_ERR_EXCLUDED_VIOLATION : No excluded subtree violation
517b7f7f640SschwarzeA name constraint violation occurred in the excluded subtrees.
518b7f7f640Sschwarze.It Dv X509_V_ERR_SUBTREE_MINMAX : \
519b7f7f640Sschwarze No name constraints minimum and maximum not supported
520b7f7f640SschwarzeA certificate name constraints extension included a minimum or maximum
521b7f7f640Sschwarzefield: this is not supported.
522b7f7f640Sschwarze.It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE : \
523b7f7f640Sschwarze No unsupported name constraint type
524b7f7f640SschwarzeAn unsupported name constraint type was encountered.
525b7f7f640SschwarzeOpenSSL currently only supports directory name, DNS name, email and URI
526b7f7f640Sschwarzetypes.
527b7f7f640Sschwarze.It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX : \
528b7f7f640Sschwarze No unsupported or invalid name constraint syntax
529b7f7f640SschwarzeThe format of the name constraint is not recognised: for example an
530b7f7f640Sschwarzeemail address format of a form not mentioned in RFC 3280.
531b7f7f640SschwarzeThis could be caused by a garbage extension or some new feature not
532b7f7f640Sschwarzecurrently supported.
53304f2b1b8Stb.\" X509_V_ERR_UNSUPPORTED_NAME_SYNTAX : No unsupported or invalid name syntax
534b7f7f640Sschwarze.It Dv X509_V_ERR_CRL_PATH_VALIDATION_ERROR : No CRL path validation error
535b7f7f640SschwarzeAn error occurred when attempting to verify the CRL path.
536b7f7f640SschwarzeThis error can only happen if extended CRL checking is enabled.
537b7f7f640Sschwarze.It Dv X509_V_ERR_APPLICATION_VERIFICATION : \
538b7f7f640Sschwarze No application verification failure
539b7f7f640SschwarzeAn application specific error.
540b7f7f640SschwarzeThis will never be returned unless explicitly set by an application.
54104f2b1b8Stb.\" .It Dv X509_V_ERR_HOSTNAME_MISMATCH : No Hostname mismatch
54204f2b1b8Stb.\" .It Dv X509_V_ERR_EMAIL_MISMATCH : No Email address mismatch
54304f2b1b8Stb.\" .It Dv X509_V_ERR_IP_ADDRESS_MISMATCH : No IP address mismatch
54404f2b1b8Stb.\" .It Dv X509_V_ERR_INVALID_CALL : \
54504f2b1b8Stb.\"  No Invalid certificate verification context
54604f2b1b8Stb.\" .It Dv X509_V_ERR_STORE_LOOKUP : No Issuer certificate lookup error
54704f2b1b8Stb.\" .It Dv X509_V_ERR_EE_KEY_TOO_SMALL : No EE certificate key too weak
54804f2b1b8Stb.\" .It Dv X509_V_ERR_CA_KEY_TOO_SMALL : No CA certificate key too weak
54904f2b1b8Stb.\" .It Dv X509_V_ERR_CA_MD_TOO_WEAK : \
55004f2b1b8Stb.\"  No CA signature digest algorithm too weak
551b7f7f640Sschwarze.El
552b7f7f640Sschwarze.Sh SEE ALSO
553d3125e1cSschwarze.Xr X509_STORE_CTX_new 3 ,
554491f2bffSschwarze.Xr X509_STORE_CTX_set_verify 3 ,
555491f2bffSschwarze.Xr X509_STORE_CTX_set_verify_cb 3 ,
556491f2bffSschwarze.Xr X509_STORE_set_verify_cb 3 ,
557274e6233Sschwarze.Xr X509_up_ref 3 ,
558b7f7f640Sschwarze.Xr X509_verify_cert 3
559d9d184f2Sschwarze.Sh HISTORY
560d9d184f2Sschwarze.Fn X509_STORE_CTX_get_error ,
561d9d184f2Sschwarze.Fn X509_STORE_CTX_set_error ,
562d9d184f2Sschwarze.Fn X509_STORE_CTX_get_error_depth ,
563d9d184f2Sschwarze.Fn X509_STORE_CTX_get_current_cert ,
564b543445eSschwarze.Fn X509_STORE_CTX_get_chain ,
565d9d184f2Sschwarzeand
566d9d184f2Sschwarze.Fn X509_verify_cert_error_string
56710e00d17Sschwarzefirst appeared in SSLeay 0.8.0 and have been available since
568d9d184f2Sschwarze.Ox 2.4 .
569958c08b5Sschwarze.Pp
570958c08b5Sschwarze.Fn X509_STORE_CTX_get1_chain
571958c08b5Sschwarzefirst appeared in OpenSSL 0.9.5 and has been available since
572958c08b5Sschwarze.Ox 2.7 .
5734b12da35Sschwarze.Pp
574295c5934Sschwarze.Fn X509_STORE_CTX_get0_current_issuer ,
575295c5934Sschwarze.Fn X509_STORE_CTX_get0_current_crl ,
576eb922cd1Sschwarzeand
577295c5934Sschwarze.Fn X509_STORE_CTX_get0_parent_ctx
578eb922cd1Sschwarzefirst appeared in OpenSSL 1.0.0 and have been available since
579eb922cd1Sschwarze.Ox 4.9 .
580eb922cd1Sschwarze.Pp
5814b12da35Sschwarze.Fn X509_STORE_CTX_get0_chain
5824a763290Sschwarzefirst appeared in OpenSSL 1.1.0 and has been available since
5834b12da35Sschwarze.Ox 6.3 .
5841798df84Sschwarze.Pp
5851798df84Sschwarze.Fn X509_STORE_CTX_set_error_depth ,
5861798df84Sschwarze.Fn X509_STORE_CTX_set_current_cert ,
5871798df84Sschwarze.Fn X509_STORE_CTX_get_num_untrusted ,
5881798df84Sschwarzeand
5891798df84Sschwarze.Fn X509_STORE_CTX_set0_verified_chain
5901798df84Sschwarzefirst appeared in OpenSSL 1.1.0 and have been available since
5911798df84Sschwarze.Ox 7.1 .
592