Botan 2.19.3
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 |
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 (const std::string ¶ms) |
static MechanismWrapper | create_ecdsa_mechanism (const std::string &hash) |
static MechanismWrapper | create_rsa_crypt_mechanism (const std::string &padding) |
static MechanismWrapper | create_rsa_sign_mechanism (const std::string &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 170 of file p11_mechanism.cpp.
|
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-160 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 240 of file p11_mechanism.cpp.
References Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), Botan::PKCS11::Ecdh1CofactorDerive, Botan::PKCS11::Ecdh1Derive, hash, 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-160 to SHA-512 |
Definition at line 223 of file p11_mechanism.cpp.
References hash, and Botan::hash_for_emsa().
|
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 174 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 200 of file p11_mechanism.cpp.
References CK_MECHANISM::pParameter, and CK_MECHANISM::ulParameterLen.
|
inline |
Definition at line 84 of file p11_mechanism.h.
|
inline |
Definition at line 90 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 77 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 66 of file p11_mechanism.h.
References salt_len.