Android using SQLCipher - how can you decrypt? Android using SQLCipher - how can you decrypt? sqlite sqlite

Android using SQLCipher - how can you decrypt?


The "normal" SQLite tools do not include SQLCipher.

You have to download the souce and compile it yourself to get a command shell with SQLCipher support.


I resolved this by using this small script.

decrypt.sh

#!/bin/bash# Bashscript to decrypt databasesecho "pull db from device.."adb pull /data/data/com.example/databases/database.dbecho "removing previous decrypted db, if existent.."rm -r decrypted_database.dbecho "decrypting database.db into decrypted_database.db"sqlcipher -line database.db 'PRAGMA key = "encryption_key";ATTACH DATABASE "decrypted_database.db" AS decrypted_database KEY "";SELECT sqlcipher_export("decrypted_database");DETACH DATABASE decrypted_database;'

These programs should be added to your PATH:

Replace in script:

  • com.example with your packagename
  • database.db with name databasefile
  • encryption_key with encryption password