views:

3085

answers:

8

I'm developing a client/server app that will communicate via rest. Some custom request data will be stored in the header of the request. Both the server sending the request and the receiving server have an SSL certificate - will the headers be encrypted, or just the content?

+11  A: 

SSL encrypts the entire communications path from the client to the server and back, so yes - the headers will be encrypted.

By the way, if you develop networked applications and care about data security, the least you should do is read a book like Practical Cryptography, by Niels Ferguson and Bruce Schneier, and probably further reading that's more focused on web application security would be a good idea. If I may make an observation - and please, I don't mean that as a personal criticism - your question indicates a fundamental lack of understanding of very basic web security technologies, and that's never a good sign.

Also, it's never a bad idea to confirm that data which is assumed to be encrypted is indeed encrypted. You can use a network analyzer to monitor traffic on the wire and watch out for anything sensitive being sent in the clear. I've used Wireshark to do this before - the results can be surprising, sometimes.

Ori Pessach
Thanks, that's very much appreciated. I was confident in the answer, but have to have this confirmed (for the powers that be) before we start development. Cheers!
adam
+1  A: 

Both headers and content are encrypted.

cjm
+1  A: 

SSL..or rather HTTPS (HTTP over SSL) sends all HTTP content over SSL, and as HTTP content and headers are in fact the same thing, this means the headers are encrypted as well. Seeing as GET and POST data is sent via HTTP headers, then it only makes sense then when sending data securely you wouldn't just want the response code or content to be encrypted.

HTTP content and headers are not the same thing, and POST data is not sent via HTTP headers, it is sent in the request body.
Jim
+3  A: 

As long as you're communicating in the SSL tunnel, everything sent between the server and the client will be encrypted. The encryption is done before any data is sent or received.

zigdon
+1  A: 

Having a certificate is not enough, you have to configure the web server to encrypt the connections (that is, to use the certificate) for that domain or virtual host. In addition, I think you would just need a single certificate, responses to requests will still be encrypted.

And yes, HTTP headers are encrypted as well as the data.

Vinko Vrsalovic
+2  A: 

You appear to think that REST is a distinct protocol.

REST is not a protocol. It is a design style for HTTP-based applications.

So, your a writing an HTTP application. Are the headers encrypted? Yes, if you are using the HTTPS (HTTP over SSL) protocol instead of plain HTTP.

Having certificates on both sides is not directly relevant to your question. SSL certificates are used for authentication. They help in detecting man-in-the-middle attacks such as are possible using DNS cache poisoning.

ddaa
Thanks, but i'm aware that REST is a methodology rather than a protocol.
adam
A: 

I know this has nothing to do with your question; I just want to warn others looking into a REST implementation. REST has definite speed advantages over other implementations; however, it does not easily provide a "transactional handshake" type of communication. My complaint is that if I send a response from the server to the client, I have no good way of knowing that the client got it.

A: 

The other answers are correct that headers are indeed encrypted, along with the body, when using SSL. But keep in mind that the URL, which can include query parameters, is never encrypted. So be careful to never put any sensitive information in URL query parameters.

Avi Flax
No, not exactly true. Query parameters are sent after the handshake and thus are encrypted; SSL specifically strips them and sends them as part of the page block.
blowdart
@blowdart - very true, but browsers will still capture query strings in their history. So best not to use sensitive information in a query string.
Matt