Skip to content
TGWAY
Channels & Bots STEP 96 / 99

How Telegram Secret Chat Encryption Works: Where Keys Live

Cloud chat keys sit on your device and Telegram's servers; secret chat keys exist only on two devices. How they are made and rekeyed after 100 messages.

  • Applies toDevelopers
  • LevelL4
  • Reading time3 min
  • Verified

The short answer

  1. 1Cloud chat keys are on your device and the server; secret chat keys only on two devices.
  2. 2The devices make the key with Diffie-Hellman and can compare an image generated from it.
  3. 3The key changes after 100 messages or a week, and the old one is deleted.
In this article
  1. The difference is where the key lives
  2. How the two devices make a key
  3. The key changes during the chat
  4. What only secret chats have
  5. What it does not protect against
  6. FAQ
  7. At a glance

The difference is where the key lives

ChatWhere the decryption key livesResult
Ordinary (cloud) chatsYour device and Telegram's serversStored on the server, so you can continue on any device
Secret chatsOnly the two devices, yours and the other person'sThe server cannot decrypt the content; it is visible only on the device where it was created

Secret chat messages still pass through the server, but the server only carries a locked box. To see this difference from a user's point of view, read what secret chats protect, and what they don't and Telegram encryption explained.

How the two devices make a key

  1. Your device requests a secret chat and sends its key-exchange ingredient, a Diffie-Hellman public value, through the server.
  2. The other device accepts and sends its own ingredient back.
  3. Each device computes the same shared key. The server only carried the ingredients, so it cannot know the key.

The principle is the same as creating the authorization key with the server; see creating an authorization key. The two people can compare an image generated from the key to confirm that no one stepped in between.

The key changes during the chat

Using one key for a long time means that if it ever leaks, more past messages can be decrypted. So the official apps switch to a new key and delete the old one once a key has been used for more than 100 messages or for more than a week. This is perfect forward secrecy. If your own app supports secret chats, it must follow the same rule.

What only secret chats have

  • Tied to a device: they belong to that device's session, not to the account, so they do not appear on other devices.
  • Sequence numbers block insertion and replay: each device counts the messages it has sent and received separately, so missing or resent messages are noticed.
  • A one-time key per file: photos and files are encrypted with a random key separate from the chat key before upload, and only that key is sent through the chat.
  • Self-destruct timer: messages can be deleted from both devices a set time after they are read.

What it does not protect against

The checks you must make if you implement this yourself are in client security guidelines, and the big picture of the protocol in MTProto at a glance.

FAQ

Can Telegram read secret chats?

No. The key exists only on the two devices; the server only relays encrypted data.

How often do secret chat keys change?

The official apps rekey after more than 100 messages or more than a week, deleting the old key.

Why don't secret chats appear on my other devices?

They are tied to the device session where they were created, not to the account.

Sources

Summary

At a glance

How Telegram Secret Chat Encryption Works: Where Keys Live — at a glance illustration
  1. 1Keys

    Secret chats: only the two devices can decrypt.

  2. 2Rekeying

    New key after 100 messages or a week (forward secrecy).

  3. 3Limits

    No protection from screenshots or a compromised device.

Share this guide

Send it to a friend who has the same question.

Telegram WhatsApp
More

Open on your phonePoint your phone camera here to open this guide.

Updated

Related articles

View all ›