I noticed that a lot of messaging start to provide "End2End" security, but I wonder how this can be possible without a key exchange between the the two clients.

To my understanding to provide real end to end security you have to exchange the key between both clients without using the internet, as all the other could be sniffed or changed by some one else. So how can for example WhatsApp provide End2End security ?

Sincerly, Thalhammer

  • What you mean is actually "authentication", ie. "is authentication possible without physical contact". End-to-end encryption actually means that the data ciphered by the sender will be deciphered only by the recipient and no other intermediary (for instance, WhatsApp server will have no mean to decipher messages when using end-to-end encryption). Commented Mar 29, 2015 at 12:15

2 Answers 2


I think you need to separate in your mind confidentiality protection from authentication.

It is quite possible to simultaneous generate a key between two parties over the Internet, with everyone from your ISP to every Govt possible listening in, yet they cannot as an eavesdropper also generate that key. That is the essential point of say the Diffie–Hellman key exchange (https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange). But both parties can use that key for confidentiality protection ONLY; in that scenario neither party truly knows who they formed the key with.

The reason being, if all those baddies on the Internet are active man-in-the-middle, each party could wind up creating a key over-the-Internet with the man-in-the-middle, and be none the wiser. Hence a proper secure communication system includes authentication first, then confidentiality second. For authentication, indeed you need some means out-of-band to get the absolutely true identity key of the other party (and there are a lot of ways to do that with varying levels of reliability). But once you've established identify and authentication of your other party, it is possible to develop keys used for confidentiality purposes over the Internet (by also including the authentication keys in the key exchange process so the man-in-the-middle cannot hijack it).

Re WhatsApp, it gets its security from TextSecure, which relies upon the security of the Off-the-Record Messaging protocol. Start with the Wikipedia article; it has a subsection that discusses authentication of the two parties: https://en.wikipedia.org/wiki/Off-the-Record_Messaging


Yes, but you need some way to be sure that a public key of the recipient corresponds to the person you want to talk to. When you rely on a central service to find a public key for a name/email address/phone number, you're vulnerable to MITM by the "directory service". To get a public key for a person using the internet you can use PKI (and then you're vulnerable to CAs) or web of trust, but that has its own problems. To get a public key for a person without the internet you rely on a different medium: phone/sms, snail mail, meeting in person. As long as you can be sure the public key you have corresponds to the right person, their private key is only under their control, their client machine is only under their control, etc., you can have end-to-end security.

  • But this is not done when using whatsapp, is it ?
    – Thalhammer
    Commented Mar 29, 2015 at 12:44
  • 1
    When you send encrypted message to phone number 123, whatsapp directory gives your client the public key of phone number 123, your client encrypts message, sends it. whatsapp can instead give you key for the NSA. NSA will decrypt, record the cleartext of the message, encrypt it again and forward it to phone number 123. You won't know it happened. Wikipedia says "TextSecure users can ... independently verify their correspondent's identities by comparing key fingerprints out-of-band". Comparing the keys out-of-band is the defense against this MITM attack. Doesn't have to be done in person.
    – Z.T.
    Commented Mar 30, 2015 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .