我尝试在macOS上编译并运行SQLCipher,但它无效。
我做错了什么?是否有任何无用的行为?
1) OpenSSL构建
-
$ ./Configure darwin64-x86_64-cc shared --openssldir=/usr/local/lib/openssl-1.0.2
$ make depend
$ sudo make install
文件位于" /usr/local/lib/openssl-1.0.2/lib"
2) SQLite构建
-
$ ./configure --prefix=/usr/local/lib/sqlite-3.22.0
$ make
$ make install
文件位于" /usr/local/lib/sqlite-3.22.0/lib"
3) SQLCipher build
-
$ ./configure --prefix=/usr/local/lib/sqlcipher-3.4.2 --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/usr/local/lib/openssl-1.0.2/lib/libcrypto.a"
$ make clean
$ make
$ make install
4)运行测试
cd "/Users/user/Documents/sqlcipher-test"
)-
$ ./sqlcipher plaintext.db
$ sqlite> create table testtable (id integer, name text);
$ sqlite> insert into testtable (id,name) values(1,'Bob');
$ sqlite> insert into testtable (id,name) values(2,'Charlie');
$ sqlite> insert into testtable (id,name) values(3,'Daphne');
$ sqlite> select * from testtable;
$ sqlite> .exit
-
$ ./sqlcipher plaintext.db
$ sqlite> ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'testkey';
"错误:无法打开数据库:encrypted.db"
" encrypted.db"文件为空