Versions in this module Expand all Collapse all v1 v1.0.0 Mar 31, 2021 Changes in this version + const CipherV1 + const CipherV2 + const CipherV3 + const MaximumVersion + const MinimumVersion + const Version1 + const Version2 + const Version3 + const VersionLatest + var ErrDecryptFailed = errors.New("failed to decrypt data bag") + var ErrInvalidSecretKey = errors.New("key must be a non-empty byte array") + var ErrInvalidTarget = errors.New("target must be a non-nil pointer") + var ErrItemNotValid = errors.New("data is not an encrypted data bag item") + var ErrSignatureValidationFailed = errors.New("signature validation failed, an invalid secret key was most likely used") + var ErrUnsupportedVersion = errors.New("unsupported encryption version") + func Decrypt(key, data []byte, target interface{}) error + func IsEncryptedDataBagItem(data []byte) (bool, int, error) + func NewSecretKey(length int) ([]byte, error) + func NewSecretKeyBase64(length int) (*string, error) + type EncryptedDataBagItem interface + Decrypt func(key []byte, target interface{}) error + GetVersion func() int + IsValid func() bool + func Encrypt(key, data []byte, version int) (EncryptedDataBagItem, error) + type EncryptedDataBagItemV1 struct + Cipher string + EncryptedData string + IV string + Version int + func EncryptDataBagItemV1(key, jsonData []byte) (*EncryptedDataBagItemV1, error) + func (c *EncryptedDataBagItemV1) Decrypt(key []byte, target interface{}) error + func (c *EncryptedDataBagItemV1) GetVersion() int + func (c *EncryptedDataBagItemV1) IsValid() bool + type EncryptedDataBagItemV2 struct + Cipher string + EncryptedData string + HMAC string + IV string + Version int + func EncryptDataBagItemV2(key, data []byte) (*EncryptedDataBagItemV2, error) + func (c *EncryptedDataBagItemV2) Decrypt(key []byte, target interface{}) error + func (c *EncryptedDataBagItemV2) GetVersion() int + func (c *EncryptedDataBagItemV2) IsValid() bool + type EncryptedDataBagItemV3 struct + AuthTag string + Cipher string + EncryptedData string + IV string + Version int + func EncryptDataBagItemV3(key, jsonData []byte) (*EncryptedDataBagItemV3, error) + func (c *EncryptedDataBagItemV3) Decrypt(key []byte, target interface{}) error + func (c *EncryptedDataBagItemV3) GetVersion() int + func (c *EncryptedDataBagItemV3) IsValid() bool