WEB开发网
开发学院软件开发Java Java Web 服务: WS-Trust 和 WS-SecureConversati... 阅读

Java Web 服务: WS-Trust 和 WS-SecureConversation

 2010-07-16 00:00:00 来源:WEB开发网   
核心提示: 在 清单 4 中,可以看到此证书从客户机发送到了服务器,Java Web 服务: WS-Trust 和 WS-SecureConversation(8),并且此证书引用被返回给客户机,且每个方向上的证书被用来验证时间戳和消息主体的签名,本系列的下一篇文章将会谈论 Apache Axis2、Met

在 清单 4 中,可以看到此证书从客户机发送到了服务器,并且此证书引用被返回给客户机,且每个方向上的证书被用来验证时间戳和消息主体的签名。对于这种策略配置,客户机证书需要受此 STS 信任,且此 STS 证书必须存在于此客户机的可信存储内。

清单 5 显示了使用了 WS-SecureConversation 的客户机与服务之间的消息交换(经大量编辑后的):

清单 5. 对服务的请求以及对客户机的响应

 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
 <soap:Header> 
  <Action xmlns="http://www.w3.org/2005/08/addressing">urn:matchQuakes</Action> 
  <MessageID xmlns="http://www.w3.org/2005/08/addressing" 
   >urn:uuid:c724a446-4375-4e8a-a318-fd3c84510eae</MessageID> 
  ... 
  <wsse:Security xmlns:wsse="...wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"> 
   <wsc:SecurityContextToken xmlns:wsc=".../ws-secureconversation/200512" 
    xmlns:wsu="...wssecurity-utility-1.0.xsd" 
    wsu:Id="sctId-A167EB2B526E0894DA12736604029099"> 
    <wsc:Identifier>A167EB2B526E0894DA12736604029098</wsc:Identifier> 
   </wsc:SecurityContextToken> 
   <wsc:DerivedKeyToken xmlns:wsc=".../ws-secureconversation/200512" 
    xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="derivedKeyId-9"> 
    <wsse:SecurityTokenReference xmlns:wsse="...wssecurity-secext-1.0.xsd"> 
     <wsse:Reference xmlns:wsse="..." URI="#sctId-A167EB2B526E0894DA12736604029099" 
     ValueType="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct"/> 
    </wsse:SecurityTokenReference> 
    <wsc:Offset>0</wsc:Offset> 
    <wsc:Length>16</wsc:Length> 
    <wsc:Nonce>AyUGKYBNNQstD9EmZUJqlA==</wsc:Nonce> 
   </wsc:DerivedKeyToken> 
   <wsc:DerivedKeyToken xmlns:wsc=".../ws-secureconversation/200512" 
    xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="derivedKeyId-11"> 
    ... 
   </wsc:DerivedKeyToken> 
   <xenc:ReferenceList xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> 
    <xenc:DataReference URI="#EncDataId-12"/> 
   </xenc:ReferenceList> 
   <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-10"> 
    <ds:SignedInfo> 
     ... 
     <ds:Reference URI="#Id-28812627"> 
      ... 
     </ds:Reference> 
    </ds:SignedInfo> 
    <ds:SignatureValue>6NHo8Si1ntZIb2Ivg3S/n1+2uzI=</ds:SignatureValue> 
    <ds:KeyInfo Id="KeyId-CF15C330C32618BF4912736604029689"> 
     <wsse:SecurityTokenReference xmlns:wsse="..." xmlns:wsu="..." 
     wsu:Id="STRId-CF15C330C32618BF49127366040296810"> 
      <wsse:Reference xmlns:wsse="..." URI="#derivedKeyId-9"/> 
     </wsse:SecurityTokenReference> 
    </ds:KeyInfo> 
   </ds:Signature> 
  </wsse:Security> 
 </soap:Header> 
 <soap:Body xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-28812627"> 
  <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" ...> 
   <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/> 
   <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> 
    <wsse:SecurityTokenReference xmlns:wsse="...wssecurity-secext-1.0.xsd"> 
     <wsse:Reference xmlns:wsse="..." URI="#derivedKeyId-11"/> 
    </wsse:SecurityTokenReference> 
   </ds:KeyInfo> 
   <xenc:CipherData> 
    <xenc:CipherValue>+krS8lGA...CKSN0fwKR36Q==</xenc:CipherValue> 
   </xenc:CipherData> 
  </xenc:EncryptedData> 
 </soap:Body> 
