Botan 3.6.1
Crypto and TLS for C&
|
#include <p11_mechanism.h>
Classes | |
union | MechanismParameters |
Holds the mechanism parameters for OAEP, PSS and ECDH. More... | |
Public Member Functions | |
Mechanism * | data () 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 (std::string_view padding) |
static MechanismWrapper | create_rsa_sign_mechanism (std::string_view padding) |
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 26 of file p11_mechanism.h.
|
explicit |
mechanism_type | the CK_MECHANISM_TYPE for the mechanism field of the CK_MECHANISM struct |
Definition at line 180 of file p11_mechanism.cpp.
References mechanism_type().
Referenced by create_ecdsa_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 247 of file p11_mechanism.cpp.
References Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), Botan::PKCS11::Ecdh1CofactorDerive, Botan::PKCS11::Ecdh1Derive, Botan::fmt(), CK_MECHANISM::pParameter, Botan::split_on(), and CK_MECHANISM::ulParameterLen.
|
static |
Creates the CK_MECHANISM data for ECDSA signature/verification
hash | the hash algorithm used to hash the data to sign. supported hash functions are Raw and SHA-1 to SHA-512 |
Definition at line 228 of file p11_mechanism.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), Botan::fmt(), and MechanismWrapper().
|
static |
Creates the CK_MECHANISM data for RSA encryption/decryption
padding | supported paddings are Raw (X.509), EME-PKCS1-v1_5 (PKCS#1 v1.5) and OAEP (PKCS#1 OAEP) |
Definition at line 183 of file p11_mechanism.cpp.
References CKZ_DATA_SPECIFIED, CK_MECHANISM::pParameter, Botan::PKCS11::RsaPkcsOaep, and CK_MECHANISM::ulParameterLen.
|
static |
Creates the CK_MECHANISM data for RSA signature/verification
padding | supported paddings are Raw (X.509), EMSA3 (PKCS#1 v1.5), EMSA4 (PKCS#1 PSS), EMSA2 (ANSI X9.31) and ISO9796 (ISO/IEC 9796) |
Definition at line 207 of file p11_mechanism.cpp.
References CK_MECHANISM::pParameter, and CK_MECHANISM::ulParameterLen.
|
inline |
Definition at line 81 of file p11_mechanism.h.
|
inline |
Definition at line 83 of file p11_mechanism.h.
References CK_MECHANISM::mechanism.
Referenced by MechanismWrapper().
|
inline |
Definition at line 86 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 75 of file p11_mechanism.h.
|
inline |
Sets the salt for the ECDH mechanism parameters.
salt | the salt |
salt_len | size of the salt in bytes |
Definition at line 65 of file p11_mechanism.h.