Struct p384::AffinePoint
source · [−]pub struct AffinePoint {
pub x: FieldElement,
pub y: FieldElement,
pub infinity: u8,
}arithmetic only.Expand description
NIST P-384 (secp384r1) 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.
Fields
x: FieldElementx-coordinate
y: FieldElementy-coordinate
infinity: u8Is this point the point at infinity? 0 = no, 1 = yes
This is a proxy for Choice, but uses u8 instead to permit const
constructors for IDENTITY and GENERATOR.
Implementations
sourceimpl AffinePoint
impl AffinePoint
sourcepub const GENERATOR: Self = Self {
x: FieldElement::from_be_hex("aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),
y: FieldElement::from_be_hex("3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),
infinity: 0,
}
pub const GENERATOR: Self = Self { x: FieldElement::from_be_hex("aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"), y: FieldElement::from_be_hex("3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"), infinity: 0, }
Base point of P-384.
Defined in FIPS 186-4 § D.1.2.4:
Gₓ = aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98
59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7
Gᵧ = 3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c
e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5fNOTE: coordinate field elements have been translated into the Montgomery domain.
Trait Implementations
sourceimpl Add<&'_ AffinePoint> for &ProjectivePoint
impl Add<&'_ AffinePoint> for &ProjectivePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the + operator.
sourcefn add(self, other: &AffinePoint) -> ProjectivePoint
fn add(self, other: &AffinePoint) -> ProjectivePoint
Performs the + operation. Read more
sourceimpl Add<&'_ AffinePoint> for ProjectivePoint
impl Add<&'_ AffinePoint> for ProjectivePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the + operator.
sourcefn add(self, other: &AffinePoint) -> ProjectivePoint
fn add(self, other: &AffinePoint) -> ProjectivePoint
Performs the + operation. Read more
sourceimpl Add<AffinePoint> for ProjectivePoint
impl Add<AffinePoint> for ProjectivePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the + operator.
sourcefn add(self, other: AffinePoint) -> ProjectivePoint
fn add(self, other: AffinePoint) -> ProjectivePoint
Performs the + operation. Read more
sourceimpl AddAssign<&'_ AffinePoint> for ProjectivePoint
impl AddAssign<&'_ AffinePoint> for ProjectivePoint
sourcefn add_assign(&mut self, rhs: &AffinePoint)
fn add_assign(&mut self, rhs: &AffinePoint)
Performs the += operation. Read more
sourceimpl AddAssign<AffinePoint> for ProjectivePoint
impl AddAssign<AffinePoint> for ProjectivePoint
sourcefn add_assign(&mut self, rhs: AffinePoint)
fn add_assign(&mut self, rhs: AffinePoint)
Performs the += operation. Read more
sourceimpl AffineXCoordinate<NistP384> for AffinePoint
impl AffineXCoordinate<NistP384> for AffinePoint
sourcefn x(&self) -> FieldBytes
fn x(&self) -> FieldBytes
Get the affine x-coordinate as a serialized field element.
sourceimpl Clone for AffinePoint
impl Clone for AffinePoint
sourcefn clone(&self) -> AffinePoint
fn clone(&self) -> AffinePoint
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl ConditionallySelectable for AffinePoint
impl ConditionallySelectable for AffinePoint
sourcefn conditional_select(
a: &AffinePoint,
b: &AffinePoint,
choice: Choice
) -> AffinePoint
fn conditional_select(
a: &AffinePoint,
b: &AffinePoint,
choice: Choice
) -> AffinePoint
Select a or b according to choice. Read more
sourcefn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Conditionally assign other to self, according to choice. Read more
sourceimpl ConstantTimeEq for AffinePoint
impl ConstantTimeEq for AffinePoint
sourcefn ct_eq(&self, other: &AffinePoint) -> Choice
fn ct_eq(&self, other: &AffinePoint) -> Choice
Determine if two items are equal. Read more
sourceimpl Debug for AffinePoint
impl Debug for AffinePoint
sourceimpl DecompressPoint<NistP384> for AffinePoint
impl DecompressPoint<NistP384> for AffinePoint
sourcefn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
fn decompress(x_bytes: &FieldBytes, y_is_odd: Choice) -> CtOption<Self>
Attempt to decompress an elliptic curve point.
sourceimpl Default for AffinePoint
impl Default for AffinePoint
sourceimpl From<&'_ AffinePoint> for ProjectivePoint
impl From<&'_ AffinePoint> for ProjectivePoint
sourcefn from(p: &AffinePoint) -> Self
fn from(p: &AffinePoint) -> Self
Converts to this type from the input type.
sourceimpl From<&'_ AffinePoint> for SharedSecret
Available on crate feature ecdh only.
impl From<&'_ AffinePoint> for SharedSecret
ecdh only.sourcefn from(affine: &AffinePoint) -> SharedSecret
fn from(affine: &AffinePoint) -> SharedSecret
Converts to this type from the input type.
sourceimpl From<&'_ ProjectivePoint> for AffinePoint
impl From<&'_ ProjectivePoint> for AffinePoint
sourcefn from(p: &ProjectivePoint) -> AffinePoint
fn from(p: &ProjectivePoint) -> AffinePoint
Converts to this type from the input type.
sourceimpl From<&'_ PublicKey<NistP384>> for AffinePoint
impl From<&'_ PublicKey<NistP384>> for AffinePoint
sourcefn from(public_key: &PublicKey) -> AffinePoint
fn from(public_key: &PublicKey) -> AffinePoint
Converts to this type from the input type.
sourceimpl From<AffinePoint> for EncodedPoint
impl From<AffinePoint> for EncodedPoint
sourcefn from(affine_point: AffinePoint) -> EncodedPoint
fn from(affine_point: AffinePoint) -> EncodedPoint
Converts to this type from the input type.
sourceimpl From<AffinePoint> for ProjectivePoint
impl From<AffinePoint> for ProjectivePoint
sourcefn from(p: AffinePoint) -> Self
fn from(p: AffinePoint) -> Self
Converts to this type from the input type.
sourceimpl From<ProjectivePoint> for AffinePoint
impl From<ProjectivePoint> for AffinePoint
sourcefn from(p: ProjectivePoint) -> AffinePoint
fn from(p: ProjectivePoint) -> AffinePoint
Converts to this type from the input type.
sourceimpl From<PublicKey<NistP384>> for AffinePoint
impl From<PublicKey<NistP384>> for AffinePoint
sourcefn from(public_key: PublicKey) -> AffinePoint
fn from(public_key: PublicKey) -> AffinePoint
Converts to this type from the input type.
sourceimpl FromEncodedPoint<NistP384> for AffinePoint
impl FromEncodedPoint<NistP384> for AffinePoint
sourcefn from_encoded_point(encoded_point: &EncodedPoint) -> CtOption<Self>
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 secp384r1 curve.
sourceimpl GroupEncoding for AffinePoint
impl GroupEncoding for AffinePoint
sourcefn from_bytes(bytes: &Self::Repr) -> CtOption<Self>
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>, B1>, B0>, B0>, B0>, B1>>
type Repr = GenericArray<u8, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>, B1>>
The encoding of group elements. Read more
sourcefn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>
fn from_bytes_unchecked(bytes: &Self::Repr) -> CtOption<Self>
Attempts to deserialize a group element, not checking if the element is valid. Read more
sourceimpl Mul<&'_ Scalar> for AffinePoint
impl Mul<&'_ Scalar> for AffinePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the * operator.
sourcefn mul(self, scalar: &Scalar) -> ProjectivePoint
fn mul(self, scalar: &Scalar) -> ProjectivePoint
Performs the * operation. Read more
sourceimpl Mul<Scalar> for AffinePoint
impl Mul<Scalar> for AffinePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the * operator.
sourcefn mul(self, scalar: Scalar) -> ProjectivePoint
fn mul(self, scalar: Scalar) -> ProjectivePoint
Performs the * operation. Read more
sourceimpl Neg for AffinePoint
impl Neg for AffinePoint
sourceimpl PartialEq<AffinePoint> for AffinePoint
impl PartialEq<AffinePoint> for AffinePoint
sourceimpl PrimeCurveAffine for AffinePoint
impl PrimeCurveAffine for AffinePoint
type Curve = ProjectivePoint
type Scalar = Scalar
sourcefn identity() -> AffinePoint
fn identity() -> AffinePoint
Returns the additive identity.
sourcefn generator() -> AffinePoint
fn generator() -> AffinePoint
Returns a fixed generator of unknown exponent.
sourcefn is_identity(&self) -> Choice
fn is_identity(&self) -> Choice
Determines if this point represents the point at infinity; the additive identity. Read more
sourcefn to_curve(&self) -> ProjectivePoint
fn to_curve(&self) -> ProjectivePoint
Converts this element to its curve representation.
sourceimpl Sub<&'_ AffinePoint> for &ProjectivePoint
impl Sub<&'_ AffinePoint> for &ProjectivePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the - operator.
sourcefn sub(self, other: &AffinePoint) -> ProjectivePoint
fn sub(self, other: &AffinePoint) -> ProjectivePoint
Performs the - operation. Read more
sourceimpl Sub<&'_ AffinePoint> for ProjectivePoint
impl Sub<&'_ AffinePoint> for ProjectivePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the - operator.
sourcefn sub(self, other: &AffinePoint) -> ProjectivePoint
fn sub(self, other: &AffinePoint) -> ProjectivePoint
Performs the - operation. Read more
sourceimpl Sub<AffinePoint> for ProjectivePoint
impl Sub<AffinePoint> for ProjectivePoint
type Output = ProjectivePoint
type Output = ProjectivePoint
The resulting type after applying the - operator.
sourcefn sub(self, other: AffinePoint) -> ProjectivePoint
fn sub(self, other: AffinePoint) -> ProjectivePoint
Performs the - operation. Read more
sourceimpl SubAssign<&'_ AffinePoint> for ProjectivePoint
impl SubAssign<&'_ AffinePoint> for ProjectivePoint
sourcefn sub_assign(&mut self, rhs: &AffinePoint)
fn sub_assign(&mut self, rhs: &AffinePoint)
Performs the -= operation. Read more
sourceimpl SubAssign<AffinePoint> for ProjectivePoint
impl SubAssign<AffinePoint> for ProjectivePoint
sourcefn sub_assign(&mut self, rhs: AffinePoint)
fn sub_assign(&mut self, rhs: AffinePoint)
Performs the -= operation. Read more
sourceimpl ToEncodedPoint<NistP384> for AffinePoint
impl ToEncodedPoint<NistP384> for AffinePoint
sourcefn 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. Read more
sourceimpl TryFrom<&'_ AffinePoint> for PublicKey
impl TryFrom<&'_ AffinePoint> for PublicKey
sourceimpl TryFrom<&'_ EncodedPoint<<<NistP384 as Curve>::UInt as ArrayEncoding>::ByteSize>> for AffinePoint
impl TryFrom<&'_ EncodedPoint<<<NistP384 as Curve>::UInt as ArrayEncoding>::ByteSize>> for AffinePoint
sourcefn try_from(point: &EncodedPoint) -> Result<AffinePoint>
fn try_from(point: &EncodedPoint) -> Result<AffinePoint>
Performs the conversion.
sourceimpl TryFrom<AffinePoint> for PublicKey
impl TryFrom<AffinePoint> for PublicKey
sourceimpl TryFrom<EncodedPoint<<<NistP384 as Curve>::UInt as ArrayEncoding>::ByteSize>> for AffinePoint
impl TryFrom<EncodedPoint<<<NistP384 as Curve>::UInt as ArrayEncoding>::ByteSize>> for AffinePoint
sourcefn try_from(point: EncodedPoint) -> Result<AffinePoint>
fn try_from(point: EncodedPoint) -> Result<AffinePoint>
Performs the conversion.
sourceimpl VerifyPrimitive<NistP384> for AffinePoint
Available on crate feature ecdsa-core only.
impl VerifyPrimitive<NistP384> for AffinePoint
ecdsa-core only.sourcefn verify_prehashed(
&self,
z: GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>,
sig: &Signature<C>
) -> Result<(), Error>
fn verify_prehashed(
&self,
z: GenericArray<u8, <<C as Curve>::UInt as ArrayEncoding>::ByteSize>,
sig: &Signature<C>
) -> Result<(), Error>
Verify the prehashed message against the provided signature Read more
sourcefn verify_digest<D>(
&self,
msg_digest: D,
sig: &Signature<C>
) -> Result<(), Error> where
D: FixedOutput<OutputSize = <<C as Curve>::UInt as ArrayEncoding>::ByteSize>,
fn verify_digest<D>(
&self,
msg_digest: D,
sig: &Signature<C>
) -> Result<(), Error> where
D: FixedOutput<OutputSize = <<C as Curve>::UInt as ArrayEncoding>::ByteSize>,
Verify message digest against the provided signature.
impl Copy for AffinePoint
impl DefaultIsZeroes for AffinePoint
impl Eq for AffinePoint
Auto Trait Implementations
impl RefUnwindSafe for AffinePoint
impl Send for AffinePoint
impl Sync for AffinePoint
impl Unpin for AffinePoint
impl UnwindSafe for AffinePoint
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more