Struct il2_utils::mem::SecretBytes [−][src]
pub struct SecretBytes { /* fields omitted */ }Expand description
This struct wraps a byte array that is guaranteed to have its contents shredded upon destruction.
It also allows the locking of the value in memory if required, preventing it from being moved into the disk.
This struct also implements a mechanism to set a logical length that differs
Implementations
Creates a new SecretBytes.
Arguments:
size: The size in bytes;locked: Locks the value in memory;
Creates a new SecretBytes and initializes it
with the given value.
Arguments:
value: The initial value;locked: Locks the value in memory;
Returns the buffer as a mutable byte slice. The buffer may be larger than the value itself.
Returns the buffer as an immutable byte slice. The buffer may be larger than the value itself.
Returns the logical size of this value. It may be equal or smaller than the actual buffer size.
Sets the logical size of this value. If the new size is larger than the buffer size, this method will set the logical size to the current buffer size.
Arguments:
size: The logical size of the value.
Returns the size of the inner buffer of this value.
Verifies if the underlying platform supports memory locking.
Returns true if locking is supported or false otherwise.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for SecretBytes
impl Send for SecretBytes
impl Sync for SecretBytes
impl Unpin for SecretBytes
impl UnwindSafe for SecretBytes
Blanket Implementations
Mutably borrows from an owned value. Read more