[][src]Trait lib3h_crypto_api::Buffer

pub trait Buffer: BufferType {
    fn new(size: usize) -> CryptoResult<Self>;
fn len(&self) -> usize;
fn set_no_access(&self);
fn set_readable(&self);
fn set_writable(&self); fn read_lock(&self) -> ReadLocker<Self> { ... }
fn write_lock(&mut self) -> WriteLocker<Self> { ... }
fn write(&mut self, offset: usize, data: &[u8]) -> CryptoResult<()> { ... } }

The Buffer trait is used by crypto_api functions to exchange data. It is implemented for Vec for direct use. If your crypto system provides memory security, you should prefer that type for private keys.

Required methods

fn new(size: usize) -> CryptoResult<Self>

Create a new Buffer instance of given type

fn len(&self) -> usize

Get the length of this buffer

fn set_no_access(&self)

Mark the buffer as no-access (secure)

fn set_readable(&self)

Mark the buffer as read-only (see read_lock)

fn set_writable(&self)

Mark the buffer as read-write (see write_lock)

Loading content...

Provided methods

fn read_lock(&self) -> ReadLocker<Self>

Mark the buffer as readable (read-only) When the returned ReadLocker instance is dropped, the buffer will be marked no-access.

fn write_lock(&mut self) -> WriteLocker<Self>

Mark the buffer as writable (read-write) When the returned WriteLocker instance is dropped, the buffer will be marked no-access.

fn write(&mut self, offset: usize, data: &[u8]) -> CryptoResult<()>

Write data to this Buffer instance

Loading content...

Implementations on Foreign Types

impl Buffer for Vec<u8>[src]

Loading content...

Implementors

impl Buffer for InsecureBuffer[src]

Loading content...