WhatsApp employs end-to-end encryption to safeguard users' conversations. This high-level security measure is based on the Signal Protocol developed by Open Whisper Systems.
Each user is equipped with a private and a public key, a fundamental component of this encryption method. When a user launches the app, a private key is automatically generated and stored within the app's data library. Simultaneously, the public key is transmitted alongside the message to the intended recipient.
The public key's role is to encrypt the message while it's in transit. Upon receipt, the recipient uses their private key to decrypt the message. Since both private keys are kept on users' devices, unauthorized access to sensitive data by third parties is effectively prevented (barring certain bugs). This powerful encryption ensures that only the intended recipient can read the messages.