pub struct Key { /* private fields */ }Expand description
Base key type backed by exact-size secret storage.
Implementations§
Source§impl Key
impl Key
Sourcepub fn new(data: &[u8]) -> Key
pub fn new(data: &[u8]) -> Key
Copy key bytes directly into exact-size owned storage.
The caller retains responsibility for clearing the source buffer. This
constructor intentionally accepts a slice rather than taking a Vec:
safe Rust cannot inspect or erase a vector’s spare capacity.
Sourcepub fn from_boxed_slice(data: Box<[u8]>) -> Key
pub fn from_boxed_slice(data: Box<[u8]>) -> Key
Take ownership of an exact-size boxed key allocation.
Sourcepub fn from_slice(data: &[u8]) -> Key
pub fn from_slice(data: &[u8]) -> Key
Copy key bytes directly into exact-size owned storage.
pub fn new_zeros(len: usize) -> Key
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn to_bytes_zeroizing_boxed(&self) -> Zeroizing<Box<[u8]>>
pub fn to_bytes_zeroizing_boxed(&self) -> Zeroizing<Box<[u8]>>
Serialize into exact-size storage that clears itself on drop.
Trait Implementations§
Source§impl SerializeSecret for Key
impl SerializeSecret for Key
impl ZeroizeOnDrop for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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> 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)