当前位置: 代码迷 >> SQL >> sqlcipher移栽
  详细解决方案

sqlcipher移栽

热度:102   发布时间:2016-05-05 11:12:47.0
sqlcipher移植

一、下载代码:

sqlcipher依赖openssl库,首先下载openssl:

[[email protected] ~]$ git clone https://github.com/openssl/openssl.git

下载sqlcipher:

站点:http://git.oschina.net/fulinux/sqlcipher.git或者https://github.com/sqlcipher/sqlcipher.git

[[email protected] ~]$ git clone http://git.oschina.net/fulinux/sqlcipher.git
或者

[[email protected] ~]$ git clone https://github.com/sqlcipher/sqlcipher.git

二、编译:

编译openssl:

[[email protected] openssl]$ ./config

[[email protected] openssl]$ sudo make install
编译sqlcipher:

[[email protected] sqlcipher]$./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"

如果遇到编译问题,请checkout到发行版本

[[email protected] sqlcipher]$git checkout v3.1.0 

[[email protected] sqlcipher]$ ls sqlciphersqlcipher

三、测试:

新建一个数据库:

[[email protected] sqlcipher]$ ./sqlcipher test.dbSQLCipher version 3.8.4.3 2014-04-03 16:53:12Enter ".help" for instructionsEnter SQL statements terminated with a ";"sqlite> PRAGMA KEY = '12345';sqlite> create table film (number,name);sqlite> insert into film values (1,'aaa');sqlite> insert into film values (2,'bbb');sqlite> select * from film;1|aaa2|bbbsqlite> .quit
打开上面创建的数据库:

[[email protected] sqlcipher]$ ./sqlcipher test.dbSQLCipher version 3.8.4.3 2014-04-03 16:53:12Enter ".help" for instructionsEnter SQL statements terminated with a ";"sqlite> PRAGMA KEY = '12345';sqlite> .schemaCREATE TABLE film (number,name);sqlite> select * from film;1|aaa2|bbbsqlite> 

错误测试:

[[email protected] sqlcipher]$ ./sqlcipher test.dbSQLCipher version 3.8.4.3 2014-04-03 16:53:12Enter ".help" for instructionsEnter SQL statements terminated with a ";"sqlite> select * from film;Error: file is encrypted or is not a databasesqlite> 


author: fulinux

e-mail:[email protected]

blog: blog.csdn.net/fulinus


  相关解决方案