Botan 3.6.1
Crypto and TLS for C&
|
#include <pk_keys.h>
Public Member Functions | |
virtual std::string | algo_name () const =0 |
virtual size_t | estimated_strength () const =0 |
virtual std::unique_ptr< Private_Key > | generate_another (RandomNumberGenerator &rng) const =0 |
virtual const BigInt & | get_int_field (std::string_view field) const |
virtual OID | object_identifier () const |
virtual bool | supports_operation (PublicKeyOperation op) const =0 |
virtual | ~Asymmetric_Key ()=default |
An interface for objects that are keys in public key algorithms
This is derived for both public and private keys
|
virtualdefault |
|
pure virtual |
Get the name of the underlying public key scheme.
Implemented in Botan::DH_PublicKey, Botan::Dilithium_PublicKey, Botan::DSA_PublicKey, Botan::ECDH_PublicKey, Botan::ECDSA_PublicKey, Botan::ECGDSA_PublicKey, Botan::ECKCDSA_PublicKey, Botan::Ed25519_PublicKey, Botan::Ed448_PublicKey, Botan::ElGamal_PublicKey, Botan::FrodoKEM_PublicKey, Botan::GOST_3410_PublicKey, Botan::HSS_LMS_PublicKey, Botan::Kyber_PublicKey, Botan::McEliece_PublicKey, Botan::RSA_PublicKey, Botan::SM2_PublicKey, Botan::SphincsPlus_PublicKey, Botan::TLS::Hybrid_KEM_PublicKey, Botan::TLS::KEX_to_KEM_Adapter_PublicKey, Botan::TPM2::EC_PrivateKey, Botan::TPM2::EC_PublicKey, Botan::TPM_PrivateKey, Botan::X25519_PublicKey, Botan::X448_PublicKey, and Botan::XMSS_PublicKey.
Referenced by Botan::PKCS8::BER_encode(), botan_pubkey_sm2_compute_za(), Botan::TLS::Policy::check_peer_key_acceptable(), Botan::TLS::Handshake_State::choose_sig_format(), Botan::X509_Object::choose_sig_format(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::Private_Key::create_decryption_op(), Botan::Public_Key::create_encryption_op(), Botan::Private_Key::create_kem_decryption_op(), Botan::Public_Key::create_kem_encryption_op(), Botan::Private_Key::create_key_agreement_op(), Botan::Private_Key::create_signature_op(), Botan::Public_Key::create_verification_op(), Botan::Public_Key::create_x509_verification_op(), get_int_field(), object_identifier(), Botan::TLS::Handshake_State::parse_sig_format(), Botan::PK_Decryptor_EME::PK_Decryptor_EME(), Botan::PK_Encryptor_EME::PK_Encryptor_EME(), Botan::PK_KEM_Decryptor::PK_KEM_Decryptor(), Botan::PK_KEM_Encryptor::PK_KEM_Encryptor(), Botan::PK_Key_Agreement::PK_Key_Agreement(), Botan::PK_Signer::PK_Signer(), Botan::PK_Verifier::PK_Verifier(), Botan::PK_Verifier::PK_Verifier(), and Botan::Private_Key::raw_private_key_bits().
|
pure virtual |
Return the estimated strength of the underlying key against the best currently known attack. Note that this ignores anything but pure attacks against the key itself and do not take into account padding schemes, usage mistakes, etc which might reduce the strength. However it does suffice to provide an upper bound.
Implemented in Botan::DH_PublicKey, Botan::Dilithium_PublicKey, Botan::DSA_PublicKey, Botan::EC_PublicKey, Botan::Ed25519_PublicKey, Botan::Ed448_PublicKey, Botan::ElGamal_PublicKey, Botan::FrodoKEM_PublicKey, Botan::HSS_LMS_PublicKey, Botan::Kyber_PublicKey, Botan::McEliece_PublicKey, Botan::RSA_PublicKey, Botan::SphincsPlus_PublicKey, Botan::TLS::Hybrid_KEM_PublicKey, Botan::TLS::KEX_to_KEM_Adapter_PublicKey, Botan::TPM_PrivateKey, Botan::X25519_PublicKey, Botan::X448_PublicKey, and Botan::XMSS_PublicKey.
|
pure virtual |
Generate another (cryptographically independent) key pair using the same algorithm parameters as this key. This is most useful for algorithms that support PublicKeyOperation::KeyAgreement to generate a fitting ephemeral key pair. For other key types it might throw Not_Implemented.
Implemented in Botan::DH_PublicKey, Botan::Dilithium_PublicKey, Botan::DSA_PublicKey, Botan::ECDH_PublicKey, Botan::ECDSA_PublicKey, Botan::ECGDSA_PublicKey, Botan::ECKCDSA_PublicKey, Botan::Ed25519_PublicKey, Botan::Ed448_PublicKey, Botan::ElGamal_PublicKey, Botan::FrodoKEM_PublicKey, Botan::GOST_3410_PublicKey, Botan::HSS_LMS_PrivateKey, Botan::HSS_LMS_PublicKey, Botan::Kyber_PublicKey, Botan::McEliece_PublicKey, Botan::RSA_PublicKey, Botan::SM2_PublicKey, Botan::SphincsPlus_PublicKey, Botan::TLS::Hybrid_KEM_PublicKey, Botan::TLS::KEX_to_KEM_Adapter_PublicKey, Botan::TPM2::EC_PrivateKey, Botan::TPM2::PublicKey, Botan::TPM2::RSA_PublicKey, Botan::TPM_PrivateKey, Botan::X25519_PublicKey, Botan::X448_PublicKey, and Botan::XMSS_PublicKey.
|
virtual |
Access an algorithm specific field
If the field is not known for this algorithm, an Invalid_Argument is thrown. The interpretation of the result requires knowledge of which algorithm is involved. For instance for RSA "p" represents one of the secret primes, while for DSA "p" is the public prime.
Some algorithms may not implement this method at all.
This is primarily used to implement the FFI botan_pubkey_get_field and botan_privkey_get_field functions.
Reimplemented in Botan::DH_PrivateKey, Botan::DH_PublicKey, Botan::DSA_PrivateKey, Botan::DSA_PublicKey, Botan::EC_PrivateKey, Botan::EC_PublicKey, Botan::ElGamal_PrivateKey, Botan::ElGamal_PublicKey, Botan::RSA_PrivateKey, and Botan::RSA_PublicKey.
Definition at line 18 of file pk_keys.cpp.
References algo_name().
Referenced by Botan::EC_PublicKey::get_int_field(), and Botan::RSA_PublicKey::get_int_field().
|
virtual |
Get the OID of the underlying public key scheme.
Reimplemented in Botan::Dilithium_PublicKey, Botan::FrodoKEM_PublicKey, Botan::HSS_LMS_PublicKey, Botan::Kyber_PublicKey, and Botan::SphincsPlus_PublicKey.
Definition at line 22 of file pk_keys.cpp.
References algo_name(), Botan::fmt(), and Botan::OID::from_string().
Referenced by Botan::DH_PublicKey::algorithm_identifier(), Botan::DSA_PublicKey::algorithm_identifier(), Botan::EC_PublicKey::algorithm_identifier(), Botan::Ed25519_PublicKey::algorithm_identifier(), Botan::Ed448_PublicKey::algorithm_identifier(), Botan::ElGamal_PublicKey::algorithm_identifier(), Botan::GOST_3410_PublicKey::algorithm_identifier(), Botan::McEliece_PublicKey::algorithm_identifier(), Botan::RSA_PublicKey::algorithm_identifier(), Botan::TPM_PrivateKey::algorithm_identifier(), Botan::X25519_PublicKey::algorithm_identifier(), and Botan::X448_PublicKey::algorithm_identifier().
|
pure virtual |
Return true if this key could be used for the specified type of operation.
Implemented in Botan::DH_PublicKey, Botan::Dilithium_PublicKey, Botan::DSA_PublicKey, Botan::ECDH_PublicKey, Botan::ECDSA_PublicKey, Botan::ECGDSA_PublicKey, Botan::ECKCDSA_PublicKey, Botan::Ed25519_PublicKey, Botan::Ed448_PublicKey, Botan::ElGamal_PublicKey, Botan::FrodoKEM_PublicKey, Botan::GOST_3410_PublicKey, Botan::HSS_LMS_PublicKey, Botan::Kyber_PublicKey, Botan::McEliece_PublicKey, Botan::RSA_PublicKey, Botan::SM2_PublicKey, Botan::SphincsPlus_PublicKey, Botan::TLS::Hybrid_KEM_PublicKey, Botan::TLS::KEX_to_KEM_Adapter_PublicKey, Botan::TPM2::EC_PrivateKey, Botan::TPM2::EC_PublicKey, Botan::TPM2::RSA_PrivateKey, Botan::TPM2::RSA_PublicKey, Botan::TPM_PrivateKey, Botan::X25519_PublicKey, Botan::X448_PublicKey, and Botan::XMSS_PublicKey.
Referenced by Botan::Key_Constraints::compatible_with().