pub struct NistP256;Expand description
NIST P-256 elliptic curve.
This curve is also known as prime256v1 (ANSI X9.62) and secp256r1 (SECG) and is specified in FIPS 186-4: Digital Signature Standard (DSS):
https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf
It’s included in the US National Security Agency’s “Suite B” and is widely used in protocols like TLS and the associated X.509 PKI.
Its equation is y² = x³ - 3x + b over a ~256-bit prime field where b is
the “verifiably random”† constant:
b = 41058363725152142129326129780047268409114441015993725554835256314039467401291† NOTE: the specific origins of this constant have never been fully disclosed (it is the SHA-1 digest of an inexplicable NSA-selected constant)
Trait Implementations§
Source§impl AffineArithmetic for NistP256
impl AffineArithmetic for NistP256
Source§type AffinePoint = AffinePoint
type AffinePoint = AffinePoint
impl Curve for NistP256
Source§impl DecompressPoint<NistP256> for AffinePoint
impl DecompressPoint<NistP256> for AffinePoint
Source§fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
Source§impl DigestPrimitive for NistP256
Available on crate feature sha256 only.
impl DigestPrimitive for NistP256
sha256 only.impl Eq for NistP256
Source§impl FromDigest<NistP256> for Scalar
Available on crate feature digest only.
impl FromDigest<NistP256> for Scalar
digest only.Source§impl FromEncodedPoint<NistP256> for AffinePoint
impl FromEncodedPoint<NistP256> for AffinePoint
Source§fn from_encoded_point(encoded_point: &EncodedPoint) -> Option<Self>
fn from_encoded_point(encoded_point: &EncodedPoint) -> Option<Self>
Attempts to parse the given EncodedPoint as an SEC1-encoded AffinePoint.
§Returns
None value if encoded_point is not on the secp256r1 curve.
Source§impl FromEncodedPoint<NistP256> for ProjectivePoint
impl FromEncodedPoint<NistP256> for ProjectivePoint
Source§fn from_encoded_point(p: &EncodedPoint) -> Option<Self>
fn from_encoded_point(p: &EncodedPoint) -> Option<Self>
EncodedPoint. Read moreSource§impl Ord for NistP256
impl Ord for NistP256
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for NistP256
impl PartialOrd for NistP256
Source§impl PointCompression for NistP256
impl PointCompression for NistP256
Source§const COMPRESS_POINTS: bool = false
const COMPRESS_POINTS: bool = false
NIST P-256 points are typically uncompressed.
Source§impl ProjectiveArithmetic for NistP256
impl ProjectiveArithmetic for NistP256
Source§type ProjectivePoint = ProjectivePoint
type ProjectivePoint = ProjectivePoint
Source§impl SignPrimitive<NistP256> for Scalar
Available on crate feature ecdsa only.
impl SignPrimitive<NistP256> for Scalar
ecdsa only.impl StructuralPartialEq for NistP256
Source§impl ToEncodedPoint<NistP256> for AffinePoint
impl ToEncodedPoint<NistP256> for AffinePoint
Source§fn to_encoded_point(&self, compress: bool) -> EncodedPoint
fn to_encoded_point(&self, compress: bool) -> EncodedPoint
EncodedPoint, optionally applying
point compression.Source§impl ToEncodedPoint<NistP256> for ProjectivePoint
impl ToEncodedPoint<NistP256> for ProjectivePoint
Source§fn to_encoded_point(&self, compress: bool) -> EncodedPoint
fn to_encoded_point(&self, compress: bool) -> EncodedPoint
EncodedPoint, optionally applying
point compression.Source§impl VerifyPrimitive<NistP256> for AffinePoint
Available on crate feature ecdsa only.
impl VerifyPrimitive<NistP256> for AffinePoint
ecdsa only.Auto Trait Implementations§
impl Freeze for NistP256
impl RefUnwindSafe for NistP256
impl Send for NistP256
impl Sync for NistP256
impl Unpin for NistP256
impl UnsafeUnpin for NistP256
impl UnwindSafe for NistP256
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C> ValidatePublicKey for Cwhere
C: Curve + ProjectiveArithmetic,
<C as AffineArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as ScalarArithmetic>::Scalar: Zeroize,
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output: Add<UInt<UTerm, B1>> + ArrayLength<u8>,
<<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
impl<C> ValidatePublicKey for Cwhere
C: Curve + ProjectiveArithmetic,
<C as AffineArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as ScalarArithmetic>::Scalar: Zeroize,
<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output: Add<UInt<UTerm, B1>> + ArrayLength<u8>,
<<<<C as Curve>::UInt as ArrayEncoding>::ByteSize as Add>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
Source§fn validate_public_key(
secret_key: &SecretKey<C>,
public_key: &EncodedPoint<C>,
) -> Result<(), Error>
fn validate_public_key( secret_key: &SecretKey<C>, public_key: &EncodedPoint<C>, ) -> Result<(), Error>
EncodedPoint is a valid public key for the
provided secret value.