pub struct SecretBuffer<const N: usize> { /* private fields */ }
Expand description
Fixed-size secret buffer that guarantees zeroization
This type provides:
- Automatic zeroization on drop
- Secure cloning that preserves security properties
- Type-safe size guarantees at compile time
Implementations§
Source§impl<const N: usize> SecretBuffer<N>
impl<const N: usize> SecretBuffer<N>
Sourcepub fn new(data: [u8; N]) -> SecretBuffer<N>
pub fn new(data: [u8; N]) -> SecretBuffer<N>
Create a new secret buffer with the given data
Sourcepub fn zeroed() -> SecretBuffer<N>
pub fn zeroed() -> SecretBuffer<N>
Create a zeroed secret buffer
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Get a mutable reference to the inner data
Trait Implementations§
Source§impl<const N: usize> Clone for SecretBuffer<N>
impl<const N: usize> Clone for SecretBuffer<N>
Source§fn clone(&self) -> SecretBuffer<N>
fn clone(&self) -> SecretBuffer<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<const N: usize> Debug for SecretBuffer<N>
impl<const N: usize> Debug for SecretBuffer<N>
Source§impl<const N: usize> Drop for SecretBuffer<N>
impl<const N: usize> Drop for SecretBuffer<N>
Source§impl<const N: usize> SecureZeroingType for SecretBuffer<N>
impl<const N: usize> SecureZeroingType for SecretBuffer<N>
Source§fn zeroed() -> SecretBuffer<N>
fn zeroed() -> SecretBuffer<N>
Create a zeroed instance
Source§fn secure_clone(&self) -> SecretBuffer<N>
fn secure_clone(&self) -> SecretBuffer<N>
Create a secure clone that preserves security properties Read more
Auto Trait Implementations§
impl<const N: usize> Freeze for SecretBuffer<N>
impl<const N: usize> RefUnwindSafe for SecretBuffer<N>
impl<const N: usize> Send for SecretBuffer<N>
impl<const N: usize> Sync for SecretBuffer<N>
impl<const N: usize> Unpin for SecretBuffer<N>
impl<const N: usize> UnwindSafe for SecretBuffer<N>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ConstantTimeEquals for T
impl<T> ConstantTimeEquals for T
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)