util

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidBlockSize    = errors.New("invalid block size")
	ErrInvalidPKCS7Data    = errors.New("invalid PKCS7 data")
	ErrInvalidPKCS7Padding = errors.New("invalid padding on input")
)

Functions

func Decrypt

func Decrypt(v interface{}, sessionKey, encryptedData, ivStr string) error

func DecryptInfo added in v0.2.0

func DecryptInfo(v interface{}, sessionKey, rawData, encryptedData, signature, iv string) error

DecryptInfo 解密用户信息

sessionKey 微信 session_key rawData 不包括敏感信息的原始数据字符串,用于计算签名。 encryptedData 包括敏感数据在内的完整用户信息的加密数据 signature 使用 sha1( rawData + session_key ) 得到字符串,用于校验用户信息 iv 加密算法的初始向量

func Gen

func Gen(arr []string) (string, error)

func GenWithAmple

func GenWithAmple(arr []string) (string, error)

func HmacSha256 added in v0.2.0

func HmacSha256(str, key string) string

func IsAnyEmpty

func IsAnyEmpty(values ...string) bool

func Md5 added in v0.2.0

func Md5(str string) string

func NewTLSClient added in v0.2.0

func NewTLSClient(certPath, keyPath string) (*http.Client, error)

NewTLSClient 创建支持双向证书认证的 http.Client.

func Pkcs7Unpacked added in v0.2.0

func Pkcs7Unpacked(data []byte, blockSize int) ([]byte, error)

解压 pkcs7Unpacked returns slice of the original data without padding

func RandSeq

func RandSeq(n int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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