|
| 1 | +.echo on |
| 2 | +-- Test to access database encrypted with SQLCipher version 1 |
| 3 | +-- Result: 75709 1 1 one one 1 2 one two 1 2 |
| 4 | +.open test/sqlcipher-1.1.8-testkey.db |
| 5 | +pragma cipher='sqlcipher'; |
| 6 | +pragma legacy=1; |
| 7 | +pragma key='testkey'; |
| 8 | +SELECT COUNT(*) FROM t1; |
| 9 | +SELECT DISTINCT * FROM t1; |
| 10 | + |
| 11 | +-- Test to access database encrypted with SQLCipher version 2 |
| 12 | +-- using 4000 iterations for the HMAC key derivation and a HMAC salt mask of zero |
| 13 | +-- Result: 38768 test-0-0 test-0-1 test-1-0 test-1-1 |
| 14 | +.open test/sqlcipher-2.0-beta-testkey.db |
| 15 | +pragma cipher='sqlcipher'; |
| 16 | +pragma legacy=2; |
| 17 | +pragma fast_kdf_iter=4000; |
| 18 | +pragma hmac_salt_mask=0; |
| 19 | +pragma key='testkey'; |
| 20 | +SELECT COUNT(*) FROM t1; |
| 21 | +SELECT DISTINCT * FROM t1; |
| 22 | + |
| 23 | +-- Test to access database encrypted with SQLCipher version 2 |
| 24 | +-- using the page number in big endian form (BE) for the HMAC calculation |
| 25 | +-- Result: 78536 1 1 one one 1 2 one two |
| 26 | +.open test/sqlcipher-2.0-be-testkey.db |
| 27 | +pragma cipher='sqlcipher'; |
| 28 | +pragma legacy=2; |
| 29 | +pragma hmac_pgno=2; |
| 30 | +pragma key='testkey'; |
| 31 | +SELECT COUNT(*) FROM t1; |
| 32 | +SELECT DISTINCT * FROM t1; |
| 33 | + |
| 34 | +-- Test to access database encrypted with SQLCipher version 2 |
| 35 | +-- using the page number in little endian form (LE) for the HMAC calculation |
| 36 | +-- Note: No change to the default initialization necessary |
| 37 | +-- Result: 78536 1 1 one one 1 2 one two |
| 38 | +.open test/sqlcipher-2.0-le-testkey.db |
| 39 | +pragma cipher='sqlcipher'; |
| 40 | +pragma legacy=2; |
| 41 | +pragma key='testkey'; |
| 42 | +SELECT COUNT(*) FROM t1; |
| 43 | +SELECT DISTINCT * FROM t1; |
| 44 | + |
| 45 | +-- // Test to access database encrypted with SQLCipher version 3 |
| 46 | +-- // Result: 78536 1 1 one one 1 2 one two |
| 47 | +.open test/sqlcipher-3.0-testkey.db |
| 48 | +pragma cipher='sqlcipher'; |
| 49 | +pragma legacy=3; |
| 50 | +pragma key='testkey'; |
| 51 | +SELECT COUNT(*) FROM t1; |
| 52 | +SELECT DISTINCT * FROM t1; |
| 53 | + |
| 54 | +-- // Test to access database encrypted with SQLCipher version 4 |
| 55 | +-- // Result: 78536 1 1 one one 1 2 one two |
| 56 | +.open test/sqlcipher-4.0-testkey.db |
| 57 | +pragma cipher='sqlcipher'; |
| 58 | +pragma legacy=4; |
| 59 | +pragma key='testkey'; |
| 60 | +SELECT COUNT(*) FROM t1; |
| 61 | +SELECT DISTINCT * FROM t1; |
0 commit comments