Ever seen this message on WhatsApp? Do you know why this appears?

Abhishek Kumar
Published in
3 min readOct 23, 2021

We all have came across this message on Whatsapp. It usually occurs when we reinstall the app. But why it occurs is tricky. To know it we need to have a basic understanding of Cryptography & Encryption.

If you already know about cryptography you can skip to the last section of the article.

Encryption key: Its is a random string of bits created specifically to scramble and unscramble data. It’s generated using algorithms that ensure each one is unique and unpredictable.

Cryptography & Encryption:

Cryptography is the science of safeguarding communications from outside observers. Cryptography can be classified into three categories:

  • Secret Key Cryptography
  • Public Key Cryptography
  • Hash Functions

Encryption techniques take the original communication (plaintext) and turn it into ciphertext, which is incomprehensible. The key enables the app to decrypt the message, ensuring that it can be read.

Public key cryptography enables end-to-end encryption, therefore we’ll learn more about it here. Know more about cryptography

Public Key Cryptography:

Public key cryptography, commonly known as Asymmetric cryptography, encrypts data using two keys. One key is used to encrypt the message, while the other may decrypt it. In contrast to symmetric cryptography, if one key is used to encrypt, the message cannot be decrypted with the same key.

One key is kept private and is referred to as the private key, while the other is shared openly and can be used by anybody, thus the term public key. The private key cannot be guessed from the public key. The private key should not be shared and should only be kept by the user. While Public Key can be shared to anyone.

End to End Encryption (E2E):

End-to-end encryption is a secure communication technology that prevents third parties from gaining access to data as it moves from one end system or device to another. In true E2E encryption, encryption occurs at the device level. That is, messages and files are encrypted before they leave the phone or computer and aren’t decrypted until they reach their destination. Due to this, any third party can’t access data. It stores private keys on the endpoint devices

How E2E works in WhatsApp

Before sending a message to anyone, WhatsApp downloads the receiver’s public key and encrypts your message with the receiver’s public key. & sender’s private key, This encrypted message is called ciphertext. This ciphertext can only be decrypted using the receiver’s private key & sender’s public key. Since WhatsApp doesn’t store your private key, each time you install it makes a new key pair.

Let’s return to the main question.

Why WhatsApp waits for your contact to be online when you reinstall it?

Let’s say Preet sends Anish a message. Anish, on the other hand, had already uninstalled WhatsApp. Since Anish’s old public key is available on the server, the message will be encrypted using the old public key.
However, when Anish reinstalls it, Whatsapp will generate a new key pair for Anish different from the old key pair, which is unable to decrypt Preet’s message.
That’s why Whatsapp waits for Preet to be online and resends Anish’s new public key to Preet, re-encrypt the message using that key, then the message cycle completes.

I hope you found this insightful. If you have any doubts or suggestions, please post in the comment section. Happy to help and discuss. Cheers!