You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

签署xadesSignedProperties报错:签名属性哈希无效的技术咨询

排查XAdES签名属性哈希无效问题

签署<xadesSignedProperties>时出现错误,错误提示:
Invalid signed properties hashing, SignedProperties with id='xadesSignedProperties'

已哈希签名属性

<ds:Reference Type="http://www.w3.org/2000/09/xmldsig#SignatureProperties" URI="#xadesSignedProperties">
    <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
    <ds:DigestValue>YmZlNTJiODNjMzQwMzE5ZWQ5MDM2NzVjNTc1YmRiMzI1YzFjM2E3MzkxMWRkZmQ4YzcwMTM2YTVkMTE2NjI5NQ==</ds:DigestValue>
</ds:Reference>

对应的签名属性

<xades:QualifyingProperties Target="signature" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#">
    <xades:SignedProperties Id="xadesSignedProperties">
        <xades:SignedSignatureProperties>
            <xades:SigningTime>2023-05-28T08: 20: 58Z</xades:SigningTime>
            <xades:SigningCertificate>
                <xades:Cert>
                    <xades:CertDigest>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></ds:DigestMethod>
                        <ds:DigestValue>MTA0YzhiMzNkNjRlZmE5OWZkN2EwYjkyODBmMWI3MjllODA0OGQzODE2MTU2NmQ3MTkwMWQ5OGJmZmI4MDZkYQ==</ds:DigestValue>
                    </xades:CertDigest>
                    <xades:IssuerSerial>
                        <ds:X509IssuerName>CN=eInvoicing</ds:X509IssuerName>
                        <ds:X509SerialNumber>1685004381661</ds:X509SerialNumber>
                    </xades:IssuerSerial>
                </xades:Cert>
            </xades:SigningCertificate>
        </xades:SignedSignatureProperties>
    </xades:SignedProperties>
</xades:QualifyingProperties>

排查方向

  • 时间格式多余空格:<xades:SigningTime>中的时间字符串存在多余空格(08: 20: 58Z冒号后有空格),XAdES验证时会对XML做规范化处理,这类空格会被移除,若计算哈希时用了带空格的原始文本,会直接导致哈希不匹配。建议修正为标准ISO8601格式:2023-05-28T08:20:58Z。
  • XML规范化执行错误:计算<xades:SignedProperties>哈希前,必须严格按照XML-DSig规范对该节点做规范化处理(通常采用http://www.w3.org/TR/2001/REC-xml-c14n-20010315算法),确保哈希计算的是规范化后的节点内容,而非带缩进、换行的原始XML。
  • 命名空间完整性问题:规范化时必须包含<xades:SignedProperties>的命名空间声明(xmlns:xades="http://uri.etsi.org/01903/v1.3.2#"),遗漏命名空间会导致哈希值错误。
  • 节点范围错误:确认哈希计算的目标是<xades:SignedProperties Id="xadesSignedProperties">及其所有子节点,不能包含外层的<xades:QualifyingProperties>,也不能遗漏任何子元素。

内容的提问来源于stack exchange,提问作者Abdullah Khatri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 09:02:44