文章
· 九月 18 阅读大约需 2 分钟

第二十八章 添加数字签名 - 指定摘要方法

第二十八章 添加数字签名 - 指定摘要方法

指定摘要方法

默认情况下,签名的摘要值是通过 SHA-1 算法计算的,安全标头中的 <Signature> 元素包含如下内容:

   <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
   <DigestValue>waSMFeYMruQn9XHx85HqunhMGIA=</DigestValue>

可以为签名指定不同的摘要方法。为此,调用 %XML.Security.Signature 实例的 SetDigestMethod() 方法。对于参数,请使用以下宏之一(包含在 %soap.inc 文件中):

  • $$$SOAPWSsha1 (the default)

-$$$SOAPWSsha256

  • $$$SOAPWSsha384

  • $$$SOAPWSsha512

 do sig.SetDigestMethod($$$SOAPWSsha256)

指定签名方法

默认情况下,签名值是通过 RSA-SHA256 算法计算的,安全标头中的 <Signature> 元素包含如下内容:

   <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256"></SignatureMethod>
...
   <SignatureValue>J+gACmdjkJxaq2hJqA[parts omitted]</SignatureValue>

可以为签名方法指定不同的算法。为此,调用 %XML.Security.Signature实例的 SetSignatureMethod() 方法。对于参数,请使用以下宏之一(包含在 %soap.inc 文件中):

  • $$$SOAPWSrsasha1

  • $$$SOAPWSrsasha256 (the default)

  • $$$SOAPWSrsasha384

  • $$$SOAPWSrsasha512

  • $$$SOAPWShmacsha256

  • $$$SOAPWShmacsha384

  • $$$SOAPWShmacsha512

 do sig.SetSignatureMethod($$$SOAPWSrsasha512)

请注意,可以修改默认签名算法。要进行此操作,请访问管理门户,单击系统管理,然后单击安全,然后单击系统安全,然后单击系统范围安全参数。指定默认签名算法的选项标记为默认签名哈希。

讨论 (0)1
登录或注册以继续