实名认证总是提示“提供了无效的签名”,使用相同的配置,支付接口没有问题。
bluicezhen opened this issue · 5 comments
bluicezhen commented
如题
michealzh commented
能否提供一下您的调用代码
bluicezhen commented
Python 3.6.1 Mac OS
这样不行
import pingpp
import os
from conf import pingpp as c
pingpp.api_key = c.app_key
pingpp.private_key_path = c.private_key_path
params = {
"app": c.app_id,
"data": {
"id_name": "张三",
"id_number": "320291198811110000",
},
"type": "id_card"
}
pingpp.Identification.create(**params)
这样也不行
import requests
import json
import os
import base64
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5 as Signature_pkcs1_v1_5
from conf import pingpp as c
if __name__ == "__main__":
data = json.dumps({
"type": "id_card",
"app": app_id,
"data": {
"id_name": "张三",
"id_number": "320291198811110000",
"card_number": "6201111122223333"
}
})
key = open(f"{os.getcwd()}/key/app").read()
rsakey = RSA.importKey(key)
signer = Signature_pkcs1_v1_5.new(rsakey)
digest = SHA256.new()
digest.update(data.encode('utf-8'))
sign = signer.sign(digest)
signature = base64.b64encode(sign).decode('utf-8')
print(sign)
print(signature)
res = requests.post(url="https://api.pingxx.com/v1/identification",
data=data,
headers={
"Pingplusplus-Signature": f"{signature}",
"Content-Type": "application/json",
"Authorization": f"Bearer {c.app_key}"
})
print(res.json())
michealzh commented
您使用的SDK版本相信请提供一下 我试了下没出现您的情况 出现证书错误一般是由于证书配置不正确
bluicezhen commented
pingpp==2.1.1
bluicezhen commented
问题已解决,是我们这边的问题。给您添麻烦了。