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