Skip to main content

StaticSecret

Struct StaticSecret 

Source
pub struct StaticSecret(/* private fields */);
Expand description

A Ristretto255 Static Secret

Implementations§

Source§

impl StaticSecret

Source

pub fn random_from_rng(csprng: &mut impl CryptoRng) -> Self

Generate a new StaticSecret with the supplied RNG.

Source

pub fn diffie_hellman(&self, their_public: &PublicKey) -> SharedSecret

Perform a Diffie-Hellman key agreement between self and their_public key to produce a SharedSecret.

Source

pub fn to_bytes(&self) -> [u8; 32]

Convert this key to its byte representation.

Source

pub fn as_bytes(&self) -> &[u8; 32]

View this key as a byte array.

Trait Implementations§

Source§

impl From<&StaticSecret> for PublicKey

Source§

fn from(value: &StaticSecret) -> Self

Converts to this type from the input type.
Source§

impl From<[u8; 32]> for StaticSecret

Source§

fn from(bytes: [u8; 32]) -> Self

Converts to this type from the input type.
Source§

impl RandomSecretKey for StaticSecret

Source§

fn random_secret_key(csprng: &mut impl CryptoRng) -> Self

Create a secret key from provided RNG.
Source§

impl TakeTheHint<DalekRistretto255> for StaticSecret

Source§

fn take_the<A: Aead + KeyInit, L: ArraySize>( &self, hint: &Hint<DalekRistretto255, A, L>, context: &[u8], ) -> Result<Array<u8, L>, Error>

Trial decryption of an individual Hint.
Source§

fn take_all_the<A: Aead + KeyInit, L: ArraySize, const S: usize>( &self, hints: &Hints<Hint<K, A, L>, S>, context: &[u8], ) -> Vec<Array<u8, L>>
where Hint<K, A, L>: HintSized<K, A, L> + Hinting<K, L>,

Trial decryption for a batch of Hints.
Source§

impl Zeroize for StaticSecret

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.