crypto

package
v0.0.0-...-245a666 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyedSignatured

func KeyedSignatured(values map[string]string) []byte

KeyedSignatured signature url query parameters with keys, used for jsapi ticket. https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115

func RandString

func RandString(n int) []byte

func Signature

func Signature(message []string) []byte

Signature signature generator for wechat message

Types

type CryptoError

type CryptoError struct {
	Detail string
	Err    error
}

func (CryptoError) Error

func (e CryptoError) Error() string

type MessageCrypto

type MessageCrypto struct {
	Token string
	AppID string
	// contains filtered or unexported fields
}

func New

func New(encodingAESKey, token, appID string) (*MessageCrypto, error)

New wechat message crypto

func (*MessageCrypto) Decrypt

func (mc *MessageCrypto) Decrypt(src []byte, signature, nonce, timestamp string) (msg []byte, err error)

Decrypt and validate wechat message

func (*MessageCrypto) Encrypt

func (mc *MessageCrypto) Encrypt(msg []byte, nonce, timestamp string) (data []byte, err error)

Encrypt a message object into xml marshaled encrypted message

Jump to

Keyboard shortcuts

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