pub struct SafeSecretKey { /* private fields */ }
Expand description
Securely stores a secret key in memory that is zeroized on drop. Care is taken so that when this struct is constructed or moved that additional copies of the secret are not made in memory or disk. https://github.com/veorq/cryptocoding#clean-memory-of-secret-data
Unfortunately the SafeSecretKey is not magic, there are some things to be aware of when using it…
- The memory used when constructing the secret key must also be zeroized, but this is left as an exercise to the caller.
- If you mem::forget the SafeSecretKey or otherwise don’t drop it, the secret will not be zeroized.
- When the caller lends out a reference to the SecretKey (available for example via Deref) it is the responsibility of the caller to not Clone the SecretKey or otherwise make a copy of it’s memory
Trait Implementations§
Source§impl Debug for SafeSecretKey
impl Debug for SafeSecretKey
Source§impl Deref for SafeSecretKey
impl Deref for SafeSecretKey
Source§impl Drop for SafeSecretKey
impl Drop for SafeSecretKey
Auto Trait Implementations§
impl Freeze for SafeSecretKey
impl RefUnwindSafe for SafeSecretKey
impl Send for SafeSecretKey
impl Sync for SafeSecretKey
impl Unpin for SafeSecretKey
impl UnwindSafe for SafeSecretKey
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