pub struct EncodedPoint<Size>where
Size: ModulusSize,{ /* private fields */ }
Expand description
SEC1 encoded curve point.
This type is an enum over the compressed and uncompressed encodings, useful for cases where either encoding can be supported, or conversions between the two forms.
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<Self>
pub fn from_bytes(input: impl AsRef<[u8]>) -> Result<Self>
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::UntaggedPointSize>,
) -> Self
pub fn from_untagged_bytes( bytes: &GenericArray<u8, Size::UntaggedPointSize>, ) -> Self
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,
) -> Self
pub fn from_affine_coordinates( x: &GenericArray<u8, Size>, y: &GenericArray<u8, Size>, compress: bool, ) -> Self
Encode an elliptic curve point from big endian serialized coordinates (with optional point compression)
Sourcepub fn identity() -> Self
pub fn identity() -> Self
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) -> Self
pub fn compress(&self) -> Self
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<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>
impl<Size> ConditionallySelectable for EncodedPoint<Size>
Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self
and other
if choice == 1
; otherwise,
reassign both unto themselves. Read moreSource§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<Size> Display for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> Display for EncodedPoint<Size>where
Size: ModulusSize,
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§impl<Size> PartialEq for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> PartialEq for EncodedPoint<Size>where
Size: ModulusSize,
Source§impl<Size> PartialOrd for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> PartialOrd for EncodedPoint<Size>where
Size: ModulusSize,
Source§impl<Size> TryFrom<&[u8]> for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> TryFrom<&[u8]> for EncodedPoint<Size>where
Size: ModulusSize,
Source§impl<Size> UpperHex for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> UpperHex for EncodedPoint<Size>where
Size: ModulusSize,
Source§impl<Size> Zeroize for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> Zeroize for EncodedPoint<Size>where
Size: ModulusSize,
impl<Size> Copy for EncodedPoint<Size>
impl<Size: ModulusSize> Eq for EncodedPoint<Size>
Auto Trait Implementations§
impl<Size> Freeze for EncodedPoint<Size>
impl<Size> RefUnwindSafe for EncodedPoint<Size>
impl<Size> Send for EncodedPoint<Size>
impl<Size> Sync for EncodedPoint<Size>
impl<Size> Unpin for EncodedPoint<Size>
impl<Size> UnwindSafe for EncodedPoint<Size>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)