Documentation ¶
Index ¶
- Variables
- func EncodeMD5(value string) string
- func ParsePKCS1Or8PrivKey(key []byte) (*rsa.PrivateKey, error)
- func ParsePublicKey(key []byte) (*rsa.PublicKey, error)
- func RSADecrypt(ciphertext, privateKey []byte) ([]byte, error)
- func RSADecryptBase64(b64Cipher string, privateKey []byte) ([]byte, error)
- func RSAEncrypt(origData, publicKey []byte) ([]byte, error)
- func RSAEncryptBase64(origData, publicKey []byte) (string, error)
- func RSAEncryptDERType(origData, publicDERKey []byte) ([]byte, error)
- func RSASign(text []byte, privateKey string, hashType crypto.Hash) ([]byte, error)
- func RSASignBase64(text []byte, privateKey string, hashType crypto.Hash) (string, error)
- func RSAVerifySign(text []byte, publicKey string, hashType crypto.Hash, sig []byte) error
- func RSAVerifySignBase64(b64Cipher, publicKey string, hashType crypto.Hash, text []byte) error
- func SHA256(data []byte) string
- func SHA256Sign(httpMethod, url, dateTime, signKey string, body []byte) (string, error)
- func SHA256WithRSA(data, privateKey []byte, noneWithRsa bool) ([]byte, error)
- func SHA256WithRSABase64(data, privateKey []byte) (string, error)
- func VerifySHA256WithRSABase64(origin []byte, b64Sign, publicKey string) error
- type AESCFBMode
Constants ¶
This section is empty.
Variables ¶
View Source
var PrivateKey = []byte(`
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDZsfv1qscqYdy4vY+P4e3cAtmvppXQcRvrF1cB4drkv0haU24Y
7m5qYtT52Kr539RdbKKdLAM6s20lWy7+5C0DgacdwYWd/7PeCELyEipZJL07Vro7
Ate8Bfjya+wltGK9+XNUIHiumUKULW4KDx21+1NLAUeJ6PeW+DAkmJWF6QIDAQAB
AoGBAJlNxenTQj6OfCl9FMR2jlMJjtMrtQT9InQEE7m3m7bLHeC+MCJOhmNVBjaM
ZpthDORdxIZ6oCuOf6Z2+Dl35lntGFh5J7S34UP2BWzF1IyyQfySCNexGNHKT1G1
XKQtHmtc2gWWthEg+S6ciIyw2IGrrP2Rke81vYHExPrexf0hAkEA9Izb0MiYsMCB
/jemLJB0Lb3Y/B8xjGjQFFBQT7bmwBVjvZWZVpnMnXi9sWGdgUpxsCuAIROXjZ40
IRZ2C9EouwJBAOPjPvV8Sgw4vaseOqlJvSq/C/pIFx6RVznDGlc8bRg7SgTPpjHG
4G+M3mVgpCX1a/EU1mB+fhiJ2LAZ/pTtY6sCQGaW9NwIWu3DRIVGCSMm0mYh/3X9
DAcwLSJoctiODQ1Fq9rreDE5QfpJnaJdJfsIJNtX1F+L3YceeBXtW0Ynz2MCQBI8
9KP274Is5FkWkUFNKnuKUK4WKOuEXEO+LpR+vIhs7k6WQ8nGDd4/mujoJBr5mkrw
DPwqA3N5TMNDQVGv8gMCQQCaKGJgWYgvo3/milFfImbp+m7/Y3vCptarldXrYQWO
AQjxwc71ZGBFDITYvdgJM1MTqc8xQek1FXn1vfpy2c6O
-----END RSA PRIVATE KEY-----
`)
View Source
var PublicKey = []byte(`
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZsfv1qscqYdy4vY+P4e3cAtmv
ppXQcRvrF1cB4drkv0haU24Y7m5qYtT52Kr539RdbKKdLAM6s20lWy7+5C0Dgacd
wYWd/7PeCELyEipZJL07Vro7Ate8Bfjya+wltGK9+XNUIHiumUKULW4KDx21+1NL
AUeJ6PeW+DAkmJWF6QIDAQAB
-----END PUBLIC KEY-----
`)
Functions ¶
func ParsePKCS1Or8PrivKey ¶
func ParsePKCS1Or8PrivKey(key []byte) (*rsa.PrivateKey, error)
func RSADecryptBase64 ¶
RSADecryptBase64 RSA 解密 Base64 密文
func RSAEncryptBase64 ¶
RSAEncryptBase64 RSA 加密 Base64 密文
func RSAEncryptDERType ¶
RSAEncryptDERType RSA加密,密钥是 DER 格式
func RSASignBase64 ¶
RSASign RSA 签名 Base64
func RSAVerifySign ¶
RSAVerifySign RSA验证签名
func RSAVerifySignBase64 ¶
RSAVerifySignBase64 RSA验证Base64签名
func SHA256Sign ¶
SHA256Sign 共用的签名算法
func SHA256WithRSA ¶
SHA256WithRSA SHA256WithRSA签名算法签名
func SHA256WithRSABase64 ¶
SHA256WithRSABase64 SHA256WithRSA签名算法签名,返回base64编码后的签名
func VerifySHA256WithRSABase64 ¶
VerifySHA256WithRSABase64 SHA256WithRSA签名算法验签,如果验签通过,则err 值为 nil
Types ¶
type AESCFBMode ¶
AESCFBMode CFB 模式的 AES 加密
func (*AESCFBMode) Encrypt ¶
func (a *AESCFBMode) Encrypt(pt string) string
Encrypt aesCFBEncrypt aes 加密 对商户敏感信息加密
Click to show internal directories.
Click to hide internal directories.