问题很简单
我所拥有的是:
>我有一个使用sqlcipher加密的数据库文件.
>我还有用于加密此db文件的密码
我需要的是:
>我需要解密数据库文件/需要一个未加密/非加密/解密的数据库文件.
解决方法
下载并构建sqlcipher – 如果已安装sqlcipher,请执行此操作
从目录中拉出
https://github.com/sqlcipher/sqlcipher中的代码(比如/ sqlcipher)
mkdir ~/bld; # Build will occur in a sibling directory
cd ~/bld; # Change to the build directory
../sqlcipher/configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto";
#configure sqlcipher
make install; # Install the build products
将数据库解密为纯文本数据库
$cd ~/;
$./sqlcipher encrypted.db
sqlite> PRAGMA key = 'testkey';
sqlite> ATTACH DATABASE 'plaintext.db' AS plaintext KEY ''; -- empty key will disable encryption
sqlite> SELECT sqlcipher_export('plaintext');
sqlite> DETACH DATABASE plaintext;
在/ plaintext.db找到解密的数据库,你可以使用任何sqlite浏览器,如this.
更新:2015年9月
http://sqlitebrowser.org现在支持sqlcipher数据库.那很整齐.
