From 8cf3ad8e1eeab9c3667ade397ac150884ea8dfee Mon Sep 17 00:00:00 2001 From: Stephen Lombardo Date: Thu, 17 Feb 2011 16:16:30 -0500 Subject: [PATCH] add test to verify that you attach and copy from non-hmac database to new format --- test/crypto.test | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/crypto.test b/test/crypto.test index 9edc8b43..cb740ae3 100644 --- a/test/crypto.test +++ b/test/crypto.test @@ -689,6 +689,28 @@ do_test open-1.1.8-database { } {4 1 1 one one 1 2 one two} db close -# test a rekey operation as the first op on a database +# open a 1.1.8 database without hmac, then copy the data + +# copy data between, verify the encypted database is good afterwards +do_test attach-and-copy-1.1.8 { + sqlite_orig db sqlcipher-1.1.8-testkey.db + + execsql { + PRAGMA key = 'testkey'; + PRAGMA cipher_use_hmac = OFF; + ATTACH DATABASE 'test.db' AS db2 KEY 'testkey-hmac'; + CREATE TABLE db2.t1(a,b); + INSERT INTO db2.t1 SELECT * FROM main.t1; + DETACH DATABASE db2; + } + db close + + sqlite_orig db test.db + execsql { + PRAGMA key = 'testkey-hmac'; + SELECT count(*) FROM t1; + SELECT * FROM t1; + } +} {4 1 1 one one 1 2 one two} finish_test