logo
pub struct ReusableSecret(_);
Expand description

A Diffie-Hellman secret key which may be used more than once, but is purposefully not serialiseable in order to discourage key-reuse. This is implemented to facilitate protocols such as Noise (e.g. Noise IK key usage, etc.) and X3DH which require an “ephemeral” key to conduct the Diffie-Hellman operation multiple times throughout the protocol, while the protocol run at a higher level is only conducted once per key.

Similarly to EphemeralSecret, this type does not have serialisation methods, in order to discourage long-term usage of secret key material. (For long-term secret keys, see StaticSecret.)

Warning

If you’re uncertain about whether you should use this, then you likely should not be using this. Our strongly recommended advice is to use EphemeralSecret at all times, as that type enforces at compile-time that secret keys are never reused, which can have very serious security implications for many protocols.

Implementations

Perform a Diffie-Hellman key agreement between self and their_public key to produce a SharedSecret.

Generate a non-serializeable x25519 [ReuseableSecret] key.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Executes the destructor for this type. Read more

Given an x25519 ReusableSecret key, compute its corresponding PublicKey.

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.