Documentation ¶
Overview ¶
Package encrypt provides the encrypter for the application.
Index ¶
- func Decrypt(ciphertextBase64 string, key []byte, encryptMethod Type) ([]byte, error)
- func Encrypt(plaintext, key []byte, encryptMethod Type) (string, error)
- func PKCS7Padding(data []byte, blockSize int) []byte
- func PKCS7Unpadding(data []byte) []byte
- type Container
- type DynamicEncrypter
- type Encrypter
- type StaticEncrypter
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts ciphertext using the specified encryption method with the given key.
func Encrypt ¶
Encrypt encrypts plaintext using the specified encryption method with the given key and IV.
func PKCS7Padding ¶
PKCS7Padding adds padding to the plaintext to make it a multiple of the block size.
func PKCS7Unpadding ¶
PKCS7Unpadding removes padding from the plaintext.
Types ¶
type Container ¶
Container is the container for the encrypter.
func NewContainerFromConfig ¶
NewContainerFromConfig creates a new encrypter container.
type DynamicEncrypter ¶
type DynamicEncrypter struct {
// contains filtered or unexported fields
}
DynamicEncrypter is the dynamic encrypter.
func NewDynamicEncrypter ¶
func NewDynamicEncrypter( str store.Store, storeBucketID, storeKey string, method Type, ) (*DynamicEncrypter, error)
NewDynamicEncrypter creates a new dynamic encrypter.
type Encrypter ¶
type Encrypter interface { Encrypt(plaintext []byte) (string, error) Decrypt(ciphertextBase64 string) ([]byte, error) }
Encrypter is the interface for the encrypter.
type StaticEncrypter ¶
type StaticEncrypter struct {
// contains filtered or unexported fields
}
StaticEncrypter is the static encrypter.
func NewStaticEncrypter ¶
func NewStaticEncrypter(key []byte, method Type) (*StaticEncrypter, error)
NewStaticEncrypter creates a new static encrypter.