Struct elliptic_curve::ecdh::EphemeralSecret [−][src]
pub struct EphemeralSecret<C> where
C: Curve + ProjectiveArithmetic,
Scalar<C>: Zeroize, { /* fields omitted */ }
ecdh
only.Expand description
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:
- Have each participant generate an
EphemeralSecret
value - Compute the
PublicKey
for that value - Have each peer provide their
PublicKey
to their counterpart - Use
EphemeralSecret
and the other participant’sPublicKey
to compute aSharedSecret
value.
⚠️ 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>: Zeroize,
Scalar<C>: Zeroize,
SharedSecret<C>: for<'a> From<&'a AffinePoint<C>>,
impl<C> EphemeralSecret<C> where
C: Curve + ProjectiveArithmetic,
AffinePoint<C>: Zeroize,
Scalar<C>: Zeroize,
SharedSecret<C>: for<'a> From<&'a AffinePoint<C>>,
Generate a cryptographically random EphemeralSecret
.
Get the public key associated with this ephemeral secret.
The compress
flag enables point compression.
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> From<&'_ EphemeralSecret<C>> for PublicKey<C> where
C: Curve + ProjectiveArithmetic,
AffinePoint<C>: Zeroize,
Scalar<C>: Zeroize,
SharedSecret<C>: for<'a> From<&'a AffinePoint<C>>,
impl<C> From<&'_ EphemeralSecret<C>> for PublicKey<C> where
C: Curve + ProjectiveArithmetic,
AffinePoint<C>: Zeroize,
Scalar<C>: Zeroize,
SharedSecret<C>: for<'a> From<&'a AffinePoint<C>>,
Performs the conversion.
impl<C> Zeroize for EphemeralSecret<C> where
C: Curve + ProjectiveArithmetic,
Scalar<C>: Zeroize,
impl<C> Zeroize for EphemeralSecret<C> where
C: Curve + ProjectiveArithmetic,
Scalar<C>: Zeroize,
Auto Trait Implementations
impl<C> RefUnwindSafe for EphemeralSecret<C> where
<C as ScalarArithmetic>::Scalar: RefUnwindSafe,
impl<C> Send for EphemeralSecret<C>
impl<C> Sync for EphemeralSecret<C>
impl<C> Unpin for EphemeralSecret<C> where
<C as ScalarArithmetic>::Scalar: Unpin,
impl<C> UnwindSafe for EphemeralSecret<C> where
<C as ScalarArithmetic>::Scalar: UnwindSafe,