feat:ras加密fix
This commit is contained in:
parent
d4fa337e3f
commit
2e938f241a
|
@ -14,11 +14,11 @@ func NewRsa(app *appmodel.App) ApiCrypt {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Rsa) Encrypt(data string) (encryptData []byte, errCode int) {
|
func (r *Rsa) Encrypt(data string) (encryptData []byte, errCode int) {
|
||||||
if r.App.PublicKey == "" {
|
if r.App.MerchantPublicKey == "" {
|
||||||
return nil, errorcode.AppRsaEncryptKeyNotFound
|
return nil, errorcode.AppRsaEncryptKeyNotFound
|
||||||
}
|
}
|
||||||
publicKeyPEM := `-----BEGIN PUBLIC KEY-----
|
publicKeyPEM := `-----BEGIN PUBLIC KEY-----
|
||||||
` + r.App.PublicKey + `
|
` + r.App.MerchantPublicKey + `
|
||||||
-----END PUBLIC KEY-----`
|
-----END PUBLIC KEY-----`
|
||||||
encryptByte, err := rsa.Encrypt(publicKeyPEM, data)
|
encryptByte, err := rsa.Encrypt(publicKeyPEM, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue