10#include <botan/ecc_key.h>
12#include <botan/ber_dec.h>
13#include <botan/der_enc.h>
14#include <botan/ec_point.h>
15#include <botan/numthry.h>
16#include <botan/secmem.h>
17#include <botan/internal/fmt.h>
18#include <botan/internal/workfactor.h>
43 m_domain_params(dom_par), m_public_key(pub_point), m_domain_encoding(default_encoding_for(m_domain_params)) {}
46 m_domain_params{
EC_Group(alg_id.parameters())},
47 m_public_key{domain().
OS2ECP(key_bits)},
48 m_domain_encoding(default_encoding_for(m_domain_params)) {}
76 throw Invalid_Argument(
"Cannot used NamedCurve encoding for a curve without an OID");
84 throw Invalid_State(
"EC_PrivateKey::private_value - uninitialized");
96 bool with_modular_inverse) {
107 std::vector<BigInt> ws;
109 if(with_modular_inverse) {
126 .
encode(
static_cast<size_t>(1))
136 std::span<const uint8_t> key_bits,
137 bool with_modular_inverse) {
157 if(with_modular_inverse) {
180 if(field ==
"public_x" || field ==
"public_y") {
181 throw Not_Implemented(
fmt(
"EC_PublicKey::get_int_field no longer implements getter for {}", field));
182 }
else if(field ==
"base_x") {
184 }
else if(field ==
"base_y") {
186 }
else if(field ==
"p") {
188 }
else if(field ==
"a") {
190 }
else if(field ==
"b") {
192 }
else if(field ==
"cofactor") {
194 }
else if(field ==
"order") {
#define BOTAN_ARG_CHECK(expr, msg)
#define BOTAN_ASSERT(expr, assertion_made)
const std::vector< uint8_t > & parameters() const
virtual const BigInt & get_int_field(std::string_view field) const
virtual OID object_identifier() const
BER_Decoder start_sequence()
BER_Decoder & decode_optional(T &out, ASN1_Type type_tag, ASN1_Class class_tag, const T &default_value=T())
BER_Decoder & decode_and_check(const T &expected, std::string_view error_msg)
T serialize(size_t len) const
secure_vector< uint8_t > get_contents()
DER_Encoder & start_explicit_context_specific(uint32_t tag)
DER_Encoder & start_sequence()
DER_Encoder & encode(bool b)
const BigInt & get_b() const
const BigInt & get_a() const
const BigInt & get_g_y() const
const BigInt & get_cofactor() const
bool verify_public_element(const EC_Point &y) const
const BigInt & get_p() const
bool verify_group(RandomNumberGenerator &rng, bool strong=false) const
const BigInt & get_order() const
size_t get_p_bits() const
const EC_Point & get_base_point() const
EC_Point blinded_base_point_multiply(const BigInt &k, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const
const BigInt & get_g_x() const
const OID & get_curve_oid() const
BigInt inverse_mod_order(const BigInt &x) const
EC_Point OS2ECP(const uint8_t bits[], size_t len) const
BigInt random_scalar(RandomNumberGenerator &rng) const
size_t get_order_bytes() const
bool on_the_curve() const
std::vector< uint8_t > encode(EC_Point_Format format) const
const BigInt & private_value() const
secure_vector< uint8_t > raw_private_key_bits() const final
bool check_key(RandomNumberGenerator &rng, bool strong) const override
const BigInt & get_int_field(std::string_view field) const final
secure_vector< uint8_t > private_key_bits() const final
const EC_Group & domain() const
std::vector< uint8_t > DER_domain() const
void set_parameter_encoding(EC_Group_Encoding enc)
EC_Point_Format m_point_encoding
EC_Group_Encoding m_domain_encoding
size_t estimated_strength() const override
AlgorithmIdentifier algorithm_identifier() const override
size_t key_length() const override
std::vector< uint8_t > raw_public_key_bits() const override
void set_point_encoding(EC_Point_Format enc)
const BigInt & get_int_field(std::string_view field) const override
EC_Point_Format point_encoding() const
bool check_key(RandomNumberGenerator &rng, bool strong) const override
const EC_Point & public_point() const
std::vector< uint8_t > public_key_bits() const override
size_t ecp_work_factor(size_t bits)
@ ExplicitContextSpecific
std::string fmt(std::string_view format, const T &... args)
EC_Point OS2ECP(const uint8_t data[], size_t data_len, const CurveGFp &curve)
std::vector< T, secure_allocator< T > > secure_vector