[][src]Enum ecdsa::PublicKey

pub enum PublicKey<C> where
    C: Curve,
    <C as Curve>::ElementSize: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
{ Compressed(CompressedPoint<C>), Uncompressed(UncompressedPoint<C>), }

Public keys for Weierstrass curves

Variants

Compressed(CompressedPoint<C>)

Compressed Weierstrass elliptic curve point

Uncompressed(UncompressedPoint<C>)

Uncompressed Weierstrass elliptic curve point

Implementations

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

pub fn from_bytes(bytes: impl AsRef<[u8]>) -> Option<PublicKey<C>>[src]

Decode public key from an elliptic curve point (compressed or uncompressed) encoded using the Elliptic-Curve-Point-to-Octet-String algorithm 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_point(
    bytes: &GenericArray<u8, <<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output>
) -> PublicKey<C> where
    <<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output: ArrayLength<u8>, 
[src]

Decode public key from a raw uncompressed point serialized as a bytestring, without a 0x04-byte tag.

This will be twice the modulus size, or 1-byte smaller than the Elliptic-Curve-Point-to-Octet-String encoding i.e with the leading 0x04 byte in that encoding removed.

pub fn compress(&mut self)[src]

Compress this PublicKey.

If the key is already compressed, this is a no-op.

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

Obtain public key as a byte array reference

impl<C> PublicKey<C> where
    C: Curve + Arithmetic,
    <C as Arithmetic>::AffinePoint: Mul<NonZeroScalar<C>>,
    <C as Curve>::ElementSize: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output: Add<UInt<UTerm, B1>>,
    CompressedPoint<C>: From<<C as Arithmetic>::AffinePoint>,
    UncompressedPoint<C>: From<<C as Arithmetic>::AffinePoint>,
    <<C as Curve>::ElementSize as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<C as Arithmetic>::AffinePoint as Mul<NonZeroScalar<C>>>::Output == <C as Arithmetic>::AffinePoint
[src]

pub fn from_secret_key(
    secret_key: &SecretKey<C>,
    compress: bool
) -> Result<PublicKey<C>, Error>
[src]

Compute the PublicKey for the provided SecretKey.

The compress flag requests point compression.

Trait Implementations

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

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

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

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

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

impl<C> From<CompressedPoint<C>> for PublicKey<C> where
    C: Curve,
    <C as Curve>::ElementSize: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

impl<C> From<UncompressedPoint<C>> for PublicKey<C> where
    C: Curve,
    <C as Curve>::ElementSize: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>, 
[src]

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

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

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

impl<'_, C> TryFrom<&'_ SecretKey<C>> for PublicKey<C> where
    C: Curve + Arithmetic,
    <C as Arithmetic>::AffinePoint: Mul<NonZeroScalar<C>>,
    <C as Curve>::ElementSize: Add<UInt<UTerm, B1>>,
    <<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output: Add<UInt<UTerm, B1>>,
    CompressedPoint<C>: From<<C as Arithmetic>::AffinePoint>,
    UncompressedPoint<C>: From<<C as Arithmetic>::AffinePoint>,
    <<C as Curve>::ElementSize as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<<C as Curve>::ElementSize as Add<<C as Curve>::ElementSize>>::Output as Add<UInt<UTerm, B1>>>::Output: ArrayLength<u8>,
    <<C as Arithmetic>::AffinePoint as Mul<NonZeroScalar<C>>>::Output == <C as Arithmetic>::AffinePoint
[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

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

impl<C> Send for PublicKey<C> where
    <C as Curve>::ElementSize: Add<<C as Curve>::ElementSize>, 

impl<C> Sync for PublicKey<C> where
    <C as Curve>::ElementSize: Add<<C as Curve>::ElementSize>, 

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

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

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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.