[][src]Enum elliptic_curve::weierstrass::public_key::PublicKey

pub enum PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
{ Compressed(CompressedPoint<C>), Uncompressed(UncompressedPoint<C>), }
This is supported on feature="weierstrass" only.

Public keys for Weierstrass curves

Variants

Compressed(CompressedPoint<C>)
This is supported on feature="weierstrass" only.

Compressed Weierstrass elliptic curve point

Uncompressed(UncompressedPoint<C>)
This is supported on feature="weierstrass" only.

Uncompressed Weierstrass elliptic curve point

Implementations

impl<C> PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

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

This is supported on feature="weierstrass" only.

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, UntaggedPointSize<C>>
) -> Self where
    <C::ElementSize as Add>::Output: ArrayLength<u8>, 
[src]

This is supported on feature="weierstrass" only.

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]

This is supported on feature="weierstrass" only.

Compress this PublicKey.

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

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

This is supported on feature="weierstrass" only.

Obtain public key as a byte array reference

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

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

This is supported on feature="weierstrass" only.

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::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C: Clone> Clone for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C> Copy for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>,
    <CompressedPointSize<C> as ArrayLength<u8>>::ArrayType: Copy,
    <UncompressedPointSize<C> as ArrayLength<u8>>::ArrayType: Copy
[src]

impl<C> Debug for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C: Eq> Eq for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C, '_> From<&'_ EphemeralSecret<C>> for PublicKey<C> where
    C: Curve + Arithmetic,
    C::Scalar: Clone + Generate + Zeroize,
    C::AffinePoint: FromPublicKey<C> + Mul<NonZeroScalar<C>, Output = C::AffinePoint> + Zeroize,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPoint<C>: From<C::AffinePoint>,
    UncompressedPoint<C>: From<C::AffinePoint>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C> From<CompressedPoint<C>> for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C> From<UncompressedPoint<C>> for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C: Ord> Ord for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C: PartialEq> PartialEq<PublicKey<C>> for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C: PartialOrd> PartialOrd<PublicKey<C>> for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C> StructuralEq for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C> StructuralPartialEq for PublicKey<C> where
    C: Curve,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

impl<C, '_> TryFrom<&'_ SecretKey<C>> for PublicKey<C> where
    C: Curve + Arithmetic,
    C::AffinePoint: Mul<NonZeroScalar<C>, Output = C::AffinePoint>,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    CompressedPoint<C>: From<C::AffinePoint>,
    UncompressedPoint<C>: From<C::AffinePoint>,
    CompressedPointSize<C>: ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[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.