Documentation
¶
Overview ¶
Package crypt provides functions to encrypt and decrypt data using AES encryption with RSA key exchange. It uses AES-256 for symmetric encryption and RSA for asymmetric encryption. The AES key is randomly generated for each encryption operation and is encrypted with the recipient's public RSA key.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts data that was encrypted with the Encrypt function. It uses the provided private RSA key to decrypt the AES key, and then uses that AES key to decrypt data. If data is nil or empty, nil is returned without error. The additionalData parameter should match the one used during encryption for authenticated decryption.
func Encrypt ¶
Encrypt encrypts data using AES-256 encryption with a randomly generated key. The AES key is then encrypted with the recipient's public RSA key. If data is nil or empty, nil is returned without error. The additionalData parameter can be used to provide additional authenticated data (AAD) for the encryption process.
Types ¶
This section is empty.