Type Alias EncodedPoint

Source
pub type EncodedPoint<C> = EncodedPoint<FieldSize<C>>;
Expand description

Encoded elliptic curve point sized appropriately for a given curve.

Aliased Type§

struct EncodedPoint<C> { /* private fields */ }

Implementations

§

impl<Size> EncodedPoint<Size>
where Size: ModulusSize,

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).

http://www.secg.org/sec1-v2.pdf

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).

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)

pub fn identity() -> EncodedPoint<Size>

Return [EncodedPoint] representing the additive identity (a.k.a. point at infinity)

pub fn len(&self) -> usize

Get the length of the encoded point in bytes

pub fn as_bytes(&self) -> &[u8]

Get byte slice containing the serialized [EncodedPoint].

pub fn to_bytes(&self) -> Box<[u8]>

Get boxed byte slice containing the serialized [EncodedPoint]

pub fn is_compact(&self) -> bool

Is this [EncodedPoint] compact?

pub fn is_compressed(&self) -> bool

Is this [EncodedPoint] compressed?

pub fn is_identity(&self) -> bool

Is this [EncodedPoint] the additive identity? (a.k.a. point at infinity)

pub fn compress(&self) -> EncodedPoint<Size>

Compress this [EncodedPoint], returning a new [EncodedPoint].

pub fn tag(&self) -> Tag

Get the SEC1 tag for this [EncodedPoint]

pub fn coordinates(&self) -> Coordinates<'_, Size>

Get the Coordinates for this [EncodedPoint].

pub fn x(&self) -> Option<&GenericArray<u8, Size>>

Get the x-coordinate for this [EncodedPoint].

Returns None if this point is the identity point.

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<&PublicKey<C>> for EncodedPoint<C>

Source§

fn from(public_key: &PublicKey<C>) -> EncodedPoint<C>

Converts to this type from the input type.
Source§

impl<C> From<PublicKey<C>> for EncodedPoint<C>

Source§

fn from(public_key: PublicKey<C>) -> EncodedPoint<C>

Converts to this type from the input type.
§

impl<Size> AsRef<[u8]> for EncodedPoint<Size>
where Size: ModulusSize,

§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<Size> Clone for EncodedPoint<Size>

§

fn clone(&self) -> EncodedPoint<Size>

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
§

impl<Size> ConditionallySelectable for EncodedPoint<Size>
where Size: ModulusSize, <<Size as ModulusSize>::UncompressedPointSize as ArrayLength<u8>>::ArrayType: Copy,

§

fn conditional_select( a: &EncodedPoint<Size>, b: &EncodedPoint<Size>, choice: Choice, ) -> EncodedPoint<Size>

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
§

impl<Size> Debug for EncodedPoint<Size>
where Size: ModulusSize,

§

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

Formats the value using the given formatter. Read more
§

impl<Size> Default for EncodedPoint<Size>

§

fn default() -> EncodedPoint<Size>

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

impl<'de, Size> Deserialize<'de> for EncodedPoint<Size>
where Size: ModulusSize,

§

fn deserialize<D>( deserializer: D, ) -> Result<EncodedPoint<Size>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<Size> Display for EncodedPoint<Size>
where Size: ModulusSize,

§

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

Formats the value using the given formatter. Read more
§

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.

§

type Err = Error

The associated error which can be returned from parsing.
§

fn from_str(hex: &str) -> Result<EncodedPoint<Size>, Error>

Parses a string s to return a value of this type. Read more
§

impl<Size> LowerHex for EncodedPoint<Size>
where Size: ModulusSize,

§

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

Formats the value using the given formatter. Read more
§

impl<Size> Ord for EncodedPoint<Size>
where Size: ModulusSize,

§

fn cmp(&self, other: &EncodedPoint<Size>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<Size> PartialEq for EncodedPoint<Size>
where Size: ModulusSize,

§

fn eq(&self, other: &EncodedPoint<Size>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

impl<Size> PartialOrd for EncodedPoint<Size>
where Size: ModulusSize,

§

fn partial_cmp(&self, other: &EncodedPoint<Size>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<Size> Serialize for EncodedPoint<Size>
where Size: ModulusSize,

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<Size> TryFrom<&[u8]> for EncodedPoint<Size>
where Size: ModulusSize,

§

type Error = Error

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

fn try_from(bytes: &[u8]) -> Result<EncodedPoint<Size>, Error>

Performs the conversion.
§

impl<Size> UpperHex for EncodedPoint<Size>
where Size: ModulusSize,

§

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

Formats the value using the given formatter. Read more
§

impl<Size> Zeroize for EncodedPoint<Size>
where Size: ModulusSize,

§

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.
§

impl<Size> Copy for EncodedPoint<Size>
where Size: ModulusSize, <<Size as ModulusSize>::UncompressedPointSize as ArrayLength<u8>>::ArrayType: Copy,

§

impl<Size> Eq for EncodedPoint<Size>
where Size: ModulusSize,