This commit is contained in:
parent
904abedd62
commit
3cf7e543fd
|
@ -0,0 +1,39 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"service/bizcommon/util"
|
||||
"service/library/logger"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRsaDecrypt(t *testing.T) {
|
||||
authId := "yxvdg/oqQo7fngzbb7c60VSHIxqyWRUSBKOzWO4Ej+RMkseZl0xr1+QaewQgdGk202QG2G+sSuERw1faQzOMC9NAW1MgW+yjFS/dlHC6oPXhd/t086G1Ma2JYSob6Kf12TExjqHSr/cfKreoLki0FbI+ggkvLx/A1vuiRbZiHOk="
|
||||
authName := "yN1MlhOHZCKD4YK6sVXE7JthgrM8W8mvY9cigb8FDnubOXoHHfEBJqB/a+K91NxJIZfoBOPvQbkNYb2I+1M5bI1Rtm4sr67oavO6LuHcQNAYSk+V3+hBRqA1alc6GT5whbq3LIOxzlMNT5TnelDzURNqTxheinVaxoA8di9MHXo="
|
||||
|
||||
alipayIdDecodeBytes, err := base64.StdEncoding.DecodeString(authId)
|
||||
if err != nil {
|
||||
logger.Error("DecodeString authAlipayId fail, req: %v, err: %v", util.ToJson(authId), err)
|
||||
return
|
||||
}
|
||||
alipayIdBytes, err := RsaDecrypt(alipayIdDecodeBytes)
|
||||
if err != nil {
|
||||
logger.Error("RsaDecrypt authAlipayId fail, req: %v, err: %v", util.ToJson(authId), err)
|
||||
return
|
||||
}
|
||||
alipayId := string(alipayIdBytes)
|
||||
|
||||
alipayNameDecodeBytes, err := base64.StdEncoding.DecodeString(authName)
|
||||
if err != nil {
|
||||
logger.Error("DecodeString authAlipayName fail, req: %v, err: %v", util.ToJson(authName), err)
|
||||
return
|
||||
}
|
||||
alipayNameBytes, err := RsaDecrypt(alipayNameDecodeBytes)
|
||||
if err != nil {
|
||||
logger.Error("RsaDecrypt authAlipayName fail, req: %v, err: %v", util.ToJson(authName), err)
|
||||
return
|
||||
}
|
||||
alipayName := string(alipayNameBytes)
|
||||
|
||||
t.Logf("%s, %s\n", alipayId, alipayName)
|
||||
}
|
Loading…
Reference in New Issue