|
Botan 3.14.1
Crypto and TLS for C&
|
#include <ffi_tls_impl.h>
Public Member Functions | |
| void | add_cert_chain (std::vector< Botan::X509_Certificate > chain, std::shared_ptr< Botan::Private_Key > key) |
chain is leaf first and not empty; key belongs to the leaf | |
| void | add_crl (const Botan::X509_CRL &crl) |
| void | add_store (std::shared_ptr< Botan::Certificate_Store > store) |
| void | add_trusted_cert (const Botan::X509_Certificate &cert) |
| virtual std::vector< X509_Certificate > | cert_chain (const std::vector< std::string > &cert_key_types, const std::vector< AlgorithmIdentifier > &cert_signature_schemes, const std::string &type, const std::string &context) |
| std::vector< X509_Certificate > | cert_chain_single_type (const std::string &cert_key_type, const std::vector< AlgorithmIdentifier > &cert_signature_schemes, const std::string &type, const std::string &context) |
| virtual std::optional< TLS::ExternalPSK > | choose_preshared_key (std::string_view host, TLS::Connection_Side whoami, const std::vector< std::string > &identities, const std::optional< std::string > &prf=std::nullopt) |
| virtual secure_vector< uint8_t > | dtls_cookie_secret () |
| std::vector< Botan::X509_Certificate > | find_cert_chain (const std::vector< std::string > &cert_key_types, const std::vector< Botan::AlgorithmIdentifier > &cert_signature_schemes, const std::vector< Botan::X509_DN > &acceptable_CAs, const std::string &type, const std::string &context) override |
| virtual std::vector< TLS::ExternalPSK > | find_preshared_keys (std::string_view host, TLS::Connection_Side whoami, const std::vector< std::string > &identities={}, const std::optional< std::string > &prf=std::nullopt) |
| virtual std::shared_ptr< Public_Key > | find_raw_public_key (const std::vector< std::string > &key_types, const std::string &type, const std::string &context) |
| std::shared_ptr< Botan::Private_Key > | private_key_for (const Botan::X509_Certificate &cert, const std::string &type, const std::string &context) override |
| virtual std::shared_ptr< Private_Key > | private_key_for (const Public_Key &raw_public_key, const std::string &type, const std::string &context) |
| virtual SymmetricKey | psk (const std::string &type, const std::string &context, const std::string &identity) |
| virtual std::string | psk_identity (const std::string &type, const std::string &context, const std::string &identity_hint) |
| virtual std::string | psk_identity_hint (const std::string &type, const std::string &context) |
| virtual secure_vector< uint8_t > | session_ticket_key () |
| std::vector< Botan::Certificate_Store * > | trusted_certificate_authorities (const std::string &type, const std::string &context) override |
The Credentials_Manager behind botan_tls_credentials_t.
Trust anchors and CRLs live in an in-memory certificate store; further stores (a directory, the system store) are kept as separate objects. The certificate chains are used for server and for client authentication alike. The setters copy certificates and CRLs and share the private keys. The object is not synchronized, but otherwise it may be modified at any time and shared between channels.
Definition at line 35 of file ffi_tls_impl.h.
| void Botan_FFI::FFI_TLS_Credentials::add_cert_chain | ( | std::vector< Botan::X509_Certificate > | chain, |
| std::shared_ptr< Botan::Private_Key > | key ) |
chain is leaf first and not empty; key belongs to the leaf
Definition at line 48 of file ffi_tls.cpp.
References BOTAN_ARG_CHECK.
| void Botan_FFI::FFI_TLS_Credentials::add_crl | ( | const Botan::X509_CRL & | crl | ) |
Definition at line 40 of file ffi_tls.cpp.
References crl.
| void Botan_FFI::FFI_TLS_Credentials::add_store | ( | std::shared_ptr< Botan::Certificate_Store > | store | ) |
Definition at line 44 of file ffi_tls.cpp.
| void Botan_FFI::FFI_TLS_Credentials::add_trusted_cert | ( | const Botan::X509_Certificate & | cert | ) |
Definition at line 36 of file ffi_tls.cpp.
|
virtualinherited |
Return a certificate chain we can use to identify ourselves, ordered from leaf to root, or else an empty vector.
This virtual function is deprecated, and will be removed in a future release. Use (and override) find_cert_chain() instead.
It is assumed that the caller can get the private key of the leaf with private_key_for()
| cert_key_types | specifies the key types desired ("RSA", "DSA", "ECDSA", etc), or empty if there is no preference by the caller. |
| cert_signature_schemes | specifies the signature types desired as signatures in the certificate(s) itself, or empty for no preference by the caller. |
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. |
Definition at line 98 of file credentials_manager.cpp.
Referenced by find_cert_chain(), and ~Credentials_Manager().
|
inherited |
Return a certificate chain we can use to identify ourselves, ordered from leaf to root, or else an empty vector. Override this if we have one certificate of type cert_key_type and we would like to use a certificate in this type and context.
For servers type will be "tls-server" and the context will be the server name that the client requested via SNI (or empty, if the client did not send SNI).
It is assumed that the caller can get the private key of the leaf with private_key_for()
| cert_key_type | specifies the type of key requested ("RSA", "DSA", "ECDSA", etc) |
| cert_signature_schemes | specifies the signature types desired as signatures in the certificate(s) itself, or empty for no preference by the caller. |
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. |
Definition at line 105 of file credentials_manager.cpp.
References find_cert_chain().
Referenced by ~Credentials_Manager().
|
virtualinherited |
Selects a single PSK identity from the given identities and returns its details (i.e. the secret value) for it to be used in the handshake.
The default implementation relies on the filtering capabilities provided by find_preshared_keys() and simply selects the first PSK returned. If applications need finer grained control, they should override this method.
In TLS 1.3 the identities might contain opaque session ticket data that is not necessarily a printable string, despite the utilized std::string type. Implementations must be prepared to ignore identities generated via the TLS 1.3 resumption mechanism.
| host | the host name for which a PSK is requested (may be empty) |
| whoami | the type of the host (client or server) that is requesting |
| identities | an optional filter for PSK identities to be returned (an empty list means: all identities are welcome) |
| prf | an optional filter for the Pseudo Random Function the PRFs must be provisioned for |
Definition at line 71 of file credentials_manager.cpp.
References find_preshared_keys().
Referenced by Botan::TLS::PSK::select_offered_psk().
|
virtualinherited |
Provides a secret to authenticate DTLS hello cookies. The default implementation returns an empty key that effectively disables hello cookies. Applications that wish to use DTLS are strongly advised to implement this method.
Definition at line 129 of file credentials_manager.cpp.
Referenced by psk(), and ~Credentials_Manager().
|
overridevirtual |
Return a cert chain we can use, ordered from leaf to root, or else an empty vector.
It is assumed that the caller can get the private key of the leaf with private_key_for
For a comprehensive write-up of how to select certificates for TLS CertificateVerify messages, see RFC 8446 Sections 4.4.2.2 and 4.4.2.3.
| cert_key_types | specifies the key types desired ("RSA", "DSA", "ECDSA", etc), or empty if there is no preference by the caller. |
| cert_signature_schemes | specifies the signature types desired as signatures in the certificate(s) itself, or empty for no preference by the caller. |
| acceptable_CAs | the CAs the requestor will accept (possibly empty) |
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. |
Reimplemented from Botan::Credentials_Manager.
Definition at line 68 of file ffi_tls.cpp.
References Botan::value_exists().
|
virtualinherited |
Filters all available PSKs with the given criterions. Note that omitted criterions (like an empty identities list or an unspecified PRF) must be interpreted as "no restriction".
Note that this is used as the underlying API for the legacy psk() method currently still used in TLS 1.2. New applications should override find_preshared_keys() and leave psk() with the default implementation.
In TLS 1.3 the identities might contain opaque session ticket data that is not necessarily a printable string, despite the utilized std::string type. Implementations must be prepared to ignore identities generated via the TLS 1.3 resumption mechanism.
| host | the host name for which a PSK is requested (may be empty) |
| whoami | the type of the host (client or server) that is requesting |
| identities | an optional filter for PSK identities to be returned (an empty list means: all identities are welcome) |
| prf | an optional filter for the Pseudo Random Function the PRFs must be provisioned for |
Definition at line 64 of file credentials_manager.cpp.
Referenced by choose_preshared_key(), psk(), and ~Credentials_Manager().
|
virtualinherited |
Return a raw public key to be used for authentication or nullptr if no public key was found.
It is assumed that the caller can get the private key of the leaf with private_key_for().
| key_types | specifies the key types desired ("RSA", "DSA", "ECDSA", etc), or empty if there is no preference by the caller. |
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. |
Definition at line 92 of file credentials_manager.cpp.
Referenced by Botan::TLS::Certificate_13::Certificate_13(), and ~Credentials_Manager().
|
overridevirtual |
Return a shared_ptr to the private key for this certificate. The cert will be the leaf cert of a chain returned previously by find_cert_chain() or cert_chain_single_type().
This function should either return nullptr or throw an exception if the matching private key is unavailable.
Reimplemented from Botan::Credentials_Manager.
Definition at line 123 of file ffi_tls.cpp.
|
virtual |
This function should either return nullptr or throw an exception if the key is unavailable.
raw_public_key was returned by find_raw_public_key() Reimplemented from Botan::Credentials_Manager.
Definition at line 182 of file credentials_manager.cpp.
|
virtualinherited |
Retrieves the PSK with the given identity or throws an exception. It's default implementation uses find_preshared_keys() with identity as the single allowed identity.
This method is called by the TLS 1.2 implementation exclusively and will eventually be deprecated in favor of find_preshared_keys(). Going forward, new applications should implement find_preshared_keys() and rely on psk()'s default implementation.
Also, the default implementation delegates context "session-ticket" and "dtls-cookie-secret" to the methods session_ticket_key() and dtls_cookie_secret() respectively. New applications should implement those methods and rely on the default implementation of psk().
TODO(Botan4) remove this interface
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. |
| identity | is a PSK identity previously returned by psk_identity for the same type and context. |
Definition at line 27 of file credentials_manager.cpp.
References Botan::TLS::Client, dtls_cookie_secret(), find_preshared_keys(), Botan::fmt(), Botan::TLS::Server, and session_ticket_key().
Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), and ~Credentials_Manager().
|
virtualinherited |
Returns the identity we would like to use given this type and context and the optional identity_hint. Not all servers or protocols will provide a hint.
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. |
| identity_hint | was passed by the server (but may be empty) |
Definition at line 21 of file credentials_manager.cpp.
Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), and ~Credentials_Manager().
|
virtualinherited |
Returns an identity hint which may be provided to the client. This can help a client understand what PSK to use.
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. |
Definition at line 17 of file credentials_manager.cpp.
Referenced by Botan::TLS::Server_Key_Exchange::Server_Key_Exchange(), and ~Credentials_Manager().
|
virtualinherited |
Provides a secret value to encrypt session tickets for stateless session resumptions. The default implementation returns an empty key that effectively disables session tickets.
Definition at line 125 of file credentials_manager.cpp.
Referenced by psk(), and ~Credentials_Manager().
|
overridevirtual |
Return a list of the certificates of CAs that we trust in this type/context.
| type | specifies the type of operation occurring |
| context | specifies a context relative to type. For instance for type "tls-client", context specifies the servers name. |
Reimplemented from Botan::Credentials_Manager.
Definition at line 58 of file ffi_tls.cpp.