[−][src]Struct keybear_core::crypto::StaticSecret
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::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>(csprng: T) -> StaticSecret where
T: RngCore + CryptoRng, [src]
T: RngCore + CryptoRng,
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]
pub fn clone(&self) -> StaticSecret[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<'de> Deserialize<'de> for StaticSecret[src]
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<StaticSecret, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>, [src]
__deserializer: __D
) -> Result<StaticSecret, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Drop for StaticSecret[src]
impl<'a> From<&'a StaticSecret> for PublicKey[src]
pub fn from(secret: &'a StaticSecret) -> PublicKey[src]
Given an x25519 StaticSecret key, compute its corresponding PublicKey.
impl From<[u8; 32]> for StaticSecret[src]
impl Serialize for StaticSecret[src]
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer, [src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl StaticSecretExt for StaticSecret[src]
pub fn verify_file<P>(file: P) -> bool where
P: AsRef<Path>, [src]
P: AsRef<Path>,
pub fn new_with_os_rand() -> StaticSecret[src]
pub fn from_file<P>(file: P) -> Result<StaticSecret> where
P: AsRef<Path>, [src]
P: AsRef<Path>,
pub fn save<P>(&self, file: P) -> Result<()> where
P: AsRef<Path>, [src]
P: AsRef<Path>,
pub fn from_file_or_generate<P>(file: P) -> Result<StaticSecret> where
P: AsRef<Path>, [src]
P: AsRef<Path>,
impl Zeroize for StaticSecret[src]
Auto Trait Implementations
impl RefUnwindSafe for StaticSecret[src]
impl Send for StaticSecret[src]
impl Sync for StaticSecret[src]
impl Unpin for StaticSecret[src]
impl UnwindSafe for StaticSecret[src]
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
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> 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>,