Decrypt WhatsApp Messages

Lakindu Akash
3 min readApr 5, 2019

--

https://www.makeuseof.com

Once I wanted to keep all the Whatsapp messages in separate place and clear all the messages from Whatsapp. I wanted that because, as it growing my chats it takes more space. Whatsapp backups your messages in both local and google drive(if you have allowed). It keeps several backups for recent days. When massages count grows backup also takes more space. Also when I open some chats they might lag when opening. So I wanted to delete them but If I need them later there must be a way to retrieve them.

Let’s dig more into the internal structure of WhatsApp.

Actually, I’m talking about android, but the procedure may be the same for other OS. Whatsapp keeps data locally in two separate locations. One is app’s private folder which user don’t have access without root access. Other is in internal SD card(user can read/write). Whatsapp encrypts your chats into crypt12 database file with AES-256 encryption(crypt12 is an extension to encrypt SQLite DB files) and stores in your phone. You can see several files that have the extension of .crypt12 inside Whatsapp/database folder. All the crypt12 files are encrypted with one key. Even if you switch into a new phone with the same account, the key won’t change. So where is the key? The key is created when you first created WhatsApp account and it stores in apps private folder /data/data/com.whatsapp/files/key. Getting that key is almost impossible without root access. I have seen several websites saying that they can decrypt those crypt12 files and then asking for human verification, they are totally fake. Actually, you cannot view your friends/girlfriend/boyfriend massages without that key. 😋 To get key you need the root access.

So what's next if you have the key. Where do I enter the key? Even if you have the key you need some kind of script to do that. Let’s go to the task.

I will list some prerequisite before starting.

Prerequisites:

  • msgstore.db.crypt12 or similar file from Whatsapp/Databases
  • key file obtained from /data/data/com.whatsapp/files/key (Need root access)
  • A computer that installed java (JRE) 8+ (Add java to your Path variable if not added to run java command from the command line)
  • Download jar file from here
  • SQLite browser

If you have all the above things, It is one line of command to boom.

Keep all the files that I have mentioned above in one directory in your machine. Then open terminal or command line execute follows assuming jar file is decrypt12.jar, encrypted database is msgstore.db.crypt12 and output file name that is decrypted is msgstore.db.

java -jar decrypt12.jar key msgstore.db.crypt12 msgstore.db

Then you have a file called msgstore.db and open it with SQLite browser. Now you can see all the massages, group, contacts and many attributes saved in your Whatsapp account.

And if you are interested in source code here is the link

--

--