[][src]Struct ecdsa::EncodedPoint

pub struct EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
{ /* fields omitted */ }

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

impl<C> EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

pub fn from_bytes(input: impl AsRef<[u8]>) -> Result<EncodedPoint<C>, Error>[src]

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, <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output>
) -> EncodedPoint<C>
[src]

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, <C as Curve>::FieldSize>,
    y: &GenericArray<u8, <C as Curve>::FieldSize>,
    compress: bool
) -> EncodedPoint<C>
[src]

Encode an elliptic curve point from big endian serialized coordinates (with optional point compression)

pub fn from_secret_key(
    secret_key: &SecretKey<C>,
    compress: bool
) -> EncodedPoint<C> where
    C: Curve + ProjectiveArithmetic,
    GenericArray<u8, <C as Curve>::FieldSize>: From<<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    GenericArray<u8, <C as Curve>::FieldSize>: for<'r> From<&'r <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: ToEncodedPoint<C>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: PrimeField,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: Zeroize,
    <<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar as PrimeField>::Repr == GenericArray<u8, <C as Curve>::FieldSize>, 
[src]

Compute EncodedPoint representing the public key for the provided SecretKey.

The compress flag requests point compression.

pub fn len(&self) -> usize[src]

Get the length of the encoded point in bytes

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

Get byte slice containing the serialized EncodedPoint.

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

Get boxed byte slice containing the serialized EncodedPoint

pub fn to_untagged_bytes(
    &self
) -> Option<GenericArray<u8, <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output>> where
    C: Curve + ProjectiveArithmetic,
    GenericArray<u8, <C as Curve>::FieldSize>: From<<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    GenericArray<u8, <C as Curve>::FieldSize>: for<'r> From<&'r <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: PrimeField,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: ConditionallySelectable,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: Default,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: Decompress<C>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: ToEncodedPoint<C>,
    <<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar as PrimeField>::Repr == GenericArray<u8, <C as Curve>::FieldSize>, 
[src]

Serialize point as raw uncompressed coordinates without tag byte, i.e. encoded as the concatenated x || y coordinates.

pub fn is_compressed(&self) -> bool[src]

Is this EncodedPoint compressed?

pub fn compress(&self) -> EncodedPoint<C>[src]

Compress this EncodedPoint, returning a new EncodedPoint.

pub fn decompress(&self) -> CtOption<EncodedPoint<C>> where
    C: Curve + ProjectiveArithmetic,
    GenericArray<u8, <C as Curve>::FieldSize>: From<<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    GenericArray<u8, <C as Curve>::FieldSize>: for<'r> From<&'r <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: PrimeField,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: ConditionallySelectable,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: Default,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: Decompress<C>,
    <<C as ProjectiveArithmetic>::ProjectivePoint as Curve>::AffineRepr: ToEncodedPoint<C>,
    <<<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar as PrimeField>::Repr == GenericArray<u8, <C as Curve>::FieldSize>, 
[src]

Decompress this EncodedPoint, returning a new EncodedPoint.

pub fn encode<T>(encodable: T, compress: bool) -> EncodedPoint<C> where
    T: ToEncodedPoint<C>, 
[src]

Encode an EncodedPoint from the desired type

pub fn decode<T>(&self) -> CtOption<T> where
    T: FromEncodedPoint<C>, 
[src]

Decode this EncodedPoint into the desired type

pub fn tag(&self) -> Tag[src]

Get the SEC1 tag for this EncodedPoint

pub fn coordinates(&self) -> Coordinates<'_, C>[src]

Get the Coordinates for this EncodedPoint.

pub fn x(&self) -> &GenericArray<u8, <C as Curve>::FieldSize>[src]

Get the x-coordinate for this EncodedPoint

pub fn y(&self) -> Option<&GenericArray<u8, <C as Curve>::FieldSize>>[src]

Get the y-coordinate for this EncodedPoint.

Returns None if this point is compressed.

Trait Implementations

impl<C> AsRef<[u8]> for EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> Clone for EncodedPoint<C> where
    C: Clone + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> Copy for EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output as ArrayLength<u8>>::ArrayType: Copy
[src]

impl<C> Debug for EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> Eq for EncodedPoint<C> where
    C: Eq + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C, '_> From<&'_ VerifyKey<C>> for EncodedPoint<C> where
    C: Curve + ProjectiveArithmetic + Compression,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + FromDigest<C>,
    AffinePoint<C>: Clone + Debug + VerifyPrimitive<C> + FromEncodedPoint<C> + ToEncodedPoint<C>,
    UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>,
    SignatureSize<C>: ArrayLength<u8>, 
[src]

impl<C> Ord for EncodedPoint<C> where
    C: Ord + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> PartialEq<EncodedPoint<C>> for EncodedPoint<C> where
    C: PartialEq<C> + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> PartialOrd<EncodedPoint<C>> for EncodedPoint<C> where
    C: PartialOrd<C> + Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> StructuralEq for EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> StructuralPartialEq for EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> Zeroize for EncodedPoint<C> where
    C: Curve,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output: ArrayLength<u8>,
    <<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for EncodedPoint<C> where
    <<<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output as ArrayLength<u8>>::ArrayType: RefUnwindSafe

impl<C> Send for EncodedPoint<C>

impl<C> Sync for EncodedPoint<C>

impl<C> Unpin for EncodedPoint<C> where
    <<<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output as ArrayLength<u8>>::ArrayType: Unpin

impl<C> UnwindSafe for EncodedPoint<C> where
    <<<<C as Curve>::FieldSize as Add<<C as Curve>::FieldSize>>::Output as Add<UInt<UTerm, B1>>>::Output as ArrayLength<u8>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<A, T> AsBits<T> for A where
    A: AsRef<[T]>,
    T: BitStore + BitMemory, 

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<Z> Zeroize for Z where
    Z: DefaultIsZeroes
[src]