@@ -13,8 +13,8 @@ public class SQLiteMCConfig extends SQLiteConfig {
13
13
14
14
private static final Pragma [] CIPHER_PRAGMA_ORDER = new Pragma []{
15
15
Pragma .CIPHER ,
16
- Pragma .HMAC_CHECK ,
17
16
Pragma .LEGACY ,
17
+ Pragma .HMAC_CHECK ,
18
18
Pragma .LEGACY_PAGE_SIZE ,
19
19
Pragma .KDF_ITER ,
20
20
Pragma .FAST_KDF_ITER ,
@@ -34,8 +34,6 @@ public SQLiteMCConfig(Properties prop) {
34
34
super (prop );
35
35
}
36
36
37
- private boolean useSQLInterface = false ;
38
-
39
37
protected boolean isValid (Integer value , int min , int max ) {
40
38
return (value >= min && value <= max );
41
39
}
@@ -110,17 +108,19 @@ protected SQLiteMCConfig setPlaintextHeaderSize(int value) {
110
108
}
111
109
112
110
public SQLiteMCConfig useSQLInterface (boolean sqlInterface ) {
113
- this . useSQLInterface = sqlInterface ;
111
+ setPragma ( Pragma . MC_USE_SQL_INTERFACE , sqlInterface ? "true" : "false" ) ;
114
112
return this ;
115
113
}
116
114
117
115
public void applyCipherParameters (Connection conn , Statement stat ) throws SQLException {
118
- applyCipherParametersByNames (CIPHER_PRAGMA_ORDER , conn , stat , useSQLInterface );
116
+ applyCipherParametersByNames (CIPHER_PRAGMA_ORDER , conn , stat );
119
117
}
120
118
121
- protected void applyCipherParametersByNames (Pragma [] pragmas , Connection conn , Statement statement , boolean useSQLInterface ) throws SQLException {
119
+ protected void applyCipherParametersByNames (Pragma [] pragmas , Connection conn , Statement statement ) throws SQLException {
122
120
Properties p = super .toProperties ();
123
121
122
+ boolean useSQLInterface = Boolean .parseBoolean (p .getProperty (Pragma .MC_USE_SQL_INTERFACE .getPragmaName (), "false" ));
123
+
124
124
String cipherProperty = p .getProperty (Pragma .CIPHER .getPragmaName (), null );
125
125
if (cipherProperty == null )
126
126
throw new SQLException ("Cipher name could not be empty at this stage" );
0 commit comments