Struct x25519_dalek::StaticSecret [−][src]
pub struct StaticSecret(_);
Expand description
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]
impl StaticSecret
[src]pub fn diffie_hellman(&self, their_public: &PublicKey) -> SharedSecret
[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
.
Trait Implementations
impl Clone for StaticSecret
[src]
impl Clone for StaticSecret
[src]fn clone(&self) -> StaticSecret
[src]
fn clone(&self) -> StaticSecret
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<'de> Deserialize<'de> for StaticSecret
[src]
impl<'de> Deserialize<'de> for StaticSecret
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl Drop for StaticSecret
[src]
impl Drop for StaticSecret
[src]impl<'a> From<&'a StaticSecret> for PublicKey
[src]
impl<'a> From<&'a StaticSecret> for PublicKey
[src]fn from(secret: &'a StaticSecret) -> PublicKey
[src]
fn from(secret: &'a StaticSecret) -> PublicKey
[src]Given an x25519 StaticSecret
key, compute its corresponding PublicKey
.
impl Serialize for StaticSecret
[src]
impl Serialize 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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,