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

pub struct SharedSecret<C> where
    C: Curve + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>>, 
{ /* fields omitted */ }
This is supported on crate 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 + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>>,
    AffinePoint<C>: Zeroize,
    UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

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

This is supported on crate 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 + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>>, 
[src]

impl<C> Zeroize for SharedSecret<C> where
    C: Curve + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>>, 
[src]

Auto Trait Implementations

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

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

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

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

impl<C> UnwindSafe for SharedSecret<C> where
    <<C as Curve>::FieldSize 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> 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> 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]