Documentation ¶
Overview ¶
Package encryption defines the various encryption Algorithms supported by the gormcrypto package
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAlgo ¶
RegisterAlgo adds an Algorithm to the internal algos map so it can be used in YAML configs
func SupportedAlgos ¶
func SupportedAlgos() []string
SupportedAlgos returns a list of registered Algorithms that can be used in YAML configs
Types ¶
type AES256CBC ¶
type AES256CBC struct { Algorithm // contains filtered or unexported fields }
AES256CBC supports AES256CBC encryption of arbitrary data
func NewAES256CBC ¶
NewAES256CBC creates a new AES256CBC value
func (AES256CBC) Config ¶
Config converts an Algorthim's internal configuration into a map for export
type AES256GCM ¶
type AES256GCM struct { Algorithm // contains filtered or unexported fields }
AES256GCM supports AES256GCM encryption of arbitrary data
func NewAES256GCM ¶
NewAES256GCM creates instance of AES256GCM with passed key
func (AES256GCM) Config ¶
Config converts an Algorthim's internal configuration into a map for export
type Algorithm ¶
type Algorithm interface { // Name identifies the Algorithm as a string for exporting configurations Name() string // Config converts an Algorthim's internal configuration into a map for export Config() map[string]interface{} // Encrypt transforms plaintext values into a securely encrypted binary representation. Encrypt([]byte) ([]byte, error) // Decrypt transforms a securely encrypted binary value into its plaintext version. Decrypt([]byte) ([]byte, error) }
Algorithm defines an interface that encryption types must implement to be usable with gormcrypto. A type implementing encryption.Algorithm will convert a value to and from its serialized and encrypted representations. The types implemented here wrap the Go standard (and extended) library's various (non-deprecated) crypto packages.
type ChaCha20Poly1305 ¶
type ChaCha20Poly1305 struct { Algorithm // contains filtered or unexported fields }
ChaCha20Poly1305 supports ChaCha20Poly1305 encryption of arbitrary data
func NewChaCha20Poly1305 ¶
func NewChaCha20Poly1305(key string) (*ChaCha20Poly1305, error)
NewChaCha20Poly1305 creates instance of ChaCha20Poly1305 with passed key
func (ChaCha20Poly1305) Config ¶
func (e ChaCha20Poly1305) Config() map[string]interface{}
Config converts an Algorthim's internal configuration into a map for export
func (*ChaCha20Poly1305) Decrypt ¶
func (e *ChaCha20Poly1305) Decrypt(crypted []byte) ([]byte, error)
Decrypt decrypts data with key
func (*ChaCha20Poly1305) Encrypt ¶
func (e *ChaCha20Poly1305) Encrypt(plain []byte) ([]byte, error)
Encrypt encrypts data with key
func (ChaCha20Poly1305) Name ¶
func (ChaCha20Poly1305) Name() string
Name identifies the Algorithm as a string for exporting configurations
type NaClBox ¶
type NaClBox struct { Algorithm // contains filtered or unexported fields }
NaClBox supports NaClBox enrcryption of arbitrary data
func NewNaClBox ¶
NewNaClBox creates a new NaClBox value
type RSA ¶
type RSA struct { Algorithm // contains filtered or unexported fields }
RSA supports RSA
type XChaCha20Poly1305 ¶
type XChaCha20Poly1305 struct { Algorithm // contains filtered or unexported fields }
XChaCha20Poly1305 supports XChaCha20Poly1305
func NewXChaCha20Poly1305 ¶
func NewXChaCha20Poly1305(key string) (*XChaCha20Poly1305, error)
NewXChaCha20Poly1305 creates instance of XChaCha20Poly1305 with passed key
func (XChaCha20Poly1305) Config ¶
func (e XChaCha20Poly1305) Config() map[string]interface{}
Config converts an Algorthim's internal configuration into a map for export
func (*XChaCha20Poly1305) Decrypt ¶
func (e *XChaCha20Poly1305) Decrypt(crypted []byte) ([]byte, error)
Decrypt decrypts data with key
func (*XChaCha20Poly1305) Encrypt ¶
func (e *XChaCha20Poly1305) Encrypt(plain []byte) ([]byte, error)
Encrypt encrypts data with key
func (XChaCha20Poly1305) Name ¶
func (XChaCha20Poly1305) Name() string
Name identifies the Algorithm as a string for exporting configurations