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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.