pub struct Sm2;
Expand description
SM2 elliptic curve.
Trait Implementations§
source§impl Curve for Sm2
impl Curve for Sm2
source§impl CurveArithmetic for Sm2
Available on crate feature arithmetic
only.
impl CurveArithmetic for Sm2
Available on crate feature
arithmetic
only.§type AffinePoint = AffinePoint<Sm2>
type AffinePoint = AffinePoint<Sm2>
Elliptic curve point in affine coordinates.
§type ProjectivePoint = ProjectivePoint<Sm2>
type ProjectivePoint = ProjectivePoint<Sm2>
Elliptic curve point in projective coordinates. Read more
source§impl FieldBytesEncoding<Sm2> for U256
impl FieldBytesEncoding<Sm2> for U256
source§fn decode_field_bytes(field_bytes: &FieldBytes) -> Self
fn decode_field_bytes(field_bytes: &FieldBytes) -> Self
Decode unsigned integer from serialized field element. Read more
source§fn encode_field_bytes(&self) -> FieldBytes
fn encode_field_bytes(&self) -> FieldBytes
Encode unsigned integer into serialized field element. Read more
source§impl Ord for Sm2
impl Ord for Sm2
source§impl PartialOrd for Sm2
impl PartialOrd for Sm2
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl PointCompression for Sm2
impl PointCompression for Sm2
source§const COMPRESS_POINTS: bool = false
const COMPRESS_POINTS: bool = false
SM2 points are typically uncompressed.
source§impl PrimeCurveArithmetic for Sm2
Available on crate feature arithmetic
only.
impl PrimeCurveArithmetic for Sm2
Available on crate feature
arithmetic
only.§type CurveGroup = ProjectivePoint<Sm2>
type CurveGroup = ProjectivePoint<Sm2>
Prime order elliptic curve group.
source§impl PrimeCurveParams for Sm2
Available on crate feature arithmetic
only.
impl PrimeCurveParams for Sm2
Available on crate feature
arithmetic
only.Adapted from draft-shen-sm2-ecdsa Appendix D: Recommended Parameters.
source§const EQUATION_A: FieldElement = _
const EQUATION_A: FieldElement = _
a = -3 (0xFFFFFFFE FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 00000000 FFFFFFFF FFFFFFFC)
source§const EQUATION_B: FieldElement = _
const EQUATION_B: FieldElement = _
b = 0x28E9FA9E 9D9F5E34 4D5A9E4B CF6509A7 F39789F5 15AB8F92 DDBCBD41 4D940E93
source§const GENERATOR: (FieldElement, FieldElement) = _
const GENERATOR: (FieldElement, FieldElement) = _
Base point of SM2.
Gₓ = 0x32C4AE2C 1F198119 5F990446 6A39C994 8FE30BBF F2660BE1 715A4589 334C74C7
Gᵧ = 0xBC3736A2 F4F6779C 59BDCEE3 6B692153 D0A9877C C62A4740 02DF32E5 2139F0A0
§type FieldElement = FieldElement
type FieldElement = FieldElement
Base field element type.
§type PointArithmetic = EquationAIsMinusThree
type PointArithmetic = EquationAIsMinusThree
Point arithmetic implementation, might be optimized for this specific curve
source§impl ToEncodedPoint<Sm2> for VerifyingKey
Available on crate features arithmetic
and dsa
only.
impl ToEncodedPoint<Sm2> for VerifyingKey
Available on crate features
arithmetic
and dsa
only.source§fn to_encoded_point(&self, compress: bool) -> EncodedPoint
fn to_encoded_point(&self, compress: bool) -> EncodedPoint
Serialize this value as a SEC1
EncodedPoint
, optionally applying
point compression.impl Copy for Sm2
impl Eq for Sm2
impl PrimeCurve for Sm2
impl StructuralEq for Sm2
impl StructuralPartialEq for Sm2
Auto Trait Implementations§
impl RefUnwindSafe for Sm2
impl Send for Sm2
impl Sync for Sm2
impl Unpin for Sm2
impl UnwindSafe for Sm2
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> DynAssociatedOid for Twhere
T: AssociatedOid,
impl<T> DynAssociatedOid for Twhere T: AssociatedOid,
source§impl<C> ValidatePublicKey for Cwhere
C: CurveArithmetic,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> ValidatePublicKey for Cwhere C: CurveArithmetic, <C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>, <C as Curve>::FieldBytesSize: ModulusSize,
source§fn validate_public_key(
secret_key: &SecretKey<C>,
public_key: &EncodedPoint<<C as Curve>::FieldBytesSize>
) -> Result<(), Error>
fn validate_public_key( secret_key: &SecretKey<C>, public_key: &EncodedPoint<<C as Curve>::FieldBytesSize> ) -> Result<(), Error>
Validate that the given
EncodedPoint
is a valid public key for the
provided secret value.