[][src]Trait tink_core::Aead

pub trait Aead: AeadBoxClone {
    fn encrypt(
        &self,
        plaintext: &[u8],
        additional_data: &[u8]
    ) -> Result<Vec<u8>, TinkError>;
fn decrypt(
        &self,
        ciphertext: &[u8],
        additional_data: &[u8]
    ) -> Result<Vec<u8>, TinkError>; }

Aead is the interface for authenticated encryption with additional authenticated data.

Implementations of this trait are secure against adaptive chosen ciphertext attacks. Encryption with additional data ensures authenticity and integrity of that data, but not its secrecy (see RFC 5116).

Required methods

fn encrypt(
    &self,
    plaintext: &[u8],
    additional_data: &[u8]
) -> Result<Vec<u8>, TinkError>

Encrypt plaintext with additional_data as additional authenticated data. The resulting ciphertext allows for checking authenticity and integrity of additional data additional_data, but there are no guarantees wrt. secrecy of that data.

fn decrypt(
    &self,
    ciphertext: &[u8],
    additional_data: &[u8]
) -> Result<Vec<u8>, TinkError>

Decrypt ciphertext with additional_data as additional authenticated data. The decryption verifies the authenticity and integrity of the additional data, but there are no guarantees wrt. secrecy of that data.

Loading content...

Implementors

Loading content...