|
Botan 3.14.1
Crypto and TLS for C&
|
#include <algorithm_spec.h>
Public Types | |
| enum class | Syntax : uint8_t { Standard , CipherMode } |
Public Member Functions | |
| AlgorithmSpec (std::string_view spec, Syntax syntax=Syntax::Standard) | |
| const AlgorithmSpec & | arg (size_t i) const |
| size_t | arg_count () const |
| std::span< const AlgorithmSpec > | args () const |
| std::string | canonical_form () const |
| std::string_view | head () const |
| std::optional< AlgorithmMatch > | match (const AlgorithmPattern &pattern) const & |
| std::optional< AlgorithmMatch > | match (const AlgorithmPattern &pattern) const &&=delete |
| bool | matches (const AlgorithmPattern &pattern) const |
| std::string_view | to_string () const |
| AlgorithmSpec | with_head (std::string_view head) const |
A parsed algorithm specification such as "HMAC(SHA-256)" or "AES-128/GCM(12)"
Specifications have the form Head(arg,arg,...) where each argument is itself a specification. With Syntax::CipherMode the form "Cipher/Mode(args)/Pad" is also accepted at the top level and canonicalized to "Mode(Cipher,args,Pad)"; otherwise a slash is an ordinary character.
Factories should match against an AlgorithmPattern, which expresses the entire accepted form including defaults, rather than inspecting arguments positionally.
Definition at line 150 of file algorithm_spec.h.
|
strong |
| Enumerator | |
|---|---|
| Standard | |
| CipherMode | |
Definition at line 152 of file algorithm_spec.h.
|
explicit |
Parse a specification
| Invalid_Algorithm_Name | if the string is malformed |
Definition at line 64 of file algorithm_spec.cpp.
References AlgorithmSpec(), and CipherMode.
Referenced by AlgorithmSpec(), arg(), match(), and with_head().
| const AlgorithmSpec & Botan::AlgorithmSpec::arg | ( | size_t | i | ) | const |
| Invalid_Argument | if i is out of range |
Definition at line 110 of file algorithm_spec.cpp.
References AlgorithmSpec(), and Botan::fmt().
|
inline |
Definition at line 173 of file algorithm_spec.h.
Referenced by Botan::commoncrypto_opts_from_algo().
|
inline |
Definition at line 175 of file algorithm_spec.h.
|
inline |
Definition at line 187 of file algorithm_spec.h.
Referenced by Botan::Cipher_Mode::create().
|
inline |
Definition at line 171 of file algorithm_spec.h.
Referenced by Botan::commoncrypto_opts_from_algo(), match(), Botan::parse_legacy_sig_options(), and with_head().
| std::optional< AlgorithmMatch > Botan::AlgorithmSpec::match | ( | const AlgorithmPattern & | pattern | ) | const & |
Match this specification against a pattern
Definition at line 132 of file algorithm_spec.cpp.
Referenced by Botan::TPM2::cipher_botan_to_tss2(), Botan::commoncrypto_opts_from_algo(), Botan::AEAD_Mode::create(), Botan::BlockCipher::create(), Botan::Cipher_Mode::create(), Botan::HashFunction::create(), Botan::KDF::create(), Botan::MessageAuthenticationCode::create(), Botan::PasswordHashFamily::create(), Botan::PBKDF::create(), Botan::StreamCipher::create(), Botan::PKCS11::MechanismWrapper::create_ecdsa_mechanism(), Botan::create_keccak_mb_engine(), Botan::create_sha2_32_mb_engine(), Botan::create_sha2_64_mb_engine(), Botan::PSS_Params::from_padding_name(), Botan::HSS_LMS_Params::HSS_LMS_Params(), matches(), Botan::parse_legacy_enc_options(), Botan::parse_legacy_sig_options(), Botan::TPM2::rsa_encryption_scheme_botan_to_tss2(), and Botan::TPM2::rsa_signature_scheme_botan_to_tss2().
|
delete |
References AlgorithmSpec(), head(), matches(), and text.
|
inline |
Definition at line 292 of file algorithm_spec.h.
References match().
Referenced by Botan::MessageAuthenticationCode::create(), Botan::PasswordHashFamily::create(), Botan::StreamCipher::create(), Botan::create_sha2_32_mb_engine(), Botan::create_sha2_64_mb_engine(), match(), Botan::parse_legacy_sig_options(), and Botan::TPM2::rsa_encryption_scheme_botan_to_tss2().
|
inline |
Definition at line 166 of file algorithm_spec.h.
|
inline |
Definition at line 193 of file algorithm_spec.h.
References AlgorithmSpec(), and head().
Referenced by Botan::parse_legacy_sig_options().