|
Botan 3.14.1
Crypto and TLS for C&
|
#include <botan/ffi_tls.h>#include <botan/assert.h>#include <botan/certstor.h>#include <botan/system_rng.h>#include <botan/tls_policy.h>#include <botan/tls_session_manager_memory.h>#include <botan/tls_session_manager_noop.h>#include <botan/x509_crl.h>#include <botan/x509cert.h>#include <botan/internal/ffi_cert.h>#include <botan/internal/ffi_pkey.h>#include <botan/internal/ffi_rng.h>#include <botan/internal/ffi_tls_impl.h>#include <botan/internal/ffi_util.h>#include <botan/internal/stl_util.h>#include <algorithm>#include <memory>#include <string>#include <string_view>#include <utility>#include <vector>Go to the source code of this file.
Namespaces | |
| namespace | Botan_FFI |
| int botan_tls_credentials_add_cert_chain | ( | botan_tls_credentials_t | creds, |
| const botan_x509_cert_t * | chain, | ||
| size_t | chain_len, | ||
| botan_privkey_t | key ) |
Add a certificate chain, leaf first, together with the private key of the leaf certificate. The chain must contain at least one certificate. The certificates are copied; the key object is shared between the key handle and the credentials, so the handle may be destroyed afterwards and a key that cannot be exported, such as a hardware backed key, can be used.
Returns BOTAN_FFI_ERROR_BAD_PARAMETER if chain_len is 0 or the key does not belong to the leaf certificate.
Several chains may be added, for instance one with an RSA and one with an ECDSA key, or chains for different server names. A channel uses the first chain whose key type the peer accepts. A server that has a chain whose leaf certificate matches the server name the client asked for offers only such chains. If the peer named acceptable certificate authorities, a chain with a certificate issued by one of them is preferred.
Definition at line 243 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, Botan_FFI::safe_get(), and Botan_FFI::safe_get_sp().
| int botan_tls_credentials_add_crl | ( | botan_tls_credentials_t | creds, |
| botan_x509_crl_t | crl ) |
Definition at line 205 of file ffi_tls.cpp.
References BOTAN_FFI_VISIT, crl, and Botan_FFI::safe_get().
| int botan_tls_credentials_add_trusted_cert | ( | botan_tls_credentials_t | creds, |
| botan_x509_cert_t | cert ) |
Add a certificate (copied) as a trust anchor for verifying the peer.
Definition at line 201 of file ffi_tls.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::safe_get().
| int botan_tls_credentials_add_trusted_dir | ( | botan_tls_credentials_t | creds, |
| const char * | path ) |
Definition at line 209 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and path.
| int botan_tls_credentials_destroy | ( | botan_tls_credentials_t | creds | ) |
| int botan_tls_credentials_init | ( | botan_tls_credentials_t * | creds | ) |
Definition at line 190 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::ffi_new_object().
| int botan_tls_credentials_use_system_store | ( | botan_tls_credentials_t | creds | ) |
Definition at line 231 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, and BOTAN_FFI_VISIT.
| int botan_tls_policy_destroy | ( | botan_tls_policy_t | policy | ) |
Definition at line 182 of file ffi_tls.cpp.
References BOTAN_FFI_CHECKED_DELETE.
| int botan_tls_policy_init | ( | botan_tls_policy_t * | policy, |
| const char * | name ) |
Definition at line 144 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_BAD_PARAMETER, BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and name.
Referenced by BOTAN_FFI_EXPORT().
| int botan_tls_policy_init_from_text | ( | botan_tls_policy_t * | policy, |
| const char * | text ) |
Definition at line 166 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and text.
| int botan_tls_policy_view_text | ( | botan_tls_policy_t | policy, |
| botan_view_ctx | ctx, | ||
| botan_view_str_fn | view ) |
View the main settings of the policy as text (Botan::TLS::Policy::to_string), one "key = value" line per setting, using the key names of Text_Policy. Not every setting is included.
Definition at line 178 of file ffi_tls.cpp.
References BOTAN_FFI_VISIT, and Botan_FFI::invoke_view_callback().
| int botan_tls_session_manager_destroy | ( | botan_tls_session_manager_t | mgr | ) |
Definition at line 312 of file ffi_tls.cpp.
References BOTAN_FFI_CHECKED_DELETE.
| int botan_tls_session_manager_init_memory | ( | botan_tls_session_manager_t * | mgr, |
| botan_rng_t | rng, | ||
| size_t | max_sessions ) |
Create a session manager that keeps sessions in memory (Botan::TLS::Session_Manager_In_Memory).
| mgr | the output handle; set to NULL on failure |
| Random Number Generators | the random number generator the manager uses; may be NULL, in which case an internal system RNG is used. The manager keeps its own reference to a non-NULL rng, so the handle may be destroyed after the call; the RNG object then lives on until the manager and every channel using the manager have been destroyed. |
| max_sessions | the maximum number of sessions kept, 0 for no limit |
Definition at line 281 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), Botan_FFI::ffi_new_object(), and Botan_FFI::safe_get_sp().
| int botan_tls_session_manager_init_noop | ( | botan_tls_session_manager_t * | mgr | ) |
Definition at line 301 of file ffi_tls.cpp.
References Botan_FFI::any_null_pointers(), BOTAN_FFI_ERROR_NULL_POINTER, Botan_FFI::ffi_guard_thunk(), and Botan_FFI::ffi_new_object().