Skip to main content

Module crypto

Module crypto 

Source

Constants§

NONCE_LEN
TAG_LEN

Functions§

decrypt_data
Decrypt data that was encrypted with encrypt_data, returns the original plaintext or an error if decryption fails.
decrypt_into
Decrypt input (which should be in the format produced by encrypt_into) into output using AES-256-GCM with the provided 32-byte key. The output buffer must be input.len() - NONCE_LEN - TAG_LEN bytes, returns the number of bytes written to output (the length of the decrypted plaintext) or an error if decryption fails.
encrypt_data
Encrypt data with a 32-byte key using AES-256-GCM, returns a byte vector containing the nonce, ciphertext, and tag or an error if encryption fails.
encrypt_into
Encrypt input into output using AES-256-GCM with the provided 32-byte key. The output buffer must be at least input.len() + NONCE_LEN + TAG_LEN bytes long, returns the total number of bytes written to output (nonce + ciphertext + tag) or an error if encryption fails.
generate_x25519_keypair
Generates and returns a new X25519 keypair (private_key, public_key)