using WSHttpBinding, by default is that secure? - c#

I have a WCF service, which was initially setup using BasicHttpBinding, but someone suggested I switch over to WsHttpBinding, as that's more secure. I see there is a way to setup the security feature of WsHttpBinding, but I was wondering is it already secured by default? Are the messages that go from my service already encrypted in some format, if so does anyone what security/algorithm is used, as we need to provide a document for the project and is security is used need to let them know which one.
thank you.

The WsHttpBinding will use Message security by default, which means that your message (payload) is encrypted and signed per the WS-Security specification. However, you can add more security on top of this by using Transport security with an SSL certificate. Microsoft has a pretty detailed article on Message Security, which you should definitely read.

Related

Does WCF do CRL/OCSP certificate checking?

We are working on a payment processing application and want to make sure we are doing CRL/OCSP checks when establishing secure connections (we will be initiating a TLS 1.1 session with a server). I would think that .NET would do this for us, but I'm not able to find any information in this regard.
Does .NET do this auto-magically?
Are there any settings to control how it works?
Please provide links to documentation that I cannot seem to find.
If it does not do this for us. Is there a 'best-practice' method for performing the checks, such as the X509Certificate2.Verify Method?
Thank you!
yes, by default WCF client do check server certificate to determine if it is valid for requested usage and is not revoked.
yes, you can control certificate validation behavior. These threads discuss the subject:
One: WCF, REST, SSL, Client, custom certificate validation
Two: Custom WCF client certificate over ssl validation
The best link I know of is this: https://msdn.microsoft.com/en-us/library/aa702579.aspx
According to that link, when using HTTPS, WCF checks the chain trust but does not check for revocation. For Message based security and for TLS over TCP, WCF does both checks according to the the client endpoint configuration.

WCF authentication without certificate

I'm setting up a WCF service. The service has to use transport security over https and I need to use some kind of authentication to prevent unwanted usage.
Digging in to WCF theory has disapointed me so far.
What I have found out so far is that I can use UserName authentication with transport security. But then I will need a certificate to secure the message.
And this makes it difficult to consume with most .NET languages.
I am surprised that I cannot find any good information on how to authenticate a user with wcf without message security?
What I would like is that the client passes username and password in some way to my service.
And for the record. The service will be using transport security.
To break it down:
How can I implement authentication without limiting interoperability?
Is WCF services so cumbersome that I either have to use a completely open service. And use IP filtering or VPN to restrict access?
UPDATE:
Since I am planing to use https with a SSL sertificate, will security mode "TransportWithMessageCredential" be the solution for me?
The only way to get REAL security IS to use digital certificates.
See my own question on this topic for details.
TransportWithMessageCredential (AKA mixed-mode security) is indeed what you are looking for.

WCF with basicHttpBinding, encryption, signing and usernameToken over HTTP

I'm trying to configure WCF client to generate proper request.
In that request I need security header with usernameToken.
Also, I need to encrypt and sign request.
All this is communicated via plain HTTP.
So far, I have managed to make client sign and encrypt message.
Now I need to somehow incorporate usernameToken into this security header.
How can I do this?
I'm using basicHttpBinding, with security mode set to "Message" and clientCredentialType = "Certificate" for message.
I stumbled upon clearUsernameToken binding library but I see no way of incorporating all of this (usernameToken, sign and encrypt) into one client, and all that over HTTP.
Is this even possible?
I have managed to do this with WSE 3.0.
Now in my SOAP request I have UsernameToken, BinarySecurityToken, digital signature and encryption. Of course, I had to do some custom WSE filters, but it wasn't that hard.
For me it's strange that this was easier to achieve in older framework like WSE, then by using WCF.

Secure connection using SOAP

I need to call a .NET SOAP webservice in a secure way. It must be secure in such a way that others can't call the WebService methods, and also it should not be possible for "the middle man" to understand the content of the messages.
The caller will also be a .NET webapplication installed on another IIS.
I can design the webservice methods as I want, so no restrictions there.
I have been researching HTTPS/SSL with certificates, but I don't know if it actually solves my problems in a good way? For example, it would be anoying if the certificates has an expiration date, although it's not a showstopper in any way.
So how would I go about this in a good way..?
Thanks for any help.
As #BrokenGlass said, SSL only encrypts the traffic between points. It doesn't handle securing individual functions from usage without authorization. Here is a good article on just such a topic using SOAP headers:
How to: Perform Custom Authentication Using SOAP Headers
This can be mixed with any form of authentication except Windows Integrated. To use Windows authentication, you'll need to have a separate library which accesses the Active Directory through the DirectoryServices namespace.
Assuming you control the infrastructure then keeping the server that is providing the web services behind a firewall so it's accessible only from the web servers and implementing IPSec should provide the necessary security.
From the software point of view, this article contains all you need to know about protecting the service interactions.
HTTPS/SSL works fine. Just make sure to renew your certificate in time to avoid warnings and messages for your client.
I need to call a .NET SOAP webservice in
a secure way. It must be secure in
such a way that others can't call the
WebService methods, and also it should
not be possible for "the middle man"
to understand the content of the
messages.
HTTPS/SSL only solves the "middle man" part of what you want to achieve. You would still need proper authentication in place on your web service. You could do this i.e by using the built in Forms authentication and providing a Login method that returns your authentication ticket.

Communication between web applications, 1 SSL certificate, other has none

This the situation: I have one webservice without SSL, which provides two pages for the other web application. When the user submits these pages, an XML file with private information is sent to the webservice.
How can I provide the necessary privacy protection on the XML file? Is the one certificate good enough to give the appropriate security?
I'm not sure about this one, and am in the preparation phase of a project... So need to know the involved work on this part...
As an alternative to SSL you could encrypt the file yourself using any of the algorithms available in using System.Security.Cryptography but then you have to work out a mechanism to exchange your key(s).
However by far the easiest way will be to have both web services using SSL endpoints. That will take care of all your confidentiality, integrity and identity considerations in one fell swoop.
Certificates are tied to the hostname of the server (or, with wildcard certificates, all the hosts in a domain). So if the two services are on the same host, then both can use the same certificate.
If they are not on the same host there will be no transport security on the non-SSL service unless this is added separately. WCF has support for message (or part of message) encryption.
The simplest solution is certainly to use TLS, ex-SSL (widely supported in every programming language).
There is no need to buy a certificate (and it brings no extra security, it is mostly there to make PHBs feel better): either create self-signed certificates or set up your own CA.

Categories