I'm accessing a SSL-protected web-service.
On the one hand, if I access this web-service with openssl s_client, copying the relevant http POST request from a file html-request, I get a HTTP/1.1 200 OK response.
On the other hand, if I set up the SSL-Layer with stunnel (listening on local port 1443 and forwarding the encrypted traffic to the server) and then use
cat html-request | nc localhost 1443
the server responds with HTTP/1.1 400 Bad Request.
I assumed that both tools to not pre-process the content from the html-request-file. But this assumption seems to be wrong - otherwise I would get the same response in both cases.
Two questions:
1) how do openssl s_tunnel and nc differ in processing the input data from html-request?
2) is there a way to get a hexdump of the unencrypted traffic from openssl s_client, considering that I use Elliptic Curve private keys (so wireshark is unable to decrypt the traffic)? The -debug option seems to dump the encrypted traffic.
-crlf) and they have no idea what HTTP looks like anyway. Unfortunately with the current information it is impossible to reproduce the issue. And, I cannot see any relation to information security (just because it uses s_client or stunnel does not make it relevant here, and if you don't find a command line option to get what you want there probably is none) so I propose to close it. – Steffen Ullrich Dec 07 '16 at 16:48s_clientconveniently displays 'master-key' and 'session-id' in its handshake summary. See https://wiki.wireshark.org/SSL#Using_the_.28Pre.29-Master-Secret which actually links back here to http://security.stackexchange.com/a/42350/39571 . But I concur it will be exactly what was in the input file, at least on Unix; on Windows there might be a CRLF-vs-LF issue. – dave_thompson_085 Dec 08 '16 at 06:46