<element name="Integrity"> <complexType> <sequence> <element name="SignatureAlgorithm" type="secpol:AlgorithmType"/> <element name="CanonicalizationAlgorithm" type="secpol:AlgorithmType"/> <element name="Target" type="secpol:IntegrityTargetType" minOccurs="1" maxOccurs="unbounded"/> <element name="SupportedTokens" type="secpol:SupportedTokensType" minOccurs="0"/> </sequence> <attribute name="SignToken" type="xsd:boolean" default="true"/> </complexType> </element>
SignToken属性用于说明签名是否会包括用于签名的密钥。SignatureAlgorithm元素指定了SignedInfo的签名方法的算法。CanonicalizationAlgorithm指定了标准方法的算法。Target元素则提供了对消息中的特定块进行签名的细节。它对应于SignedInfo中的Reference。可以有一个或多个Target。SupportedTokens元素指定了所支持的进行签名的安全令牌的类型。它也可以省略,这种情况下Integrity断言就成为“抽象”(abstract)。服务运行时会动态地将其补上,这使配置更为灵活。我将单独写一篇文章,详细介绍抽象策略的概念,并说明如何使用Qname和Xpath表达式指定Target元素。
WLS 9.0附带了一个内置的WS-SecurityPolicy文件,Sign.xml,它包含了对SOAP消息使用数字签名的大多数常见用例。下面是Integrity断言的一个代码片段:
<wssp:Integrity> <wssp:SignatureAlgorithm URI="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <wssp:CanonicalizationAlgorithm URI="http://www.w3.org/2001/10/xml-exc-c14n#"/> <wssp:Target> <wssp:DigestAlgorithm URI="http://www.w3.org/2000/09/xmldsig#sha1" /> <wssp:MessageParts Dialect="http://www.bea.com/wls90/security/policy/wsee#part"> wls:SystemHeaders() </wssp:MessageParts> </wssp:Target> <wssp:Target> <wssp:DigestAlgorithm URI="http://www.w3.org/2000/09/xmldsig#sha1" /> <wssp:MessageParts Dialect="http://www.bea.com/wls90/security/policy/wsee#part"> wls:SecurityHeader(wsu:Timestamp) </wssp:MessageParts> </wssp:Target> <wssp:Target> <wssp:DigestAlgorithm URI="http://www.w3.org/2000/09/xmldsig#sha1" /> <wssp:MessageParts Dialect="http://schemas.xmlsoap.org/2002/12/wsse#part"> wsp:Body() </wssp:MessageParts> </wssp:Target> </wssp:Integrity>
策略要求所有的WLS系统标题(如:WS-Addressing标题)都必须进行签名。签名还在wsse:Security soap标题中包括soap主体和时间戳元素。因为SignToken属性使用默认值true,签名密钥也将受到保护。
原文出处:http://dev2dev.bea.com/blog/jlee/archive/2005/09/wls_wssecurityp_2.html