[][src]Struct elliptic_curve::ecdh::SharedSecret

pub struct SharedSecret<C: Curve + Arithmetic> { /* fields omitted */ }
This is supported on feature="ecdh" only.

Shared secret value computed via ECDH key agreement.

This value contains the raw serialized x-coordinate of the elliptic curve point computed from a Diffie-Hellman exchange.

⚠️ WARNING: NOT UNIFORMLY RANDOM! ⚠️

This value is not uniformly random and should not be used directly as a cryptographic key for anything which requires that property (e.g. symmetric ciphers).

Instead, the resulting value should be used as input to a Key Derivation Function (KDF) or cryptographic hash function to produce a symmetric key.

Implementations

impl<C> SharedSecret<C> where
    C: Curve + Arithmetic,
    C::AffinePoint: Zeroize,
    C::ElementSize: Add<U1>,
    <C::ElementSize as Add>::Output: Add<U1>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

pub fn as_bytes(&self) -> &ElementBytes<C>[src]

This is supported on feature="ecdh" only.

Shared secret value, serialized as bytes.

As noted in the comments for this struct, this value is non-uniform and should not be used directly as a symmetric encryption key, but instead as input to a KDF (or failing that, a hash function) used to produce a symmetric key.

Trait Implementations

impl<C> Drop for SharedSecret<C> where
    C: Curve + Arithmetic
[src]

impl<C> Zeroize for SharedSecret<C> where
    C: Curve + Arithmetic
[src]

Auto Trait Implementations

impl<C> RefUnwindSafe for SharedSecret<C> where
    <<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe

impl<C> Send for SharedSecret<C> where
    <C as Curve>::ElementSize: ArrayLength<u8>, 

impl<C> Sync for SharedSecret<C> where
    <C as Curve>::ElementSize: ArrayLength<u8>, 

impl<C> Unpin for SharedSecret<C> where
    <<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: Unpin

impl<C> UnwindSafe for SharedSecret<C> where
    <<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: UnwindSafe

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, 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]