【发布时间】:2017-12-04 11:25:47
【问题描述】:
我正在阅读此IBM Developer Works SAML article,您可以在其中看到以下两种不同的签名/摘要算法:sha1 和 sha256。我很好奇为什么两者都被列出以及通过哪种方法签名的内容。那篇文章说,“[IdP] 将散列算法应用于 Assertion 元素的内容。”那似乎是sha256,但是为什么要提到DigestMethod sha1呢?如果这两种方法都在散列相同的内容,那么当 sha1 是 DigestMethod 时,服务提供商 (SP) 如何知道使用 sha256 验证签名?
这是StackOverflow post的正确解释吗?
...DigestMethod Algorithm 元素引用其父 Reference 元素。您可以为多个参考元素使用不同的 DigestMethod 算法,并再次使用不同的 SignatureMethod 算法对所有参考进行散列和签名。
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
ID="Assertion1487321564650" IssueInstant="2017-02-17T08:52:44.650Z"
Version="2.0">
<saml2:Issuer>samlsso.sample.net</saml2:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<ds:SignatureMethod
Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<ds:Reference URI="#Assertion1487321564650">
<ds:Transforms>
<ds:Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>nKYxEAMG1LY4H+LqR22KJ/vqyb8=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
m5V44OFKU1PMdibileobvVVA8NVZMKRmKAauOin2f+Kr1WQ [...] Z/5JcU/qw==
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
MIIDRzCCAi+gAwIBAgIEKa/crTANBgkq
【问题讨论】:
标签: digital-signature saml-2.0