Botan
1.11.15
|
#include <pk_keys.h>
Public Member Functions | |
virtual std::string | algo_name () const =0 |
virtual AlgorithmIdentifier | algorithm_identifier () const =0 |
virtual bool | check_key (RandomNumberGenerator &rng, bool strong) const =0 |
virtual size_t | estimated_strength () const =0 |
virtual OID | get_oid () const |
virtual size_t | max_input_bits () const =0 |
virtual size_t | message_part_size () const |
virtual size_t | message_parts () const |
virtual std::vector< byte > | x509_subject_public_key () const =0 |
virtual | ~Public_Key () |
Protected Member Functions | |
virtual void | load_check (RandomNumberGenerator &rng) const |
virtual Botan::Public_Key::~Public_Key | ( | ) | [inline, virtual] |
virtual std::string Botan::Public_Key::algo_name | ( | ) | const [pure virtual] |
Get the name of the underlying public key scheme.
Implemented in Botan::GOST_3410_PublicKey, Botan::ECDH_PublicKey, Botan::ECDSA_PublicKey, Botan::McEliece_PublicKey, Botan::RSA_PublicKey, Botan::DH_PublicKey, Botan::DSA_PublicKey, Botan::ElGamal_PublicKey, Botan::NR_PublicKey, Botan::RW_PublicKey, and Botan::Curve25519_PublicKey.
Referenced by Botan::PKCS8::BER_encode(), Botan::EAC_Signed_Object::check_signature(), Botan::X509_Object::check_signature(), Botan::TLS::Handshake_State::choose_sig_format(), Botan::choose_sig_format(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::find_constraints(), Botan::Private_Key::gen_check(), get_oid(), load_check(), Botan::Private_Key::load_check(), Botan::PK_Encryptor_EME::PK_Encryptor_EME(), Botan::PK_Key_Agreement::PK_Key_Agreement(), Botan::PK_Signer::PK_Signer(), Botan::PK_Verifier::PK_Verifier(), and Botan::TLS::Handshake_State::understand_sig_format().
virtual AlgorithmIdentifier Botan::Public_Key::algorithm_identifier | ( | ) | const [pure virtual] |
Implemented in Botan::EC_PublicKey, Botan::McEliece_PublicKey, Botan::GOST_3410_PublicKey, Botan::IF_Scheme_PublicKey, Botan::Curve25519_PublicKey, and Botan::DL_Scheme_PublicKey.
Referenced by Botan::X509::BER_encode(), and Botan::choose_sig_format().
virtual bool Botan::Public_Key::check_key | ( | RandomNumberGenerator & | rng, |
bool | strong | ||
) | const [pure virtual] |
Test the key values for consistency.
rng | rng to use |
strong | whether to perform strong and lengthy version of the test |
Implemented in Botan::McEliece_PrivateKey, Botan::DL_Scheme_PrivateKey, Botan::ECDSA_PrivateKey, Botan::IF_Scheme_PrivateKey, Botan::Curve25519_PrivateKey, Botan::RW_PrivateKey, Botan::DSA_PrivateKey, Botan::McEliece_PublicKey, Botan::EC_PublicKey, Botan::RSA_PrivateKey, Botan::NR_PrivateKey, Botan::ElGamal_PrivateKey, Botan::IF_Scheme_PublicKey, Botan::Curve25519_PublicKey, and Botan::DL_Scheme_PublicKey.
Referenced by Botan::Private_Key::gen_check(), load_check(), and Botan::Private_Key::load_check().
virtual size_t Botan::Public_Key::estimated_strength | ( | ) | const [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::EC_PublicKey, Botan::DL_Scheme_PublicKey, Botan::McEliece_PublicKey, Botan::IF_Scheme_PublicKey, and Botan::Curve25519_PublicKey.
Referenced by botan_pubkey_estimated_strength().
OID Botan::Public_Key::get_oid | ( | ) | const [virtual] |
Get the OID of the underlying public key scheme.
Definition at line 17 of file pk_keys.cpp.
References algo_name(), and Botan::OIDS::lookup().
Referenced by Botan::DL_Scheme_PublicKey::algorithm_identifier(), Botan::Curve25519_PublicKey::algorithm_identifier(), Botan::IF_Scheme_PublicKey::algorithm_identifier(), Botan::GOST_3410_PublicKey::algorithm_identifier(), Botan::EC_PublicKey::algorithm_identifier(), and Botan::McEliece_PublicKey::algorithm_identifier().
{ try { return OIDS::lookup(algo_name()); } catch(Lookup_Error) { throw Lookup_Error("PK algo " + algo_name() + " has no defined OIDs"); } }
void Botan::Public_Key::load_check | ( | RandomNumberGenerator & | rng | ) | const [protected, virtual] |
Self-test after loading a key
rng | a random number generator |
Reimplemented in Botan::Private_Key.
Definition at line 31 of file pk_keys.cpp.
References algo_name(), and check_key().
{ if(!check_key(rng, BOTAN_PUBLIC_KEY_STRONG_CHECKS_ON_LOAD)) throw Invalid_Argument(algo_name() + ": Invalid public key"); }
virtual size_t Botan::Public_Key::max_input_bits | ( | ) | const [pure virtual] |
Get the maximum message size in bits supported by this public key.
Implemented in Botan::McEliece_PrivateKey, Botan::GOST_3410_PublicKey, Botan::ECDH_PublicKey, Botan::ECDSA_PublicKey, Botan::IF_Scheme_PublicKey, Botan::McEliece_PublicKey, Botan::NR_PublicKey, Botan::DSA_PublicKey, Botan::DH_PublicKey, Botan::ElGamal_PublicKey, and Botan::Curve25519_PublicKey.
Referenced by Botan::choose_sig_format().
virtual size_t Botan::Public_Key::message_part_size | ( | ) | const [inline, virtual] |
Find out the message part size supported by this scheme/key.
Reimplemented in Botan::GOST_3410_PublicKey, Botan::ECDSA_PublicKey, Botan::NR_PublicKey, and Botan::DSA_PublicKey.
Definition at line 67 of file pk_keys.h.
{ return 0; }
virtual size_t Botan::Public_Key::message_parts | ( | ) | const [inline, virtual] |
Find out the number of message parts supported by this scheme.
Reimplemented in Botan::GOST_3410_PublicKey, Botan::ECDSA_PublicKey, Botan::NR_PublicKey, and Botan::DSA_PublicKey.
Definition at line 61 of file pk_keys.h.
Referenced by Botan::EAC_Signed_Object::check_signature(), Botan::X509_Object::check_signature(), and Botan::choose_sig_format().
{ return 1; }
virtual std::vector<byte> Botan::Public_Key::x509_subject_public_key | ( | ) | const [pure virtual] |
Implemented in Botan::McEliece_PublicKey, Botan::EC_PublicKey, Botan::GOST_3410_PublicKey, Botan::IF_Scheme_PublicKey, Botan::Curve25519_PublicKey, and Botan::DL_Scheme_PublicKey.
Referenced by Botan::X509::BER_encode().