Struct memsecurity::EncryptedMem
source · pub struct EncryptedMem { /* private fields */ }
Expand description
A struct that holds the encrypted secret and performs encryption and decryption on the secret.
Structure
pub struct EncryptedMem {
ciphertext: ZeroizeBytes,
nonce: AsconNonce,
}
Implementations§
source§impl EncryptedMem
impl EncryptedMem
sourcepub fn encrypt<T: Zeroize + AsRef<[u8]>>(
&mut self,
plaintext: &T
) -> MemSecurityResult<&mut Self>
pub fn encrypt<T: Zeroize + AsRef<[u8]>>( &mut self, plaintext: &T ) -> MemSecurityResult<&mut Self>
Performs an encryption operation.
sourcepub fn decrypt(&self) -> MemSecurityResult<ZeroizeBytes>
pub fn decrypt(&self) -> MemSecurityResult<ZeroizeBytes>
Performs an decryption operation.
sourcepub fn blake3_hmac<T: Zeroize + AsRef<[u8]>>(plaintext: T) -> Hash
pub fn blake3_hmac<T: Zeroize + AsRef<[u8]>>(plaintext: T) -> Hash
Hash some bytes with Blake3 using a key to create a HMAC
sourcepub fn blake3_keyed_hash_with_array<T: Zeroize + AsRef<[u8]>>(
plaintext_array: &[T]
) -> Hash
pub fn blake3_keyed_hash_with_array<T: Zeroize + AsRef<[u8]>>( plaintext_array: &[T] ) -> Hash
Hash some an array of bytes with Blake3 using a key to create a HMAC
sourcepub fn blake3_hkdf(plaintext: &str) -> [u8; 32]
pub fn blake3_hkdf(plaintext: &str) -> [u8; 32]
Hash a predetermined content with Blake3 using a secret key to derive a key (HKDF)
sourcepub fn decrypt_16byte(&self) -> MemSecurityResult<ZeroizeArray<16>>
pub fn decrypt_16byte(&self) -> MemSecurityResult<ZeroizeArray<16>>
Performs an decryption operation expecting a 16 byte array that is zeroed when dropped.
sourcepub fn decrypt_32byte(&self) -> MemSecurityResult<ZeroizeArray<32>>
pub fn decrypt_32byte(&self) -> MemSecurityResult<ZeroizeArray<32>>
Performs an decryption operation expecting a 32 byte array that is zeroed when dropped.
source§impl EncryptedMem
impl EncryptedMem
sourcepub fn ciphertext(&self) -> &ZeroizeBytes
pub fn ciphertext(&self) -> &ZeroizeBytes
Expose the ciphertext
Trait Implementations§
source§impl Debug for EncryptedMem
impl Debug for EncryptedMem
Auto Trait Implementations§
impl RefUnwindSafe for EncryptedMem
impl Send for EncryptedMem
impl Sync for EncryptedMem
impl Unpin for EncryptedMem
impl UnwindSafe for EncryptedMem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more