gpt4 book ai didi

xml-signature - 'SignatureMethod' 算法与 XML 签名中的 'DigestMethod' 算法

转载 作者:行者123 更新时间:2023-12-04 03:43:00 25 4
gpt4 key购买 nike

如果我们以下面的 Signature 元素为例:

<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/2000/09/xmldsig#rsa-sha1" />
<ds:Reference URI="#_884D49DAD03AD60748547F8322C11AA0">
<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>...</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>...</ds:SignatureValue>
<ds:KeyInfo>
<ds:KeyName>...</ds:KeyName>
</ds:KeyInfo>
</ds:Signature>

有一个 SignatureMethod 算法 ( http://www.w3.org/2000/09/xmldsig#rsa-sha1 ) 和一个 DigestMethod 算法 ( http://www.w3.org/2000/09/xmldsig#sha1 )。

据我了解,SignatureMethod 算法是 'rsa-sha1' 意味着要签名的内容首先使用 SHA1 散列(消化),然后使用 RSA 签名。

DigestMethod 算法是否总是等于 SignatureMethod 算法('rsa-sha1' 的 sha1 部分)中指定的摘要机制?

我相信事实并非如此,因为两次指定相同的算法是没有用的。我推测可以使用不同的 DigestMethod 算法来消化多个“引用”,并且这些摘要的集合将使用 SignatureMethod 算法指定的摘要机制再次散列。

我试图通过引用“XML 签名语法和处理”规范来理解这一点。如果有人能确认我是否理解正确,或解释这两种算法的目的,我将不胜感激。谢谢。

最佳答案

您说得对, DigestMethod Algorithm 元素引用了它们的父 Reference 元素。您可以为多个引用元素使用不同的 DigestMethod 算法,并再次使用不同的 SignatureMethod 算法来散列和签名所有引用。

关于xml-signature - 'SignatureMethod' 算法与 XML 签名中的 'DigestMethod' 算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31358612/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com