Skip to main content

SymmetricSignature

Struct SymmetricSignature 

Source
pub struct SymmetricSignature { /* private fields */ }
Expand description

HMAC-based symmetric signature.

Keys are securely zeroized from memory when dropped.

Implementations§

Source§

impl SymmetricSignature

Source

pub fn new(signing_key: [u8; 32]) -> Self

Create from signing key.

Source

pub fn generate() -> Result<Self>

Generate new random signing identity.

Source

pub fn from_password(password: &str, identity: &str) -> Self

Derive from password and identity.

Source

pub fn sign(&self, message: &[u8], include_timestamp: bool) -> Vec<u8>

Sign a message.

Source

pub fn verify( &self, message: &[u8], signature: &[u8], verification_key: &[u8; 32], max_age: u64, ) -> bool

Verify a signature.

Source

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

Get verification key.

Source

pub fn fingerprint(&self) -> String

Get key fingerprint.

Trait Implementations§

Source§

impl Drop for SymmetricSignature

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Zeroize for SymmetricSignature

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, 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.