RSA解密全删了
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
package localjx
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -52,40 +47,10 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
CodeURL: utils.LimitUTF8StringLen(result.PayInfo, 3200),
|
||||
TotalFee: int(order.ActualPayPrice),
|
||||
}
|
||||
// plainText, err2 := RSADecrypt([]byte(result2.PaySign))
|
||||
// result2.PaySign = string(plainText)
|
||||
// globals.SugarLogger.Debugf("pay4OrderByTL2, [%v]", string(plainText))
|
||||
// str, err2 := json.Marshal(result2)
|
||||
// result.PayInfo = string(str)
|
||||
// err = err2
|
||||
}
|
||||
return orderPay, err
|
||||
}
|
||||
|
||||
func RSADecrypt(pub []byte) (plainText []byte, err error) {
|
||||
//打开文件
|
||||
// file, err := os.Open("conf/rsa_key.pem")
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// defer file.Close()
|
||||
// //获取文件内容
|
||||
// info, _ := file.Stat()
|
||||
// buf := make([]byte, info.Size())
|
||||
// file.Read(buf)
|
||||
buf, err := ioutil.ReadFile("conf/rsa_key.pem")
|
||||
//pem解码
|
||||
block, _ := pem.Decode(buf)
|
||||
//X509解码
|
||||
privateKey, err := x509.ParsePKCS8PrivateKey(block.Bytes)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
//对密文进行解密
|
||||
plainText, err = rsa.DecryptPKCS1v15(rand.Reader, privateKey.(*rsa.PrivateKey), pub)
|
||||
return plainText, err
|
||||
}
|
||||
|
||||
func OnTLPayCallback(call *tonglianpayapi.CallBackResult) (err error) {
|
||||
globals.SugarLogger.Debugf("OnTLPayCallback msg:%s", utils.Format4Output(call, true))
|
||||
switch call.TrxCode {
|
||||
|
||||
Reference in New Issue
Block a user