Module xchacha20

Source
Expand description

ยงXChaCha20Poly1305 operations

Contains low level XChaCha20Poly1305 operations used by the rest of the crate.

In most cases you should use the EncString with KeyEncryptable & KeyDecryptable instead.

Note: XChaCha20Poly1305 encrypts data, and authenticates both the cipher text and associated data. This does not provide key-commitment, and assumes there can only be one key.

If multiple keys are possible, a key-committing cipher such as XChaCha20Poly1305Blake3CTX should be used: https://github.com/bitwarden/sdk-internal/pull/41 to prevent invisible-salamander style attacks. https://eprint.iacr.org/2019/016.pdf https://soatok.blog/2024/09/10/invisible-salamanders-are-not-what-you-think/

Modulesยง

tests ๐Ÿ”’

Structsยง

XChaCha20Poly1305Ciphertext ๐Ÿ”’

Constantsยง

KEY_SIZE ๐Ÿ”’
NONCE_SIZE ๐Ÿ”’

Functionsยง

decrypt_xchacha20_poly1305 ๐Ÿ”’
encrypt_xchacha20_poly1305 ๐Ÿ”’
encrypt_xchacha20_poly1305_internal ๐Ÿ”’