Botan
2.1.0
Crypto and TLS for C++11
|
#include <ec_group.h>
Public Member Functions | |
std::vector< uint8_t > | DER_encode (EC_Group_Encoding form) const |
EC_Group (const CurveGFp &curve, const PointGFp &base_point, const BigInt &order, const BigInt &cofactor) | |
EC_Group (const std::vector< uint8_t > &ber_encoding) | |
EC_Group (const OID &oid) | |
EC_Group (const std::string &pem_or_oid="") | |
const PointGFp & | get_base_point () const |
const BigInt & | get_cofactor () const |
const CurveGFp & | get_curve () const |
std::string | get_oid () const |
const BigInt & | get_order () const |
bool | initialized () const |
bool | operator== (const EC_Group &other) const |
std::string | PEM_encode () const |
bool | verify_group (RandomNumberGenerator &rng, bool strong=false) const |
Static Public Member Functions | |
static std::string | PEM_for_named_group (const std::string &name) |
Class representing an elliptic curve
Definition at line 31 of file ec_group.h.
|
inline |
Construct Domain paramers from specified parameters
curve | elliptic curve |
base_point | a base point |
order | the order of the base point |
cofactor | the cofactor |
Definition at line 42 of file ec_group.h.
Referenced by EC_Group().
|
explicit |
Decode a BER encoded ECC domain parameter set
ber_encoding | the bytes of the BER encoding |
Definition at line 48 of file ec_group.cpp.
References Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_and_check(), Botan::BER_Decoder::decode_octet_string_bigint(), EC_Group(), Botan::BER_Decoder::end_cons(), Botan::BER_Decoder::get_next_object(), Botan::NULL_TAG, Botan::OBJECT_ID, Botan::OCTET_STRING, Botan::OS2ECP(), Botan::SEQUENCE, Botan::BER_Decoder::start_cons(), Botan::BER_Object::type_tag, and Botan::BER_Decoder::verify_end().
|
explicit |
Create an EC domain by OID (or throw if unknown)
oid | the OID of the EC domain to create |
Definition at line 19 of file ec_group.cpp.
References Botan::OID::as_string(), EC_Group(), Botan::OIDS::lookup(), and PEM_for_named_group().
Botan::EC_Group::EC_Group | ( | const std::string & | pem_or_oid = "" | ) |
Create an EC domain from PEM encoding (as from PEM_encode), or from an OID name (eg "secp256r1", or "1.2.840.10045.3.1.7")
pem_or_oid | PEM-encoded data, or an OID |
Definition at line 30 of file ec_group.cpp.
References Botan::PEM_Code::decode_check_label(), EC_Group(), Botan::OIDS::lookup(), and Botan::unlock().
std::vector< uint8_t > Botan::EC_Group::DER_encode | ( | EC_Group_Encoding | form | ) | const |
Create the DER encoding of this domain
form | of encoding to use |
Definition at line 92 of file ec_group.cpp.
References Botan::BigInt::bytes(), Botan::EC2OSP(), Botan::EC_DOMPAR_ENC_EXPLICIT, Botan::EC_DOMPAR_ENC_IMPLICITCA, Botan::EC_DOMPAR_ENC_OID, Botan::DER_Encoder::encode(), Botan::BigInt::encode_1363(), Botan::DER_Encoder::encode_null(), Botan::DER_Encoder::end_cons(), Botan::CurveGFp::get_a(), Botan::CurveGFp::get_b(), Botan::DER_Encoder::get_contents_unlocked(), get_oid(), Botan::CurveGFp::get_p(), Botan::OCTET_STRING, Botan::SEQUENCE, Botan::DER_Encoder::start_cons(), and Botan::PointGFp::UNCOMPRESSED.
Referenced by PEM_encode().
|
inline |
Return group base point
Definition at line 95 of file ec_group.h.
References m_base_point.
Referenced by Botan::EC_PrivateKey::EC_PrivateKey(), and operator==().
|
inline |
Return the cofactor
Definition at line 107 of file ec_group.h.
References m_cofactor.
Referenced by Botan::EC_PublicKey::check_key(), Botan::ECIES_KA_Operation::derive_secret(), Botan::ECIES_Decryptor::ECIES_Decryptor(), and operator==().
|
inline |
Return domain parameter curve
Definition at line 89 of file ec_group.h.
References m_curve.
Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::ECIES_Encryptor::ECIES_Encryptor(), Botan::EC_PublicKey::key_length(), and operator==().
|
inline |
Return the OID of these domain parameters
Definition at line 115 of file ec_group.h.
References m_oid.
Referenced by DER_encode(), and Botan::EC_PublicKey::set_parameter_encoding().
|
inline |
Return the order of the base point
Definition at line 101 of file ec_group.h.
References m_order.
Referenced by Botan::EC_PublicKey::check_key(), Botan::ECIES_KA_Operation::derive_secret(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::ECIES_Decryptor::ECIES_Decryptor(), and operator==().
|
inline |
|
inline |
Definition at line 124 of file ec_group.h.
References get_base_point(), get_cofactor(), get_curve(), and get_order().
std::string Botan::EC_Group::PEM_encode | ( | ) | const |
Return the PEM encoding (always in explicit form)
Definition at line 128 of file ec_group.cpp.
References DER_encode(), Botan::EC_DOMPAR_ENC_EXPLICIT, and Botan::PEM_Code::encode().
|
static |
Return PEM representation of named EC group
Definition at line 13 of file ec_named.cpp.
Referenced by EC_Group().
bool Botan::EC_Group::verify_group | ( | RandomNumberGenerator & | rng, |
bool | strong = false |
||
) | const |
Verify EC_Group domain
Definition at line 134 of file ec_group.cpp.
References Botan::CurveGFp::get_a(), Botan::CurveGFp::get_b(), Botan::CurveGFp::get_p(), Botan::is_prime(), and Botan::PointGFp::on_the_curve().
Referenced by Botan::EC_PublicKey::check_key().