1.3 KiB
1.3 KiB
git.sa-roci.de/oss/go_encryption
An extensible encryption package with an implementation for AES-128Bit en-/decryption functionality.
type IEncryptionProvider interface {
// SetEncryptionKey allows to modify the encryption key.
SetEncryptionKey(key []byte)
// SetContext allows to modify the encryption context.
SetContext(context []byte) (err error)
// Encrypt tries to encrypt the given binary with the appropriate cipher.
Encrypt(binary []byte) (encrypted []byte, err error)
// EncryptData returns the given data as JSON in encrypted form.
EncryptData(data interface{}) (encrypted []byte, err error)
// EncryptToFile saves the given data to the given filepath as JSON in encrypted form.
EncryptToFile(data interface{}, filepath string) (err error)
// Decrypt tries to decrypt the given binary with the appropriate cipher.
Decrypt(binary []byte) (decrypted []byte, err error)
// DecryptData tries to decrypt the given binary and to unmarshal the resulting JSON to the target interface.
DecryptData(binary []byte, target interface{}) (err error)
// DecryptData tries to decrypt the content of the file specified and to unmarshal the resulting JSON to the target interface.
DecryptFile(path string, target interface{}) (err error)
}