http://msdn.microsoft.com/en-us/library/aa347791.aspx
To sign all messages for a service
[ServiceContract(ProtectionLevel = ProtectionLevel.Sign)]
public interface ICalculator
To sign all message parts for an operation
// Set the ProtectionLevel on the whole service to Sign.
[ServiceContract(ProtectionLevel = ProtectionLevel.Sign)]
public interface ICalculator
{
// Set the ProtectionLevel on this operation to None.
[OperationContract(ProtectionLevel = ProtectionLevel.Sign)]
double Add(double a, double b);
}
Protecting Fault Messages
public interface ICalculator
{
// Set the ProtectionLevel on a FaultContractAttribute.
[OperationContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
[FaultContract(
typeof(MathFault),
Action = @"http://localhost/Add",
Name = "AddFault",
Namespace = "http://contoso.com",
ProtectionLevel = ProtectionLevel.EncryptAndSign)]
double Add(double a, double b);
}
Protecting Message Parts
[MessageContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
public class Company
{
[MessageHeader(ProtectionLevel = ProtectionLevel.Sign)]
public string CompanyName;
[MessageBodyMember(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
public string CompanyID;
}