Struct p256::AffinePoint

source ·
pub struct AffinePoint { /* private fields */ }
Expand description

NIST P-256 (secp256r1) curve point expressed in affine coordinates.

serde support

When the serde feature of this crate is enabled, the Serialize and Deserialize traits are impl’d for this type.

The serialization uses the SEC1 Elliptic-Curve-Point-to-Octet-String encoding, serialized as binary.

When serialized with a text-based format, the SEC1 representation is subsequently hex encoded.

Implementations§

source§

impl AffinePoint

source

pub const IDENTITY: Self = _

Additive identity of the group: the point at infinity.

source

pub const GENERATOR: Self = _

Base point of P-256.

Defined in FIPS 186-4 § D.1.2.3:

Gₓ = 6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296
Gᵧ = 4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5

Trait Implementations§

source§

impl Add<&AffinePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

fn add(self, other: &AffinePoint) -> ProjectivePoint

Performs the + operation. Read more
source§

impl Add<&AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

fn add(self, other: &AffinePoint) -> ProjectivePoint

Performs the + operation. Read more
source§

impl Add<AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the + operator.
source§

fn add(self, other: AffinePoint) -> ProjectivePoint

Performs the + operation. Read more
source§

impl AddAssign<&AffinePoint> for ProjectivePoint

source§

fn add_assign(&mut self, rhs: &AffinePoint)

Performs the += operation. Read more
source§

impl AddAssign<AffinePoint> for ProjectivePoint

source§

fn add_assign(&mut self, rhs: AffinePoint)

Performs the += operation. Read more
source§

impl AffineXCoordinate<NistP256> for AffinePoint

source§

fn x(&self) -> FieldBytes

Get the affine x-coordinate as a serialized field element.
source§

impl Clone for AffinePoint

source§

fn clone(&self) -> AffinePoint

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ConditionallySelectable for AffinePoint

source§

fn conditional_select( a: &AffinePoint, b: &AffinePoint, choice: Choice ) -> AffinePoint

Select a or b according to choice. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

impl ConstantTimeEq for AffinePoint

source§

fn ct_eq(&self, other: &AffinePoint) -> Choice

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl Debug for AffinePoint

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DecompactPoint<NistP256> for AffinePoint

source§

fn decompact(x_bytes: &FieldBytes) -> CtOption<Self>

Attempt to decompact an elliptic curve point
source§

impl DecompressPoint<NistP256> for AffinePoint

source§

fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>

Attempt to decompress an elliptic curve point.
source§

impl Default for AffinePoint

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<&AffinePoint> for ProjectivePoint

source§

fn from(p: &AffinePoint) -> Self

Converts to this type from the input type.
source§

impl From<&AffinePoint> for SharedSecret

source§

fn from(affine: &AffinePoint) -> SharedSecret

Converts to this type from the input type.
source§

impl From<&ProjectivePoint> for AffinePoint

source§

fn from(p: &ProjectivePoint) -> AffinePoint

Converts to this type from the input type.
source§

impl From<&PublicKey<NistP256>> for AffinePoint

source§

fn from(public_key: &PublicKey) -> AffinePoint

Converts to this type from the input type.
source§

impl From<AffinePoint> for EncodedPoint

source§

fn from(affine_point: AffinePoint) -> EncodedPoint

Converts to this type from the input type.
source§

impl From<AffinePoint> for ProjectivePoint

source§

fn from(p: AffinePoint) -> Self

Converts to this type from the input type.
source§

impl From<ProjectivePoint> for AffinePoint

source§

fn from(p: ProjectivePoint) -> AffinePoint

Converts to this type from the input type.
source§

impl From<PublicKey<NistP256>> for AffinePoint

source§

fn from(public_key: PublicKey) -> AffinePoint

Converts to this type from the input type.
source§

impl FromEncodedPoint<NistP256> for AffinePoint

source§

