I'm using SQLite3MultipleCiphers compiled (from amalgamation) for sqlite-jdbc on Android.
When I apply plaintext_header_size in uri jdbc:sqlite:file:<file_path>?plaintext_header_size=32 it's doesn't effect to real new database file:
hexdump -C -n 32 file.db
00000000 cb 2a 85 13 80 8a d0 c7 26 24 8f c9 00 cf d9 38 |.*......&$.....8|
00000010 10 00 02 02 50 40 20 20 2e 0f 4f 0a 83 05 66 01 |....P@ ..O...f.|
The sql query SELECT sqlite3mc_config('sqlcipher', 'plaintext_header_size') returns value is 32 as set in URI.
Also I'm try set value of plaintext_header_size in source file and it's doesn't effect to the database file too.
SQLITE_PRIVATE CipherParams mcSQLCipherParams[] =
{
{ "legacy", SQLCIPHER_LEGACY_DEFAULT, SQLCIPHER_LEGACY_DEFAULT, 0, SQLCIPHER_VERSION_MAX },
...
{ "plaintext_header_size", 32, 32 0, 100 /* restrict to db header size */ },
CIPHER_PARAMS_SENTINEL
};
Compile options:
-DSQLITE_ENABLE_LOAD_EXTENSION=1 \
-DSQLITE_HAVE_ISNAN \
-DHAVE_USLEEP=1 \
-DSQLITE_ENABLE_COLUMN_METADATA \
-DSQLITE_CORE \
-DSQLITE_ENABLE_FTS3 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_PERCENTILE \
-DSQLITE_ENABLE_STAT4 \
-DSQLITE_ENABLE_DBSTAT_VTAB \
-DSQLITE_ENABLE_MATH_FUNCTIONS \
-DSQLITE_THREADSAFE=1 \
-DSQLITE_DEFAULT_MEMSTATUS=0 \
-DSQLITE_DEFAULT_FILE_PERMISSIONS=0666 \
-DSQLITE_MAX_VARIABLE_NUMBER=250000 \
-DSQLITE_MAX_MMAP_SIZE=1099511627776 \
-DSQLITE_MAX_LENGTH=2147483647 \
-DSQLITE_MAX_COLUMN=32767 \
-DSQLITE_MAX_SQL_LENGTH=1073741824 \
-DSQLITE_MAX_FUNCTION_ARG=127 \
-DSQLITE_MAX_ATTACHED=125 \
-DSQLITE_MAX_PAGE_COUNT=4294967294 \
-DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS \
-DHAVE_CIPHER_AES_128_CBC=0 \
-DHAVE_CIPHER_AES_256_CBC=0 \
-DHAVE_CIPHER_SQLCIPHER=1 \
-DHAVE_CIPHER_CHACHA20=0 \
-DHAVE_CIPHER_RC4=0 \
-DHAVE_CIPHER_ASCON128=0 \
-DHAVE_CIPHER_AEGIS=0 \
-DCODEC_TYPE=CODEC_TYPE_SQLCIPHER \
-DSQLITE_TEMP_STORE=2 \
UPD:
The oldest version (2.0.0) that which I was able to compile has the same behavior
UPD2:
When I change key set up from pragma key = <key> to URI syntax jdbc:sqlite:file:<file_path>?plaintext_header_size=32&cipher_salt=61e5f19e244fedfc8cb6e531536d37f4&key=1 the database file header still contains the salt I passed:
hexdump -C -n 16 saferep.db
00000000 61 e5 f1 9e 24 4f ed fc 8c b6 e5 31 53 6d 37 f4 |a...$O.....1Sm7.|
I'm using SQLite3MultipleCiphers compiled (from amalgamation) for sqlite-jdbc on Android.
When I apply plaintext_header_size in uri
jdbc:sqlite:file:<file_path>?plaintext_header_size=32it's doesn't effect to real new database file:The sql query
SELECT sqlite3mc_config('sqlcipher', 'plaintext_header_size')returns value is 32 as set in URI.Also I'm try set value of plaintext_header_size in source file and it's doesn't effect to the database file too.
Compile options:
UPD:
The oldest version (2.0.0) that which I was able to compile has the same behavior
UPD2:
When I change key set up from
pragma key = <key>to URI syntaxjdbc:sqlite:file:<file_path>?plaintext_header_size=32&cipher_salt=61e5f19e244fedfc8cb6e531536d37f4&key=1the database file header still contains the salt I passed: