mirror of
https://github.com/status-im/sqlcipher.git
synced 2026-08-30 22:11:14 +00:00
update tests to expect "ok" from PRAGMA key
This commit is contained in:
@@ -68,7 +68,7 @@ do_test unencrypted-attach {
|
||||
PRAGMA key='testkey';
|
||||
SELECT count(*) FROM t1;
|
||||
} db2
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db2 close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -102,7 +102,7 @@ do_test unencrypted-attach-raw-key {
|
||||
PRAGMA key="x'10483C6EB40B6C31A448C22A66DED3B5E5E8D5119CAC8327B655C8B5C4836481'";
|
||||
SELECT count(*) FROM t1;
|
||||
} db2
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db2 close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -115,7 +115,7 @@ do_test compat-open-4.0-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 78536}
|
||||
} {ok ok 78536}
|
||||
db close
|
||||
|
||||
# create an encrypted database, attach an default-key encrypted volume
|
||||
@@ -148,7 +148,7 @@ do_test encrypted-attach-default-key {
|
||||
PRAGMA key='testkey';
|
||||
SELECT count(*) FROM t1;
|
||||
} db2
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db close
|
||||
db2 close
|
||||
file delete -force test.db
|
||||
@@ -257,7 +257,7 @@ do_test unencrypted-corrupt-to-encrypted-export {
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {1 2}
|
||||
} {ok 1 2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -299,7 +299,7 @@ do_test unencrypted-to-encrypted-import {
|
||||
PRAGMA key = 'testkey2';
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -354,7 +354,7 @@ do_test open-1.1.8-database {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {75709 1 1 one one 1 2 one two 1 2}
|
||||
} {ok 75709 1 1 one one 1 2 one two 1 2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -381,7 +381,7 @@ do_test attach-and-copy-1.1.8 {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {75709 1 1 one one 1 2 one two 1 2}
|
||||
} {ok 75709 1 1 one one 1 2 one two 1 2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -424,7 +424,7 @@ do_test attached-database-pragmas {
|
||||
PRAGMA cipher_use_hmac = OFF;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -505,7 +505,7 @@ do_test export-database {
|
||||
SELECT seq FROM sqlite_sequence WHERE name = 't1'; -- verify that autoincrement worked
|
||||
SELECT a FROM fts WHERE b MATCH '1000000';
|
||||
}
|
||||
} {1000 1000 1 1000 1001 1001 1000000}
|
||||
} {ok 1000 1000 1 1000 1001 1001 1000000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -578,7 +578,7 @@ do_test export-attached-database {
|
||||
SELECT a FROM fts WHERE b MATCH '1000000';
|
||||
SELECT count(*) FROM t3;
|
||||
}
|
||||
} {1000 1000 2 1000 1001 1001 1000000 2}
|
||||
} {ok 1000 1000 2 1000 1001 1001 1000000 2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -644,7 +644,7 @@ do_test vacuum {
|
||||
SELECT count(*) FROM t1;
|
||||
}]
|
||||
|
||||
} {10000 true true 5000 5000}
|
||||
} {10000 true true {ok 5000} {ok 5000}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force test-vacuum.db
|
||||
@@ -671,7 +671,7 @@ do_test default-hmac-kdf-attach {
|
||||
PRAGMA cipher_default_page_size = 4096;
|
||||
PRAGMA cipher_default_kdf_algorithm = PBKDF2_HMAC_SHA512;
|
||||
}
|
||||
} {75709 75709}
|
||||
} {ok 75709 75709}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force sqlcipher-1.1.8-testkey.db
|
||||
@@ -722,7 +722,7 @@ do_test change-default-hmac-kdf-attach {
|
||||
PRAGMA cipher_default_page_size = 4096;
|
||||
PRAGMA cipher_default_kdf_algorithm = PBKDF2_HMAC_SHA512;
|
||||
}
|
||||
} {1 75709}
|
||||
} {ok 1 75709}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force sqlcipher-1.1.8-testkey.db
|
||||
@@ -818,7 +818,7 @@ do_test multipage-schema {
|
||||
SELECT count(*) FROM sqlite_master where type = 'table';
|
||||
} db
|
||||
|
||||
} {300}
|
||||
} {ok 300}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -852,7 +852,7 @@ do_test multipage-schema-autovacuum-shortread {
|
||||
SELECT count(*) FROM sqlite_master where type = 'table';
|
||||
} db
|
||||
|
||||
} {300}
|
||||
} {ok 300}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -882,7 +882,7 @@ do_test multipage-schema-autovacuum-shortread-wal {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master where type = 'table';
|
||||
} db
|
||||
} {300}
|
||||
} {ok 300}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -899,7 +899,7 @@ do_test open-3.0-le-database {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {78536 1 1 one one 1 2 one two}
|
||||
} {ok 78536 1 1 one one 1 2 one two}
|
||||
db close
|
||||
|
||||
# open a 2.0 database with little endian hmac page numbers (default)
|
||||
@@ -915,7 +915,7 @@ do_test open-2.0-le-database {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {78536 1 1 one one 1 2 one two}
|
||||
} {ok 78536 1 1 one one 1 2 one two}
|
||||
db close
|
||||
|
||||
# open a 2.0 database with big-endian hmac page numbers
|
||||
@@ -932,7 +932,7 @@ do_test open-2.0-be-database {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {{PRAGMA cipher_hmac_pgno is deprecated, please remove from use} 78536 1 1 one one 1 2 one two}
|
||||
} {ok {PRAGMA cipher_hmac_pgno is deprecated, please remove from use} 78536 1 1 one one 1 2 one two}
|
||||
db close
|
||||
|
||||
# open a 2.0 database with big-endian hmac page numbers
|
||||
@@ -962,7 +962,7 @@ do_test be-to-le-migration {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {78536 1 1 one one 1 2 one two}
|
||||
} {ok 78536 1 1 one one 1 2 one two}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -984,7 +984,7 @@ do_test open-2.0-beta-database {
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {{PRAGMA fast_kdf_iter is deprecated, please remove from use} {PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use} 38768 test-0-0 test-0-1 test-1-0 test-1-1}
|
||||
} {ok {PRAGMA fast_kdf_iter is deprecated, please remove from use} {PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use} 38768 test-0-0 test-0-1 test-1-0 test-1-1}
|
||||
db close
|
||||
|
||||
# open a 2.0 beta database
|
||||
@@ -1018,7 +1018,7 @@ do_test 2.0-beta-to-2.0-migration {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT distinct * FROM t1;
|
||||
}
|
||||
} {test-0-0 test-0-1 test-1-0 test-1-1}
|
||||
} {ok test-0-0 test-0-1 test-1-0 test-1-1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -1036,7 +1036,7 @@ do_test migrate-1.1.8-database-to-current-format {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
}
|
||||
} {1}
|
||||
} {ok 1}
|
||||
db close
|
||||
file delete -force test.db test.db-migrated test.db-journal
|
||||
|
||||
@@ -1054,7 +1054,7 @@ do_test migrate-2-0-le-database-to-current-format {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
}
|
||||
} {1}
|
||||
} {ok 1}
|
||||
db close
|
||||
file delete -force test.db test.db-migrated test.db-journal
|
||||
|
||||
@@ -1073,7 +1073,7 @@ do_test migrate-3-0-database-to-current-format {
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
PRAGMA journal_mode;
|
||||
}
|
||||
} {1 delete}
|
||||
} {ok 1 delete}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -1103,7 +1103,7 @@ do_test migrate-wal-database-to-current {
|
||||
SELECT count(*) FROM sqlite_master;
|
||||
PRAGMA journal_mode;
|
||||
}]
|
||||
} {wal {0 wal} {1 wal}}
|
||||
} {{ok wal} {ok 0 wal} {ok 1 wal}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -1124,7 +1124,7 @@ do_test key-database-by-name {
|
||||
pragma key = 'foo';
|
||||
select * from t1;
|
||||
}
|
||||
} {foo bar}
|
||||
} {ok foo bar}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force new.db
|
||||
@@ -1150,7 +1150,7 @@ do_test key-multiple-databases-with-different-keys-using-pragma {
|
||||
select * from t1;
|
||||
select * from test.t1;
|
||||
}
|
||||
} {foo bar baz qux}
|
||||
} {ok foo bar baz qux}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force new.db
|
||||
@@ -1213,7 +1213,7 @@ do_test can-migrate-with-keys-longer-than-64-characters {
|
||||
PRAGMA key = "012345678901234567890123456789012345678901234567890123456789012345";
|
||||
PRAGMA user_version;
|
||||
}
|
||||
} {5}
|
||||
} {ok 5}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -1240,7 +1240,7 @@ do_test can-migrate-with-raw-hex-key {
|
||||
PRAGMA user_version;
|
||||
}
|
||||
|
||||
} {5}
|
||||
} {ok 5}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -1263,7 +1263,7 @@ do_test attach_database_with_non_default_page_size {
|
||||
SELECT count(*) FROM test2.t1;
|
||||
PRAGMA cipher_default_page_size = 4096;
|
||||
}
|
||||
} {2}
|
||||
} {ok 2}
|
||||
db close
|
||||
file delete -force test.db test2.db
|
||||
|
||||
@@ -1296,7 +1296,7 @@ do_test compat-open-1.1.8-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 75709}
|
||||
} {ok ok 75709}
|
||||
db close
|
||||
|
||||
# open a 2.0 database using cipher_compatibility
|
||||
@@ -1308,7 +1308,7 @@ do_test compat-open-2.0-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 78536}
|
||||
} {ok ok 78536}
|
||||
db close
|
||||
|
||||
# open a 3.0 database using cipher_compatibility
|
||||
@@ -1320,7 +1320,7 @@ do_test compat-open-3.0-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 78536}
|
||||
} {ok ok 78536}
|
||||
db close
|
||||
|
||||
# open a 4.0 database using cipher_compatibility
|
||||
@@ -1332,7 +1332,7 @@ do_test compat-open-4.0-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 78536}
|
||||
} {ok ok 78536}
|
||||
db close
|
||||
|
||||
# open a 1.1.8 database using cipher_default_compatibility
|
||||
@@ -1344,7 +1344,7 @@ do_test default-compat-open-1.1.8-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 75709}
|
||||
} {ok ok 75709}
|
||||
db close
|
||||
|
||||
# open a 2.0 database using cipher_default_compatibility
|
||||
@@ -1356,7 +1356,7 @@ do_test default-compat-open-2.0-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 78536}
|
||||
} {ok ok 78536}
|
||||
|
||||
# open a 3.0 database using cipher_default_compatibility
|
||||
do_test default-compat-open-3.0-database {
|
||||
@@ -1367,7 +1367,7 @@ do_test default-compat-open-3.0-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 78536}
|
||||
} {ok ok 78536}
|
||||
|
||||
# re-open a 4.0 database using cipher_default_compatibility
|
||||
do_test default-compat-open-4.0-database {
|
||||
@@ -1378,7 +1378,7 @@ do_test default-compat-open-4.0-database {
|
||||
PRAGMA integrity_check;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {ok 78536}
|
||||
} {ok ok 78536}
|
||||
|
||||
sqlite3_test_control_pending_byte $old_pending_byte
|
||||
|
||||
|
||||
+17
-17
@@ -52,7 +52,7 @@ do_test will-open-with-correct-raw-key {
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT * from t1;
|
||||
}
|
||||
} {t1 test1 test2}
|
||||
} {ok t1 test1 test2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -70,7 +70,7 @@ do_test will-open-with-correct-derived-key {
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
SELECT * from t1;
|
||||
}
|
||||
} {t1 test1 test2}
|
||||
} {ok t1 test1 test2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -87,7 +87,7 @@ do_test test-temp-master {
|
||||
SELECT name FROM sqlite_temp_master WHERE type='table';
|
||||
SELECT * from temp_t1;
|
||||
}
|
||||
} {temp_t1 test1 test2}
|
||||
} {ok temp_t1 test1 test2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -236,7 +236,7 @@ do_test attach-empty-database-with-default-key {
|
||||
SELECT count(*) FROM t1;
|
||||
} db2]
|
||||
lappend rc [string equal [hexio_read test.db 0 16] [hexio_read test2.db 0 16]]
|
||||
} {2 1}
|
||||
} {{ok 2} 1}
|
||||
db close
|
||||
db2 close
|
||||
file delete -force test.db
|
||||
@@ -267,7 +267,7 @@ do_test attach-empty-database-with-default-key-first-op {
|
||||
} db2]
|
||||
|
||||
lappend rc [string equal [hexio_read test.db 0 16] [hexio_read test2.db 0 16]]
|
||||
} {1 0}
|
||||
} {{ok 1} 0}
|
||||
db close
|
||||
db2 close
|
||||
file delete -force test.db
|
||||
@@ -298,7 +298,7 @@ do_test attach-empty-database-with-cipher-store-pass {
|
||||
SELECT count(*) FROM t1;
|
||||
} db2]
|
||||
lappend rc [string equal [hexio_read test.db 0 16] [hexio_read test2.db 0 16]]
|
||||
} {2 0}
|
||||
} {{ok 2} 0}
|
||||
db close
|
||||
db2 close
|
||||
file delete -force test.db
|
||||
@@ -341,7 +341,7 @@ do_test attach-database-with-default-key-using-cipher-store-pass {
|
||||
SELECT * FROM t1;
|
||||
} db2
|
||||
|
||||
} {foo bar}
|
||||
} {ok foo bar}
|
||||
db2 close
|
||||
file delete -force test.db
|
||||
file delete -force test2.db
|
||||
@@ -451,7 +451,7 @@ do_test alter-schema {
|
||||
SELECT * FROM t1a;
|
||||
}
|
||||
|
||||
} {3 2 teststring}
|
||||
} {ok 3 2 teststring}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -465,7 +465,7 @@ do_test verify-errors-for-rekey-kdf-and-cipher-changes {
|
||||
PRAGMA rekey_kdf_iter = 1000;
|
||||
PRAGMA rekey_cipher = 'aes-256-ecb';
|
||||
}
|
||||
} {{PRAGMA rekey_kdf_iter is no longer supported.} {PRAGMA rekey_cipher is no longer supported.}}
|
||||
} {ok {PRAGMA rekey_kdf_iter is no longer supported.} {PRAGMA rekey_cipher is no longer supported.}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -477,7 +477,7 @@ do_test verify-errors-for-cipher-change {
|
||||
PRAGMA key = 'testkey';
|
||||
PRAGMA cipher = 'aes-256-ecb';
|
||||
}
|
||||
} {{PRAGMA cipher is no longer supported.}}
|
||||
} {ok {PRAGMA cipher is no longer supported.}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -516,7 +516,7 @@ do_test custom-pagesize {
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db close
|
||||
|
||||
# open the database with the default page size
|
||||
@@ -565,7 +565,7 @@ do_test journal-mode-wal {
|
||||
PRAGMA journal_mode;
|
||||
}
|
||||
|
||||
} {1000 wal}
|
||||
} {ok 1000 wal}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -577,7 +577,7 @@ do_test multiple-key-calls-safe-1 {
|
||||
PRAGMA cache_size = 0;
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
}
|
||||
} {t1}
|
||||
} {ok t1}
|
||||
|
||||
do_test multiple-key-calls-safe-2 {
|
||||
catchsql {
|
||||
@@ -591,7 +591,7 @@ do_test multiple-key-calls-safe-3 {
|
||||
PRAGMA key = 'testkey';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
}
|
||||
} {t1}
|
||||
} {ok t1}
|
||||
|
||||
db close
|
||||
file delete -force test.db
|
||||
@@ -630,7 +630,7 @@ do_test custom-hmac-kdf-iter {
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db close
|
||||
|
||||
# open the database with the default hmac
|
||||
@@ -698,7 +698,7 @@ do_test auto-vacuum {
|
||||
SELECT count(*) FROM t1;
|
||||
}]
|
||||
|
||||
} {10000 true 5000}
|
||||
} {10000 true {ok 5000}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -725,7 +725,7 @@ do_test cipher-options-before-keys {
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
|
||||
} {1}
|
||||
} {ok 1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ do_test nohmac-not-tamper-resistent {
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -165,7 +165,7 @@ do_test memory-integrity-check-should-fail {
|
||||
INSERT INTO t1(a,b) values (1,2);
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {{database file is undefined}}
|
||||
} {ok {database file is undefined}}
|
||||
db close
|
||||
|
||||
# try cipher_integrity_check on a valid 1.1.8 database
|
||||
@@ -178,7 +178,7 @@ do_test version-1-integrity-check-fail-no-hmac {
|
||||
PRAGMA cipher_compatibility = 1;
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {{HMAC is not enabled, unable to integrity check}}
|
||||
} {ok {HMAC is not enabled, unable to integrity check}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -191,7 +191,7 @@ do_test version-2-integrity-check-valid {
|
||||
PRAGMA cipher_compatibility = 2;
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {}
|
||||
} {ok}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -206,7 +206,7 @@ do_test version-2-integrity-check-invalid {
|
||||
PRAGMA cipher_compatibility = 2;
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {{HMAC verification failed for page 9} {HMAC verification failed for page 11}}
|
||||
} {ok {HMAC verification failed for page 9} {HMAC verification failed for page 11}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -219,7 +219,7 @@ do_test version-3-integrity-check-valid {
|
||||
PRAGMA cipher_compatibility = 3;
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {}
|
||||
} {ok}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -234,7 +234,7 @@ do_test version-3-integrity-check-invalid {
|
||||
PRAGMA cipher_compatibility = 3;
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {{HMAC verification failed for page 9} {HMAC verification failed for page 11}}
|
||||
} {ok {HMAC verification failed for page 9} {HMAC verification failed for page 11}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -246,7 +246,7 @@ do_test version-4-integrity-check-valid {
|
||||
PRAGMA key = 'testkey';
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {}
|
||||
} {ok}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -264,7 +264,7 @@ do_test version-4-integrity-check-invalid {
|
||||
PRAGMA key = 'testkey';
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {{HMAC verification failed for page 2} {HMAC verification failed for page 3} {HMAC verification failed for page 4}}
|
||||
} {ok {HMAC verification failed for page 2} {HMAC verification failed for page 3} {HMAC verification failed for page 4}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -277,7 +277,7 @@ do_test version-4-integrity-check-invalid-last-page {
|
||||
PRAGMA key = 'testkey';
|
||||
PRAGMA cipher_integrity_check;
|
||||
}
|
||||
} {{page 240 has an invalid size of 2 bytes}}
|
||||
} {ok {page 240 has an invalid size of 2 bytes}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ set hexkeyspec "\"x'98483C6EB40B6C31A448C22A66DED3B5E5E8D5119CAC8327B655C8B5C483
|
||||
# of an existing database
|
||||
do_test test-pragma-salt-get {
|
||||
sqlite_orig db test.db
|
||||
execsql { PRAGMA key = 'test'; }
|
||||
set salt [execsql {
|
||||
PRAGMA key = 'test';
|
||||
CREATE TABLE t1(a,b);
|
||||
PRAGMA cipher_salt;
|
||||
}]
|
||||
@@ -75,7 +75,7 @@ do_test test-pragma-salt-set {
|
||||
PRAGMA cipher_salt;
|
||||
"]
|
||||
|
||||
} {01010101010101010101010101010101 {1 01010101010101010101010101010101}}
|
||||
} {01010101010101010101010101010101 {ok 1 01010101010101010101010101010101}}
|
||||
file delete -force test.db
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ do_test test-raw-key-with-salt-spec {
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA cipher_salt;
|
||||
"]
|
||||
} {01010101010101010101010101010101 {1 01010101010101010101010101010101}}
|
||||
} {01010101010101010101010101010101 {ok 1 01010101010101010101010101010101}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -145,7 +145,7 @@ do_test test-raw-key-with-invalid-salt-spec-no-hmac {
|
||||
PRAGMA cipher_use_hmac = OFF;
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {1}
|
||||
} {ok 1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -201,7 +201,7 @@ do_test test-valid-plaintext-header-size {
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA cipher_plaintext_header_size;
|
||||
"]
|
||||
} {53514C69746520666F726D6174203300 {1 16}}
|
||||
} {53514C69746520666F726D6174203300 {ok 1 16}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -247,9 +247,12 @@ file delete -force test.db
|
||||
do_test test-valid-default-plaintext-header-size {
|
||||
set rc {}
|
||||
sqlite_orig db test.db
|
||||
set salt [execsql {
|
||||
execsql {
|
||||
PRAGMA cipher_default_plaintext_header_size = 16;
|
||||
PRAGMA key = 'test';
|
||||
}
|
||||
|
||||
set salt [execsql {
|
||||
CREATE TABLE t1(a,b);
|
||||
INSERT INTO t1(a,b) VALUES (1,2);
|
||||
PRAGMA cipher_salt;
|
||||
@@ -259,8 +262,8 @@ do_test test-valid-default-plaintext-header-size {
|
||||
lappend rc [hexio_read test.db 0 16]
|
||||
|
||||
sqlite_orig db test.db
|
||||
execsql { PRAGMA key = 'test'; }
|
||||
lappend rc [execsql "
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_salt = \"x'$salt'\";
|
||||
SELECT count(*) FROM t1;
|
||||
PRAGMA cipher_plaintext_header_size;
|
||||
@@ -280,9 +283,11 @@ file delete -force test.db
|
||||
do_test test-valid-default-plaintext-header-size-attach {
|
||||
set rc {}
|
||||
sqlite_orig db test.db
|
||||
set salt [execsql {
|
||||
execsql {
|
||||
PRAGMA cipher_default_plaintext_header_size = 16;
|
||||
PRAGMA key = 'test';
|
||||
}
|
||||
set salt [execsql {
|
||||
CREATE TABLE temp(a);
|
||||
ATTACH DATABASE 'test2.db' as db2;
|
||||
CREATE TABLE db2.t2(a,b);
|
||||
@@ -294,8 +299,8 @@ do_test test-valid-default-plaintext-header-size-attach {
|
||||
lappend rc [hexio_read test2.db 0 16]
|
||||
|
||||
sqlite_orig db test2.db
|
||||
execsql { PRAGMA key = 'test'; }
|
||||
lappend rc [execsql "
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_salt = \"x'$salt'\";
|
||||
SELECT count(*) FROM t2;
|
||||
PRAGMA cipher_plaintext_header_size;
|
||||
@@ -343,7 +348,7 @@ do_test test-plaintext-header-migrate-journal-delete {
|
||||
SELECT count(*) FROM t1;
|
||||
"]
|
||||
|
||||
} {01010101010101010101010101010101 53514C69746520666F726D61742033001000010150 1}
|
||||
} {01010101010101010101010101010101 53514C69746520666F726D61742033001000010150 {ok 1}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -383,7 +388,7 @@ do_test test-plaintext-header-migrate-journal-wal {
|
||||
PRAGMA journal_mode;
|
||||
"]
|
||||
|
||||
} {01010101010101010101010101010101 {1 wal 0 1 1} 53514C69746520666F726D61742033001000020250 {1 wal}}
|
||||
} {01010101010101010101010101010101 {ok 1 wal 0 1 1} 53514C69746520666F726D61742033001000020250 {ok 1 wal}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -426,7 +431,7 @@ do_test test-plaintext-header-migrate-journal-wal-string-key-random-salt {
|
||||
"]
|
||||
|
||||
|
||||
} {{1 wal 0 1 1} 53514C69746520666F726D61742033001000020250 {1 wal}}
|
||||
} {{ok 1 wal 0 1 1} 53514C69746520666F726D61742033001000020250 {ok 1 wal}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -436,8 +441,8 @@ file delete -force test.db
|
||||
do_test plaintext-header-size-salt-first-op {
|
||||
set rc {}
|
||||
sqlite_orig db test.db
|
||||
execsql { PRAGMA key = 'test'; }
|
||||
set salt1 [execsql {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_plaintext_header_size = 16;
|
||||
PRAGMA cipher_salt;
|
||||
}]
|
||||
|
||||
+24
-24
@@ -58,7 +58,7 @@ do_test verify-pragma-cipher-use-hmac-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_use_hmac;
|
||||
}
|
||||
} {1}
|
||||
} {ok 1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -71,7 +71,7 @@ do_test verify-pragma-cipher-use-hmac-off {
|
||||
PRAGMA cipher_use_hmac = off;
|
||||
PRAGMA cipher_use_hmac;
|
||||
}
|
||||
} {0}
|
||||
} {ok 0}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -135,7 +135,7 @@ do_test verify-pragma-kdf-iter-reports-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA kdf_iter;
|
||||
}
|
||||
} {256000}
|
||||
} {ok 256000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -148,7 +148,7 @@ do_test verify-pragma-kdf-iter-reports-value-changed {
|
||||
PRAGMA kdf_iter = 8000;
|
||||
PRAGMA kdf_iter;
|
||||
}
|
||||
} {8000}
|
||||
} {ok 8000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -160,7 +160,7 @@ do_test verify-pragma-fast-kdf-iter-reports-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA fast_kdf_iter;
|
||||
}
|
||||
} {2}
|
||||
} {ok 2}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -173,7 +173,7 @@ do_test verify-pragma-kdf-iter-reports-value-changed {
|
||||
PRAGMA fast_kdf_iter = 4000;
|
||||
PRAGMA fast_kdf_iter;
|
||||
}
|
||||
} {{PRAGMA fast_kdf_iter is deprecated, please remove from use} 4000}
|
||||
} {ok {PRAGMA fast_kdf_iter is deprecated, please remove from use} 4000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -185,7 +185,7 @@ do_test verify-pragma-cipher-page-size-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_page_size;
|
||||
}
|
||||
} {4096}
|
||||
} {ok 4096}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -198,7 +198,7 @@ do_test verify-pragma-cipher-page-size-changed {
|
||||
PRAGMA cipher_page_size = 8192;
|
||||
PRAGMA cipher_page_size;
|
||||
}
|
||||
} {8192}
|
||||
} {ok 8192}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -210,7 +210,7 @@ do_test verify-cipher-store-pass-before-key-does-not-segfault {
|
||||
PRAGMA cipher_store_pass = 1;
|
||||
PRAGMA key = 'test';
|
||||
}
|
||||
} {}
|
||||
} {ok}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -222,7 +222,7 @@ if_built_with_openssl verify-pragma-cipher-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher;
|
||||
}
|
||||
} {AES-256-CBC}
|
||||
} {ok AES-256-CBC}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -233,7 +233,7 @@ do_test verify-pragma-hmac-salt-mask-reports-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_hmac_salt_mask;
|
||||
}
|
||||
} {3a}
|
||||
} {ok 3a}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -247,7 +247,7 @@ do_test verify-pragma-hmac-salt-mask-reports-value-changed {
|
||||
PRAGMA cipher_hmac_salt_mask;
|
||||
PRAGMA cipher_hmac_salt_mask = "x'3a'";
|
||||
}
|
||||
} {{PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use} 11 {PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use}}
|
||||
} {ok {PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use} 11 {PRAGMA cipher_hmac_salt_mask is deprecated, please remove from use}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -258,7 +258,7 @@ do_test verify-pragma-hmac-pgno-reports-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_hmac_pgno;
|
||||
}
|
||||
} {le}
|
||||
} {ok le}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -275,7 +275,7 @@ do_test verify-pragma-hmac-pgno-reports-value-changed {
|
||||
PRAGMA cipher_hmac_pgno = le;
|
||||
PRAGMA cipher_hmac_pgno;
|
||||
}
|
||||
} {{PRAGMA cipher_hmac_pgno is deprecated, please remove from use} be {PRAGMA cipher_hmac_pgno is deprecated, please remove from use} native {PRAGMA cipher_hmac_pgno is deprecated, please remove from use} le}
|
||||
} {ok {PRAGMA cipher_hmac_pgno is deprecated, please remove from use} be {PRAGMA cipher_hmac_pgno is deprecated, please remove from use} native {PRAGMA cipher_hmac_pgno is deprecated, please remove from use} le}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -286,7 +286,7 @@ do_test verify-pragma-cipher-hmac-algorithm-reports-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_hmac_algorithm;
|
||||
}
|
||||
} {HMAC_SHA512}
|
||||
} {ok HMAC_SHA512}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -297,7 +297,7 @@ do_test verify-pragma-cipher-hmac-algorithm-reports-value-changed {
|
||||
PRAGMA cipher_hmac_algorithm = HMAC_SHA1;
|
||||
PRAGMA cipher_hmac_algorithm;
|
||||
}
|
||||
} {HMAC_SHA1}
|
||||
} {ok HMAC_SHA1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -320,7 +320,7 @@ do_test verify-pragma-cipher-kdf-algorithm-reports-default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_kdf_algorithm;
|
||||
}
|
||||
} {PBKDF2_HMAC_SHA512}
|
||||
} {ok PBKDF2_HMAC_SHA512}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -331,7 +331,7 @@ do_test verify-pragma-cipher-kdf-algorithm-reports-value-changed {
|
||||
PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;
|
||||
PRAGMA cipher_kdf_algorithm;
|
||||
}
|
||||
} {PBKDF2_HMAC_SHA1}
|
||||
} {ok PBKDF2_HMAC_SHA1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -353,7 +353,7 @@ if_built_with_openssl verify-default-cipher {
|
||||
PRAGMA key='test';
|
||||
PRAGMA cipher;
|
||||
}
|
||||
} {AES-256-CBC}
|
||||
} {ok AES-256-CBC}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -363,7 +363,7 @@ if_built_with_libtomcrypt verify-default-cipher {
|
||||
PRAGMA key='test';
|
||||
PRAGMA cipher;
|
||||
}
|
||||
} {aes-256-cbc}
|
||||
} {ok aes-256-cbc}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -373,7 +373,7 @@ if_built_with_commoncrypto verify-default-cipher {
|
||||
PRAGMA key='test';
|
||||
PRAGMA cipher;
|
||||
}
|
||||
} {aes-256-cbc}
|
||||
} {ok aes-256-cbc}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -383,7 +383,7 @@ if_built_with_nss verify-default-cipher {
|
||||
PRAGMA key='test';
|
||||
PRAGMA cipher;
|
||||
}
|
||||
} {aes-256-cbc}
|
||||
} {ok aes-256-cbc}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -393,7 +393,7 @@ do_test verify-cipher_settings_default {
|
||||
PRAGMA key = 'test';
|
||||
PRAGMA cipher_settings;
|
||||
}
|
||||
} {{PRAGMA kdf_iter = 256000;} {PRAGMA cipher_page_size = 4096;} {PRAGMA cipher_use_hmac = 1;} {PRAGMA cipher_plaintext_header_size = 0;} {PRAGMA cipher_hmac_algorithm = HMAC_SHA512;} {PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA512;}}
|
||||
} {ok {PRAGMA kdf_iter = 256000;} {PRAGMA cipher_page_size = 4096;} {PRAGMA cipher_use_hmac = 1;} {PRAGMA cipher_plaintext_header_size = 0;} {PRAGMA cipher_hmac_algorithm = HMAC_SHA512;} {PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA512;}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -404,7 +404,7 @@ do_test verify-cipher_settings_v1 {
|
||||
PRAGMA cipher_compatibility = 1;
|
||||
PRAGMA cipher_settings;
|
||||
}
|
||||
} {{PRAGMA kdf_iter = 4000;} {PRAGMA cipher_page_size = 1024;} {PRAGMA cipher_use_hmac = 0;} {PRAGMA cipher_plaintext_header_size = 0;} {PRAGMA cipher_hmac_algorithm = HMAC_SHA1;} {PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;}}
|
||||
} {ok {PRAGMA kdf_iter = 4000;} {PRAGMA cipher_page_size = 1024;} {PRAGMA cipher_use_hmac = 0;} {PRAGMA cipher_plaintext_header_size = 0;} {PRAGMA cipher_hmac_algorithm = HMAC_SHA1;} {PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;}}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
|
||||
+11
-11
@@ -65,7 +65,7 @@ do_test rekey-as-first-op {
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
|
||||
} {100}
|
||||
} {ok 100}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -98,7 +98,7 @@ do_test rekey-then-key-as-first-ops {
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
|
||||
} {100}
|
||||
} {ok ok 100}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -120,7 +120,7 @@ do_test rekey-as-first-operation {
|
||||
PRAGMA key = 'testkeynew';
|
||||
SELECT name FROM sqlite_master WHERE type='table';
|
||||
}
|
||||
} {t1}
|
||||
} {ok t1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -146,7 +146,7 @@ do_test rekey-same-passkey {
|
||||
PRAGMA rekey = 'test123';
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {1000 1000}
|
||||
} {1000 ok 1000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -174,7 +174,7 @@ do_test rekey-and-query-1 {
|
||||
PRAGMA rekey = 'test321';
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {1000 1000}
|
||||
} {1000 ok 1000}
|
||||
|
||||
db close
|
||||
|
||||
@@ -184,7 +184,7 @@ do_test rekey-and-query-2 {
|
||||
PRAGMA key = 'test321';
|
||||
SELECT count(*) FROM t1;
|
||||
}
|
||||
} {1000}
|
||||
} {ok 1000}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -235,7 +235,7 @@ do_test rekey-delete-and-query-2 {
|
||||
SELECT count(*) > 1 FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {1 ok}
|
||||
} {ok ok 1 ok}
|
||||
db close
|
||||
|
||||
do_test rekey-delete-and-query-3 {
|
||||
@@ -244,7 +244,7 @@ do_test rekey-delete-and-query-3 {
|
||||
PRAGMA key = 'test321';
|
||||
SELECT count(*) > 1 FROM t1;
|
||||
}
|
||||
} {1}
|
||||
} {ok 1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -290,7 +290,7 @@ do_test rekey-delete-and-query-wal-2 {
|
||||
SELECT count(*) > 1 FROM t1;
|
||||
PRAGMA integrity_check;
|
||||
}
|
||||
} {wal 1 ok}
|
||||
} {ok wal ok 1 ok}
|
||||
db close
|
||||
|
||||
do_test rekey-delete-and-query-wal-3 {
|
||||
@@ -300,7 +300,7 @@ do_test rekey-delete-and-query-wal-3 {
|
||||
PRAGMA journal_mode = WAL;
|
||||
SELECT count(*) > 1 FROM t1;
|
||||
}
|
||||
} {wal 1}
|
||||
} {ok wal 1}
|
||||
db close
|
||||
file delete -force test.db
|
||||
|
||||
@@ -321,7 +321,7 @@ do_test rekey-database-by-name {
|
||||
pragma key = 'bar';
|
||||
select * from t1;
|
||||
}
|
||||
} {foo bar}
|
||||
} {ok foo bar}
|
||||
db close
|
||||
file delete -force test.db
|
||||
file delete -force new.db
|
||||
|
||||
@@ -46,7 +46,6 @@ slave_test_file $testdir/sqlcipher-core.test
|
||||
slave_test_file $testdir/sqlcipher-compatibility.test
|
||||
slave_test_file $testdir/sqlcipher-rekey.test
|
||||
slave_test_file $testdir/sqlcipher-plaintext-header.test
|
||||
slave_test_file $testdir/sqlcipher-rekey.test
|
||||
slave_test_file $testdir/sqlcipher-pragmas.test
|
||||
slave_test_file $testdir/sqlcipher-integrity.test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user