Struct cosmian_crypto_core::ChaCha20Poly1305

source ·
pub struct ChaCha20Poly1305(/* private fields */);

Implementations§

source§

impl ChaCha20Poly1305

source

pub const KEY_LENGTH: usize = 32usize

Use a 256-bit key.

source

pub const MAC_LENGTH: usize = 16usize

Use a 128-bit MAC tag.

source

pub const NONCE_LENGTH: usize = 12usize

Use a 96-bit nonce.

Trait Implementations§

source§

impl Debug for ChaCha20Poly1305

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Dem<{ Self::KEY_LENGTH }, { Self::NONCE_LENGTH }, { Self::MAC_LENGTH }, ChaChaPoly1305<StreamCipherCoreWrapper<ChaChaCore<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B0>>>>> for ChaCha20Poly1305

§

type Nonce = Nonce<{ Self::NONCE_LENGTH }>

source§

fn encrypt( &self, nonce: &Self::Nonce, plaintext: &[u8], aad: Option<&[u8]>, ) -> Result<Vec<u8>, CryptoCoreError>

Encrypts a plaintext using the given symmetric key. Read more
source§

fn decrypt( &self, nonce: &Self::Nonce, ciphertext: &[u8], aad: Option<&[u8]>, ) -> Result<Vec<u8>, CryptoCoreError>

Decrypts a ciphertext using the given symmetric key. Read more
source§

impl DemInPlace<{ Self::KEY_LENGTH }, { Self::NONCE_LENGTH }, { Self::MAC_LENGTH }, ChaChaPoly1305<StreamCipherCoreWrapper<ChaChaCore<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B0>>>>> for ChaCha20Poly1305

§

type Nonce = Nonce<{ Self::NONCE_LENGTH }>

source§

fn encrypt_in_place_detached( &self, nonce: &Self::Nonce, plaintext: &mut [u8], aad: Option<&[u8]>, ) -> Result<Vec<u8>, CryptoCoreError>

Encrypts a message in place using a secret key and a public nonce in detached mode: the tag authenticating both the confidential message and non-confidential data, are returned separately Read more
source§

fn decrypt_in_place_detached( &self, nonce: &Self::Nonce, bytes: &mut [u8], tag: &[u8], aad: Option<&[u8]>, ) -> Result<(), CryptoCoreError>

Decrypts a message in pace in detached mode. The bytes should not contain the authentication tag. Read more
source§

impl DemStream<{ Self::KEY_LENGTH }, { Self::NONCE_LENGTH }, { Self::MAC_LENGTH }, ChaChaPoly1305<StreamCipherCoreWrapper<ChaChaCore<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B0>>>>> for ChaCha20Poly1305

§

type Nonce = Nonce<{ Self::NONCE_LENGTH }>

source§

fn into_aead_stream_backend(self) -> ChaCha20Poly1305Lib

Returns the RustCrypto Aead in place backend algorithm with stream capabilities
source§

fn into_stream_encryptor_be32( self, nonce: &Self::Nonce, ) -> EncryptorBE32<RustCryptoBackend>

source§

fn into_stream_decryptor_be32( self, nonce: &Self::Nonce, ) -> DecryptorBE32<RustCryptoBackend>

source§

fn into_stream_encryptor_le31( self, nonce: &Self::Nonce, ) -> EncryptorLE31<RustCryptoBackend>

source§

fn into_stream_decryptor_le31( self, nonce: &Self::Nonce, ) -> DecryptorLE31<RustCryptoBackend>

source§

impl Deref for ChaCha20Poly1305

§

type Target = ChaChaPoly1305<StreamCipherCoreWrapper<ChaChaCore<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B0>>>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Instantiable<{ Self::KEY_LENGTH }> for ChaCha20Poly1305

§

type Secret = SymmetricKey<{ Self::KEY_LENGTH }>

source§

fn new(symmetric_key: &Self::Secret) -> Self

Instantiate the DEM

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V