如何在WCF中使用WS-Security?

时间:2010-03-16 19:19:02

标签: wcf soap ws-security

以下是我需要创建的标题样式。我应该使用公钥/私钥或SSL样式证书。

我不确定,但我认为我的反对方正在使用某种形式的Java。

 <soap-env:Header>
   <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">
     <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
       <ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
         <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
         <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
         <ds:Reference URI="#secinfo">
           <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
           <ds:DigestValue>xxxxxxxxxxxxx</ds:DigestValue>
           <ds:Transforms>
             <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
               <ds:XPath>//*[@id='secinfo']/child::*/text()</ds:XPath>
             </ds:Transform>
           </ds:Transforms>
         </ds:Reference>
       </ds:SignedInfo>
       <ds:SignatureValue>xxxxxxxxxxds:SignatureValue>
       <ds:KeyInfo>
         <ds:KeyName>xxxxxxx</ds:KeyName>
       </ds:KeyInfo>
     </ds:Signature>
     <t:UsernameToken xmlns:t="http://schemas.xmlsoap.org/ws/2002/04/secext" id="secinfo">
       <t:UserInfo>USER=xxxx;CORR=xxxx;TIMESTAMP=201003161916</t:UserInfo>
     </t:UsernameToken>
   </wsse:Security>
 </soap-env:Header>

1 个答案:

答案 0 :(得分:2)

有点晚了,但是这个怎么样:

How to: Sign a SOAP Message Using an X.509 Certificate