Trait engine::vault::BoxProvider [−][src]
pub trait BoxProvider: Sized + Ord + PartialOrd { fn box_key_len() -> usize; fn box_overhead() -> usize; fn box_seal(key: &Key<Self>, ad: &[u8], data: &[u8]) -> Result<Vec<u8>>; fn box_open(key: &Key<Self>, ad: &[u8], data: &[u8]) -> Result<Vec<u8>>; fn random_buf(buf: &mut [u8]) -> Result<()>; fn random_vec(len: usize) -> Result<Vec<u8>> { ... } }
A provider interface between the vault and a crypto box. See libsodium’s secretbox for an example.
Required methods
fn box_key_len() -> usize
[src]
function for the key length of the crypto box
fn box_overhead() -> usize
[src]
gets the crypto box’s overhead
fn box_seal(key: &Key<Self>, ad: &[u8], data: &[u8]) -> Result<Vec<u8>>
[src]
seals some data into the crypto box using the key
and the ad
fn box_open(key: &Key<Self>, ad: &[u8], data: &[u8]) -> Result<Vec<u8>>
[src]
opens a crypto box to get data using the key
and the ad
.
fn random_buf(buf: &mut [u8]) -> Result<()>
[src]
fills a buffer buf
with secure random bytes.
Provided methods
fn random_vec(len: usize) -> Result<Vec<u8>>
[src]
creates a vector with secure random bytes based off of an inputted length len
.