fn from_encoded_point(encoded_point: &EncodedPoint) -> CtOption<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 GroupEncoding for AffinePoint

source§

fn from_bytes(bytes: &Self::Repr) -> CtOption<Self>

NOTE: not constant-time with respect to identity point

§

type Repr = GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B1>>

The encoding of group elements. Read more
source§

fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>

Attempts to deserialize a group element, not checking if the element is valid. Read more
source§

fn to_bytes(&self) -> Self::Repr

Converts this element into its byte encoding. This may or may not support encoding the identity.
source§

impl Mul<&Scalar> for AffinePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
source§

fn mul(self, scalar: &Scalar) -> ProjectivePoint

Performs the * operation. Read more
source§

impl Mul<Scalar> for AffinePoint

§

type Output = ProjectivePoint

The resulting type after applying the * operator.
source§

fn mul(self, scalar: Scalar) -> ProjectivePoint

Performs the * operation. Read more
source§

impl Neg for AffinePoint

§

type Output = AffinePoint

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq<AffinePoint> for AffinePoint

source§

fn eq(&self, other: &AffinePoint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PrimeCurveAffine for AffinePoint

§

type Scalar = Scalar

§

type Curve = ProjectivePoint

source§

fn identity() -> AffinePoint

Returns the additive identity.
source§

fn generator() -> AffinePoint

Returns a fixed generator of unknown exponent.
source§

fn is_identity(&self) -> Choice

Determines if this point represents the point at infinity; the additive identity.
source§

fn to_curve(&self) -> ProjectivePoint

Converts this element to its curve representation.
source§

impl Sub<&AffinePoint> for &ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

fn sub(self, other: &AffinePoint) -> ProjectivePoint

Performs the - operation. Read more
source§

impl Sub<&AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

fn sub(self, other: &AffinePoint) -> ProjectivePoint

Performs the - operation. Read more
source§

impl Sub<AffinePoint> for ProjectivePoint

§

type Output = ProjectivePoint

The resulting type after applying the - operator.
source§

fn sub(self, other: AffinePoint) -> ProjectivePoint

Performs the - operation. Read more
source§

impl SubAssign<&AffinePoint> for ProjectivePoint

source§

fn sub_assign(&mut self, rhs: &AffinePoint)

Performs the -= operation. Read more
source§

impl SubAssign<AffinePoint> for ProjectivePoint

source§

fn sub_assign(&mut self, rhs: AffinePoint)

Performs the -= operation. Read more
source§

impl ToCompactEncodedPoint<NistP256> for AffinePoint

source§

fn to_compact_encoded_point(&self) -> CtOption<EncodedPoint>

Serialize this value as a SEC1 compact EncodedPoint

source§

impl ToEncodedPoint<NistP256> for AffinePoint

source§

fn to_encoded_point(&self, compress: bool) -> EncodedPoint

Serialize this value as a SEC1 EncodedPoint, optionally applying point compression.
source§

impl TryFrom<&AffinePoint> for PublicKey

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(affine_point: &AffinePoint) -> Result<PublicKey>

Performs the conversion.
source§

impl TryFrom<&EncodedPoint<<<NistP256 as Curve>::UInt as ArrayEncoding>::ByteSize>> for AffinePoint

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(point: &EncodedPoint) -> Result<AffinePoint>

Performs the conversion.
source§

impl TryFrom<AffinePoint> for PublicKey

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(affine_point: AffinePoint) -> Result<PublicKey>

Performs the conversion.
source§

impl TryFrom<EncodedPoint<<<NistP256 as Curve>::UInt as ArrayEncoding>::ByteSize>> for AffinePoint

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(point: EncodedPoint) -> Result<AffinePoint>

Performs the conversion.
source§

impl Copy for AffinePoint

source§

impl DefaultIsZeroes for AffinePoint

source§

impl Eq for AffinePoint

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<Z> Zeroize for Zwhere Z: DefaultIsZeroes,

source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.