You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently only the cipher schemes [sqleet: ChaCha20]({{ site.baseurl }}{% link docs/ciphers/cipher_chacha20.md %}) and [SQLCipher: AES 256 Bit]({{ site.baseurl }}{% link docs/ciphers/cipher_sqlcipher.md %}) support this method, requiring the literal syntax as given in the example.
97
+
Starting with version [2.2.0](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v2.2.0) the ciphers [Ascon128]({{ site.baseurl }}{% link docs/ciphers/cipher_ascon128.md %}) and [AEGIS]({{ site.baseurl }}{% link docs/ciphers/cipher_aegis.md %}) support this option, too.
98
+
All named ciphers accept the raw key material in both forms shown in the example.
97
99
98
100
<spanclass="label label-green">Example 3:</span> _Raw key data including salt (without key derivation)_
Currently only the cipher schemes [sqleet: ChaCha20]({{ site.baseurl }}{% link docs/ciphers/cipher_chacha20.md %}) and [SQLCipher: AES 256 Bit]({{ site.baseurl }}{% link docs/ciphers/cipher_sqlcipher.md %}) support this method, requiring the literal syntax as given in the example.
114
+
Starting with version [2.2.0](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v2.2.0) the ciphers [Ascon128]({{ site.baseurl }}{% link docs/ciphers/cipher_ascon128.md %}) and [AEGIS]({{ site.baseurl }}{% link docs/ciphers/cipher_aegis.md %}) support this option, too.
115
+
All named ciphers accept the raw key material in both forms shown in the example.
112
116
113
117
---
114
118
@@ -183,6 +187,23 @@ PRAGMA cipher = 'aes256cbc';
183
187
184
188
---
185
189
190
+
### PRAGMA *cipher_salt*
191
+
192
+
The `PRAGMA cipher_salt` allows to set or retrieve the _cipher salt_ used by the cipher scheme, and has the following syntax:
where the value for `ciphersalt` has to be given as a string consisting of 32 hex digits representing the 16 bytes cipher salt.
199
+
200
+
Note
201
+
{: .label .label-red .ml-0 .mb-1 .mt-2 }
202
+
-**Setting** the cipher salt is only possible, _before_`PRAGMA key` is executed.
203
+
-**Retrieving** the cipher salt is only possible, _after_`PRAGMA key` was executed.
204
+
205
+
---
206
+
186
207
### PRAGMA *hmac_check*
187
208
188
209
The `PRAGMA hmac_check` sets a boolean flag whether the HMAC should be validated on read operations for encryption schemes using HMACs. It has the following syntax:
Copy file name to clipboardExpand all lines: docs/configuration/config_uri.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Notes
22
22
- If either the URI query parameter `key` or `hexkey` is used and if it is not intended to use the default cipher, then the `cipher` query parameter and optionally further cipher configuration parameters have to be given in the URI query string as well.
23
23
- For security reasons it is not recommended to use the URI query parameter `key` or `hexkey`, because the passphrase is visible in memory for the whole duration of the database connection.
24
24
- The URI query parameters `key` or `hexkey` are respected on **opening** a database, and on **attaching** a database. However, if the keyword `KEY` of the SQL command `ATTACH` is used on attaching a database, the value after the keyword `KEY` will take precedence over the URI parameters.
25
-
-The `cipher` query parameter is always required, if further query parameters should be used to configure the encryption extension. If this parameter is missing or specifies an unknown cipher, all other cipher configuration parameters are silently ignored, and the default cipher as selected at compile time will be used.
25
+
-If query parameters are used to configure the encryption extension, the `cipher` query parameter is mandatory for _all_**non-default** ciphers; it is optional for the default cipher, but it is recommended to always specify the cipher. If this parameter specifies an unknown cipher, all other cipher configuration parameters are silently ignored, and the default cipher as selected at compile time will be used.
26
26
- On **opening** a database all cipher configuration parameters given in the URI query string are used to set the **default** cipher configuration of the database connection. On **attaching** a database the cipher configuration parameters given in the URI query string will be used for the attached database, but will not change the defaults of the main database connection.
27
27
28
28
<spanclass="label label-green">Example:</span> URI query string to select the _legacy_ SQLCipher Version 2 encryption scheme
Copy file name to clipboardExpand all lines: docs/faq/faq_overview.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,3 +58,13 @@ Therefore the SQL configuration functions can't be used any longer for configuri
58
58
Dynamically loading certain SQLite extensions may also fail, if done before`PRAGMA key` was executed. Namely FTS5 extensions (like [sqlite-better-trigram](https://github.com/streetwriters/sqlite-better-trigram) or [sqlite3-fts5-html](https://github.com/streetwriters/sqlite3-fts5-html)) are affected, because they retrieve the FTS5 API pointer via a `SELECT` statement (see [issue #208](https://github.com/utelle/SQLite3MultipleCiphers/issues/208)). Postpone dynamically loading affected extensions until `PRAGMA key` was executed.
59
59
60
60
[Automatically loading statically linked extensions](https://sqlite.org/c3ref/auto_extension.html) will not work at all for extensions that depend on using `SELECT` statements while initializing the extension, because SQLite initializes extensions registered for automatic loading, before the cipher scheme is activated for the connection. For example, in case of extending the FTS5 extension, it would be necessary that the FTS5 extension provides access to the API pointer by other means than a `SELECT` statement.
61
+
62
+
## Why my app is killed under **iOS** on suspension, when the _SQLite_ database is stored in a shared container for app groups?
63
+
64
+
_iOS_ apps can't share an **encrypted** database with app extensions (e.g. share extensions) without being terminated every time they enter the background. _iOS_ won't let suspended apps retain a file lock on apps in the _"shared data container"_ used to share files between _iOS_ apps and their app extensions. This seems to affect all versions of iOS and all device models.
65
+
66
+
To overcome this issue version 4 of _SQLCipher_ introduced a new parameter `plain_text_header_size`. If this parameter is set to a non-zero value (like 16 or 32), the corresponding number of bytes at the beginning of the database header are not encrypted allowing _iOS_ to identify the file as a _SQLite_ database file. The drawback of this approach is that the cipher salt used for the key derivation can't be stored in the database header any longer. Therefore it is necessary to retrieve the cipher salt on creating a new database, and to specify the salt on opening an existing database.
67
+
68
+
While _SQLite3 Multiple Ciphers_ supported the parameter `plain_text_header_size` right from the beginning, it did not for other cipher schemes. Starting with version [2.2.0](https://github.com/utelle/SQLite3MultipleCiphers/releases/tag/v2.2.0) the cipher schemes _chacha20_, _ascon128_, and _aegis_ support this parameter as well.
69
+
70
+
In _SQLite3 Multiple Ciphers_ the cipher salt can be retrieved with the function [`sqlite3mc_codec_data`]({{ site.baseurl }}{% link docs/configuration/config_sql_functions/#function-sqlite3mc_codec_data %}) using parameter `cipher_salt`. Alternatively, it can be retrieved with `PRAGMA cipher_salt`. On opening a database the _cipher salt_ has to be supplied either via the database URI parameter `cipher_salt`, or via `PRAGMA cipher_salt='<hex bytes of cipher salt>'`, before `PRAGMA key` is executed.
0 commit comments