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

pub struct EphemeralSecret<C> where
    C: Curve + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    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.

Implementations

impl<C> EphemeralSecret<C> where
    C: Curve + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Clone + Zeroize,
    AffinePoint<C>: FromEncodedPoint<C> + Mul<NonZeroScalar<C>, Output = AffinePoint<C>> + Zeroize,
    PublicKey<C>: From<AffinePoint<C>>,
    UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

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

This is supported on crate feature ecdh only.

Generate a cryptographically random EphemeralSecret.

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

This is supported on crate feature ecdh only.

Get the public key associated with this ephemeral secret.

The compress flag enables point compression.

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

This is supported on crate feature ecdh only.

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,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Zeroize
[src]

impl<C, '_> From<&'_ EphemeralSecret<C>> for PublicKey<C> where
    C: Curve + ProjectiveArithmetic,
    FieldBytes<C>: From<Scalar<C>> + for<'r> From<&'r Scalar<C>>,
    Scalar<C>: PrimeField<Repr = FieldBytes<C>> + Clone + Zeroize,
    AffinePoint<C>: FromEncodedPoint<C> + Mul<NonZeroScalar<C>, Output = AffinePoint<C>> + Zeroize,
    PublicKey<C>: From<AffinePoint<C>>,
    UntaggedPointSize<C>: Add<U1> + ArrayLength<u8>,
    UncompressedPointSize<C>: ArrayLength<u8>, 
[src]

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

Auto Trait Implementations

impl<C> RefUnwindSafe for EphemeralSecret<C> where
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: RefUnwindSafe

impl<C> Send for EphemeralSecret<C>

impl<C> Sync for EphemeralSecret<C>

impl<C> Unpin for EphemeralSecret<C> where
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: Unpin

impl<C> UnwindSafe for EphemeralSecret<C> where
    <<C as ProjectiveArithmetic>::ProjectivePoint as Group>::Scalar: 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]