Skip to content

Instantly share code, notes, and snippets.

@sjlombardo
Created March 30, 2012 02:40
Show Gist options
  • Save sjlombardo/2245989 to your computer and use it in GitHub Desktop.
Save sjlombardo/2245989 to your computer and use it in GitHub Desktop.
SQLCipher Backwards Compatibility with HMAC and aes-256-cfb
new-host% git checkout 1.1.x
Switched to branch '1.1.x'
new-host% ./configure --enable-load-extension --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_FTS3" LDFLAGS="-ltcl8.5 -lcrypto"
...
new-host% make
...
new-host% ./sqlite3 11x-aes-256-cfb.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key = 'test123';
sqlite> PRAGMA cipher = 'aes-256-cfb';
sqlite> CREATE TABLE t1(a,b);
sqlite> INSERT INTO t1(a,b) VALUES (1,2);
sqlite> .q
new-host% hexdump -C 11x-aes-256-cfb.db | head -5
00000000 19 5b cb 7d 86 29 6b 6f 0f 70 9d 73 f0 ab 6b 5f |.[.}.)ko.p.s..k_|
00000010 60 20 37 c4 53 24 31 62 4c 56 a0 6d 70 06 41 e1 |` 7.S$1bLV.mp.A.|
00000020 47 40 79 2d 00 01 54 84 ab 73 b6 d9 ce bf 69 21 |G@y-..T..s....i!|
00000030 02 00 c8 56 20 42 64 6a 9f 2b 01 93 fb 98 c2 60 |...V Bdj.+.....`|
00000040 80 7c 2b e5 dc a3 1b 3f d2 e4 61 82 1a 0b cf bd |.|+....?..a.....|
new-host% make clean
...
new-host% git checkout v2.0.3
Note: checking out 'v2.0.3'.
new-host% ./configure --enable-load-extension --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_FTS3" LDFLAGS="-ltcl8.5 -lcrypto"
...
new-host% make
...
new-host% ./sqlite3 11x-aes-256-cfb.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key = 'test123';
sqlite> PRAGMA cipher = 'aes-256-cfb';
sqlite> PRAGMA cipher_use_hmac = OFF;
sqlite> .schema
CREATE TABLE t1(a,b);
sqlite> select * from t1;
1|2
sqlite> .q
new-host% ./sqlite3 11x-aes-256-cfb.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key = 'test123';
sqlite> PRAGMA cipher_use_hmac = OFF;
sqlite> PRAGMA cipher = 'aes-256-cfb';
sqlite> .schema
CREATE TABLE t1(a,b);
sqlite> select * from t1;
1|2
sqlite> .q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment