Botan
1.11.15
|
#include <curve25519.h>
Public Member Functions | |
std::string | algo_name () const override |
AlgorithmIdentifier | algorithm_identifier () const override |
bool | check_key (RandomNumberGenerator &rng, bool strong) const override |
Curve25519_PublicKey (const AlgorithmIdentifier &alg_id, const secure_vector< byte > &key_bits) | |
Curve25519_PublicKey (const secure_vector< byte > &pub) | |
size_t | estimated_strength () const override |
virtual OID | get_oid () const |
size_t | max_input_bits () const |
virtual size_t | message_part_size () const |
virtual size_t | message_parts () const |
std::vector< byte > | public_value () const |
std::vector< byte > | x509_subject_public_key () const override |
Protected Member Functions | |
Curve25519_PublicKey () | |
virtual void | load_check (RandomNumberGenerator &rng) const |
Protected Attributes | |
secure_vector< byte > | m_public |
Definition at line 15 of file curve25519.h.
Botan::Curve25519_PublicKey::Curve25519_PublicKey | ( | const AlgorithmIdentifier & | alg_id, |
const secure_vector< byte > & | key_bits | ||
) |
Definition at line 50 of file curve25519.cpp.
References Botan::BER_Decoder::decode(), Botan::BER_Decoder::end_cons(), m_public, Botan::OCTET_STRING, Botan::SEQUENCE, Botan::BER_Decoder::start_cons(), and Botan::BER_Decoder::verify_end().
{ BER_Decoder(key_bits) .start_cons(SEQUENCE) .decode(m_public, OCTET_STRING) .verify_end() .end_cons(); size_check(m_public.size(), "public key"); }
Botan::Curve25519_PublicKey::Curve25519_PublicKey | ( | const secure_vector< byte > & | pub | ) | [inline] |
Definition at line 35 of file curve25519.h.
: m_public(pub) {}
Botan::Curve25519_PublicKey::Curve25519_PublicKey | ( | ) | [inline, protected] |
Definition at line 37 of file curve25519.h.
{}
std::string Botan::Curve25519_PublicKey::algo_name | ( | ) | const [inline, override, virtual] |
Get the name of the underlying public key scheme.
Implements Botan::Public_Key.
Definition at line 18 of file curve25519.h.
{ return "Curve25519"; }
AlgorithmIdentifier Botan::Curve25519_PublicKey::algorithm_identifier | ( | ) | const [override, virtual] |
Implements Botan::Public_Key.
Definition at line 40 of file curve25519.cpp.
References Botan::Public_Key::get_oid(), and Botan::AlgorithmIdentifier::USE_NULL_PARAM.
{ return AlgorithmIdentifier(get_oid(), AlgorithmIdentifier::USE_NULL_PARAM); }
bool Botan::Curve25519_PublicKey::check_key | ( | RandomNumberGenerator & | rng, |
bool | strong | ||
) | const [override, virtual] |
Test the key values for consistency.
rng | rng to use |
strong | whether to perform strong and lengthy version of the test |
Implements Botan::Public_Key.
Reimplemented in Botan::Curve25519_PrivateKey.
Definition at line 45 of file curve25519.cpp.
{ return true; // no tests possible? }
size_t Botan::Curve25519_PublicKey::estimated_strength | ( | ) | const [inline, override, 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.
Implements Botan::Public_Key.
Definition at line 20 of file curve25519.h.
{ return 128; }
OID Botan::Public_Key::get_oid | ( | ) | const [virtual, inherited] |
Get the OID of the underlying public key scheme.
Definition at line 17 of file pk_keys.cpp.
References Botan::Public_Key::algo_name(), and Botan::OIDS::lookup().
Referenced by Botan::DL_Scheme_PublicKey::algorithm_identifier(), 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, inherited] |
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 Botan::Public_Key::algo_name(), and Botan::Public_Key::check_key().
{ if(!check_key(rng, BOTAN_PUBLIC_KEY_STRONG_CHECKS_ON_LOAD)) throw Invalid_Argument(algo_name() + ": Invalid public key"); }
size_t Botan::Curve25519_PublicKey::max_input_bits | ( | ) | const [inline, virtual] |
Get the maximum message size in bits supported by this public key.
Implements Botan::Public_Key.
Definition at line 22 of file curve25519.h.
{ return 256; }
virtual size_t Botan::Public_Key::message_part_size | ( | ) | const [inline, virtual, inherited] |
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, inherited] |
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; }
std::vector<byte> Botan::Curve25519_PublicKey::public_value | ( | ) | const [inline] |
Reimplemented in Botan::Curve25519_PrivateKey.
Definition at line 30 of file curve25519.h.
References Botan::unlock().
Referenced by Botan::Curve25519_PrivateKey::public_value().
std::vector< byte > Botan::Curve25519_PublicKey::x509_subject_public_key | ( | ) | const [override, virtual] |
Implements Botan::Public_Key.
Definition at line 62 of file curve25519.cpp.
References Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::get_contents_unlocked(), m_public, Botan::OCTET_STRING, Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().
{ return DER_Encoder() .start_cons(SEQUENCE) .encode(m_public, OCTET_STRING) .end_cons() .get_contents_unlocked(); }
secure_vector<byte> Botan::Curve25519_PublicKey::m_public [protected] |
Definition at line 38 of file curve25519.h.
Referenced by Botan::Curve25519_PrivateKey::check_key(), Botan::Curve25519_PrivateKey::Curve25519_PrivateKey(), Curve25519_PublicKey(), Botan::Curve25519_PrivateKey::pkcs8_private_key(), and x509_subject_public_key().