fn encrypt_in_place(
        &self,
        buffer: &mut dyn ResizeBuffer,
        nonce: &[u8],
        aad: &[u8],
    ) -> Result<usize, Error> {
        if nonce.len() != NonceSize::<T>::USIZE {
            return Err(err_msg!(InvalidNonce));
        }
        let nonce = GenericArray::from_slice(nonce);
        let chacha = T::Aead::new(self.0.as_ref());
        let tag = chacha
            .encrypt_in_place_detached(nonce, aad, buffer.as_mut())
            .map_err(|_| err_msg!(Encryption, "AEAD encryption error"))?;
        let ctext_len = buffer.as_ref().len();
        buffer.buffer_write(&tag[..])?;
        Ok(ctext_len)
    }
/// Encrypt a secret value in place, appending the verification tag
Encrypt a secret value in place, appending the verification tag
Encrypt a secret value in place appending the verification tag
fn encrypt_in_place(
        &self,
        buffer: &mut dyn ResizeBuffer,
        nonce: &[u8],
        aad: &[u8],
    ) -> Result<usize, Error> {
        if nonce.len() != NonceSize::<T>::USIZE {
            return Err(err_msg!(InvalidNonce));
        }
        let nonce = GenericArray::from_slice(nonce);
        let chacha = T::Aead::new(self.0.as_ref());
        let tag = chacha
            .encrypt_in_place_detached(nonce, aad, buffer.as_mut())
            .map_err(|_| err_msg!(Encryption, "AEAD encryption error"))?;
        let ctext_len = buffer.as_ref().len();
        buffer.buffer_write(&tag[..])?;
        Ok(ctext_len)
    }
fn encrypt_in_place ( & self , buffer : & mut dyn ResizeBuffer , nonce : & [ u8 ] , aad : & [ u8 ] , ) -> Result < usize , Error > { if nonce . len ( ) != NonceSize :: < T > :: USIZE { return Err ( err_msg ! ( InvalidNonce ) ) ; } let nonce = GenericArray :: from_slice ( nonce ) ; let chacha = T :: Aead :: new ( self . 0 . as_ref ( ) ) ; let tag = chacha . encrypt_in_place_detached ( nonce , aad , buffer . as_mut ( ) ) . map_err ( | _ | err_msg ! ( Encryption " " ) ) ? ; let ctext_len = buffer . as_ref ( ) . len ( ) ; buffer . buffer_write ( & tag [ .. ] ) ? ; Ok ( ctext_len ) }
Encrypt a secret value in place, appending the verification tag
Encrypt a secret value in place appending the verification tag
&self
buffer
&mut dyn ResizeBuffer
nonce
&[u8]
aad
&[u8]