8000 add test for behavior with multiple key operations · PHPDOTSQL/sqlcipher@a2a5488 · GitHub
[go: up one dir, main page]

Skip to content

Commit a2a5488

Browse files
committed
add test for behavior with multiple key operations
1 parent f8bf2b1 commit a2a5488

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/crypto.test

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,5 +896,33 @@ do_test rekey-then-key-as-first-ops {
896896

897897
} {100}
898898
db close
899+
file delete -force test.db
900+
901+
setup test.db "'testkey'"
902+
do_test multiple-key-calls-safe-1 {
903+
sqlite_orig db test.db
904+
execsql {
905+
PRAGMA key = 'testkey';
906+
PRAGMA cache_size = 0;
907+
SELECT name FROM sqlite_master WHERE type='table';
908+
}
909+
} {t1}
910+
911+
do_test multiple-key-calls-safe-2 {
912+
catchsql {
913+
PRAGMA key = 'wrong key';
914+
SELECT name FROM sqlite_master WHERE type='table';
915+
}
916+
} {1 {file is encrypted or is not a database}}
917+
918+
do_test multiple-key-calls-safe-3 {
919+
execsql {
920+
PRAGMA key = 'testkey';
921+
SELECT name FROM sqlite_master WHERE type='table';
922+
}
923+
} {t1}
924+
925+
db close
926+
file delete -force test.db
899927

900928
finish_test

0 commit comments

Comments
 (0)
0