I am using stunnel as a MITM to decrypt TLS traffic in between an app and its web server.

The traffic between the app and the MITM server cannot be decrypted simply with RSA cipher as the app is not accepting such cipher anymore.

The traffic between the MITM client and the webserver could be decrypted with the RSA keys method as the webserver allows the use of RSA ciphers and the MITM client is configured to use RSA ciphers only.

Thus, I captured traffic between the MITM client and the webserver. I can confirm the cipher used is from the RSA family (TLS_RSA_WITH_AES_256_GCM_SHA384).


I used to decrypt TLS 1.2 RSA traffic by using the server pem file. In this setup, I only have client RSA keys. Would it still be possible to decrypt the traffic knowing only the client's RSA keys? And where could I find them?

My stunnel client conf is as follow

client = yes
accept =
connect = webserver.com:8888
cert = C:/whatever/stunnel/config/stunnel.pem
ciphers = RSA

I tried to include the stunnel pem file in Wireshark but without success. Am I doing something wrong here?


I'm assuming that [client] is the configuration for the connection between stunnel and the server. In the case cert specifies the optional client certificate which is used to authenticate a TLS client against the server. This certificate is not involved in the key exchange at all and thus cannot be used to decrypt the traffic. Only the server certificate is involved in the RSA key exchange and thus for decrypting the private key of the server certificate needs to be known.

  • You are right about [client] assumptions. Since the cert configuration here is useless for my need - is there anything else involved in the client decryption process? The app is still able to decrypt traffic from the server without knowing its private key. I was assuming the client could use its own RSA private key to decrypt traffic.
    – mouch
    Nov 21 '19 at 15:47
  • @mouch: "The app is still able to decrypt traffic from the server without knowing its private key." - The client never needs to know the servers private key to decrypt the data. The data are encrypted with a key determined during the key exchange. In the case of RSA key exchange the client defines the key and submits it to the server encrypted with the servers public key, so that the server can decrypt it with its private key (note: this is a simplification to get the idea). Thus the private key of the server certificate is only used by the server itself. Nov 21 '19 at 15:59
  • Thanks Steffen, that makes a lot of sense. To be able to solve my initial issue I had to create not 1 but 2 MITM chained so that I could intercept traffic between the first and the second MITM and decrypt the traffic with the pem file from the second MITM that I control.
    – mouch
    Nov 22 '19 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.