File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -242,10 +242,18 @@ db2 close
242242file delete -force test.db
243243file delete -force test2.db
244244
245- # attach an empty encrypted database as the first op
246- # on a keyed database and verify different
247- # salts but same keys (because derivation of the key spec
248- # has not occured yet)
245+ # attach an empty encrypted database as the first operation on a keyed database. Verify
246+ # that the new database has the same salt as the original.
247+ #
248+ # HISTORICAL NOTE: The original behavior of SQLCipher under these conditions
249+ # was that the databases would have different salts but the same keys. This was because
250+ # derivation of the key spec would not have occurred yet. However, upstream check-in
251+ # https://sqlite.org/src/info/a02da71f3a80dd8e changed this behavior by
252+ # forcing a read of the main database schema during the attach operation.
253+ # This causes the main database to be opened and the key derivation logic to fire which
254+ # reads the salt. Thus the current behavior of this test should now be identical
255+ # to the previous attach-empty-database-with-default-key.
256+
249257setup test.db "'testkey'"
250258do_test attach-empty-database-with-default-key-first-op {
251259 sqlite_orig db test.db
@@ -267,7 +275,7 @@ do_test attach-empty-database-with-default-key-first-op {
267275 } db2]
268276
269277 lappend rc [string equal [hexio_read test.db 0 16] [hexio_read test2.db 0 16]]
270- } {{ok 1} 0 }
278+ } {{ok 1} 1 }
271279db close
272280db2 close
273281file delete -force test.db
You can’t perform that action at this time.
0 commit comments