xref: /freebsd/crypto/openssl/doc/man3/X509_verify_cert.pod (revision e71b70530d95c4f34d8bdbd78d1242df1ba4a945)
1*e71b7053SJung-uk Kim=pod
2*e71b7053SJung-uk Kim
3*e71b7053SJung-uk Kim=head1 NAME
4*e71b7053SJung-uk Kim
5*e71b7053SJung-uk KimX509_verify_cert - discover and verify X509 certificate chain
6*e71b7053SJung-uk Kim
7*e71b7053SJung-uk Kim=head1 SYNOPSIS
8*e71b7053SJung-uk Kim
9*e71b7053SJung-uk Kim #include <openssl/x509.h>
10*e71b7053SJung-uk Kim
11*e71b7053SJung-uk Kim int X509_verify_cert(X509_STORE_CTX *ctx);
12*e71b7053SJung-uk Kim
13*e71b7053SJung-uk Kim=head1 DESCRIPTION
14*e71b7053SJung-uk Kim
15*e71b7053SJung-uk KimThe X509_verify_cert() function attempts to discover and validate a
16*e71b7053SJung-uk Kimcertificate chain based on parameters in B<ctx>. A complete description of
17*e71b7053SJung-uk Kimthe process is contained in the L<verify(1)> manual page.
18*e71b7053SJung-uk Kim
19*e71b7053SJung-uk Kim=head1 RETURN VALUES
20*e71b7053SJung-uk Kim
21*e71b7053SJung-uk KimIf a complete chain can be built and validated this function returns 1,
22*e71b7053SJung-uk Kimotherwise it return zero, in exceptional circumstances it can also
23*e71b7053SJung-uk Kimreturn a negative code.
24*e71b7053SJung-uk Kim
25*e71b7053SJung-uk KimIf the function fails additional error information can be obtained by
26*e71b7053SJung-uk Kimexamining B<ctx> using, for example X509_STORE_CTX_get_error().
27*e71b7053SJung-uk Kim
28*e71b7053SJung-uk Kim=head1 NOTES
29*e71b7053SJung-uk Kim
30*e71b7053SJung-uk KimApplications rarely call this function directly but it is used by
31*e71b7053SJung-uk KimOpenSSL internally for certificate validation, in both the S/MIME and
32*e71b7053SJung-uk KimSSL/TLS code.
33*e71b7053SJung-uk Kim
34*e71b7053SJung-uk KimA negative return value from X509_verify_cert() can occur if it is invoked
35*e71b7053SJung-uk Kimincorrectly, such as with no certificate set in B<ctx>, or when it is called
36*e71b7053SJung-uk Kimtwice in succession without reinitialising B<ctx> for the second call.
37*e71b7053SJung-uk KimA negative return value can also happen due to internal resource problems or if
38*e71b7053SJung-uk Kima retry operation is requested during internal lookups (which never happens
39*e71b7053SJung-uk Kimwith standard lookup methods).
40*e71b7053SJung-uk KimApplications must check for <= 0 return value on error.
41*e71b7053SJung-uk Kim
42*e71b7053SJung-uk Kim=head1 BUGS
43*e71b7053SJung-uk Kim
44*e71b7053SJung-uk KimThis function uses the header B<x509.h> as opposed to most chain verification
45*e71b7053SJung-uk Kimfunctions which use B<x509_vfy.h>.
46*e71b7053SJung-uk Kim
47*e71b7053SJung-uk Kim=head1 SEE ALSO
48*e71b7053SJung-uk Kim
49*e71b7053SJung-uk KimL<X509_STORE_CTX_get_error(3)>
50*e71b7053SJung-uk Kim
51*e71b7053SJung-uk Kim=head1 COPYRIGHT
52*e71b7053SJung-uk Kim
53*e71b7053SJung-uk KimCopyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
54*e71b7053SJung-uk Kim
55*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
56*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
57*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
58*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
59*e71b7053SJung-uk Kim
60*e71b7053SJung-uk Kim=cut
61