pub struct SecureBox<T>where
T: Copy,{ /* private fields */ }Expand description
A data type suitable for storing sensitive information such as passwords and private keys in memory, that implements:
- Automatic zeroing in
Drop - Constant time comparison in
PartialEq(does not short circuit on the first different character; but terminates instantly if strings have different length) - Outputting
***SECRET***to prevent leaking secrets into logs infmt::Debugandfmt::Display - Automatic
mlockto protect against leaking into swap (any unix) - Automatic
madvise(MADV_NOCORE/MADV_DONTDUMP)to protect against leaking into core dumps (FreeBSD, DragonflyBSD, Linux)
Implementations§
Trait Implementations§
Source§impl<T> BorrowMut<T> for SecureBox<T>where
T: Copy,
impl<T> BorrowMut<T> for SecureBox<T>where
T: Copy,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T: Copy + ConstantTimeEq> ConstantTimeEq for SecureBox<T>
impl<T: Copy + ConstantTimeEq> ConstantTimeEq for SecureBox<T>
impl<T: Copy + ConstantTimeEq> Eq for SecureBox<T>
Auto Trait Implementations§
impl<T> Freeze for SecureBox<T>
impl<T> RefUnwindSafe for SecureBox<T>where
T: RefUnwindSafe,
impl<T> Send for SecureBox<T>where
T: Send,
impl<T> Sync for SecureBox<T>where
T: Sync,
impl<T> Unpin for SecureBox<T>
impl<T> UnsafeUnpin for SecureBox<T>
impl<T> UnwindSafe for SecureBox<T>where
T: UnwindSafe,
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