add test to verify that you attach and copy from non-hmac database to new format

This commit is contained in:
Stephen Lombardo 2011-02-17 16:16:30 -05:00
parent dd911f3023
commit 8cf3ad8e1e

View File

@ -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