我正在尝试实现 XML 数字签名的例程,并且能够正确计算要签名的信息的哈希值。但是,我面临签名本身的问题,因为我无法创建要签名的真实字符串。
现在我有这个:
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod>
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
<DigestValue>eDSx9uS7oB++bnG/6tGiD/l8374=</DigestValue>
</Reference>
</SignedInfo>
仅使用 CR 而不是 CRLF。没有用于缩进的空格(帖子显示标签之间有空格的地方,有一个 CR)
计算有效签名的任何建议?
PD 我已将规范化算法更改为 EXCLUSIVE 并且它可以工作,但要求是使用 INCLUSIVE。
提前非常感谢。