encrypter

package
v0.0.0-...-5f3621a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: MulanPSL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCBCEncrypt

func AesCBCEncrypt(rawData []byte, key []byte) ([]byte, []byte, error)

aes加密,填充秘钥key的16位,24,32分别对应AES-128, AES-192, or AES-256.

func AesCbcDecrypt

func AesCbcDecrypt(enData []byte, key []byte, iv []byte) ([]byte, error)

func Decrypt

func Decrypt(secret string, data string, v interface{}) (err error)

func DecryptString

func DecryptString(secret string, data string) (string, error)

func Encrypt

func Encrypt(secret string, data interface{}) (string, error)

func EncryptString

func EncryptString(secret string, data string) (string, error)

func HashSha256

func HashSha256(src string) string

func Md5

func Md5(str string) string

func NullUnPadding

func NullUnPadding(in []byte) []byte

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(data []byte) []byte

func PasswordHash

func PasswordHash(password string) (string, error)

func PasswordVerify

func PasswordVerify(password, hash string) bool

Types

type ApiDataEncrypter

type ApiDataEncrypter struct {
	Key                     string
	AppId                   string
	Timeout                 time.Duration
	SslVerify               bool
	SslClientCertPemPath    string
	SslClientCertPemContent []byte
	SslClientCertPemKey     []byte
	// contains filtered or unexported fields
}

func (*ApiDataEncrypter) BuildEnParams

func (ae *ApiDataEncrypter) BuildEnParams(params url.Values, data map[string]interface{}) (url.Values, error)

func (*ApiDataEncrypter) Decrypt

func (ae *ApiDataEncrypter) Decrypt(data string, v interface{}, debug ...bool) error

func (*ApiDataEncrypter) DecryptRaw

func (ae *ApiDataEncrypter) DecryptRaw(data string, v interface{}) error

func (*ApiDataEncrypter) DecryptString

func (ae *ApiDataEncrypter) DecryptString(data string) (string, error)

func (*ApiDataEncrypter) Encrypt

func (ae *ApiDataEncrypter) Encrypt(data interface{}) (string, error)

func (*ApiDataEncrypter) EncryptString

func (ae *ApiDataEncrypter) EncryptString(data string) (string, error)

func (*ApiDataEncrypter) Request

func (ae *ApiDataEncrypter) Request(method string, remoteUrl string, data map[string]interface{}, params url.Values, headers map[string]string, timeout ...time.Duration) (*http.Response, error)

func (*ApiDataEncrypter) RequestJson

func (ae *ApiDataEncrypter) RequestJson(v interface{}, method string, remoteUrl string, data map[string]interface{}, params url.Values, headers map[string]string, timeout ...time.Duration) error

func (*ApiDataEncrypter) RequestJsonDecryptData

func (ae *ApiDataEncrypter) RequestJsonDecryptData(v interface{}, method string, remoteUrl string, data map[string]interface{}, params url.Values, headers map[string]string, timeout ...time.Duration) (err error)

func (*ApiDataEncrypter) RequestJsonDecryptString

func (ae *ApiDataEncrypter) RequestJsonDecryptString(method string, remoteUrl string, data map[string]interface{}, params url.Values, headers map[string]string, timeout ...time.Duration) (resStr string, err error)

func (*ApiDataEncrypter) SetTimeout

func (ae *ApiDataEncrypter) SetTimeout(timeout time.Duration) *ApiDataEncrypter

func (*ApiDataEncrypter) SignRequest

func (ae *ApiDataEncrypter) SignRequest(method string, remoteUrl string, params url.Values, headers map[string]string, timeout ...time.Duration) (resp *http.Response, err error)

func (*ApiDataEncrypter) SignRequestJson

func (ae *ApiDataEncrypter) SignRequestJson(v interface{}, method string, remoteUrl string, params url.Values, headers map[string]string, timeout ...time.Duration) error

type ApiReturnJson

type ApiReturnJson struct {
	Status  bool        `json:"status"`
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Errors  []string    `json:"errors"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL