Documentation ¶
Index ¶
- Variables
- func AesCBCDeB58(s string, key []byte) []byte
- func AesCBCDeB64(s string, key []byte) []byte
- func AesCBCDeHex(s string, key []byte) []byte
- func AesCBCDePKCS7B58(s string, key []byte) []byte
- func AesCBCDePKCS7B64(s string, key []byte) []byte
- func AesCBCDePKCS7Hex(s string, key []byte) []byte
- func AesCBCDePKCS7StringB58(s string, key []byte) string
- func AesCBCDePKCS7StringB64(s string, key []byte) string
- func AesCBCDePKCS7StringHex(s string, key []byte) string
- func AesCBCDeStringB58(s string, key []byte) string
- func AesCBCDeStringB64(s string, key []byte) string
- func AesCBCDeStringHex(s string, key []byte) string
- func AesCBCDecrypt(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) (plaintext []byte)
- func AesCBCDecryptE(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) ([]byte, error)
- func AesCBCEnB58(b, key []byte) string
- func AesCBCEnB64(b, key []byte) string
- func AesCBCEnHex(b, key []byte) string
- func AesCBCEnPKCS7B58(b, key []byte) string
- func AesCBCEnPKCS7B64(b, key []byte) string
- func AesCBCEnPKCS7Hex(b, key []byte) string
- func AesCBCEnPKCS7StringB58(s string, key []byte) string
- func AesCBCEnPKCS7StringB64(s string, key []byte) string
- func AesCBCEnPKCS7StringHex(s string, key []byte) string
- func AesCBCEnStringB58(s string, key []byte) string
- func AesCBCEnStringB64(s string, key []byte) string
- func AesCBCEnStringHex(s string, key []byte) string
- func AesCBCEncrypt(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) (ciphertext []byte)
- func AesCBCEncryptE(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) ([]byte, error)
- func AesGCMDeB58(s string, key, nonce []byte) []byte
- func AesGCMDeB64(s string, key, nonce []byte) []byte
- func AesGCMDeHex(s string, key, nonce []byte) []byte
- func AesGCMDeStringB58(s string, key, nonce []byte) string
- func AesGCMDeStringB64(s string, key, nonce []byte) string
- func AesGCMDeStringHex(s string, key, nonce []byte) string
- func AesGCMDecrypt(ciphertext, key, nonce []byte) (plaintext []byte)
- func AesGCMDecryptWithNonce(ciphertext, key, nonce, additionalData []byte) ([]byte, error)
- func AesGCMEnB58(b, key []byte) (string, []byte)
- func AesGCMEnB64(b, key []byte) (string, []byte)
- func AesGCMEnHex(b, key []byte) (string, []byte)
- func AesGCMEnStringB58(s string, key []byte) (string, []byte)
- func AesGCMEnStringB64(s string, key []byte) (string, []byte)
- func AesGCMEnStringHex(s string, key []byte) (string, []byte)
- func AesGCMEncrypt(plaintext, key []byte) (ciphertext []byte, nonce []byte)
- func AesGCMEncryptWithNonce(plaintext, key, nonce, additionalData []byte) ([]byte, []byte, error)
- func Decrypt(value, secret string) string
- func DesCBCDeB58(s string, key []byte) []byte
- func DesCBCDeB64(s string, key []byte) []byte
- func DesCBCDeHex(s string, key []byte) []byte
- func DesCBCDePKCS7B58(s string, key []byte) []byte
- func DesCBCDePKCS7B64(s string, key []byte) []byte
- func DesCBCDePKCS7Hex(s string, key []byte) []byte
- func DesCBCDePKCS7StringB58(s string, key []byte) string
- func DesCBCDePKCS7StringB64(s string, key []byte) string
- func DesCBCDePKCS7StringHex(s string, key []byte) string
- func DesCBCDeStringB58(s string, key []byte) string
- func DesCBCDeStringB64(s string, key []byte) string
- func DesCBCDeStringHex(s string, key []byte) string
- func DesCBCDecrypt(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) (plaintext []byte)
- func DesCBCDecryptE(asPKCS7 bool, ciphertext, key []byte, ivs ...[]byte) ([]byte, error)
- func DesCBCEnB58(b, key []byte) string
- func DesCBCEnB64(b, key []byte) string
- func DesCBCEnHex(b, key []byte) string
- func DesCBCEnPKCS7B58(b, key []byte) string
- func DesCBCEnPKCS7B64(b, key []byte) string
- func DesCBCEnPKCS7Hex(b, key []byte) string
- func DesCBCEnPKCS7StringB58(s string, key []byte) string
- func DesCBCEnPKCS7StringB64(s string, key []byte) string
- func DesCBCEnPKCS7StringHex(s string, key []byte) string
- func DesCBCEnStringB58(s string, key []byte) string
- func DesCBCEnStringB64(s string, key []byte) string
- func DesCBCEnStringHex(s string, key []byte) string
- func DesCBCEncrypt(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) (ciphertext []byte)
- func DesCBCEncryptE(asPKCS7 bool, plaintext, key []byte, ivs ...[]byte) ([]byte, error)
- func Encrypt(value, secret string) string
- func GCMDeB58(s string, key []byte) []byte
- func GCMDeB64(s string, key []byte) []byte
- func GCMDeHex(s string, key []byte) []byte
- func GCMDeStringB58(s string, key []byte) string
- func GCMDeStringB64(s string, key []byte) string
- func GCMDeStringHex(s string, key []byte) string
- func GCMDecrypt(encrypted, key []byte) ([]byte, error)
- func GCMEnB58(b, key []byte) string
- func GCMEnB64(b, key []byte) string
- func GCMEnHex(b, key []byte) string
- func GCMEnStringB58(s string, key []byte) string
- func GCMEnStringB64(s string, key []byte) string
- func GCMEnStringHex(s string, key []byte) string
- func GCMEncrypt(plaintext, key []byte) ([]byte, error)
- func GenRSAKey(bits int) (publicKey, privateKey []byte)
- func GetCertificate(network, addr string, timeout time.Duration, tlsConf *tls.Config) (*x509.Certificate, error)
- func GetenvDecrypt(key string, secret string) string
- func Padding(b []byte, bSize int, pkcs7 bool) []byte
- func ParsePrivateKey(privateKey []byte) (priv *rsa.PrivateKey, err error)
- func ParsePublicKey(publicKey []byte) (pub *rsa.PublicKey, err error)
- func RSADecrypt(ciphertext, privateKey []byte) ([]byte, error)
- func RSAEncrypt(plaintext, publicKey []byte) ([]byte, error)
- func RSASign(data, privateKey []byte) ([]byte, error)
- func RSASignVerify(data, publicKey, sig []byte) error
- func SetenvEncrypt(key, value, secret string) (string, error)
- func UnPadding(b []byte, pkcs7 bool) []byte
- func XOR(src, key []byte) []byte
- func XORDeB58(s string, key []byte) []byte
- func XORDeB64(s string, key []byte) []byte
- func XORDeHex(s string, key []byte) []byte
- func XORDeStringB58(s string, key []byte) string
- func XORDeStringB64(s string, key []byte) string
- func XORDeStringHex(s string, key []byte) string
- func XORE(src, key []byte) ([]byte, error)
- func XOREnB58(b, key []byte) string
- func XOREnB64(b, key []byte) string
- func XOREnHex(b, key []byte) string
- func XOREnStringB58(s string, key []byte) string
- func XOREnStringB64(s string, key []byte) string
- func XOREnStringHex(s string, key []byte) string
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidParam = errors.New("invalid parameter") ErrInvalidCert = errors.New("invalid certificate") )
Functions ¶
func AesCBCDePKCS7B58 ¶
AesCBCDePKCS7B58 解密, Pkcs7Padding
func AesCBCDePKCS7B64 ¶
AesCBCDePKCS7B64 解密, Pkcs7Padding
func AesCBCDePKCS7Hex ¶
AesCBCDePKCS7Hex 解密, Pkcs7Padding
func AesCBCDePKCS7StringB58 ¶
AesCBCDePKCS7StringB58 解密, Pkcs7Padding
func AesCBCDePKCS7StringB64 ¶
AesCBCDePKCS7StringB64 解密, Pkcs7Padding
func AesCBCDePKCS7StringHex ¶
AesCBCDePKCS7StringHex 解密, Pkcs7Padding
func AesCBCDeStringB58 ¶
AesCBCDeStringB58 解密, ZerosPadding
func AesCBCDeStringB64 ¶
AesCBCDeStringB64 解密, ZerosPadding
func AesCBCDeStringHex ¶
AesCBCDeStringHex 解密, ZerosPadding
func AesCBCDecrypt ¶
AesCBCDecrypt AES-CBC 解密
func AesCBCDecryptE ¶
AesCBCDecryptE AES-CBC 解密, 密码分组链接模式 (Cipher Block Chaining (CBC))
func AesCBCEnPKCS7B58 ¶
AesCBCEnPKCS7B58 加密, Pkcs7Padding
func AesCBCEnPKCS7B64 ¶
AesCBCEnPKCS7B64 加密, Pkcs7Padding
func AesCBCEnPKCS7Hex ¶
AesCBCEnPKCS7Hex 加密, Pkcs7Padding
func AesCBCEnPKCS7StringB58 ¶
AesCBCEnPKCS7StringB58 加密, Pkcs7Padding
func AesCBCEnPKCS7StringB64 ¶
AesCBCEnPKCS7StringB64 加密, Pkcs7Padding
func AesCBCEnPKCS7StringHex ¶
AesCBCEnPKCS7StringHex 加密, Pkcs7Padding
func AesCBCEnStringB58 ¶
AesCBCEnStringB58 加密, ZerosPadding
func AesCBCEnStringB64 ¶
AesCBCEnStringB64 加密, ZerosPadding
func AesCBCEnStringHex ¶
AesCBCEnStringHex 加密, ZerosPadding
func AesCBCEncrypt ¶
AesCBCEncrypt AES-CBC 加密
func AesCBCEncryptE ¶
AesCBCEncryptE AES-CBC 加密, 密码分组链接模式 (Cipher Block Chaining (CBC)) key 长度分别是 16 (AES-128), 24 (AES-192?), 32 (AES-256?) asPKCS7: false (ZerosPadding), true (Pkcs7Padding)
func AesGCMDeStringB58 ¶
AesGCMDeStringB58 解密
func AesGCMDeStringB64 ¶
AesGCMDeStringB64 解密
func AesGCMDeStringHex ¶
AesGCMDeStringHex 解密
func AesGCMDecrypt ¶
AesGCMDecrypt AES-GCM 解密
func AesGCMDecryptWithNonce ¶
AesGCMDecryptWithNonce AES-GCM 解密, (Galois/Counter Mode (GCM))
func AesGCMEnStringB58 ¶
AesGCMEnStringB58 加密
func AesGCMEnStringB64 ¶
AesGCMEnStringB64 加密
func AesGCMEnStringHex ¶
AesGCMEnStringHex 加密
func AesGCMEncrypt ¶
AesGCMEncrypt AES-GCM 加密
func AesGCMEncryptWithNonce ¶
AesGCMEncryptWithNonce AES-GCM 加密, (Galois/Counter Mode (GCM)) key 长度分别是 16 (AES-128), 32 (AES-256)
func DesCBCDePKCS7B58 ¶
DesCBCDePKCS7B58 解密, Pkcs7Padding
func DesCBCDePKCS7B64 ¶
DesCBCDePKCS7B64 解密, Pkcs7Padding
func DesCBCDePKCS7Hex ¶
DesCBCDePKCS7Hex 解密, Pkcs7Padding
func DesCBCDePKCS7StringB58 ¶
DesCBCDePKCS7StringB58 解密, Pkcs7Padding
func DesCBCDePKCS7StringB64 ¶
DesCBCDePKCS7StringB64 解密, Pkcs7Padding
func DesCBCDePKCS7StringHex ¶
DesCBCDePKCS7StringHex 解密, Pkcs7Padding
func DesCBCDeStringB58 ¶
DesCBCDeStringB58 解密, ZerosPadding
func DesCBCDeStringB64 ¶
DesCBCDeStringB64 解密, ZerosPadding
func DesCBCDeStringHex ¶
DesCBCDeStringHex 解密, ZerosPadding
func DesCBCDecrypt ¶
DesCBCDecrypt AES-CBC 解密
func DesCBCDecryptE ¶
DesCBCDecryptE DES-CBC 解密, 密码分组链接模式 (Cipher Block Chaining (CBC))
func DesCBCEnPKCS7B58 ¶
DesCBCEnPKCS7B58 加密, Pkcs7Padding
func DesCBCEnPKCS7B64 ¶
DesCBCEnPKCS7B64 加密, Pkcs7Padding
func DesCBCEnPKCS7Hex ¶
DesCBCEnPKCS7Hex 加密, Pkcs7Padding
func DesCBCEnPKCS7StringB58 ¶
DesCBCEnPKCS7StringB58 加密, Pkcs7Padding
func DesCBCEnPKCS7StringB64 ¶
DesCBCEnPKCS7StringB64 加密, Pkcs7Padding
func DesCBCEnPKCS7StringHex ¶
DesCBCEnPKCS7StringHex 加密, Pkcs7Padding
func DesCBCEnStringB58 ¶
DesCBCEnStringB58 加密, ZerosPadding
func DesCBCEnStringB64 ¶
DesCBCEnStringB64 加密, ZerosPadding
func DesCBCEnStringHex ¶
DesCBCEnStringHex 加密, ZerosPadding
func DesCBCEncrypt ¶
DesCBCEncrypt AES-CBC 加密
func DesCBCEncryptE ¶
DesCBCEncryptE DES-CBC 加密, 密码分组链接模式 (Cipher Block Chaining (CBC)) key 长度固定为 8 asPKCS7: false (ZerosPadding), true (Pkcs7Padding)
func GenRSAKey ¶
GenRSAKey 生成 RSA 密钥对 openssl genrsa -out rsa_private_key.pem 1024 openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem
func GetCertificate ¶ added in v0.9.10
func GetCertificate(network, addr string, timeout time.Duration, tlsConf *tls.Config) (*x509.Certificate, error)
GetCertificate 获取域名证书信息
func GetenvDecrypt ¶
GetenvDecrypt 解密环境变量参数(string)
func ParsePrivateKey ¶
func ParsePrivateKey(privateKey []byte) (priv *rsa.PrivateKey, err error)
ParsePrivateKey parses an RSA private key in PKCS #1, ASN.1 DER form.
func ParsePublicKey ¶
ParsePublicKey parses a public key in PKIX, ASN.1 DER form.
func SetenvEncrypt ¶
SetenvEncrypt 加密并设置环境变量(string)
Types ¶
This section is empty.