2012-02-23 59 views
1

我正在嘗試實現自定義WCF服務客戶端。服務器使用wsHttpBinding和消息安全性,沒有客戶端憑據。我必須通過編程來形成適當的肥皂信封才能開始TLS握手。我已經從標準的WCF客戶端獲取了初始請求。消息是這樣的:使用郵件安全性的WCF服務TLS握手

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 
    <s:Header> 
     <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action> 
     <a:MessageID>urn:uuid:f88d1721-29ce-4418-994e-a3796f053e63</a:MessageID> 
     <a:ReplyTo> 
     <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address> 
     </a:ReplyTo> 
     <a:To s:mustUnderstand="1">http://localhost:56635/Service1.svc</a:To> 
    </s:Header> 
    <s:Body> 
     <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" Context="uuid-6549ee11-0349-4dbc-8686-6b7f0b079251-1"> 
     <t:TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</t:TokenType> 
     <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType> 
     <t:KeySize>256</t:KeySize> 
     <t:BinaryExchange ValueType="http://schemas.xmlsoap.org/ws/2005/02/trust/tlsnego" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">FgMBAFoBAABWAwFPQ8mbvU/nL8Cgu/CRIhhvVyRAYNdppNpdUY2UEi/GLQAAGAAvADUABQAKwBPAFMAJwAoAMgA4ABMABAEAABX/AQABAAAKAAYABAAXABgACwACAQA=</t:BinaryExchange> 
     </t:RequestSecurityToken> 
    </s:Body> 
</s:Envelope> 

問題是,我找不出我應該編碼和插入到BinaryExchange標記的值。任何幫助,將不勝感激。

回答

1

你不想走那條路。有兩個複雜的標準(ws-secureconversation和ssl nego)。每個包含多個消息交換。您需要非常努力地完成所有簽名和加密的部分。您應該使用常規的WCF客戶端。