|
Botan 3.14.1
Crypto and TLS for C&
|
#include <p11_mechanism.h>
Classes | |
| union | MechanismParameters |
Public Member Functions | |
| Mechanism * | data () const |
| KeyDerivation | ecdh_kdf () const |
| MechanismType | mechanism_type () const |
| MechanismWrapper (MechanismType mechanism_type) | |
| size_t | padding_size () const |
| void | set_ecdh_other_key (const uint8_t other_key[], size_t other_key_len) |
| void | set_ecdh_salt (const uint8_t salt[], size_t salt_len) |
Static Public Member Functions | |
| static MechanismWrapper | create_ecdh_mechanism (std::string_view params) |
| static MechanismWrapper | create_ecdsa_mechanism (std::string_view hash) |
| static MechanismWrapper | create_rsa_crypt_mechanism (const PK_Encryption_Options_Reader &options) |
| static MechanismWrapper | create_rsa_sign_mechanism (const PK_Signature_Options_Reader &options) |
Simple class to build and hold the data for a CK_MECHANISM struct for RSA (encryption/decryption, signature/verification) and EC (ECDSA signature/verification, ECDH key derivation).
Definition at line 32 of file p11_mechanism.h.
|
explicit |
| mechanism_type | the CK_MECHANISM_TYPE for the mechanism field of the CK_MECHANISM struct |
Definition at line 93 of file p11_mechanism.cpp.
References mechanism_type().
Referenced by create_ecdh_mechanism(), create_ecdsa_mechanism(), create_rsa_crypt_mechanism(), and create_rsa_sign_mechanism().
|
static |
Creates the CK_MECHANISM data for ECDH key derivation (CKM_ECDH1_DERIVE or CKM_ECDH1_COFACTOR_DERIVE)
| params | specifies the key derivation function to use. Supported KDFs are Raw and SHA-1 to SHA-512. Params can also include the string "Cofactor" if the cofactor key derivation mechanism should be used, for example "SHA-512,Cofactor" |
Definition at line 325 of file p11_mechanism.cpp.
References Botan::PKCS11::Ecdh1CofactorDerive, Botan::PKCS11::Ecdh1Derive, Botan::fmt(), MechanismWrapper(), Botan::PKCS11::Null, CK_MECHANISM::pParameter, Botan::PKCS11::Sha1Kdf, Botan::PKCS11::Sha224Kdf, Botan::PKCS11::Sha256Kdf, Botan::PKCS11::Sha384Kdf, Botan::PKCS11::Sha512Kdf, Botan::split_on(), and CK_MECHANISM::ulParameterLen.
|
static |
Creates the CK_MECHANISM data for ECDSA signature/verification
| Hashes | the hash algorithm used to hash the data to sign. supported hash functions are Raw and SHA-1 to SHA-512 |
Definition at line 298 of file p11_mechanism.cpp.
References Botan::PKCS11::Ecdsa, Botan::PKCS11::EcdsaSha1, Botan::PKCS11::EcdsaSha224, Botan::PKCS11::EcdsaSha256, Botan::PKCS11::EcdsaSha384, Botan::PKCS11::EcdsaSha512, Botan::fmt(), Botan::AlgorithmSpec::match(), and MechanismWrapper().
|
static |
Creates the CK_MECHANISM data for RSA encryption/decryption
| options | supported paddings are Raw (X.509), PKCS1v15 (PKCS#1 v1.5) and OAEP (PKCS#1 OAEP); for OAEP the hash (SHA-1, SHA-224, SHA-256, SHA-384 or SHA-512), an optional distinct MGF1 hash, and an optional label (the context) are used |
Definition at line 96 of file p11_mechanism.cpp.
References Botan::PKCS11::checked_ulong_cast(), CKZ_DATA_SPECIFIED, Botan::PK_Encryption_Options_Reader::context(), Botan::fmt(), Botan::PK_Encryption_Options_Reader::hash_function_name(), MechanismWrapper(), Botan::PK_Encryption_Options_Reader::mgf1_hash_function(), Botan::PKCS11::Mgf1Sha1, Botan::PKCS11::Mgf1Sha224, Botan::PKCS11::Mgf1Sha256, Botan::PKCS11::Mgf1Sha384, Botan::PKCS11::Mgf1Sha512, Botan::PK_Encryption_Options_Reader::padding(), CK_MECHANISM::pParameter, Botan::PKCS11::RsaPkcs, Botan::PKCS11::RsaPkcsOaep, Botan::PKCS11::RsaX509, Botan::PKCS11::Sha1, Botan::PKCS11::Sha224, Botan::PKCS11::Sha256, Botan::PKCS11::Sha384, Botan::PKCS11::Sha512, CK_MECHANISM::ulParameterLen, Botan::PK_Encryption_Options_Reader::using_hash(), Botan::PK_Encryption_Options_Reader::using_mgf1_hash(), and Botan::PK_Encryption_Options_Reader::using_padding().
|
static |
Creates the CK_MECHANISM data for RSA signature/verification
| options | supported paddings are Raw (X.509), PKCS1v15 (PKCS#1 v1.5), PSS (PKCS#1 PSS), X9.31 (ANSI X9.31) and ISO9796 (ISO/IEC 9796) |
Definition at line 175 of file p11_mechanism.cpp.
References Botan::PKCS11::checked_ulong_cast(), Botan::externally_computed_prehash_name(), Botan::fmt(), Botan::PK_Signature_Options_Reader::hash_function_name(), MechanismWrapper(), Botan::PK_Signature_Options_Reader::padding(), CK_MECHANISM::pParameter, Botan::PKCS11::Rsa9796, Botan::PKCS11::RsaPkcs, Botan::PKCS11::RsaPkcsPss, Botan::PKCS11::RsaX509, Botan::PKCS11::RsaX931, Botan::PK_Signature_Options_Reader::salt_size(), Botan::PKCS11::Sha1RsaPkcs, Botan::PKCS11::Sha1RsaPkcsPss, Botan::PKCS11::Sha1RsaX931, Botan::PKCS11::Sha224RsaPkcs, Botan::PKCS11::Sha224RsaPkcsPss, Botan::PKCS11::Sha256RsaPkcs, Botan::PKCS11::Sha256RsaPkcsPss, Botan::PKCS11::Sha384RsaPkcs, Botan::PKCS11::Sha384RsaPkcsPss, Botan::PKCS11::Sha512RsaPkcs, Botan::PKCS11::Sha512RsaPkcsPss, CK_MECHANISM::ulParameterLen, Botan::PK_Signature_Options_Reader::using_deterministic_signature(), Botan::PK_Signature_Options_Reader::using_externally_computed_prehash(), Botan::PK_Signature_Options_Reader::using_hash(), Botan::PK_Signature_Options_Reader::using_padding(), and Botan::PK_Signature_Options_Reader::using_salt_size().
|
inline |
Definition at line 89 of file p11_mechanism.h.
|
inline |
|
inline |
|
inline |
Definition at line 94 of file p11_mechanism.h.
|
inline |
Sets the public key of the other party for the ECDH mechanism parameters.
| other_key | key of the other party |
| other_key_len | size of the key of the other party in bytes |
Definition at line 83 of file p11_mechanism.h.
References Botan::PKCS11::checked_ulong_cast().
|
inline |
Sets the salt for the ECDH mechanism parameters.
| salt | the salt |
| salt_len | size of the salt in bytes |
Definition at line 73 of file p11_mechanism.h.
References Botan::PKCS11::checked_ulong_cast().