[][src]Function iop_keyvault::encrypt::encrypt

pub fn encrypt(
    plaintext: impl AsRef<[u8]>,
    pw: impl AsRef<str>,
    nonce: impl AsRef<[u8]>
) -> Result<Vec<u8>>

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.