pub struct SecureBuffer { /* private fields */ }Expand description
A page-guarded, mlock’d buffer for secret material.
Layout: [guard page (PROT_NONE)] [inner region, mlock’d] [guard page (PROT_NONE)]
Guard pages are filled with random canary bytes. On drop, canaries are verified (detects overflow), inner region is zeroized, and all pages are unmapped.
Implementations§
Source§impl SecureBuffer
impl SecureBuffer
pub fn size(&self) -> usize
pub fn is_alive(&self) -> bool
pub fn is_mutable(&self) -> bool
Sourcepub fn bytes(&mut self) -> &mut [u8] ⓘ
pub fn bytes(&mut self) -> &mut [u8] ⓘ
Get a mutable slice to the inner region. Requires Mutable state.
Trait Implementations§
Source§impl Debug for SecureBuffer
impl Debug for SecureBuffer
Source§impl Drop for SecureBuffer
impl Drop for SecureBuffer
impl Send for SecureBuffer
Auto Trait Implementations§
impl Freeze for SecureBuffer
impl RefUnwindSafe for SecureBuffer
impl !Sync for SecureBuffer
impl Unpin for SecureBuffer
impl UnsafeUnpin for SecureBuffer
impl UnwindSafe for SecureBuffer
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