Struct elliptic_curve::ecdh::SharedSecret[][src]

pub struct SharedSecret<C: Curve> { /* fields omitted */ }
This is supported on crate feature ecdh only.
Expand description

Shared secret value computed via ECDH key agreement.

This value contains the raw serialized x-coordinate of the elliptic curve point computed from a Diffie-Hellman exchange.

⚠️ WARNING: NOT UNIFORMLY RANDOM! ⚠️

This value is not uniformly random and should not be used directly as a cryptographic key for anything which requires that property (e.g. symmetric ciphers).

Instead, the resulting value should be used as input to a Key Derivation Function (KDF) or cryptographic hash function to produce a symmetric key.

Implementations

Shared secret value, serialized as bytes.

As noted in the comments for this struct, this value is non-uniform and should not be used directly as a symmetric encryption key, but instead as input to a KDF (or failing that, a hash function) used to produce a symmetric key.

Trait Implementations

Executes the destructor for this type. Read more

NOTE: this impl is intended to be used by curve implementations to instantiate a SharedSecret value from their respective AffinePoint type.

Curve implementations should provide the field element representing the affine x-coordinate as secret_bytes.

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.

Performs the conversion.

Should always be Self

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.