Documentation ¶
Overview ¶
Package algorithms contains implementations of various crypto algorithms for the crypto engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownAlgorithm is returned when an incorrect algorithm name is used. ErrUnknownAlgorithm = errors.New("unexpected encryption algorithm") // ErrExceedsMaxSize is returned when the plaintext is too large. ErrExceedsMaxSize = errors.New("plaintext is too large, limited to 32MiB") )
Functions ¶
This section is empty.
Types ¶
type AES256CFBAlgorithm ¶
type AES256CFBAlgorithm struct{}
AES256CFBAlgorithm implements the AES-256-CFB algorithm
type AES256GCMAlgorithm ¶
type AES256GCMAlgorithm struct{}
AES256GCMAlgorithm provides symmetric authenticated encryption using 256-bit AES-GCM with a random nonce.
func (*AES256GCMAlgorithm) Decrypt ¶
func (_ *AES256GCMAlgorithm) Decrypt(ciphertext []byte, key []byte) ([]byte, error)
Decrypt decrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.
func (*AES256GCMAlgorithm) Encrypt ¶
func (_ *AES256GCMAlgorithm) Encrypt(plaintext []byte, key []byte) ([]byte, error)
Encrypt encrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.
type EncryptionAlgorithm ¶
type EncryptionAlgorithm interface { Encrypt(plaintext []byte, key []byte) ([]byte, error) Decrypt(ciphertext []byte, key []byte) ([]byte, error) }
EncryptionAlgorithm represents a crypto algorithm used by the Engine
func NewFromType ¶
func NewFromType(algoType Type) (EncryptionAlgorithm, error)
NewFromType instantiates an encryption algorithm by name
type Type ¶
type Type string
Type is an enum of supported encryption algorithms
func TypeFromString ¶
TypeFromString attempts to map a string to a `Type` value.