# Exporting and decrypting your Whatsapp message SQLite store (Android)

1. Create an E2E encrypted backup on Whatsapp Settings on your phone. It will prompt you to setup E2E encryption either with a custom password or an autogenerated 64 bit string. Choose the 64 bit option and *save this string*!
    
2. Create a Python virtualenv and install [wa-crypt-tools](https://github.com/ElDavoo/wa-crypt-tools)
    
    ```bash
    pip install wa-crypt-tools
    ```
    
3. Create the key file
    
    ```bash
    wacreatekey --hex <your-hex-value>
    # creates a file called encrypted_backup.key
    ```
    
4. Connect your phone and pull the encrypted DB file
    
    ```bash
    adb pull /sdcard/Android/media/com.whatsapp/WhatsApp/Databases/msgstore.db.crypt15
    # will copy this file to your cwd
    ```
    
5. Decrypt the DB file using your key
    
    ```bash
    wadecrypt encrypted_backup.key msgstore.db.crypt15 msgstore.db
    # key15.py:54 	: [I] Crypt15 / Raw key loaded
    # wadecrypt.py:271 	: [I] Done
    ```
