[−][src]Struct elliptic_curve::ecdh::SharedSecret
feature="ecdh"
only.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
impl<C> SharedSecret<C> where
C: Curve + Arithmetic,
C::AffinePoint: Zeroize,
C::ElementSize: Add<U1>,
<C::ElementSize as Add>::Output: Add<U1>,
UncompressedPointSize<C>: ArrayLength<u8>,
[src]
C: Curve + Arithmetic,
C::AffinePoint: Zeroize,
C::ElementSize: Add<U1>,
<C::ElementSize as Add>::Output: Add<U1>,
UncompressedPointSize<C>: ArrayLength<u8>,
pub fn as_bytes(&self) -> &ElementBytes<C>
[src]
feature="ecdh"
only.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
impl<C> Drop for SharedSecret<C> where
C: Curve + Arithmetic,
[src]
C: Curve + Arithmetic,
impl<C> Zeroize for SharedSecret<C> where
C: Curve + Arithmetic,
[src]
C: Curve + Arithmetic,
Auto Trait Implementations
impl<C> RefUnwindSafe for SharedSecret<C> where
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<C> Send for SharedSecret<C> where
<C as Curve>::ElementSize: ArrayLength<u8>,
<C as Curve>::ElementSize: ArrayLength<u8>,
impl<C> Sync for SharedSecret<C> where
<C as Curve>::ElementSize: ArrayLength<u8>,
<C as Curve>::ElementSize: ArrayLength<u8>,
impl<C> Unpin for SharedSecret<C> where
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: Unpin,
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: Unpin,
impl<C> UnwindSafe for SharedSecret<C> where
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
<<C as Curve>::ElementSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<Z> Zeroize for Z where
Z: DefaultIsZeroes,
[src]
Z: DefaultIsZeroes,