Type Definition crypto::ciphers::chacha::XChaCha20Poly1305
source · pub type XChaCha20Poly1305 = XChaCha20Poly1305;
Trait Implementations§
source§impl Aead for XChaCha20Poly1305
impl Aead for XChaCha20Poly1305
source§fn encrypt(
key: &Key<Self>,
nonce: &Nonce<Self>,
associated_data: &[u8],
plaintext: &[u8],
ciphertext: &mut [u8],
tag: &mut Tag<Self>
) -> Result<()>
fn encrypt(
key: &Key<Self>,
nonce: &Nonce<Self>,
associated_data: &[u8],
plaintext: &[u8],
ciphertext: &mut [u8],
tag: &mut Tag<Self>
) -> Result<()>
Warning: type conversions on the tag type can be tricky. instead of &mut tag.try_into().unwrap()
use
(&mut tag).try_into().unwrap()
§type KeyLength = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>
type KeyLength = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>
The size of the
key
required by this algorithm.§type NonceLength = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>
type NonceLength = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>
The size of the
nonce
required by this algorithm.§type TagLength = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
type TagLength = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
The size of the
tag
produced by this algorithm.source§const NAME: &'static str = "XCHACHA20-POLY1305"
const NAME: &'static str = "XCHACHA20-POLY1305"
A human-friendly identifier of this algorithm.
source§fn decrypt(
key: &Key<Self>,
nonce: &Nonce<Self>,
associated_data: &[u8],
plaintext: &mut [u8],
ciphertext: &[u8],
tag: &Tag<Self>
) -> Result<usize>
fn decrypt(
key: &Key<Self>,
nonce: &Nonce<Self>,
associated_data: &[u8],
plaintext: &mut [u8],
ciphertext: &[u8],
tag: &Tag<Self>
) -> Result<usize>
source§const KEY_LENGTH: usize = <Self::KeyLength as Unsigned>::USIZE
const KEY_LENGTH: usize = <Self::KeyLength as Unsigned>::USIZE
A const version of
Aead::KeyLength
.source§const NONCE_LENGTH: usize = <Self::NonceLength as Unsigned>::USIZE
const NONCE_LENGTH: usize = <Self::NonceLength as Unsigned>::USIZE
A const version of
Aead::NonceLength
.source§const TAG_LENGTH: usize = <Self::TagLength as Unsigned>::USIZE
const TAG_LENGTH: usize = <Self::TagLength as Unsigned>::USIZE
A const version of
Aead::TagLength
.source§fn try_encrypt(
key: &[u8],
nonce: &[u8],
associated_data: &[u8],
plaintext: &[u8],
ciphertext: &mut [u8],
tag: &mut [u8]
) -> Result<()>
fn try_encrypt(
key: &[u8],
nonce: &[u8],
associated_data: &[u8],
plaintext: &[u8],
ciphertext: &mut [u8],
tag: &mut [u8]
) -> Result<()>
source§fn try_decrypt(
key: &[u8],
nonce: &[u8],
associated_data: &[u8],
plaintext: &mut [u8],
ciphertext: &[u8],
tag: &[u8]
) -> Result<usize>
fn try_decrypt(
key: &[u8],
nonce: &[u8],
associated_data: &[u8],
plaintext: &mut [u8],
ciphertext: &[u8],
tag: &[u8]
) -> Result<usize>
source§fn random_nonce() -> Result<Nonce<Self>>
fn random_nonce() -> Result<Nonce<Self>>
Generates a random nonce with the correct size for this algorithm.