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