Use in rust wasm32-unknown-unknown
target
#202
Replies: 1 comment
-
Well, if However, Doing it right means that the method must read the file content via the encryption VFS shim. If that is done, the header check will succeed. Some (but not all) cipher schemes supported by SQLite3 Multiple Ciphers allow to leave the database header unencrypted. In that case header verification would succeed on reading the raw database header.
If reading and writing is done via the encryption VFS shim, all should work as expected. However, processing raw database content will fail - at least for all so-called legacy ciphers in SQLite3 Multiple Ciphers. The non-legacy cipher schemes in SQLite3 Multiple Ciphers leave the header bytes 16-23 unencrypted, so that modifying them on disk does no harm.
Well, in this context SQLite3 Multiple Ciphers is just used as a drop-in replacement for the official SQLite Encryption Extension (SEE). That is, all what works for SEE should usually also work for SQLite3 Multiple Ciphers. Method Conclusion: Method |
Beta Was this translation helpful? Give feedback.
-
Recently I finished supporting the SQLite3MultipleCiphers feature in the
wasm32-unknown-unknown
target. After adding a few shims, it works fine. https://github.com/Spxg/sqlite-wasm-rsopfs-sahpool provided by sqlite-wasm-rs is ported from the official one. During the development process, I found that importDb provided by opfs-sahpool is not available under cipher for two reasons:
importDb
has header verification, and the verification cannot pass after encryption. https://github.com/sqlite/sqlite-wasm/blob/f38f7ab4753e408906ca8d9cc28a9446a02cbde3/sqlite-wasm/jswasm/sqlite3.mjs#L13704importDb
will write 1 to the offset 18,19 of the imported DB, which will damage the encrypted database. https://github.com/sqlite/sqlite-wasm/blob/f38f7ab4753e408906ca8d9cc28a9446a02cbde3/sqlite-wasm/jswasm/sqlite3.mjs#L13714Considering that SQLite3MultipleCiphers provides wasm precompiled products, I think this also affects it.
Beta Was this translation helpful? Give feedback.
All reactions