Type Alias ecdsa::EncodedPoint
source · pub type EncodedPoint<C> = EncodedPoint<<C as Curve>::FieldBytesSize>;
Expand description
Encoded elliptic curve point sized appropriately for a given curve.
Aliased Type§
struct EncodedPoint<C> { /* private fields */ }
Implementations
source§impl<Size> EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> EncodedPoint<Size>where
Size: ModulusSize,
sourcepub fn from_bytes(input: impl AsRef<[u8]>) -> Result<EncodedPoint<Size>, Error>
pub fn from_bytes(input: impl AsRef<[u8]>) -> Result<EncodedPoint<Size>, Error>
Decode elliptic curve point (compressed or uncompressed) from the
Elliptic-Curve-Point-to-Octet-String
encoding described in
SEC 1: Elliptic Curve Cryptography (Version 2.0) section
2.3.3 (page 10).
sourcepub fn from_untagged_bytes(
bytes: &GenericArray<u8, <Size as ModulusSize>::UntaggedPointSize>,
) -> EncodedPoint<Size>
pub fn from_untagged_bytes( bytes: &GenericArray<u8, <Size as ModulusSize>::UntaggedPointSize>, ) -> EncodedPoint<Size>
Decode elliptic curve point from raw uncompressed coordinates, i.e.
encoded as the concatenated x || y
coordinates with no leading SEC1
tag byte (which would otherwise be 0x04
for an uncompressed point).
sourcepub fn from_affine_coordinates(
x: &GenericArray<u8, Size>,
y: &GenericArray<u8, Size>,
compress: bool,
) -> EncodedPoint<Size>
pub fn from_affine_coordinates( x: &GenericArray<u8, Size>, y: &GenericArray<u8, Size>, compress: bool, ) -> EncodedPoint<Size>
Encode an elliptic curve point from big endian serialized coordinates (with optional point compression)
sourcepub fn identity() -> EncodedPoint<Size>
pub fn identity() -> EncodedPoint<Size>
Return EncodedPoint
representing the additive identity
(a.k.a. point at infinity)
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Get byte slice containing the serialized EncodedPoint
.
sourcepub fn to_bytes(&self) -> Box<[u8]>
pub fn to_bytes(&self) -> Box<[u8]>
Get boxed byte slice containing the serialized EncodedPoint
sourcepub fn is_compact(&self) -> bool
pub fn is_compact(&self) -> bool
Is this EncodedPoint
compact?
sourcepub fn is_compressed(&self) -> bool
pub fn is_compressed(&self) -> bool
Is this EncodedPoint
compressed?
sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Is this EncodedPoint
the additive identity? (a.k.a. point at infinity)
sourcepub fn compress(&self) -> EncodedPoint<Size>
pub fn compress(&self) -> EncodedPoint<Size>
Compress this EncodedPoint
, returning a new EncodedPoint
.
sourcepub fn tag(&self) -> Tag
pub fn tag(&self) -> Tag
Get the SEC1 tag for this EncodedPoint
sourcepub fn coordinates(&self) -> Coordinates<'_, Size>
pub fn coordinates(&self) -> Coordinates<'_, Size>
Get the Coordinates
for this EncodedPoint
.
sourcepub fn x(&self) -> Option<&GenericArray<u8, Size>>
pub fn x(&self) -> Option<&GenericArray<u8, Size>>
Get the x-coordinate for this EncodedPoint
.
Returns None
if this point is the identity point.
sourcepub fn y(&self) -> Option<&GenericArray<u8, Size>>
pub fn y(&self) -> Option<&GenericArray<u8, Size>>
Get the y-coordinate for this EncodedPoint
.
Returns None
if this point is compressed or the identity point.
Trait Implementations§
source§impl<C> From<&VerifyingKey<C>> for EncodedPoint<C>where
C: PrimeCurve + CurveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
impl<C> From<&VerifyingKey<C>> for EncodedPoint<C>where
C: PrimeCurve + CurveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
source§fn from(verifying_key: &VerifyingKey<C>) -> EncodedPoint<C>
fn from(verifying_key: &VerifyingKey<C>) -> EncodedPoint<C>
source§impl<C> From<VerifyingKey<C>> for EncodedPoint<C>where
C: PrimeCurve + CurveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
impl<C> From<VerifyingKey<C>> for EncodedPoint<C>where
C: PrimeCurve + CurveArithmetic + PointCompression,
AffinePoint<C>: FromEncodedPoint<C> + ToEncodedPoint<C>,
FieldBytesSize<C>: ModulusSize,
source§fn from(verifying_key: VerifyingKey<C>) -> EncodedPoint<C>
fn from(verifying_key: VerifyingKey<C>) -> EncodedPoint<C>
source§impl<Size> AsRef<[u8]> for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> AsRef<[u8]> for EncodedPoint<Size>where
Size: ModulusSize,
source§impl<Size> Clone for EncodedPoint<Size>
impl<Size> Clone for EncodedPoint<Size>
source§fn clone(&self) -> EncodedPoint<Size>
fn clone(&self) -> EncodedPoint<Size>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Size> ConditionallySelectable for EncodedPoint<Size>where
Size: ModulusSize,
<<Size as ModulusSize>::UncompressedPointSize as ArrayLength<u8>>::ArrayType: Copy,
impl<Size> ConditionallySelectable for EncodedPoint<Size>where
Size: ModulusSize,
<<Size as ModulusSize>::UncompressedPointSize as ArrayLength<u8>>::ArrayType: Copy,
source§fn conditional_select(
a: &EncodedPoint<Size>,
b: &EncodedPoint<Size>,
choice: Choice,
) -> EncodedPoint<Size>
fn conditional_select( a: &EncodedPoint<Size>, b: &EncodedPoint<Size>, choice: Choice, ) -> EncodedPoint<Size>
source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
source§impl<Size> Debug for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> Debug for EncodedPoint<Size>where
Size: ModulusSize,
source§impl<Size> Default for EncodedPoint<Size>
impl<Size> Default for EncodedPoint<Size>
source§fn default() -> EncodedPoint<Size>
fn default() -> EncodedPoint<Size>
source§impl<'de, Size> Deserialize<'de> for EncodedPoint<Size>where
Size: ModulusSize,
impl<'de, Size> Deserialize<'de> for EncodedPoint<Size>where
Size: ModulusSize,
source§fn deserialize<D>(
deserializer: D,
) -> Result<EncodedPoint<Size>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<EncodedPoint<Size>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl<Size> Display for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> Display for EncodedPoint<Size>where
Size: ModulusSize,
source§impl<C> From<&PublicKey<C>> for EncodedPoint<<C as Curve>::FieldBytesSize>where
C: CurveArithmetic + PointCompression,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> From<&PublicKey<C>> for EncodedPoint<<C as Curve>::FieldBytesSize>where
C: CurveArithmetic + PointCompression,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
source§fn from(public_key: &PublicKey<C>) -> EncodedPoint<<C as Curve>::FieldBytesSize>
fn from(public_key: &PublicKey<C>) -> EncodedPoint<<C as Curve>::FieldBytesSize>
source§impl<C> From<PublicKey<C>> for EncodedPoint<<C as Curve>::FieldBytesSize>where
C: CurveArithmetic + PointCompression,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
impl<C> From<PublicKey<C>> for EncodedPoint<<C as Curve>::FieldBytesSize>where
C: CurveArithmetic + PointCompression,
<C as CurveArithmetic>::AffinePoint: FromEncodedPoint<C> + ToEncodedPoint<C>,
<C as Curve>::FieldBytesSize: ModulusSize,
source§fn from(public_key: PublicKey<C>) -> EncodedPoint<<C as Curve>::FieldBytesSize>
fn from(public_key: PublicKey<C>) -> EncodedPoint<<C as Curve>::FieldBytesSize>
source§impl<Size> FromStr for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> FromStr for EncodedPoint<Size>where
Size: ModulusSize,
Decode a SEC1-encoded point from hexadecimal.
Upper and lower case hexadecimal are both accepted, however mixed case is rejected.
source§impl<Size> Hash for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> Hash for EncodedPoint<Size>where
Size: ModulusSize,
source§impl<Size> LowerHex for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> LowerHex for EncodedPoint<Size>where
Size: ModulusSize,
source§impl<Size> Ord for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> Ord for EncodedPoint<Size>where
Size: ModulusSize,
source§fn cmp(&self, other: &EncodedPoint<Size>) -> Ordering
fn cmp(&self, other: &EncodedPoint<Size>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<Size> PartialEq for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> PartialEq for EncodedPoint<Size>where
Size: ModulusSize,
source§fn eq(&self, other: &EncodedPoint<Size>) -> bool
fn eq(&self, other: &EncodedPoint<Size>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<Size> PartialOrd for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> PartialOrd for EncodedPoint<Size>where
Size: ModulusSize,
source§fn partial_cmp(&self, other: &EncodedPoint<Size>) -> Option<Ordering>
fn partial_cmp(&self, other: &EncodedPoint<Size>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more