</soap:Envelope> 
 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
 <soap:Header> 
  <Action xmlns="http://www.w3.org/2005/08/addressing" 
   >http://ws.sosnoski.com/seismic/wsdl/SeismicInterface/quakeResponse</Action> 
  <MessageID xmlns="http://www.w3.org/2005/08/addressing" 
   >urn:uuid:c3aa0671-8751-4d6b-8d4c-0e37ce3e394a</MessageID> 
  <To xmlns="http://www.w3.org/2005/08/addressing" 
   >http://www.w3.org/2005/08/addressing/anonymous</To> 
  <RelatesTo xmlns="http://www.w3.org/2005/08/addressing" 
   >urn:uuid:c724a446-4375-4e8a-a318-fd3c84510eae</RelatesTo> 
  <wsse:Security xmlns:wsse="...wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"> 
   <wsc:DerivedKeyToken xmlns:wsc="...ws-secureconversation/200512" 
   ... 
   </wsc:DerivedKeyToken> 
   <wsc:DerivedKeyToken xmlns:wsc="...ws-secureconversation/200512" 
   ... 
   </wsc:DerivedKeyToken> 
   <xenc:ReferenceList xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> 
    <xenc:DataReference URI="#EncDataId-12"/> 
   </xenc:ReferenceList> 
   <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-10"> 
    <ds:SignedInfo> 
     ... 
     <ds:Reference URI="#Id-10766816"> 
      ... 
     </ds:Reference> 
    </ds:SignedInfo> 
    <ds:SignatureValue>rU6YoV7BiO0qSQjWw2vwCp9R+fg=</ds:SignatureValue> 
    <ds:KeyInfo Id="KeyId-A167EB2B526E0894DA127366040304813"> 
     <wsse:SecurityTokenReference xmlns:wsse="...wssecurity-secext-1.0.xsd" ...> 
      <wsse:Reference xmlns:wsse="..." URI="#derivedKeyId-9"/> 
     </wsse:SecurityTokenReference> 
    </ds:KeyInfo> 
   </ds:Signature> 
  </wsse:Security> 
 </soap:Header> 
 <soap:Body xmlns:wsu="...wssecurity-utility-1.0.xsd" wsu:Id="Id-10766816"> 
  <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" ...> 
   <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/> 
   <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> 
    <wsse:SecurityTokenReference xmlns:wsse="...wssecurity-secext-1.0.xsd"> 
     <wsse:Reference xmlns:wsse="..." URI="#derivedKeyId-11"/> 
    </wsse:SecurityTokenReference> 
   </ds:KeyInfo> 
   <xenc:CipherData> 
    <xenc:CipherValue>Cl0iUu...TJ6WkZl2A==</xenc:CipherValue> 
   </xenc:CipherData> 
  </xenc:EncryptedData> 
 </soap:Body> 
</soap:Envelope>

在 清单 5 中, SecurityContextToken 被包括于每个消息的头部,并由 <wsc:DerivedKeyToken> 元素引用,这些元素给出了获得实际用于签名并加密数据的那些私密密匙所需的参数。

结束语

至此,您已经了解了 WS-Trust 和 WS-SecureConversation 的基础知识,本系列的下一篇文章将会谈论 Apache Axis2、Metro 和 Apache CXF Web 服务堆栈上的 WS-SecureConversation 带来的性能益处。并且在获得此性能成果的过程中,您还将看到在这三个堆栈上配置 WS-SecureConversation 的细节。

上一页  3 4 5 6 7 8 

Tags:Java Web 服务

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接