222 explicit EC_Group(std::span<const uint8_t> der);
251 static
EC_Group from_PEM(std::string_view pem);
342 static bool supports_application_specific_group();
349 static bool supports_application_specific_group_with_cofactor();
356 static bool supports_named_group(std::string_view
name);
382 static const std::set<std::string>& known_named_groups();
396 std::vector<uint8_t> DER_encode() const;
412 size_t get_p_bits() const;
417 size_t get_p_bytes() const;
422 size_t get_order_bits() const;
427 size_t get_order_bytes() const;
494 std::unique_ptr<EC_Mul2Table_Data> m_tbl;
604 const std::shared_ptr<const EC_Group_Data>&
_data()
const {
return m_data; }
606#if defined(BOTAN_HAS_LEGACY_EC_POINT)
613 bool verify_public_element(
const EC_Point& y)
const;
621 return EC_AffinePoint(*
this, std::span{bits, len}).to_legacy_point();
633 EC_Point OS2ECP(std::span<const uint8_t> encoded_point)
const {
634 return EC_AffinePoint(*
this, encoded_point).to_legacy_point();
641 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& get_base_point() const;
649 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& generator() const;
656 EC_Point point_multiply(const BigInt& x_bn, const EC_Point& h_pt, const BigInt& y_bn)
const {
657 const auto x = EC_Scalar::from_bigint(*
this, x_bn);
658 const auto y = EC_Scalar::from_bigint(*
this, y_bn);
659 const auto h = EC_AffinePoint(*
this, h_pt);
661 const Mul2Table gh_mul(h);
663 if(
auto r = gh_mul.mul2_vartime(x, y)) {
664 return r->to_legacy_point();
666 return EC_AffinePoint::identity(*this).to_legacy_point();
677 EC_Point blinded_base_point_multiply(const BigInt& k_bn,
678 RandomNumberGenerator& rng,
679 std::vector<BigInt>& )
const {
680 const auto k = EC_Scalar::from_bigint(*
this, k_bn);
681 const auto pt = EC_AffinePoint::g_mul(k, rng);
682 return pt.to_legacy_point();
694 BigInt blinded_base_point_multiply_x(const BigInt& k_bn,
695 RandomNumberGenerator& rng,
696 std::vector<BigInt>& )
const {
697 const auto k = EC_Scalar::from_bigint(*
this, k_bn);
698 return BigInt(EC_AffinePoint::g_mul(k, rng).x_bytes());
709 EC_Point blinded_var_point_multiply(const EC_Point& point,
711 RandomNumberGenerator& rng,
712 std::vector<BigInt>& )
const {
713 const auto k = EC_Scalar::from_bigint(*
this, k_bn);
714 const auto pt = EC_AffinePoint(*
this, point);
715 return pt.mul(k, rng).to_legacy_point();
721 BOTAN_DEPRECATED(
"Use EC_Scalar::random") BigInt random_scalar(RandomNumberGenerator& rng)
const {
722 return EC_Scalar::random(*
this, rng).to_bigint();
739 EC_Point hash_to_curve(std::string_view hash_fn,
740 const uint8_t input[],
742 const uint8_t domain_sep[],
743 size_t domain_sep_len,
744 bool random_oracle = true)
const {
745 const auto inp = std::span{input, input_len};
746 const auto dst = std::span{domain_sep, domain_sep_len};
749 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
751 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
768 EC_Point hash_to_curve(std::string_view hash_fn,
769 const uint8_t input[],
771 std::string_view domain_sep,
772 bool random_oracle = true)
const {
773 const auto inp = std::span{input, input_len};
776 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, domain_sep).to_legacy_point();
778 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, domain_sep).to_legacy_point();
785 BOTAN_DEPRECATED(
"Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y)
const {
786 if(
auto pt = EC_AffinePoint::from_bigint_xy(*
this, x, y)) {
787 return pt->to_legacy_point();
789 throw Decoding_Error(
"Invalid x/y coordinates for elliptic curve point");
797 return EC_AffinePoint::identity(*this).to_legacy_point();
837 return xs.to_bigint();
849 return (xs * ys).to_bigint();
864 return (xs * ys * zs).to_bigint();
874 return (xs * xs * xs).to_bigint();
898 explicit EC_Group(std::shared_ptr<const EC_Group_Data> data);
900 static bool verify_generator_order(std::shared_ptr<const EC_Group_Data> data);
902 static std::pair<std::shared_ptr<EC_Group_Data>,
bool> DER_decode_EC_group(std::span<const uint8_t> der,
905 static std::shared_ptr<EC_Group_Data> load_EC_group_info(
const char* p,
916 std::shared_ptr<const EC_Group_Data> m_data;
917 bool m_explicit_encoding =
false;