Hi,
I am consuming a soap webservice with transport security based on a x509 certificate with a private key.
For this we have configured a WsHttpBinding with transport mode and clientcredentialtype certificate.
In the behavior, we have added the client certificate with the private key in the client credentials.
This is working fine.
Now the client who is hosting the webservice wants an additional layer of security by adding message encryption.
I know this is redundant because the transport is already being encrypted, but the client really wants the messages also to be encrypted.
I have got another x509 certificate with a public key for the message encryption, but I can't find out how to get this working.
I found out that message security doesn't work with SSL out of the box, so probably this has to be done with a custom binding.
Is that true?
I have converted the WsHttpBinding for the transport security to a CustomBinding and that is working fine. This is the config for the custom binding for just the transport security:
<system.serviceModel>
<client>
<endpoint address="https://endpointurl"
behaviorConfiguration="endpointCredentialBehavior"
binding="customBinding"
bindingConfiguration="Binding1"
contract="MyNamespace.MyType"/>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="endpointCredentialBehavior">
<clientCredentials>
<clientCertificate findValue="mysubjectname"
storeLocation="CurrentUser"
storeName="My"
x509FindType="FindBySubjectName" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="Binding1">
<textMessageEncoding messageVersion="Soap12"></textMessageEncoding>
<httpsTransport requireClientCertificate="true"></httpsTransport>
</binding>
</customBinding>
</bindings>
</system.serviceModel>
What do I have to add to the custom binding to add the message encryption? I suppose I have to add a security element, but I can't find out which one and how it has to be configured.
Am I right that for the message encryption I have to add the new certificate with the public key to the behavior in a servicecertificate's defaultcertificate? So that the certificate with the private key has to be configured in a client certificate (for the transport security, like we have now) and the other certificate with the public key has to be configured in a service certificate? Sorry, but I can't find good documentation about this.
Any help would be appreciated.