1SSL_CHECK_CHAIN(3ossl) OpenSSL SSL_CHECK_CHAIN(3ossl)
2
3
4
6 SSL_check_chain - check certificate chain suitability
7
9 #include <openssl/ssl.h>
10
11 int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain);
12
14 SSL_check_chain() checks whether certificate x, private key pk and
15 certificate chain chain is suitable for use with the current session s.
16
18 SSL_check_chain() returns a bitmap of flags indicating the validity of
19 the chain.
20
21 CERT_PKEY_VALID: the chain can be used with the current session. If
22 this flag is not set then the certificate will never be used even if
23 the application tries to set it because it is inconsistent with the
24 peer preferences.
25
26 CERT_PKEY_SIGN: the EE key can be used for signing.
27
28 CERT_PKEY_EE_SIGNATURE: the signature algorithm of the EE certificate
29 is acceptable.
30
31 CERT_PKEY_CA_SIGNATURE: the signature algorithms of all CA certificates
32 are acceptable.
33
34 CERT_PKEY_EE_PARAM: the parameters of the end entity certificate are
35 acceptable (e.g. it is a supported curve).
36
37 CERT_PKEY_CA_PARAM: the parameters of all CA certificates are
38 acceptable.
39
40 CERT_PKEY_EXPLICIT_SIGN: the end entity certificate algorithm can be
41 used explicitly for signing (i.e. it is mentioned in the signature
42 algorithms extension).
43
44 CERT_PKEY_ISSUER_NAME: the issuer name is acceptable. This is only
45 meaningful for client authentication.
46
47 CERT_PKEY_CERT_TYPE: the certificate type is acceptable. Only
48 meaningful for client authentication.
49
50 CERT_PKEY_SUITEB: chain is suitable for Suite B use.
51
53 SSL_check_chain() must be called in servers after a client hello
54 message or in clients after a certificate request message. It will
55 typically be called in the certificate callback.
56
57 An application wishing to support multiple certificate chains may call
58 this function on each chain in turn: starting with the one it considers
59 the most secure. It could then use the chain of the first set which
60 returns suitable flags.
61
62 As a minimum the flag CERT_PKEY_VALID must be set for a chain to be
63 usable. An application supporting multiple chains with different CA
64 signature algorithms may also wish to check CERT_PKEY_CA_SIGNATURE too.
65 If no chain is suitable a server should fall back to the most secure
66 chain which sets CERT_PKEY_VALID.
67
68 The validity of a chain is determined by checking if it matches a
69 supported signature algorithm, supported curves and in the case of
70 client authentication certificate types and issuer names.
71
72 Since the supported signature algorithms extension is only used in TLS
73 1.2, TLS 1.3 and DTLS 1.2 the results for earlier versions of TLS and
74 DTLS may not be very useful. Applications may wish to specify a
75 different "legacy" chain for earlier versions of TLS or DTLS.
76
78 SSL_CTX_set_cert_cb(3), ssl(7)
79
81 Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
82
83 Licensed under the Apache License 2.0 (the "License"). You may not use
84 this file except in compliance with the License. You can obtain a copy
85 in the file LICENSE in the source distribution or at
86 <https://www.openssl.org/source/license.html>.
87
88
89
903.0.5 2022-07-05 SSL_CHECK_CHAIN(3ossl)