如何在命令行上解密加密的sqlcipher数据库文件? [英] How to decrypt an encrypted sqlcipher database file on command line?

查看:1428
本文介绍了如何在命令行上解密加密的sqlcipher数据库文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题很简单

我的是:


  • 我有一个使用sqlcipher加密的数据库文件

  • 我还拥有用于加密此数据库文件的密码

  • I have a database file which is encrypted using sqlcipher.
  • I also have the passphrase which was used to encrypt this db file

我需要的是:


  • 我需要解密数据库文件 /需要一个未加密/非加密/解密的数据库文件。

推荐答案

h1>下载并构建sqlcipher

- 如果sqlcipher已安装,请跳过此步骤


https://github.com/sqlcipher/sqlcipher 在一个目录中(例如〜/ sqlcipher)

Download and Build sqlcipher

--Skip this if sqlcipher is already installed

Pull the code from https://github.com/sqlcipher/sqlcipher in a directory (say ~/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浏览器,如这个

Find the decrypted database at ~/plaintext.db which you can use with any sqlite browser like this.

更新 :2015年9月

Update : September 2015

http://sqlitebrowser.org 现在支持sqlcipher数据库。这很整洁。

http://sqlitebrowser.org now supports sqlcipher databases. That's neat.

这篇关于如何在命令行上解密加密的sqlcipher数据库文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