Sinegy API 签名,HMAC-SHA25,并以 base64 格式编码
有人可以帮我处理 sinegy API 签名吗?这就是他们要问的:
使用完整签名身份验证的 API 方法需要请求标头中的 api-key 和请求正文中的 api-signature。
API 签名是一条编码消息,其中包含:
字符串请求参数
API函数方法
API函数路径
API秘密这些属性必须用竖线分隔 线 |分隔符,采用 HMAC-SHA25 进行哈希处理,并采用 Base64 格式进行编码。
我对 API 签名没有任何经验,这是我迄今为止尝试过的:
secret = '$KDcKdsemlwJ6Vmj05f5NOQ4e.'
digest = hmac.new(
secret.encode(),
'ghjfghjfgh|fjkghkghj|ghjkghjk|ljklhjklh'.encode(),
hashlib.sha256
)
signature = base64.b64encode(digest.digest())
这是他们的示例签名:8asufaol53wad
, 但我收到的是: b'qCTV/psNaUdZt/F+0QMhDISb/n4yYuYrK7YG8aMCC7U='
这是他们完整的 API 文档:https://docs.sinegy.com/#tag/Authentication
Can somebody help me with sinegy API signature? This is what they are asking:
API methods that use full signed authentication requires api-key in the request header and api-signature in the request body.
API signature is an encoded message which contains:
Stringed request parameters
Method of API function
Path of API function
API secretThese attributes must be separated by the vertical
line | delimiter, hashed in HMAC-SHA25, and encoded in base64 format.
I don't have any experience with API signatures, this is what I tried so far:
secret = '$KDcKdsemlwJ6Vmj05f5NOQ4e.'
digest = hmac.new(
secret.encode(),
'ghjfghjfgh|fjkghkghj|ghjkghjk|ljklhjklh'.encode(),
hashlib.sha256
)
signature = base64.b64encode(digest.digest())
This is what their example signature looks like: 8asufaol53wad
,
but what I receive is: b'qCTV/psNaUdZt/F+0QMhDISb/n4yYuYrK7YG8aMCC7U='
Here is their full API doc: https://docs.sinegy.com/#tag/Authentication
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: