http加密过滤

master
hzy 11 months ago
parent ddc366e958
commit 8424c4af83
  1. 2
      transport/v1/http/request.go
  2. 2
      transport/v1/http/response.go

@ -125,7 +125,7 @@ func (t *Transport) RequestDecoderWithSignFilter(noEncrypt map[string]bool) http
}
// 正式服验签
if t.env == enum.Env_Production && noEncrypt[r.URL.Path] {
if t.env == enum.Env_Production && !noEncrypt[r.URL.Path] {
signature := request.NewSignature(t.apiKey, request.NewSHA1HashAlg())
signStr := signature.GenSignature(params)
if signStr != r.Header.Get("sm5") {

@ -159,7 +159,7 @@ func (t *Transport) ResponseEncoderWithEncryptFilter(noEncrypt map[string]bool)
dataRes := string(data)
// 正式服加密
if t.env == enum.Env_Production && noEncrypt[r.URL.Path] {
if t.env == enum.Env_Production && !noEncrypt[r.URL.Path] {
ecbMsg, err := sm4.Sm4Ecb([]byte(t.sm4Key), data, true)
if err == nil {
dataRes = fmt.Sprintf("\"%s\"", hex.EncodeToString(ecbMsg))

Loading…
Cancel
Save