[−][src]Struct lib3h_sodium::secbuf::SecBuf
A SecBuf is a memory buffer for use with libsodium functions. It can be backed by insecure (raw) memory for things like public keys, or secure (mlocked / mprotected) memory for things like private keys.
Methods
impl SecBuf
[src]
pub fn with_insecure(s: usize) -> Self
[src]
create a new SecBuf backed by insecure memory (for things like public keys)
pub fn with_secure(s: usize) -> Self
[src]
create a new SecBuf backed by secure memory (for things like private keys) warning: funky sizes may result in mis-alignment
pub fn with_insecure_from_string(s: String) -> Self
[src]
pub fn protect_state(&self) -> ProtectState
[src]
what is the current memory protection state of this SecBuf?
pub fn len(&self) -> usize
[src]
should be able to get size without messing with mem protection
pub fn readable(&mut self)
[src]
make this SecBuf readable
pub fn writable(&mut self)
[src]
make this SecBuf writable
pub fn noaccess(&mut self)
[src]
secure this SecBuf against reading or writing
pub fn read_lock(&mut self) -> Locker
[src]
make this SecBuf readable, and return a locker object that will secure this SecBuf automatically when it goes out of scope.
pub fn write_lock(&mut self) -> Locker
[src]
make this SecBuf writable, and return a locker object that will secure this SecBuf automatically when it goes out of scope.
pub fn write(&mut self, offset: usize, data: &[u8]) -> Result<(), CryptoError>
[src]
helper for writing data to our internal buffer
impl SecBuf
[src]
impl SecBuf
[src]
pub fn zero(&mut self)
[src]
Zero all memory
pub fn increment(&mut self)
[src]
Increments all memory by 1
pub fn compare(&mut self, b: &mut SecBuf) -> i32
[src]
Compares two SecBuf Return : | if a > b; return 1 | if a < b; return -1 | if a == b; return 0
pub fn from_array(&mut self, data: &[u8]) -> Result<(), CryptoError>
[src]
Load the u8 into the SecBuf
Trait Implementations
impl Clone for SecBuf
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Deref for SecBuf
[src]
impl DerefMut for SecBuf
[src]
impl Debug for SecBuf
[src]
Auto Trait Implementations
impl Send for SecBuf
impl Unpin for SecBuf
impl !Sync for SecBuf
impl !UnwindSafe for SecBuf
impl !RefUnwindSafe for SecBuf
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &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, 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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,