为API请求构建摘要标头

发布于 2025-01-24 14:43:15 字数 876 浏览 3 评论 0 原文

我一直在努力缠绕一些东西 - 我正在尝试了解有关API的更多信息,

以计算消化,您必须执行以下操作:

“ sha-512 =” + base64(sha512(有效载荷) 对于一个空字符串,输出应为“ SHA-512 = Z4PHNX7VUL3XVCHQ1M2AB9YG5AULVXCGG/SPIDNS6C5H0NE8XYXYXYXYSP+dgnKHFUWVY7KXVUDBEOGOGLODJ6+SFAPG

== 我需要在计算中添加一些东西吗? RFC 3230- http中的实例摘要 ... HTTP中的实例摘要(RFC 3230) 在文档中,我已经解释了此示例,我们有:

raw_payload = "{\"data\":{\"type\":\"customerAccessToken\",\"attributes\":{\"applicationCustomerReference\":\"15874569\"}}}"
digest = "SHA-512=" + BASE64(SHA512(raw_payload)
=> "SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg=="

我需要在计算中添加一些东西,而不是仅仅是空字符串? 当我尝试按照示例进行示例时,结果是完全不同的 - 这是一个空白的计算。 任何帮助都将不胜感激:轻微的_smile:

i've been struggling to wrap my head around something - https://datatracker.ietf.org/doc/html/rfc3230#section-4.3.2
I'm trying to learn more about the API in general

To calculate the digest, you must do the following:

"SHA-512=" + Base64(SHA512(payload)
For an empty string, the output should be "SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg=="

I tried to do this for the empty payload but never came to the same conclusion..
Do I need to add something into the computation?
RFC 3230 - Instance Digests in HTTP
...
Instance Digests in HTTP (RFC 3230)
In the documentation I have explaining this example, we have this:

raw_payload = "{\"data\":{\"type\":\"customerAccessToken\",\"attributes\":{\"applicationCustomerReference\":\"15874569\"}}}"
digest = "SHA-512=" + BASE64(SHA512(raw_payload)
=> "SHA-512=z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg=="

Do I need to add something to the calculation instead of the just the empty string?
When I try to follow the example, the result is completely different - this is a calculation with an empty body.
Any help would be greatly appreciated :slight_smile:

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文