Open stoneUoU opened 6 months ago
待验签字符串:sortString = 'appId=19E179E5DC29C05E65B90CDE57A1C7E5&data={"acct":"15717914505","devImei":"ce82f0ff5afe40b39fa339d53a84d39d","devMol":"iPhone 6s Plus","deviceToken":"8da8d387b530643e1aa0509c3fe4a20de50850fddefef9f6a093b2b121eab699","lat":"24.485945","lnt":"118.177704","pointAddr":"福建省厦门市思明区观日路靠近易联众信息技术股份有限公司","pwd":"51459c23ca91ebce271449dd8b5c26751c99039c2ae4c628067898ca0e104039","region":"福建省-厦门市"}&encType=SM4&signType=SM2×tamp=1717233971&transType=ec.queryCode&version=1.0.0&key=D91CEB11EE62219CD91CEB11EE62219C'
let sigValueHex = sm2.doSignature(sortString, this.prvkey, {hash:true}); let signData = Buffer.from(sigValueHex, 'hex').toString('base64');
中文该怎么处理?
我用flutter库试了下,同样的字符串,有中文加签后,后台也可以正常验签
是否可以尝试编码转换,这个密码库我理解使用使用utf8编码的,前后端在编码中文字符到二进制字节数组时候可能是不一样的。 可以尝试: 1、base64编码之后,签名;后端验签之后,解base64。 2、跟你们的后端沟通,统一使用utf8编码,在统一编码之后,签名和验签。
待验签字符串:sortString = 'appId=19E179E5DC29C05E65B90CDE57A1C7E5&data={"acct":"15717914505","devImei":"ce82f0ff5afe40b39fa339d53a84d39d","devMol":"iPhone 6s Plus","deviceToken":"8da8d387b530643e1aa0509c3fe4a20de50850fddefef9f6a093b2b121eab699","lat":"24.485945","lnt":"118.177704","pointAddr":"福建省厦门市思明区观日路靠近易联众信息技术股份有限公司","pwd":"51459c23ca91ebce271449dd8b5c26751c99039c2ae4c628067898ca0e104039","region":"福建省-厦门市"}&encType=SM4&signType=SM2×tamp=1717233971&transType=ec.queryCode&version=1.0.0&key=D91CEB11EE62219CD91CEB11EE62219C'
let sigValueHex = sm2.doSignature(sortString, this.prvkey, {hash:true}); let signData = Buffer.from(sigValueHex, 'hex').toString('base64');
中文该怎么处理?
我用flutter库试了下,同样的字符串,有中文加签后,后台也可以正常验签