Trait wasefire_board_api::crypto::aead::Api
source · pub trait Api<Key, Iv>: Support<AeadSupport> + Send{
type Tag: ArrayLength<u8>;
// Required methods
fn encrypt(
key: &Array<Key>,
iv: &Array<Iv>,
aad: &[u8],
clear: Option<&[u8]>,
cipher: &mut [u8],
tag: &mut Array<Self::Tag>
) -> Result<(), Error>;
fn decrypt(
key: &Array<Key>,
iv: &Array<Iv>,
aad: &[u8],
cipher: Option<&[u8]>,
tag: &Array<Self::Tag>,
clear: &mut [u8]
) -> Result<(), Error>;
}
Available on crate features
internal-api-crypto
and internal-api-crypto-aead
only.Expand description
Elliptic-curve cryptography interface.
Required Associated Types§
sourcetype Tag: ArrayLength<u8>
type Tag: ArrayLength<u8>
The tag length.
Required Methods§
sourcefn encrypt(
key: &Array<Key>,
iv: &Array<Iv>,
aad: &[u8],
clear: Option<&[u8]>,
cipher: &mut [u8],
tag: &mut Array<Self::Tag>
) -> Result<(), Error>
fn encrypt( key: &Array<Key>, iv: &Array<Iv>, aad: &[u8], clear: Option<&[u8]>, cipher: &mut [u8], tag: &mut Array<Self::Tag> ) -> Result<(), Error>
Encrypts and authenticates a clear text with associated data given a key and IV.
The clear- and cipher-texts must have the same length. If the clear text is omitted, then the cipher text is encrypted in place.
sourcefn decrypt(
key: &Array<Key>,
iv: &Array<Iv>,
aad: &[u8],
cipher: Option<&[u8]>,
tag: &Array<Self::Tag>,
clear: &mut [u8]
) -> Result<(), Error>
fn decrypt( key: &Array<Key>, iv: &Array<Iv>, aad: &[u8], cipher: Option<&[u8]>, tag: &Array<Self::Tag>, clear: &mut [u8] ) -> Result<(), Error>
Decrypts and authenticates a cipher text with associated data given a key and IV.
The cipher- and clear-texts must have the same length. If the cipher text is omitted, then the clear text is decrypted in place.
Object Safety§
This trait is not object safe.