We can add a message header to a WCF message by adding a MessageHeader attribute, like this
[MessageContract]
public class HelloResponseMessage
{
[MessageHeader(ProtectionLevel=EncryptAndSign)]
public string SSN
{
get { return extra; }
set { this.extra = value; }
}
}
First question: how safe is it and does it work for all types of WCF bindings?
and the second question, is it possible to add an encrypted header to all messages and extract a dynamic version of the server from it?
MessageHeader header = MessageHeader.CreateHeader("SessionKey", "ns", _key);
OperationContext.Current.OutgoingMessageHeaders.Add(header);
source
share