1 .\" $OpenBSD: X509_STORE_CTX_get_error.3,v 1.5 2016/12/25 22:15:10 schwarze Exp $
2 .\" OpenSSL 9b86974e Aug 17 15:21:33 2015 -0400
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2009, 2013, 2015, 2016 The OpenSSL Project.
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in
17 .\" the documentation and/or other materials provided with the
20 .\" 3. All advertising materials mentioning features or use of this
21 .\" software must display the following acknowledgment:
22 .\" "This product includes software developed by the OpenSSL Project
23 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\" endorse or promote products derived from this software without
27 .\" prior written permission. For written permission, please contact
28 .\" openssl-core@openssl.org.
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\" nor may "OpenSSL" appear in their names without prior written
32 .\" permission of the OpenSSL Project.
34 .\" 6. Redistributions of any form whatsoever must retain the following
36 .\" "This product includes software developed by the OpenSSL Project
37 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
52 .Dd $Mdocdate: December 25 2016 $
53 .Dt X509_STORE_CTX_GET_ERROR 3
56 .Nm X509_STORE_CTX_get_error ,
57 .Nm X509_STORE_CTX_set_error ,
58 .Nm X509_STORE_CTX_get_error_depth ,
59 .Nm X509_STORE_CTX_get_current_cert ,
60 .Nm X509_STORE_CTX_get1_chain ,
61 .Nm X509_verify_cert_error_string
62 .Nd get or set certificate verification status information
66 .Fo X509_STORE_CTX_get_error
67 .Fa "X509_STORE_CTX *ctx"
70 .Fo X509_STORE_CTX_set_error
71 .Fa "X509_STORE_CTX *ctx"
75 .Fo X509_STORE_CTX_get_error_depth
76 .Fa "X509_STORE_CTX *ctx"
79 .Fo X509_STORE_CTX_get_current_cert
80 .Fa "X509_STORE_CTX *ctx"
83 .Fo X509_STORE_CTX_get1_chain
84 .Fa "X509_STORE_CTX *ctx"
87 .Fo X509_verify_cert_error_string
91 These functions are typically called after
92 .Xr X509_verify_cert 3
93 has indicated an error or in a verification callback to determine the
96 .Fn X509_STORE_CTX_get_error
97 returns the error code of
101 section for a full description of all error codes.
103 .Fn X509_STORE_CTX_set_error
104 sets the error code of
108 For example it might be used in a verification callback to set an error
109 based on additional checks.
111 .Fn X509_STORE_CTX_get_error_depth
112 returns the depth of the error.
113 This is a non-negative integer representing where in the certificate
114 chain the error occurred.
115 If it is zero, it occurred in the end entity certificate, one if it is
116 the certificate which signed the end entity certificate, and so on.
118 .Fn X509_STORE_CTX_get_current_cert
119 returns the certificate in
121 which caused the error or
123 if no certificate is relevant.
125 .Fn X509_STORE_CTX_get1_chain
126 returns a complete validate chain if a previous call to
127 .Xr X509_verify_cert 3
130 .Xr X509_verify_cert 3
133 successful, the returned chain may be incomplete or invalid.
134 The returned chain persists after the
137 When it is no longer needed, it should be freed up using
138 .Fn sk_X509_pop_free chain X509_free .
140 .Fn X509_verify_cert_error_string
141 returns a human readable error string for verification error
144 The above functions should be used instead of directly referencing the
149 In versions of OpenSSL before 1.0, the current certificate returned by
150 .Fn X509_STORE_CTX_get_current_cert
153 Applications should check the return value before printing out any
154 debugging information relating to the current certificate.
156 If an unrecognised error code is passed to
157 .Fn X509_verify_cert_error_string ,
158 the numerical value of the unknown code is returned in a static buffer.
159 This is not thread safe but will never happen unless an invalid code is
162 .Fn X509_STORE_CTX_get_error
167 .Fn X509_STORE_CTX_get_error_depth
168 returns a non-negative error depth.
170 .Fn X509_STORE_CTX_get_current_cert
171 returns the certificate which caused the error or
173 if no certificate is relevant to the error.
175 .Fn X509_verify_cert_error_string
176 returns a human readable error string for verification error
179 A list of error codes and messages is shown below.
180 Some of the error codes are defined but currently never returned:
181 these are described as "unused".
183 .It Dv X509_V_OK : No ok
184 The operation was successful.
185 .It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT : \
186 No unable to get issuer certificate
187 The issuer certificate could not be found: this occurs if the issuer
188 certificate of an untrusted certificate cannot be found.
189 .It Dv X509_V_ERR_UNABLE_TO_GET_CRL : No unable to get certificate CRL
190 The CRL of a certificate could not be found.
191 .It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE : \
192 No unable to decrypt certificate's signature
193 The certificate signature could not be decrypted.
194 This means that the actual signature value could not be determined
195 rather than it not matching the expected value.
196 This is only meaningful for RSA keys.
197 .It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE : \
198 No unable to decrypt CRL's signature
199 The CRL signature could not be decrypted: this means that the actual
200 signature value could not be determined rather than it not matching the
203 .It Dv X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY : \
204 No unable to decode issuer public key
205 The public key in the certificate
206 .Vt SubjectPublicKeyInfo
208 .It Dv X509_V_ERR_CERT_SIGNATURE_FAILURE : No certificate signature failure
209 The signature of the certificate is invalid.
210 .It Dv X509_V_ERR_CRL_SIGNATURE_FAILURE : No CRL signature failure
211 The signature of the certificate is invalid.
212 .It Dv X509_V_ERR_CERT_NOT_YET_VALID : No certificate is not yet valid
213 The certificate is not yet valid: the notBefore date is after the
215 .It Dv X509_V_ERR_CERT_HAS_EXPIRED : No certificate has expired
216 The certificate has expired: that is the notAfter date is before the
218 .It Dv X509_V_ERR_CRL_NOT_YET_VALID : No CRL is not yet valid
219 The CRL is not yet valid.
220 .It Dv X509_V_ERR_CRL_HAS_EXPIRED : No CRL has expired
222 .It Dv X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD : \
223 No format error in certificate's notBefore field
224 The certificate notBefore field contains an invalid time.
225 .It Dv X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD : \
226 No format error in certificate's notAfter field
227 The certificate notAfter field contains an invalid time.
228 .It Dv X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD : \
229 No format error in CRL's lastUpdate field
230 The CRL lastUpdate field contains an invalid time.
231 .It Dv X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD : \
232 No format error in CRL's nextUpdate field
233 The CRL nextUpdate field contains an invalid time.
234 .It Dv X509_V_ERR_OUT_OF_MEM : No out of memory
235 An error occurred trying to allocate memory.
236 This should never happen.
237 .It Dv X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT : No self signed certificate
238 The passed certificate is self signed and the same certificate cannot be
239 found in the list of trusted certificates.
240 .It Dv X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN : \
241 No self signed certificate in certificate chain
242 The certificate chain could be built up using the untrusted certificates
243 but the root could not be found locally.
244 .It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY : \
245 No unable to get local issuer certificate
246 The issuer certificate of a locally looked up certificate could not be found.
247 This normally means the list of trusted certificates is not complete.
248 .It Dv X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE : \
249 No unable to verify the first certificate
250 No signatures could be verified because the chain contains only one
251 certificate and it is not self signed.
252 .It Dv X509_V_ERR_CERT_CHAIN_TOO_LONG : No certificate chain too long
253 The certificate chain length is greater than the supplied maximum depth.
255 .It Dv X509_V_ERR_CERT_REVOKED : No certificate revoked
256 The certificate has been revoked.
257 .It Dv X509_V_ERR_INVALID_CA : No invalid CA certificate
258 A CA certificate is invalid.
259 Either it is not a CA or its extensions are not consistent with the
261 .It Dv X509_V_ERR_PATH_LENGTH_EXCEEDED : No path length constraint exceeded
262 The basicConstraints path-length parameter has been exceeded.
263 .It Dv X509_V_ERR_INVALID_PURPOSE : No unsupported certificate purpose
264 The supplied certificate cannot be used for the specified purpose.
265 .It Dv X509_V_ERR_CERT_UNTRUSTED : No certificate not trusted
266 The root CA is not marked as trusted for the specified purpose.
267 .It Dv X509_V_ERR_CERT_REJECTED : No certificate rejected
268 The root CA is marked to reject the specified purpose.
269 .It Dv X509_V_ERR_SUBJECT_ISSUER_MISMATCH : No subject issuer mismatch
270 The current candidate issuer certificate was rejected because its
271 subject name did not match the issuer name of the current certificate.
272 This is only set if issuer check debugging is enabled; it is used for
273 status notification and is
276 .It Dv X509_V_ERR_AKID_SKID_MISMATCH : \
277 No authority and subject key identifier mismatch
278 The current candidate issuer certificate was rejected because its
279 subject key identifier was present and did not match the authority key
280 identifier current certificate.
281 This is only set if issuer check debugging is enabled; it is used for
282 status notification and is
285 .It Dv X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH : \
286 Noauthority and issuer serial number mismatch
287 The current candidate issuer certificate was rejected because its issuer
288 name and serial number was present and did not match the authority key
289 identifier of the current certificate.
290 This is only set if issuer check debugging is enabled; it is used for
291 status notification and is
294 .It Dv X509_V_ERR_KEYUSAGE_NO_CERTSIGN : \
295 No key usage does not include certificate signing
296 The current candidate issuer certificate was rejected because its
297 keyUsage extension does not permit certificate signing.
298 This is only set if issuer check debugging is enabled it is used for
299 status notification and is
302 .It Dv X509_V_ERR_INVALID_EXTENSION : \
303 No invalid or inconsistent certificate extension
304 A certificate extension had an invalid value (for example an incorrect
305 encoding) or some value inconsistent with other extensions.
306 .It Dv X509_V_ERR_INVALID_POLICY_EXTENSION : \
307 No invalid or inconsistent certificate policy extension
308 A certificate policies extension had an invalid value (for example an
309 incorrect encoding) or some value inconsistent with other extensions.
310 This error only occurs if policy processing is enabled.
311 .It Dv X509_V_ERR_NO_EXPLICIT_POLICY : No no explicit policy
312 The verification flags were set to require an explicit policy but none
314 .It Dv X509_V_ERR_DIFFERENT_CRL_SCOPE : No different CRL scope
315 The only CRLs that could be found did not match the scope of the
317 .It Dv X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE : \
318 No unsupported extension feature
319 Some feature of a certificate extension is not supported.
321 .It Dv X509_V_ERR_PERMITTED_VIOLATION : No permitted subtree violation
322 A name constraint violation occurred in the permitted subtrees.
323 .It Dv X509_V_ERR_EXCLUDED_VIOLATION : No excluded subtree violation
324 A name constraint violation occurred in the excluded subtrees.
325 .It Dv X509_V_ERR_SUBTREE_MINMAX : \
326 No name constraints minimum and maximum not supported
327 A certificate name constraints extension included a minimum or maximum
328 field: this is not supported.
329 .It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE : \
330 No unsupported name constraint type
331 An unsupported name constraint type was encountered.
332 OpenSSL currently only supports directory name, DNS name, email and URI
334 .It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX : \
335 No unsupported or invalid name constraint syntax
336 The format of the name constraint is not recognised: for example an
337 email address format of a form not mentioned in RFC 3280.
338 This could be caused by a garbage extension or some new feature not
340 .It Dv X509_V_ERR_CRL_PATH_VALIDATION_ERROR : No CRL path validation error
341 An error occurred when attempting to verify the CRL path.
342 This error can only happen if extended CRL checking is enabled.
343 .It Dv X509_V_ERR_APPLICATION_VERIFICATION : \
344 No application verification failure
345 An application specific error.
346 This will never be returned unless explicitly set by an application.
349 .Xr X509_verify_cert 3