crypto_secretbox

Type Alias XSalsa20Poly1305

Source
pub type XSalsa20Poly1305 = SecretBox<Salsa20>;
Expand description

crypto_secretbox instantiated with the XSalsa20 stream cipher.

Aliased Type§

struct XSalsa20Poly1305 { /* private fields */ }

Implementations

Source§

impl<C> SecretBox<C>

Source

pub const KEY_SIZE: usize = 32usize

Size of an XSalsa20Poly1305 key in bytes

Source

pub const NONCE_SIZE: usize = 24usize

Size of an XSalsa20Poly1305 nonce in bytes

Source

pub const TAG_SIZE: usize = 16usize

Size of a Poly1305 tag in bytes

Trait Implementations

Source§

impl<C> AeadCore for SecretBox<C>

Source§

type NonceSize = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>

The length of a nonce.
Source§

type TagSize = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>

The maximum length of the nonce.
Source§

type CiphertextOverhead = UTerm

The upper bound amount of additional space required to support a ciphertext vs. a plaintext.
Source§

fn generate_nonce( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::NonceSize>

Generate a random nonce for this AEAD algorithm. Read more
Source§

impl<C> AeadInPlace for SecretBox<C>
where C: Kdf + KeyIvInit + KeySizeUser<KeySize = U32> + IvSizeUser<IvSize = U8> + StreamCipher,

Source§

fn encrypt_in_place( &self, nonce: &Nonce, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<(), Error>

Encrypt the given buffer containing a plaintext message in-place. Read more
Source§

fn encrypt_in_place_detached( &self, nonce: &Nonce, associated_data: &[u8], buffer: &mut [u8], ) -> Result<Tag, Error>

Encrypt the data in-place, returning the authentication tag
Source§

fn decrypt_in_place( &self, nonce: &Nonce, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<(), Error>

Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext. Read more
Source§

fn decrypt_in_place_detached( &self, nonce: &Nonce, associated_data: &[u8], buffer: &mut [u8], tag: &Tag, ) -> Result<(), Error>

Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext (i.e. ciphertext is modified/unauthentic)
Source§

impl<C> Clone for SecretBox<C>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C> Drop for SecretBox<C>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<C> Kdf for SecretBox<C>
where C: Kdf,

Source§

fn kdf(key: &Key, nonce: &GenericArray<u8, U16>) -> Key

Derive a new key from the provided input key and nonce.
Source§

impl<C> KeyInit for SecretBox<C>

Source§

fn new(key: &Key) -> Self

Create new value from fixed size key.
Source§

fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>

Create new value from variable size key.
Source§

fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>

Generate random key using the provided CryptoRng.
Source§

impl<C> KeySizeUser for SecretBox<C>

Source§

type KeySize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

Key size in bytes.
Source§

fn key_size() -> usize

Return key size in bytes.