Struct x25519_dalek::StaticSecret [−][src]
A Diffie-Hellman secret key that can be used to compute multiple SharedSecret
s.
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::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
impl StaticSecret
[src]
pub fn diffie_hellman(&self, their_public: &PublicKey) -> SharedSecret
[src]
Perform a Diffie-Hellman key agreement between self
and
their_public
key to produce a SharedSecret
.
pub fn new<T: RngCore + CryptoRng>(csprng: T) -> Self
[src]
Generate an x25519 key.
pub fn to_bytes(&self) -> [u8; 32]
[src]
Extract this key’s bytes for serialization.
Trait Implementations
impl Clone for StaticSecret
[src]
fn clone(&self) -> StaticSecret
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Drop for StaticSecret
[src]
impl<'a> From<&'a StaticSecret> for PublicKey
[src]
fn from(secret: &'a StaticSecret) -> PublicKey
[src]
Given an x25519 StaticSecret
key, compute its corresponding PublicKey
.
impl From<[u8; 32]> for StaticSecret
[src]
impl Zeroize for StaticSecret
[src]
Auto Trait Implementations
impl RefUnwindSafe for StaticSecret
impl Send for StaticSecret
impl Sync for StaticSecret
impl Unpin for StaticSecret
impl UnwindSafe for StaticSecret
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,
pub 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
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,