Documentation ¶
Index ¶
- Variables
- func AESDecrypt(crypted, key []byte) ([]byte, error)
- func AESDecryptPEM(data, key []byte) ([]byte, error)
- func AESEncrypt(data, key []byte) ([]byte, error)
- func AESEncryptPEM(data, key []byte) ([]byte, error)
- func CipherSuites() (suites []uint16)
- func ECCSign(data, priKey []byte) (string, error)
- func ECCSignPEM(data, priKey []byte) (string, error)
- func ECCSign_(data []byte, priKey *ecdsa.PrivateKey) (sigB64 string, err error)
- func ECCVerify(data []byte, sigB64 string, pubKey []byte) error
- func ECCVerifyPEM(data []byte, signStr string, pubKey []byte) error
- func ECCVerify_(data []byte, sigB64 string, pubKey *ecdsa.PublicKey) error
- func GenerateAESKey() (key []byte)
- func GenerateECCKey(c elliptic.Curve) (priKey []byte, pubKey []byte, err error)
- func GeneratePEMAESKey() (key []byte)
- func GeneratePEMECCKey(c elliptic.Curve) (priKey []byte, pubKey []byte, err error)
- func GeneratePEMRSAKey(bits int) (priKey []byte, pubKey []byte, err error)
- func GenerateRSAKey(bits int) (priKey []byte, pubKey []byte, err error)
- func InsecureCipherSuites() (suites []uint16)
- func PKCS5Padding(data []byte, blockSize int) []byte
- func PKCS5UnPadding(data []byte) ([]byte, error)
- func RSADecrypt(data, priKey []byte) ([]byte, error)
- func RSADecryptPEM(data, priKey []byte) ([]byte, error)
- func RSADecryptPKCS1v15(data, priKey []byte) ([]byte, error)
- func RSADecryptPKCS1v15PEM(data, priKey []byte) ([]byte, error)
- func RSADecryptPKCS1v15_(crypted []byte, priKey *rsa.PrivateKey) ([]byte, error)
- func RSADecrypt_(crypted []byte, priKey *rsa.PrivateKey) ([]byte, error)
- func RSAEncrypt(data, pubKey []byte) ([]byte, error)
- func RSAEncryptPEM(data, pubKey []byte) ([]byte, error)
- func RSAEncryptPKCS1v15(data, pubKey []byte) ([]byte, error)
- func RSAEncryptPKCS1v15PEM(data, pubKey []byte) ([]byte, error)
- func RSAEncryptPKCS1v15_(data []byte, pubKey *rsa.PublicKey) ([]byte, error)
- func RSAEncrypt_(data []byte, pubKey *rsa.PublicKey) ([]byte, error)
- func RSASignPKCS1v15(data, priKey []byte) (string, error)
- func RSASignPKCS1v15PEM(data, priKey []byte) (string, error)
- func RSASignPKCS1v15_(data []byte, priKey *rsa.PrivateKey) (string, error)
- func RSASignPSS(data, priKey []byte) (string, error)
- func RSASignPSSPEM(data, priKey []byte) (string, error)
- func RSASignPSS_(data []byte, priKey *rsa.PrivateKey) (string, error)
- func RSAVerifyPKCS1v15(data []byte, signStr string, pubKey []byte) error
- func RSAVerifyPKCS1v15PEM(data []byte, signStr string, pubKey []byte) error
- func RSAVerifyPKCS1v15_(data []byte, signStr string, pubKey *rsa.PublicKey) error
- func RSAVerifyPSS(data []byte, signStr string, pubKey []byte) error
- func RSAVerifyPSSPEM(data []byte, signStr string, pubKey []byte) error
- func RSAVerifyPSS_(data []byte, signStr string, pubKey *rsa.PublicKey) error
Constants ¶
This section is empty.
Variables ¶
var ErrEccVerification = errors.New("ecdsa: verification error")
Functions ¶
func AESDecrypt ¶
func AESDecryptPEM ¶
func AESEncrypt ¶
func AESEncryptPEM ¶
func CipherSuites ¶ added in v1.15.5
func CipherSuites() (suites []uint16)
CipherSuites 获取安全的 tls 加密套件
func ECCSignPEM ¶ added in v1.12.0
ECCSignPEM 使用 ecc 私钥签名,接收PEM格式的公钥
func ECCSign_ ¶ added in v1.12.0
func ECCSign_(data []byte, priKey *ecdsa.PrivateKey) (sigB64 string, err error)
ECCSign_ 使用 ecc 私钥签名,接收 *ecdsa.PrivateKey 公钥
func ECCVerifyPEM ¶ added in v1.12.0
ECCVerifyPEM 使用 ecc 公钥验签,接收PEM格式的公钥
func ECCVerify_ ¶ added in v1.12.0
ECCVerify_ 使用 ecc 公钥验签,接收 *ecdsa.PublicKey 公钥
func GenerateAESKey ¶
func GenerateAESKey() (key []byte)
GenerateAESKey 生成 256 位 aes 密钥;用 md5 算的 32 个字节
func GenerateECCKey ¶ added in v1.12.0
GenerateECCKey 生成 ecc 密钥,c 可以是
elliptic.P224() elliptic.P256() elliptic.P384() elliptic.P521()
或其他椭圆曲线算法
func GeneratePEMAESKey ¶
func GeneratePEMAESKey() (key []byte)
GeneratePEMAESKey 生成 256 位 PME格式 的 aes 密钥;用 md5 算的 32 个字节
func GeneratePEMECCKey ¶ added in v1.12.0
GeneratePEMECCKey 生成 PEM格式 的 ecc 密钥,c 可以是
elliptic.P224() elliptic.P256() elliptic.P384() elliptic.P521()
或其他椭圆曲线算法
func GeneratePEMRSAKey ¶
GeneratePEMRSAKey 生成 PEM格式 的 rsa 密钥,bits 可以给 2048
func GenerateRSAKey ¶
GenerateRSAKey 生成 rsa 密钥,bits 可以给 2048
func InsecureCipherSuites ¶ added in v1.15.5
func InsecureCipherSuites() (suites []uint16)
InsecureCipherSuites 获取不安全的 tls 加密套件
func PKCS5Padding ¶
func PKCS5UnPadding ¶
func RSADecryptPKCS1v15_ ¶ added in v1.7.3
func RSADecryptPKCS1v15_(crypted []byte, priKey *rsa.PrivateKey) ([]byte, error)
RSADecrypt_ 使用 RSA 私钥解密,接收 *rsa.PrivateKey 私钥
PKCS1v15
func RSADecrypt_ ¶
func RSADecrypt_(crypted []byte, priKey *rsa.PrivateKey) ([]byte, error)
RSADecrypt_ 使用 RSA 私钥解密,接收 *rsa.PrivateKey 私钥
OAEP: sha256
func RSASignPKCS1v15 ¶ added in v1.12.0
RSASignPKCS1v15 使用 rsa 私钥签名(PKCS1v15),接收 []byte 类型的私钥
func RSASignPKCS1v15PEM ¶ added in v1.12.0
RSASignPKCS1v15PEM 使用 rsa 私钥签名(PKCS1v15),接收PEM格式的私钥
func RSASignPKCS1v15_ ¶ added in v1.12.0
func RSASignPKCS1v15_(data []byte, priKey *rsa.PrivateKey) (string, error)
RSASignPKCS1v15_ 使用 rsa 私钥签名(PKCS1v15),接收 *rsa.PrivateKey 私钥
func RSASignPSS ¶ added in v1.12.0
RSASignPSS 使用 rsa 私钥签名(PSS),接收 []byte 类型的私钥
func RSASignPSSPEM ¶ added in v1.12.0
RSASignPSSPEM 使用 rsa 私钥签名(PSS),接收PEM格式的私钥
func RSASignPSS_ ¶ added in v1.12.0
func RSASignPSS_(data []byte, priKey *rsa.PrivateKey) (string, error)
RSASignPSS_ 使用 rsa 私钥签名(PSS),接收 *rsa.PrivateKey 私钥
func RSAVerifyPKCS1v15 ¶ added in v1.12.0
RSAVerifyPKCS1v15 使用 rsa 公钥验签(PKCS1v15),接收 []byte 类型的公钥
func RSAVerifyPKCS1v15PEM ¶ added in v1.12.0
RSAVerifyPKCS1v15PEM 使用 rsa 公钥验签(PKCS1v15),接收PEM格式的公钥
func RSAVerifyPKCS1v15_ ¶ added in v1.12.0
RSAVerifyPKCS1v15_ 使用 rsa 公钥验签(PKCS1v15),接收 *rsa.PublicKey 公钥
func RSAVerifyPSS ¶ added in v1.12.0
RSAVerifyPSS 使用 rsa 公钥验签(PSS),接收 []byte 类型的公钥
func RSAVerifyPSSPEM ¶ added in v1.12.0
RSAVerifyPSSPEM 使用 rsa 公钥验签(PSS),接收PEM格式的公钥
Types ¶
This section is empty.