Android using SQLCipher - how can you decrypt?

你离开我真会死。 提交于 2019-12-05 12:33:52

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.

Tobrun

I resolved this by using this small script.

decrypt.sh

#!/bin/bash
# Bashscript to decrypt databases

echo "pull db from device.."
adb pull /data/data/com.example/databases/database.db

echo "removing previous decrypted db, if existent.."
rm -r decrypted_database.db

echo "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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!