pub struct Secret<const N: usize>(/* private fields */);Expand description
Generic container for sensitive bytes with best-effort security measures.
In particular this implementation provides:
- Zeroise memory on drop.
- Private API methods to retrieve bytes, preventing misuse.
- Hide bytes value when printing debug info.
- Constant-time comparison implementation to prevent timing attacks.
This represents a “best-effort” attempt, since side-channels are ultimately a property of a deployed cryptographic system including the hardware it runs on, not just of software.
Trait Implementations§
Source§impl<'de, const N: usize> Deserialize<'de> for Secret<N>
impl<'de, const N: usize> Deserialize<'de> for Secret<N>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<UpdateSecret> for Secret<RATCHET_KEY_SIZE>
impl From<UpdateSecret> for Secret<RATCHET_KEY_SIZE>
Source§fn from(update_secret: UpdateSecret) -> Self
fn from(update_secret: UpdateSecret) -> Self
Converts to this type from the input type.
impl<const N: usize> Eq for Secret<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for Secret<N>
impl<const N: usize> RefUnwindSafe for Secret<N>
impl<const N: usize> Send for Secret<N>
impl<const N: usize> Sync for Secret<N>
impl<const N: usize> Unpin for Secret<N>
impl<const N: usize> UnwindSafe for Secret<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