通联宝支付测试

This commit is contained in:
苏尹岚
2020-02-27 09:56:54 +08:00
parent ed245203c9
commit eb8a8b0381

View File

@@ -97,12 +97,12 @@ func RSADecrypt(pub []byte) (plainText []byte, err error) {
//pem解码
block, _ := pem.Decode(buf)
//X509解码
privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
privateKey, err := x509.ParsePKCS8PrivateKey(block.Bytes)
if err != nil {
panic(err)
}
//对密文进行解密
plainText, err = rsa.DecryptPKCS1v15(rand.Reader, privateKey, pub)
plainText, err = rsa.DecryptPKCS1v15(rand.Reader, privateKey.(*rsa.PrivateKey), pub)
return plainText, err
}