xref: /freebsd/crypto/openssl/doc/man3/SSL_check_chain.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 KimSSL_check_chain - check certificate chain suitability
6*e71b7053SJung-uk Kim
7*e71b7053SJung-uk Kim=head1 SYNOPSIS
8*e71b7053SJung-uk Kim
9*e71b7053SJung-uk Kim #include <openssl/ssl.h>
10*e71b7053SJung-uk Kim
11*e71b7053SJung-uk Kim int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain);
12*e71b7053SJung-uk Kim
13*e71b7053SJung-uk Kim=head1 DESCRIPTION
14*e71b7053SJung-uk Kim
15*e71b7053SJung-uk KimSSL_check_chain() checks whether certificate B<x>, private key B<pk> and
16*e71b7053SJung-uk Kimcertificate chain B<chain> is suitable for use with the current session
17*e71b7053SJung-uk KimB<s>.
18*e71b7053SJung-uk Kim
19*e71b7053SJung-uk Kim=head1 RETURN VALUES
20*e71b7053SJung-uk Kim
21*e71b7053SJung-uk KimSSL_check_chain() returns a bitmap of flags indicating the validity of the
22*e71b7053SJung-uk Kimchain.
23*e71b7053SJung-uk Kim
24*e71b7053SJung-uk KimB<CERT_PKEY_VALID>: the chain can be used with the current session.
25*e71b7053SJung-uk KimIf this flag is B<not> set then the certificate will never be used even
26*e71b7053SJung-uk Kimif the application tries to set it because it is inconsistent with the
27*e71b7053SJung-uk Kimpeer preferences.
28*e71b7053SJung-uk Kim
29*e71b7053SJung-uk KimB<CERT_PKEY_SIGN>: the EE key can be used for signing.
30*e71b7053SJung-uk Kim
31*e71b7053SJung-uk KimB<CERT_PKEY_EE_SIGNATURE>: the signature algorithm of the EE certificate is
32*e71b7053SJung-uk Kimacceptable.
33*e71b7053SJung-uk Kim
34*e71b7053SJung-uk KimB<CERT_PKEY_CA_SIGNATURE>: the signature algorithms of all CA certificates
35*e71b7053SJung-uk Kimare acceptable.
36*e71b7053SJung-uk Kim
37*e71b7053SJung-uk KimB<CERT_PKEY_EE_PARAM>: the parameters of the end entity certificate are
38*e71b7053SJung-uk Kimacceptable (e.g. it is a supported curve).
39*e71b7053SJung-uk Kim
40*e71b7053SJung-uk KimB<CERT_PKEY_CA_PARAM>: the parameters of all CA certificates are acceptable.
41*e71b7053SJung-uk Kim
42*e71b7053SJung-uk KimB<CERT_PKEY_EXPLICIT_SIGN>: the end entity certificate algorithm
43*e71b7053SJung-uk Kimcan be used explicitly for signing (i.e. it is mentioned in the signature
44*e71b7053SJung-uk Kimalgorithms extension).
45*e71b7053SJung-uk Kim
46*e71b7053SJung-uk KimB<CERT_PKEY_ISSUER_NAME>: the issuer name is acceptable. This is only
47*e71b7053SJung-uk Kimmeaningful for client authentication.
48*e71b7053SJung-uk Kim
49*e71b7053SJung-uk KimB<CERT_PKEY_CERT_TYPE>: the certificate type is acceptable. Only meaningful
50*e71b7053SJung-uk Kimfor client authentication.
51*e71b7053SJung-uk Kim
52*e71b7053SJung-uk KimB<CERT_PKEY_SUITEB>: chain is suitable for Suite B use.
53*e71b7053SJung-uk Kim
54*e71b7053SJung-uk Kim=head1 NOTES
55*e71b7053SJung-uk Kim
56*e71b7053SJung-uk KimSSL_check_chain() must be called in servers after a client hello message or in
57*e71b7053SJung-uk Kimclients after a certificate request message. It will typically be called
58*e71b7053SJung-uk Kimin the certificate callback.
59*e71b7053SJung-uk Kim
60*e71b7053SJung-uk KimAn application wishing to support multiple certificate chains may call this
61*e71b7053SJung-uk Kimfunction on each chain in turn: starting with the one it considers the
62*e71b7053SJung-uk Kimmost secure. It could then use the chain of the first set which returns
63*e71b7053SJung-uk Kimsuitable flags.
64*e71b7053SJung-uk Kim
65*e71b7053SJung-uk KimAs a minimum the flag B<CERT_PKEY_VALID> must be set for a chain to be
66*e71b7053SJung-uk Kimusable. An application supporting multiple chains with different CA signature
67*e71b7053SJung-uk Kimalgorithms may also wish to check B<CERT_PKEY_CA_SIGNATURE> too. If no
68*e71b7053SJung-uk Kimchain is suitable a server should fall back to the most secure chain which
69*e71b7053SJung-uk Kimsets B<CERT_PKEY_VALID>.
70*e71b7053SJung-uk Kim
71*e71b7053SJung-uk KimThe validity of a chain is determined by checking if it matches a supported
72*e71b7053SJung-uk Kimsignature algorithm, supported curves and in the case of client authentication
73*e71b7053SJung-uk Kimcertificate types and issuer names.
74*e71b7053SJung-uk Kim
75*e71b7053SJung-uk KimSince the supported signature algorithms extension is only used in TLS 1.2,
76*e71b7053SJung-uk KimTLS 1.3 and DTLS 1.2 the results for earlier versions of TLS and DTLS may not
77*e71b7053SJung-uk Kimbe very useful. Applications may wish to specify a different "legacy" chain
78*e71b7053SJung-uk Kimfor earlier versions of TLS or DTLS.
79*e71b7053SJung-uk Kim
80*e71b7053SJung-uk Kim=head1 SEE ALSO
81*e71b7053SJung-uk Kim
82*e71b7053SJung-uk KimL<SSL_CTX_set_cert_cb(3)>,
83*e71b7053SJung-uk KimL<ssl(7)>
84*e71b7053SJung-uk Kim
85*e71b7053SJung-uk Kim=head1 COPYRIGHT
86*e71b7053SJung-uk Kim
87*e71b7053SJung-uk KimCopyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
88*e71b7053SJung-uk Kim
89*e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License").  You may not use
90*e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
91*e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
92*e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
93*e71b7053SJung-uk Kim
94*e71b7053SJung-uk Kim=cut
95