crypto

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidateSignatureError int = -40001
	ParseXmlError          int = -40002
	ComputeSignatureError  int = -40003
	IllegalAesKey          int = -40004
	ValidateCorpIdError    int = -40005
	EncryptAESError        int = -40006
	DecryptAESError        int = -40007
	IllegalBuffer          int = -40008
	EncodeBase64Error      int = -40009
	DecodeBase64Error      int = -40010
	GenXmlError            int = -40010
	ParseJsonError         int = -40012
	GenJsonError           int = -40013
	IllegalProtocolType    int = -40014
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CDATA

type CDATA struct {
	Value string `xml:",cdata"`
}

type CryptError

type CryptError struct {
	ErrCode int
	ErrMsg  string
}

func NewCryptError

func NewCryptError(errCode int, errMsg string) *CryptError

type ProtocolProcessor

type ProtocolProcessor interface {
	// contains filtered or unexported methods
}

type ProtocolType

type ProtocolType int
const (
	XmlType ProtocolType = 1
)

type WXBizMsg4Recv

type WXBizMsg4Recv struct {
	ToUserName string `xml:"ToUserName"`
	Encrypt    string `xml:"Encrypt"`
	AgentID    string `xml:"AgentID"`
}

type WXBizMsg4Send

type WXBizMsg4Send struct {
	XMLName   xml.Name `xml:"xml"`
	Encrypt   CDATA    `xml:"Encrypt"`
	Signature CDATA    `xml:"MsgSignature"`
	Timestamp string   `xml:"TimeStamp"`
	Nonce     CDATA    `xml:"Nonce"`
}

func NewWXBizMsg4Send

func NewWXBizMsg4Send(encrypt, signature, timestamp, nonce string) *WXBizMsg4Send

type WXBizMsgCrypt

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

func NewWXBizMsgCrypt

func NewWXBizMsgCrypt(token, encodingAesKey, receiverId string, protocolType ProtocolType) *WXBizMsgCrypt

func (*WXBizMsgCrypt) DecryptMsg

func (r *WXBizMsgCrypt) DecryptMsg(msgSignature, timestamp, nonce string, postData []byte) ([]byte, *CryptError)

func (*WXBizMsgCrypt) EncryptMsg

func (r *WXBizMsgCrypt) EncryptMsg(replyMsg, timestamp, nonce string) ([]byte, *CryptError)

func (*WXBizMsgCrypt) ParsePlainText

func (r *WXBizMsgCrypt) ParsePlainText(plaintext []byte) ([]byte, uint32, []byte, []byte, *CryptError)

func (*WXBizMsgCrypt) VerifyURL

func (r *WXBizMsgCrypt) VerifyURL(msgSignature, timestamp, nonce, echoStr string) ([]byte, *CryptError)

type XmlProcessor

type XmlProcessor struct {
}

Jump to

Keyboard shortcuts

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