log
This commit is contained in:
parent
11f07197c0
commit
6a15c47799
|
|
@ -2,6 +2,7 @@ package cmb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
v1 "voucher/api/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenerateSm2Key(t *testing.T) {
|
func TestGenerateSm2Key(t *testing.T) {
|
||||||
|
|
@ -68,3 +69,30 @@ func TestVerify(t *testing.T) {
|
||||||
xx, err := Verify(pukKey, content, signDataBase64)
|
xx, err := Verify(pukKey, content, signDataBase64)
|
||||||
t.Log(xx, err)
|
t.Log(xx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestVerifyCmbReply(t *testing.T) {
|
||||||
|
zsStr := "cmbKeyAlias=SM2_CMBLIFE&date=20250312094153&encryptBody=BPaYG3nLlLJvnu6tHBBNKCwXigqN/n8yhUbVRtaKWCIb06GkYo/ykWSNXFRKEPzaYNEeh49frKlVckqvq0heDIYxSUs9uozl5dDnkcFwBv2UK9jxlTRHLkO7MznBD3p/et/m01FsTlMXQcMjL46HsvRZUsXVwpeb56cS4/kQ+zum5mLhgXVv4Mkpheig|JCmQuJMe/WkF9JjLoPspNRK6QxC+ViGT9TccJKUal1dgcawKGLbcoAIwd0zO/6kkFwzkjp83+iwRu5WOsO0ver27v1671RmRJQAObxtmk0LRf7JeHbq+KTd/cGbGu+ZZZcQzPIgfrUTt3TTx8eT0aQ==&keyAlias=CO_PUB_KEY_SM2&respCode=1000&respMsg=成功"
|
||||||
|
prk := "8d39ff3d2559258c163f4510f082727f51531e1953ab203d5ab1ea4a6d94fd73"
|
||||||
|
|
||||||
|
reply := &v1.CmbReply{
|
||||||
|
RespCode: "1000",
|
||||||
|
RespMsg: "成功",
|
||||||
|
Date: "20250312094153",
|
||||||
|
KeyAlias: "CO_PUB_KEY_SM2",
|
||||||
|
CmbKeyAlias: "SM2_CMBLIFE",
|
||||||
|
EncryptBody: "BPaYG3nLlLJvnu6tHBBNKCwXigqN/n8yhUbVRtaKWCIb06GkYo/ykWSNXFRKEPzaYNEeh49frKlVckqvq0heDIYxSUs9uozl5dDnkcFwBv2UK9jxlTRHLkO7MznBD3p/et/m01FsTlMXQcMjL46HsvRZUsXVwpeb56cS4/kQ+zum5mLhgXVv4Mkpheig|JCmQuJMe/WkF9JjLoPspNRK6QxC+ViGT9TccJKUal1dgcawKGLbcoAIwd0zO/6kkFwzkjp83+iwRu5WOsO0ver27v1671RmRJQAObxtmk0LRf7JeHbq+KTd/cGbGu+ZZZcQzPIgfrUTt3TTx8eT0aQ==",
|
||||||
|
Sign: "",
|
||||||
|
}
|
||||||
|
|
||||||
|
str := SortStructStr(reply)
|
||||||
|
t.Log(str)
|
||||||
|
|
||||||
|
t.Log(zsStr == str)
|
||||||
|
|
||||||
|
xx, err := Sign(prk, str)
|
||||||
|
if err != nil {
|
||||||
|
t.Log(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Log(xx)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ func (s *VoucherService) CmbOrder(ctx http.Context) error {
|
||||||
return ctx.JSON(400, err)
|
return ctx.JSON(400, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Warnf("CmbOrder GetResponse: %v", reply)
|
log.Warnf("cmbProductQuery replyBizContent:%s GetResponse: %v", string(replyBizContent), reply)
|
||||||
return ctx.JSON(200, reply)
|
return ctx.JSON(200, reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ func (s *VoucherService) CmbProductQuery(ctx http.Context) error {
|
||||||
return ctx.JSON(400, err)
|
return ctx.JSON(400, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Warnf("cmbProductQuery GetResponse: %v", reply)
|
log.Warnf("cmbProductQuery replyBizContent:%s GetResponse: %v", string(replyBizContent), reply)
|
||||||
|
|
||||||
return ctx.JSON(200, reply)
|
return ctx.JSON(200, reply)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue