Documentation ¶
Index ¶
- Constants
- func DeSkip32(key string, value uint32) (uint32, error)
- func DecodeAESCBC(data, key []byte) (contentBytes []byte, err error)
- func DecodeAESGCM(data, key []byte) (contentBytes []byte, err error)
- func EnSHA256(value string) string
- func EnSkip32(key string, value uint32) (uint32, error)
- func EncodeAESCBC(data, key []byte) (base64ContentBytes []byte, err error)
- func EncodeAESGCM(data, key []byte) (base64ContentBytes []byte, nonceBytes []byte, err error)
- func EncodeMD5(value string) string
- func RSADecryptionOaepSha256FromBase64(privateKeyByte []byte, ciphertextBase64Bytes []byte) (contentBytes []byte, err error)
- func RSAEncryptionOaepSha256ToBase64(publicKeyByte []byte, dataToEncryptBytes []byte) (base64ContentBytes []byte, err error)
- type GolangCharset
- type MapExtend
- type SignUtils
Constants ¶
const ( CharsetIso2022Jp GolangCharset = "ISO-2022-JP" CharsetIso2022Cn = "ISO-2022-CN" CharsetIso2022Kr = "ISO-2022-KR" CharsetIso88595 = "ISO-8859-5" CharsetIso88597 = "ISO-8859-7" CharsetIso88598 = "ISO-8859-8" CharsetBig5 = "BIG5" CharsetGb18030 = "GB18030" CharsetEucJp = "EUC-JP" CharsetEucKr = "EUC-KR" CharsetEucTw = "EUC-TW" CharsetShiftJis = "SHIFT_JIS" CharsetIbm855 = "IBM855" CharsetIbm866 = "IBM866" CharsetKoi8R = "KOI8-R" CharsetMacCyrillic = "x-mac-cyrillic" CharsetWindows1251 = "WINDOWS-1251" CharsetWindows1252 = "WINDOWS-1252" CharsetWindows1253 = "WINDOWS-1253" CharsetWindows1255 = "WINDOWS-1255" CharsetUtf8 = "UTF-8" CharsetUtf16Be = "UTF-16BE" CharsetUtf16Le = "UTF-16LE" CharsetUtf32Be = "UTF-32BE" CharsetUtf32Le = "UTF-32LE" CharsetTis620 = "WINDOWS-874" CharsetHzGb2312 = "HZ-GB-2312" CharsetXIso10646Ucs43412 = "X-ISO-10646-UCS-4-3412" CharsetXIso10646Ucs42143 = "X-ISO-10646-UCS-4-2143" )
字符编码类型常量
Variables ¶
This section is empty.
Functions ¶
func DecodeAESCBC ¶
DecodeAESCBC aes-256-cbc AES/CBC/PKCS5Padding
AES_CBC加密解密的算法为: aes-256-cbc, iv初始向量为随机16位字符串, padding为PKCS5Padding, 常用于HTTP中, 过程如下: 1.客户端发送加密请求体 ---> 2.服务器接收请求体并解密 ---> 3.服务器处理请求,返回加密响应体 ---> 4.客户端接收响应体并解密
解密数据处理的流程为: 先将iv拼接加密的数据进行Base64解码, 然后按照aes-256-cbc用key和iv对数据进行解密, 最后对数据进行zlib 6 level解压 即 AES_CBC解密: base64解密 --> AES解密 --> 解压缩
func DecodeAESGCM ¶
DecodeAESGCM aes-256-gcm AES/GCM/NoPadding
AES_GCM加密解密的算法为: aes-256-gcm, nonce为随机12位字符串, padding为NoPadding, 常用于HTTP中, 过程如下: 1.客户端发送加密请求体 ---> 2.服务器接收请求体并解密 ---> 3.服务器处理请求,返回加密响应体 ---> 4.客户端接收响应体并解密
解密数据处理的流程为: 先将nonce拼接加密的数据进行Base64解码, 然后按照aes-256-gcm用key和nonce对数据进行解密, 最后对数据进行zlib 6 level解压 即 AES_GCM解密: base64解密 --> AES解密 --> 解压缩
func EncodeAESCBC ¶
EncodeAESCBC aes-256-cbc AES/CBC/PKCS5Padding
AES_CBC加密解密的算法为: aes-256-cbc, iv初始向量为随机16位字符串, padding为PKCS5Padding, 常用于HTTP中, 过程如下: 1.客户端发送加密请求体 ---> 2.服务器接收请求体并解密 ---> 3.服务器处理请求,返回加密响应体 ---> 4.客户端接收响应体并解密
加密数据处理的流程为: 先对数据进行zlib 6 level压缩, 然后按照aes-256-cbc用key和iv对数据进行加密, 最后对iv拼接加密的数据进行Base64编码 即 AES_CBC加密: 压缩 --> AES加密 --> base64加密
func EncodeAESGCM ¶
func RSADecryptionOaepSha256FromBase64 ¶ added in v0.1.2
Types ¶
type SignUtils ¶
type SignUtils struct {
// contains filtered or unexported fields
}
SignUtils 签名类
func (*SignUtils) GetUtf8Bytes ¶
GetUtf8Bytes 默认utf8字符串
func (*SignUtils) SignTopRequest ¶
func (s *SignUtils) SignTopRequest(parameters *map[string]interface{}, secret string, signMethod GolangCharset) string
SignTopRequest
签名算法 parameters 要签名的数据项 secret 生成的publicKey signMethod 签名的字符编码