Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(cipherString, key string) ([]byte, error)
- func Encrypt(originalBytes []byte, key string, o *EncryptOptions) (string, error)
- type BlockMode
- type EncryptOptions
- type EncryptionAlgorithm
- type PaddingMethod
- type String
- func (e String) MarshalJSON() ([]byte, error)
- func (e String) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error)
- func (e *String) ProtoMessage()
- func (e *String) Reset()
- func (e String) Size() int
- func (e *String) String() string
- func (e *String) UnmarshalJSON(bytes []byte) error
- func (e *String) UnmarshalJSONPB(_ *jsonpb.Unmarshaler, bytes []byte) error
- func (e String) UnsafeString() (string, error)
- func (e *String) XXX_WellKnownType() string
- type WithOptionsFunc
Constants ¶
View Source
const (
BlockModeCBC = 0x00
)
Variables ¶
View Source
var SecretEnvName = "GLOBAL_ENCRYPT_KEY"
Functions ¶
Types ¶
type EncryptOptions ¶
type EncryptOptions struct {
// contains filtered or unexported fields
}
func NewEncryptOptions ¶
func NewEncryptOptions(ofs ...WithOptionsFunc) *EncryptOptions
type EncryptionAlgorithm ¶
type EncryptionAlgorithm byte
const ( Algorithm3DES EncryptionAlgorithm = 0 AlgorithmDES EncryptionAlgorithm = 1 AlgorithmAES EncryptionAlgorithm = 2 AlgorithmTEA EncryptionAlgorithm = 3 )
func (EncryptionAlgorithm) NewCipher ¶
func (algo EncryptionAlgorithm) NewCipher(key []byte) (cipher.Block, error)
func (EncryptionAlgorithm) String ¶
func (algo EncryptionAlgorithm) String() string
type PaddingMethod ¶
type PaddingMethod byte
const (
PKCS5Padding PaddingMethod = 0x00
)
type String ¶
type String struct { Value string // contains filtered or unexported fields }
func NewEncryptedString ¶
func (String) MarshalJSON ¶
func (*String) ProtoMessage ¶
func (e *String) ProtoMessage()
func (*String) UnmarshalJSON ¶
func (*String) UnmarshalJSONPB ¶
func (e *String) UnmarshalJSONPB(_ *jsonpb.Unmarshaler, bytes []byte) error
func (String) UnsafeString ¶
func (*String) XXX_WellKnownType ¶
type WithOptionsFunc ¶
type WithOptionsFunc func(o *EncryptOptions)
func WithAlgorithm ¶
func WithAlgorithm(algo EncryptionAlgorithm) WithOptionsFunc
func WithMode ¶
func WithMode(mode BlockMode) WithOptionsFunc
func WithPadding ¶
func WithPadding(padding PaddingMethod) WithOptionsFunc
Click to show internal directories.
Click to hide internal directories.