How to Encrypt data contract in WCF WsHttpBinding

Jul 15 2009 7:47 PM

Hi there.

I've been trying to trace the message encryption but it seems like the message in only signed (not encrypted).

I have configured the following operation contract in both service and client. and using WsHttpBinding

  1. [OperationContract(IsOneWay = true, ProtectionLevel = ProtectionLevel.EncryptAndSign)]  
  2.         void Execute(MessageType msg);  
  3.   
  4.   
  5.   
  6. //MessageType  
  7. [DataContract()]  
  8.     public class MessageType  
  9.     {  
  10.         private string m_batchName;  
  11.   
  12.         [DataMember()]  
  13.         public string BatchName  
  14.         {  
  15.             get { return m_batchName; }  
  16.             set { this.m_batchName = value; }  
  17.         }  
  18. }  

The SOAP message result:

  1. <s:Body u:Id="_0" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">  
  2. <Execute xmlns="http://tempuri.org/">  
  3. <msg xmlns:a="http://schemas.datacontract.org/2004/07/MarketsoftService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
  4. <a:BatchName>REFORMAT-INPUT-DATA.BAT</a:BatchName>  
  5. </msg>  
  6. </Execute>  
  7. </s:Body>  


Notice that the batchName in the above SOAP message was not encrypted but it was signed.


any thoughts?