Trait engine::vault::BoxProvider
source · pub trait BoxProvider: 'static + Sized + Ord + PartialOrd {
type Error: Debug;
// Required methods
fn box_key_len() -> usize;
fn box_overhead() -> usize;
fn box_seal(
key: &Key<Self>,
ad: &[u8],
data: &[u8]
) -> Result<Vec<u8>, Self::Error>;
fn box_open(
key: &Key<Self>,
ad: &[u8],
data: &[u8]
) -> Result<Vec<u8>, Self::Error>;
fn random_buf(buf: &mut [u8]) -> Result<(), Self::Error>;
// Provided method
fn random_vec(len: usize) -> Result<Zeroizing<Vec<u8>>, Self::Error> { ... }
}
Expand description
A provider interface between the vault and a crypto box. See libsodium’s secretbox for an example.
Required Associated Types§
Required Methods§
sourcefn box_key_len() -> usize
fn box_key_len() -> usize
defines the key length for the BoxProvider
.
sourcefn box_overhead() -> usize
fn box_overhead() -> usize
defines the size of the Nonce combined with the Ad for the BoxProvider
.
sourcefn box_seal(
key: &Key<Self>,
ad: &[u8],
data: &[u8]
) -> Result<Vec<u8>, Self::Error>
fn box_seal( key: &Key<Self>, ad: &[u8], data: &[u8] ) -> Result<Vec<u8>, Self::Error>
seals some data into the crypto box using the Key
and the associated data.
Provided Methods§
Object Safety§
This trait is not object safe.