Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 与GoCardless Webhooks签名匹配的问题_Python 3.x_Base64_Hmac_Hashlib_Gocardless - Fatal编程技术网

Python 3.x 与GoCardless Webhooks签名匹配的问题

Python 3.x 与GoCardless Webhooks签名匹配的问题,python-3.x,base64,hmac,hashlib,gocardless,Python 3.x,Base64,Hmac,Hashlib,Gocardless,我试图匹配从GoCardless收到的Webhook签名,但遇到了困难 不幸的是,没有错误消息可以处理,只是我收到的签名与我生成的任何哈希摘要都不匹配 如果有人能快速查看一下他们的文档,并告诉我是否遗漏了一些明显的内容,我将不胜感激 我正在使用Flask、hmac、hashlib和base64模块 # webhook signature request.headers.get('Webhook-Signature').encode('utf-8') # digest generated usi

我试图匹配从GoCardless收到的Webhook签名,但遇到了困难

不幸的是,没有错误消息可以处理,只是我收到的签名与我生成的任何哈希摘要都不匹配

如果有人能快速查看一下他们的文档,并告诉我是否遗漏了一些明显的内容,我将不胜感激

我正在使用Flask、hmac、hashlib和base64模块

# webhook signature
request.headers.get('Webhook-Signature').encode('utf-8')

# digest generated using the request body and SECRET key
digest = hmac.new(key = SECRET, msg=request.get_data(), digestmod = hashlib.sha256).digest()
base64.b64encode(digest)

任何帮助都将不胜感激。

因此问题在于base64.b64encode(摘要)不等于request.headers.get('Webhook-Signature')。encode('utf-8')您的问题而不是评论