wxencrypter

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValidateSignatureError = errors.New("ValidateSignatureError")
	ParseXmlError          = errors.New("ParseXmlError")
	ComputeSignatureError  = errors.New("ComputeSignatureError")
	IllegalAesKey          = errors.New("IllegalAesKey")
	ValidateAppidError     = errors.New("ValidateAppidError")
	EncryptAESError        = errors.New("EncryptAESError")
	DecryptAESError        = errors.New("DecryptAESError")
	IllegalBuffer          = errors.New("IllegalBuffer")
	EncodeBase64Error      = errors.New("EncodeBase64Error")
	DecodeBase64Error      = errors.New("DecodeBase64Error")
	GenReturnXmlError      = errors.New("GenReturnXmlError")
)

Functions

func GenerateResponseXML

func GenerateResponseXML(encrypt, signature, timestamp, nonce string) (b []byte, err error)

func Sha1

func Sha1(token, timestamp, nonce, msg string) (ret string)

Types

type EncryptedRequestXML

type EncryptedRequestXML struct {
	XMLName    xml.Name `xml:"xml"`
	ToUserName string
	Encrypt    string
}

func ParseRequestXML

func ParseRequestXML(data []byte) (e EncryptedRequestXML, err error)

type EncryptedResponseXML

type EncryptedResponseXML struct {
	XMLName      xml.Name `xml:"xml"`
	TimeStamp    string
	Encrypt      string
	MsgSignature string
	Nonce        string
}

func ParseResponseXML

func ParseResponseXML(data []byte) (e EncryptedResponseXML, err error)

type Encrypter

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

func NewEncrypter

func NewEncrypter(token, encodingAesKey, appId string) (e *Encrypter, err error)

func (*Encrypter) Decrypt

func (e *Encrypter) Decrypt(msgSignature, timestamp, nonce string, data []byte) (b []byte, err error)

func (*Encrypter) Encrypt

func (e *Encrypter) Encrypt(replyMsg []byte) (b []byte, err error)

type PKCS7Encoder

type PKCS7Encoder interface {
	Encode([]byte) []byte
	Decode([]byte) []byte
}

type Prpcrypt

type Prpcrypt struct {
	Encoder PKCS7Encoder
	// contains filtered or unexported fields
}

func NewPrpcrypt

func NewPrpcrypt(key string) (p *Prpcrypt, err error)

func (*Prpcrypt) Decrypt

func (p *Prpcrypt) Decrypt(appId string, src string) (ret []byte, err error)

func (*Prpcrypt) Encrypt

func (p *Prpcrypt) Encrypt(appId string, src []byte) (ret string, err error)

type WechatErrorCode

type WechatErrorCode int
const (
	ValidateSignatureErrorCode WechatErrorCode = -40001 - iota
	ParseXmlErrorCode
	ComputeSignatureErrorCode
	IllegalAesKeyCode
	ValidateAppidErrorCode
	EncryptAESErrorCode
	DecryptAESErrorCode
	IllegalBufferCode
	EncodeBase64ErrorCode
	DecodeBase64ErrorCode
	GenReturnXmlErrorCode
)

Jump to

Keyboard shortcuts

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