Struct elliptic_curve::ecdh::EphemeralSecret[][src]

pub struct EphemeralSecret<C> where
    C: Curve + ProjectiveArithmetic,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Zeroize
{ /* fields omitted */ }
This is supported on crate feature ecdh only.

Ephemeral Diffie-Hellman Secret.

These are ephemeral "secret key" values which are deliberately designed to avoid being persisted.

To perform an ephemeral Diffie-Hellman exchange, do the following:

⚠️ SECURITY WARNING ⚠️

Ephemeral Diffie-Hellman exchanges are unauthenticated and without a further authentication step are trivially vulnerable to man-in-the-middle attacks!

These exchanges should be performed in the context of a protocol which takes further steps to authenticate the peers in a key exchange.

Implementations

impl<C> EphemeralSecret<C> where
    C: Curve + ProjectiveArithmetic,
    AffinePoint<C>: Copy + Clone + Debug + Zeroize,
    ProjectivePoint<C>: From<AffinePoint<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Clone + Zeroize,
    SharedSecret<C>: for<'a> From<&'a AffinePoint<C>>, 
[src]

pub fn random(rng: impl CryptoRng + RngCore) -> Self[src]

Generate a cryptographically random EphemeralSecret.

pub fn public_key(&self) -> PublicKey<C>[src]

Get the public key associated with this ephemeral secret.

The compress flag enables point compression.

pub fn diffie_hellman(&self, public_key: &PublicKey<C>) -> SharedSecret<C>[src]

Compute a Diffie-Hellman shared secret from an ephemeral secret and the public key of the other participant in the exchange.

Trait Implementations

impl<C> Drop for EphemeralSecret<C> where
    C: Curve + ProjectiveArithmetic,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Zeroize
[src]

impl<C> From<&'_ EphemeralSecret<C>> for PublicKey<C> where
    C: Curve + ProjectiveArithmetic,
    AffinePoint<C>: Copy + Clone + Debug + Zeroize,
    ProjectivePoint<C>: From<AffinePoint<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Clone + Zeroize,
    SharedSecret<C>: for<'a> From<&'a AffinePoint<C>>, 
[src]

impl<C> Zeroize for EphemeralSecret<C> where
    C: Curve + ProjectiveArithmetic,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Zeroize
[src]

Auto Trait Implementations

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> 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 where
    T: ?Sized

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> 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> 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.