B.2.5. Signing a Request Using hmac-sha256 (B.2.5. 使用 hmac-sha256 签名请求)
B.2.5. Signing a Request Using hmac-sha256 (B.2.5. 使用 hmac-sha256 签名请求)
本示例使用 hmac-sha256 算法与密钥 test-shared-secret 覆盖 test-request 消息的部分内容.
对应的签名基为:
NOTE: '' line wrapping per RFC 8792
"date": Tue, 20 Apr 2021 02:07:55 GMT
"@authority": example.com
"content-type": application/json
"@signature-params": ("date" "@authority" "content-type")
;created=1618884473;keyid="test-shared-secret"
这导致在标签 sig-b25 下将下列 Signature-Input 与 Signature 头字段加入消息:
NOTE: '' line wrapping per RFC 8792
Signature-Input: sig-b25=("date" "@authority" "content-type")
;created=1618884473;keyid="test-shared-secret"
Signature: sig-b25=:pxcQw6G3AjtMBQjwo8XzkZf/bws5LelbaMk5rGIGtE8=:
在实践中使用对称签名前, 见第 7.3.3 节关于安全权衡的讨论.