181 explicit EC_Group(std::span<const uint8_t> ber);
205 static
EC_Group from_PEM(std::string_view pem);
215 static
EC_Group from_name(std::string_view name);
250 static bool supports_application_specific_group();
257 static bool supports_application_specific_group_with_cofactor();
262 static bool supports_named_group(std::string_view name);
286 static const std::set<std::string>& known_named_groups();
300 std::vector<uint8_t> DER_encode() const;
316 size_t get_p_bits() const;
321 size_t get_p_bytes() const;
326 size_t get_order_bits() const;
331 size_t get_order_bytes() const;
384 std::unique_ptr<EC_Mul2Table_Data> m_tbl;
462 const std::shared_ptr<EC_Group_Data>&
_data()
const {
return m_data; }
464#if defined(BOTAN_HAS_LEGACY_EC_POINT)
471 bool verify_public_element(
const EC_Point& y)
const;
479 return EC_AffinePoint(*
this, std::span{bits, len}).to_legacy_point();
483 EC_Point OS2ECP(std::span<const uint8_t> encoded_point)
const {
484 return EC_AffinePoint(*
this, encoded_point).to_legacy_point();
491 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& get_base_point() const;
499 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& generator() const;
506 EC_Point point_multiply(const BigInt& x_bn, const EC_Point& h_pt, const BigInt& y_bn)
const {
507 auto x = EC_Scalar::from_bigint(*
this, x_bn);
508 auto y = EC_Scalar::from_bigint(*
this, y_bn);
509 auto h = EC_AffinePoint(*
this, h_pt);
513 if(
auto r = gh_mul.mul2_vartime(x, y)) {
514 return r->to_legacy_point();
516 return EC_AffinePoint::identity(*this).to_legacy_point();
527 EC_Point blinded_base_point_multiply(const BigInt& k_bn,
528 RandomNumberGenerator& rng,
529 std::vector<BigInt>& )
const {
530 auto k = EC_Scalar::from_bigint(*
this, k_bn);
531 auto pt = EC_AffinePoint::g_mul(k, rng);
532 return pt.to_legacy_point();
544 BigInt blinded_base_point_multiply_x(const BigInt& k_bn,
545 RandomNumberGenerator& rng,
546 std::vector<BigInt>& )
const {
547 auto k = EC_Scalar::from_bigint(*
this, k_bn);
548 return BigInt(EC_AffinePoint::g_mul(k, rng).x_bytes());
559 EC_Point blinded_var_point_multiply(const EC_Point& point,
561 RandomNumberGenerator& rng,
562 std::vector<BigInt>& )
const {
563 auto k = EC_Scalar::from_bigint(*
this, k_bn);
564 auto pt = EC_AffinePoint(*
this, point);
565 return pt.mul(k, rng).to_legacy_point();
571 BOTAN_DEPRECATED(
"Use EC_Scalar::random") BigInt random_scalar(RandomNumberGenerator& rng)
const {
572 return EC_Scalar::random(*
this, rng).to_bigint();
589 EC_Point hash_to_curve(std::string_view hash_fn,
590 const uint8_t input[],
592 const uint8_t domain_sep[],
593 size_t domain_sep_len,
594 bool random_oracle = true)
const {
595 auto inp = std::span{input, input_len};
596 auto dst = std::span{domain_sep, domain_sep_len};
599 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
601 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
618 EC_Point hash_to_curve(std::string_view hash_fn,
619 const uint8_t input[],
621 std::string_view domain_sep,
622 bool random_oracle = true)
const {
623 auto inp = std::span{input, input_len};
626 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, domain_sep).to_legacy_point();
628 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, domain_sep).to_legacy_point();
635 BOTAN_DEPRECATED(
"Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y)
const {
636 if(
auto pt = EC_AffinePoint::from_bigint_xy(*
this, x, y)) {
637 return pt->to_legacy_point();
639 throw Decoding_Error(
"Invalid x/y coordinates for elliptic curve point");
647 return EC_AffinePoint::identity(*this).to_legacy_point();
681 return xs.to_bigint();
690 return (xs * ys).to_bigint();
701 return (xs * ys * zs).to_bigint();
709 return (xs * xs * xs).to_bigint();
722 static EC_Group_Data_Map& ec_group_data();
724 explicit EC_Group(std::shared_ptr<EC_Group_Data>&& data);
726 static std::pair<std::shared_ptr<EC_Group_Data>,
bool> BER_decode_EC_group(std::span<const uint8_t> ber,
729 static std::shared_ptr<EC_Group_Data> load_EC_group_info(
const char* p,
740 std::shared_ptr<EC_Group_Data> m_data;
741 bool m_explicit_encoding =
false;