Struct diem_sdk::crypto::x25519::x25519_dalek::StaticSecret[][src]

pub struct StaticSecret(_);
Expand description

A Diffie-Hellman secret key that can be used to compute multiple SharedSecrets.

This type is identical to the EphemeralSecret type, except that the StaticSecret::diffie_hellman method does not consume the secret key, and the type provides serialization methods to save and load key material. This means that the secret may be used multiple times (but does not have to be).

Some protocols, such as Noise, already handle the static/ephemeral distinction, so the additional guarantees provided by EphemeralSecret are not helpful or would cause duplicate code paths. In this case, it may be useful to

use x25519_dalek_fiat::StaticSecret as SecretKey;

since the only difference between the two is that StaticSecret does not enforce at compile-time that the key is only used once.

Implementations

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

Generate an x25519 key.

Extract this key’s bytes for serialization.

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 StaticSecret key, compute its corresponding PublicKey.

Load a secret key from a byte array.

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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more