Documentation ¶
Index ¶
- Variables
- func DecryptPKCS1v15(ciphertext string, privateKey *rsa.PrivateKey) (message string, err error)
- func EncryptPKCS1v15WithPublicKey(message string, publicKey *rsa.PublicKey) (ciphertext string, err error)
- func GenCertificate(bits int) (error error, privateKeyStr, publicKeyStr string)
- func GenCertificateFile(bits int) (err error)
- func LoadCertificate(certificateStr string) (certificate *x509.Certificate, err error)
- func LoadPrivateKey(privateKeyStr string) (privateKey *rsa.PrivateKey, err error)
- func LoadPrivateKeyWithPath(fileName string) (privateKey *rsa.PrivateKey, err error)
- func LoadPublicKey(publicKeyStr string) (publicKey *rsa.PublicKey, err error)
- func LoadPublicKeyWithPath(fileName string) (privateKey *rsa.PublicKey, err error)
- func SignSHA256WithRSA(source string, privateKy *rsa.PrivateKey) (signature string, err error)
- func SignSHA256WithRSAUseURLValues(param url.Values, privateKy *rsa.PrivateKey) (signature string, err error)
- func VerifySHA256WithRSA(signed string, source string, publicKey *rsa.PublicKey) error
- func VerifySha256WithRSAUseURLValues(param url.Values, publicKey *rsa.PublicKey) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidBase64Str = errors.New("Invalid base64 string")
Functions ¶
func DecryptPKCS1v15 ¶
func DecryptPKCS1v15(ciphertext string, privateKey *rsa.PrivateKey) (message string, err error)
DecryptPKCS1v15 使用私钥对PKCS1 padding方式加密的字符串进行解密
func EncryptPKCS1v15WithPublicKey ¶
func EncryptPKCS1v15WithPublicKey(message string, publicKey *rsa.PublicKey) (ciphertext string, err error)
EncryptPKCS1v15WithPublicKey 使用PKCS1 padding方式用公钥进行加密
func GenCertificate ¶
GenCertificate 生成bits大小的公钥和私钥文本内容(推荐3096大小)
func LoadCertificate ¶
func LoadCertificate(certificateStr string) (certificate *x509.Certificate, err error)
LoadCertificate 通过证书的文本内容加载证书
func LoadPrivateKey ¶
func LoadPrivateKey(privateKeyStr string) (privateKey *rsa.PrivateKey, err error)
LoadPrivateKey 通过私钥的文本内容加载私钥
func LoadPrivateKeyWithPath ¶
func LoadPrivateKeyWithPath(fileName string) (privateKey *rsa.PrivateKey, err error)
LoadPrivateKeyWithPath 通过私钥的文件加载私钥
func LoadPublicKey ¶
LoadPublicKey 通过公钥文本内容加载公钥
func LoadPublicKeyWithPath ¶
LoadPublicKeyWithPath 通过公钥文件加载公钥
func SignSHA256WithRSA ¶
func SignSHA256WithRSA(source string, privateKy *rsa.PrivateKey) (signature string, err error)
SignSHA256WithRSA 通过私钥对字符以 SHA256WithRSA 算法生成签名信息
func SignSHA256WithRSAUseURLValues ¶
func SignSHA256WithRSAUseURLValues(param url.Values, privateKy *rsa.PrivateKey) (signature string, err error)
SignSHA256WithRSAUseURLValues 通过私钥对 url.Values 以 SHA256WithRSA 算法生成签名信息
func VerifySHA256WithRSA ¶
VerifySHA256WithRSA 使用公钥对字符以 SHA256WithRSA 算法验证签名
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.