Documentation
¶
Overview ¶
Package encryption provides functions for encrypting and decrypting data using AES-256-GCM.
Note: You MUST call InitEncryption before using any encryption functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts the given ciphertext using AES-256-GCM with the provided key.
The key should be 32 bytes (256 bits) for AES-256. If usedBinaryData is true, the ciphertext should be a byte slice or it will return an error. Unlike Encrypt, decrypt is going to return the plaintext as a byte slice.
func Encrypt ¶
Encrypt encrypts the given plaintext using AES-256-GCM with the provided key.
The key should be 32 bytes (256 bits) for AES-256. If useBinaryData is true, the ciphertext will be returned as a byte slice. The return will be in the format of string (useBinaryData = false) or []byte (useBinaryData = true).
func GenerateRandomKey ¶ added in v0.0.21
GenerateRandomKey generates a random key of the specified length. For AES-256, the length should be 32 bytes.
func InitEncryption ¶ added in v0.0.21
func InitEncryption(setNoncePoolSize int)
InitEncryption should be run before any (de)encryption operations.
Types ¶
This section is empty.