Skip to main content

Aes128GcmSiv

Struct Aes128GcmSiv 

Source
pub struct Aes128GcmSiv(/* private fields */);
Expand description

AES-128 in GCM-SIV mode (which is different from SIV mode!).

Implementations§

Source§

impl Aes128GcmSiv

Source

pub fn new(key: &[u8; 16]) -> Self

Create a new AEAD context for the given key.

Trait Implementations§

Source§

impl Aead for Aes128GcmSiv

Source§

type Tag = [u8; 16]

The type of tags produced by this AEAD. Generally a u8 array of fixed length.
Source§

type Nonce = [u8; 12]

The type of nonces used by this AEAD. Generally a u8 array of fixed length.
Source§

fn seal(&self, nonce: &Self::Nonce, plaintext: &[u8], ad: &[u8]) -> Vec<u8>

Encrypt and authenticate plaintext, and authenticate ad, returning the result as a freshly allocated Vec. The nonce must never be used in any sealing operation with the same key, ever again.
Source§

fn seal_in_place( &self, nonce: &Self::Nonce, plaintext: &mut [u8], ad: &[u8], ) -> Self::Tag

Encrypt and authenticate plaintext, and authenticate ad, writing the ciphertext over plaintext and additionally returning the calculated tag, which is usually appended to the ciphertext. The nonce must never be used in any sealing operation with the same key, ever again.
Source§

fn open( &self, nonce: &Self::Nonce, ciphertext: &[u8], ad: &[u8], ) -> Option<Vec<u8>>

Authenticate ciphertext and ad and, if valid, decrypt ciphertext, returning the original plaintext in a newly allocated Vec. The nonce must be the same value as given to the sealing operation that produced ciphertext.
Source§

fn open_in_place( &self, nonce: &Self::Nonce, ciphertext: &mut [u8], tag: &Self::Tag, ad: &[u8], ) -> Result<(), InvalidCiphertext>

Authenticate ciphertext and ad using tag and, if valid, decrypt ciphertext in place. The nonce must be the same value as given to the sealing operation that produced ciphertext.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.