Module iop_keyvault::encrypt[][src]

A thin integration of Argon2i and XChaCha20Poly1305 algorithms from the orion crate to encrypt/decrypt in-memory blobs with a password.

Functions

decrypt

Decrypts the ciphertext with a password. The format of the ciphertext is defined by the [encrypt] function. Only the matching password will decrypt the ciphertext.

encrypt

Encrypts the plaintext with a password. Make sure the password is not weak. Make sure to generate an exactly 24-byte random nonce for each call otherwise there is a chance of weakening the key if the same nonce is used more than once. The ciphertext returned will be 40 bytes longer than the plaintext.

nonce

Generates a 24-byte random nonce that can be used with the [encrypt] function.