import "github.com/engmtcdrm/go-entomb"Package entomb allows for the encryption and decryption of data using the Fernet symmetric encryption algorithm. It includes additional salting, and hashing to enhance security.
- func Decrypt(key *Key, data []byte) ([]byte, error)
- func Encrypt(key *Key, msg []byte) ([]byte, error)
- type Key
func Decrypt
func Decrypt(key *Key, data []byte) ([]byte, error)Decrypts the data and returns the decrypted message.
func Encrypt
func Encrypt(key *Key, msg []byte) ([]byte, error)Encrypts the message and returns the encrypted data.
type Key
Key represents an encryption key with its associated Fernet key and encrypted passphrase.
type Key struct {
FernetKey *fernet.Key
EncryptedPassphrase []byte
}func GetKey
func GetKey(keyPath string, passphrase []byte) (*Key, error)GetKey generates a new encryption key or reads an existing one from the specified path. The passphrase is used for verfication when reading the key and tomb decryption.
func GetKeyHostUser
func GetKeyHostUser(keyPath string, useHost, useUser bool) (*Key, error)GetKeyHostUser generates a new encryption key or reads an existing one from the specified path. If useHost or useUser is true, the host/user hash will be included in the key to bind it to the host/user.
Generated by gomarkdoc