crypt

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateSignature added in v0.0.10

func CalculateSignature(token, timestamp, nonce, data string) (string, error)

CalculateSignature 计算SHA1签名

func Decrypt

func Decrypt(sessionKey, encryptedData, iv string) ([]byte, error)

Decrypt 解密加密信息获取微信用户信息

Types

type CBCEncryptor

type CBCEncryptor struct {
	// contains filtered or unexported fields
}

CBCEncryptor 加解密核心类

func (*CBCEncryptor) Decrypt

func (p *CBCEncryptor) Decrypt(text, appid string) ([]byte, error)

Decrypt 解密

func (*CBCEncryptor) Encrypt

func (p *CBCEncryptor) Encrypt(text, appid string) (string, error)

Encrypt 加密

type EncryptResult

type EncryptResult struct {
	Encrypt      string `xml:"Encrypt" json:"Encrypt"`
	MsgSignature string `xml:"MsgSignature" json:"MsgSignature"`
	Timestamp    string `xml:"Timestamp" json:"Timestamp"`
	Nonce        string `xml:"Nonce" json:"Nonce"`
}

type PKCS7Encoder

type PKCS7Encoder struct {
	BlockSize int
}

PKCS7Encoder PKCS7填充

func (*PKCS7Encoder) Decode

func (p *PKCS7Encoder) Decode(decrypted []byte) []byte

Decode PKCS7去除填充

func (*PKCS7Encoder) Encode

func (p *PKCS7Encoder) Encode(text []byte) []byte

Encode PKCS7填充

type WXBizMsgCrypt

type WXBizMsgCrypt struct {
	// contains filtered or unexported fields
}

WXBizMsgCrypt 微信消息加解密主类

func NewBizMsgCrypt

func NewBizMsgCrypt(appIdOrCorpId, token, encodingAESKey string) (*WXBizMsgCrypt, error)

NewBizMsgCrypt 创建WXBizMsgCrypt实例

func (*WXBizMsgCrypt) Decrypt

func (w *WXBizMsgCrypt) Decrypt(msgSignature, timestamp, nonce, encryptedData string) ([]byte, error)

Decrypt 解密消息

func (*WXBizMsgCrypt) Encrypt

func (w *WXBizMsgCrypt) Encrypt(replyMsg, nonce string, timestamp ...string) (*EncryptResult, error)

Encrypt 加密消息

Jump to

Keyboard shortcuts

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