Skip to main content

Module encryption

Module encryption 

Source

Structs§

EncryptedEncodedContent
Ciphertext and the parameters needed to decrypt it.
EncryptedPayload
Encrypted payload containing the ciphertext and encryption parameters.
EncryptionKeys
Parameters for the existing remote-attachment encryption scheme.

Constants§

AES_GCM_NONCE_SIZE
Size of the AES-GCM nonce in bytes (96-bit)
AES_GCM_TAG_SIZE
Size of the AES-GCM authentication tag in bytes (128-bit)
HKDF_SALT_SIZE
Size of the HKDF salt in bytes (256-bit)
SECRET_SIZE
Size of the encryption secret in bytes (256-bit)

Functions§

decrypt
Decrypts ciphertext that was encrypted with encrypt.
decrypt_bytes
Checks the length and digest before decrypting arbitrary bytes.
decrypt_encoded_content
Decrypts a protobuf envelope encrypted with encrypt_encoded_content.
derive_key
Derives an AES-256 key from a secret and salt using HKDF-SHA256.
encrypt
Encrypts plaintext using AES-256-GCM with HKDF-SHA256 key derivation.
encrypt_bytes
Encrypts arbitrary bytes with the remote-attachment scheme.
encrypt_encoded_content
Encrypts the protobuf envelope, not only its content field.
sha256
Computes the SHA-256 hash of the given bytes.