[−][src]Struct t_rust_less_lib::memguard::SecretBytes
Strictly memory protected bytes contain sensitive data.
This implementation borrows a lot of code and ideas from:
- https://crates.io/crates/memsec
- https://crates.io/crates/secrets
- https://download.libsodium.org/doc/memory_management
secrets
is not good enough because it relies on libsodium which breaks the desired
portability of this library (at least at the time of this writing).
memsec
is not
good enough because it focuses on protecting a generic type T
which size is known at
compile-time. In this library we are dealing with dynamic amounts of sensitive data and
there is no point in securing a Vec<u8>
via memsec
... all we would achieve is protecting
the pointer to sensitive data in unsecured space.
Implementations
impl SecretBytes
[src]
pub fn from_secured(bytes: &[u8]) -> Self
[src]
Copy from slice of bytes.
This is not a regular From implementation because the caller has to ensure that the original bytes are zeroed out (or are already in some secured memspace. This different signature should be a reminder of that.
pub fn with_capacity(capacity: usize) -> SecretBytes
[src]
pub fn with_capacity_for_chars(capacity_for_chars: usize) -> SecretBytes
[src]
pub fn zeroed(size: usize) -> SecretBytes
[src]
pub fn random<T>(rng: &mut T, size: usize) -> SecretBytes where
T: RngCore + CryptoRng,
[src]
T: RngCore + CryptoRng,
pub fn is_empty(&self) -> bool
[src]
pub fn len(&self) -> usize
[src]
pub fn capacity(&self) -> usize
[src]
pub fn borrow(&self) -> Ref<'_>
[src]
pub fn borrow_mut(&mut self) -> RefMut<'_>
[src]
pub fn locks(&self) -> isize
[src]
Trait Implementations
impl Clone for SecretBytes
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SecretBytes
[src]
impl Drop for SecretBytes
[src]
impl<'_> From<&'_ mut [u8]> for SecretBytes
[src]
impl From<String> for SecretBytes
[src]
impl From<Vec<u8>> for SecretBytes
[src]
impl Send for SecretBytes
[src]
impl Sync for SecretBytes
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,