crypto

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package crypto 消息的加解密功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypto

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

Crypto 加解密功能

func New

func New(appid, token, encodingAesKey string) (*Crypto, error)

New 声明一个 Crypto 实例

encodingAesKey 不需要结尾的 = 字符

func (*Crypto) Decrypt

func (c *Crypto) Decrypt(body []byte, sign, timestamp, nonce string) ([]byte, error)

Decrypt 解密 XML 内容

func (*Crypto) DecryptObject

func (c *Crypto) DecryptObject(body []byte, sign, timestamp, nonce string, object interface{}) error

DecryptObject 解密 XML 内容

func (*Crypto) Encrypt

func (c *Crypto) Encrypt(xmltext []byte, timestamp, nonce string) ([]byte, string, error)

Encrypt 加密 XML 内容

返回加密后的 XML 结构体内容以及签名内容

func (*Crypto) EncryptObject

func (c *Crypto) EncryptObject(xmlobj interface{}, timestamp, nonce string) ([]byte, string, error)

EncryptObject 将一个对象数据进行加密并发送

Jump to

Keyboard shortcuts

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