utils

package
v2.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

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模块包含了客户端加解密相关内容 本工具目前仅支持AES-GCM-NoPadding加密方式

func NewCrypto

func NewCrypto(key []byte) (cry *Crypto, err error)

NewCrypto构造一个新的Crypto,传入你的加密密钥 加密密钥位数限定16,24或32,分别对应AES-128,AES-192或AES-256算法 本工具中,GCM下NonceSize为默认长度12,不提供修改接口 如若修改NonceSize,请自行实现并务必牢记加解密保持一致

func (*Crypto) Decrypt

func (c *Crypto) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt实现数据解密

func (*Crypto) Encrypt

func (c *Crypto) Encrypt(plaintext []byte) ([]byte, error)

Encrypt实现数据加密

Jump to

Keyboard shortcuts

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