Struct Key
Source pub struct Key { }
Available on crate feature allow-non-fips only.
Expand description
Represents a 32-byte secret key for Poly1305 and ChaCha20Poly1305.
This struct ensures that the key material is securely managed and zeroed from memory when
dropped.
Creates a new Key from a 32-byte array.
§Arguments
inner - A 32-byte array containing the key material.
§Example
use wolf_crypto::mac::poly1305::Key;
let key = Key::new([0u8; 32]);
Returns a reference to the key as a KeyRef.
§Returns
KeyRef - A reference to the key material.
§Example
use wolf_crypto::mac::poly1305::{Key, KeyRef};
let key = Key::new([0u8; 32]);
let key_ref: KeyRef = key.as_ref();
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Drops the Key, ensuring that the key material is zeroed from memory.
Converts a 32-byte array into a Key.
§Arguments
value - A 32-byte array containing the key material.
§Example
use wolf_crypto::mac::poly1305::Key;
let key_bytes = [1u8; 32];
let key: Key = key_bytes.into();
Zeroes the key material in memory.
This method securely erases the key from memory to prevent leakage.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.