@@ -101,6 +101,42 @@ impl SqliteConnectOptions {
101
101
// SQLCipher special case: if the `key` pragma is set, it must be executed first.
102
102
pragmas. insert ( "key" . into ( ) , None ) ;
103
103
104
+ // Other SQLCipher pragmas that has to be after the key, but before any other operation on the database.
105
+ // https://www.zetetic.net/sqlcipher/sqlcipher-api/
106
+
107
+ // Bytes of the database file that is not encrypted
108
+ // Default for SQLCipher v4 is 0
109
+ // If greater than zero 'cipher_salt' pragma must be also defined
110
+ pragmas. insert ( "cipher_plaintext_header_size" . into ( ) , None ) ;
111
+
112
+ // Allows to provide salt manually
113
+ // By default SQLCipher sets salt automatically, use only in conjunction with
114
+ // 'cipher_plaintext_header_size' pragma
115
+ pragmas. insert ( "cipher_salt" . into ( ) , None ) ;
116
+
117
+ // Number of iterations used in PBKDF2 key derivation.
118
+ // Default for SQLCipher v4 is 256000
119
+ pragmas. insert ( "kdf_iter" . into ( ) , None ) ;
120
+
121
+ // Define KDF algorithm to be used.
122
+ // Default for SQLCipher v4 is PBKDF2_HMAC_SHA512.
123
+ pragmas. insert ( "cipher_kdf_algorithm" . into ( ) , None ) ;
124
+
125
+ // Enable or disable HMAC functionality.
126
+ // Default for SQLCipher v4 is 1.
127
+ pragmas. insert ( "cipher_use_hmac" . into ( ) , None ) ;
128
+
129
+ // Set default encryption settings depending on the version 1,2,3, or 4.
130
+ pragmas. insert ( "cipher_compatibility" . into ( ) , None ) ;
131
+
132
+ // Page size of encrypted database.
133
+ // Default for SQLCipher v4 is 4096.
134
+ pragmas. insert ( "cipher_page_size" . into ( ) , None ) ;
135
+
136
+ // Choose algorithm used for HMAC.
137
+ // Default for SQLCipher v4 is HMAC_SHA512.
138
+ pragmas. insert ( "cipher_hmac_algorithm" . into ( ) , None ) ;
139
+
104
140
// Normally, page_size must be set before any other action on the database.
105
141
// Defaults to 4096 for new databases.
106
142
pragmas. insert ( "page_size" . into ( ) , None ) ;
@@ -282,9 +318,9 @@ impl SqliteConnectOptions {
282
318
/// Note this excerpt:
283
319
/// > The collating function must obey the following properties for all strings A, B, and C:
284
320
/// >
285
- /// > If A==B then B==A.
286
- /// > If A==B and B==C then A==C.
287
- /// > If A\<B then B>A.
321
+ /// > If A==B then B==A.
322
+ /// > If A==B and B==C then A==C.
323
+ /// > If A\<B then B>A.
288
324
/// > If A<B and B<C then A<C.
289
325
/// >
290
326
/// > If a collating function fails any of the above constraints and that collating function is
@@ -326,7 +362,7 @@ impl SqliteConnectOptions {
326
362
/// ### Note
327
363
/// Setting this to `true` may help if you are getting access violation errors or segmentation
328
364
/// faults, but will also incur a significant performance penalty. You should leave this
329
- /// set to `false` if at all possible.
365
+ /// set to `false` if at all possible.
330
366
///
331
367
/// If you do end up needing to set this to `true` for some reason, please
332
368
/// [open an issue](https://github.com/launchbadge/sqlx/issues/new/choose) as this may indicate
0 commit comments