@@ -148,50 +148,30 @@ public void sqlCipherDatabaseHexKeyTest() throws SQLException, IOException {
148
148
149
149
}
150
150
151
-
152
151
@ Test
153
- public void sqlCipherDatabaseSpecialKeyTest () throws SQLException , IOException {
154
-
152
+ public void sqlCipherDatabaseSpecialKeyTest () throws SQLException , IOException {
155
153
String dbfile = createFile ();
156
154
String Key1 = URLEncoder .encode ("Key2&2ax" , "utf8" );
157
- String Key2 = "Key2" ;
155
+ String Key2 = "Key2&2ax " ;
158
156
cipherDatabaseCreate (dbfile , Key1 );
159
157
160
- //2. Ensure db is readable with good Password
158
+ //2. Ensure db is readable with Key1 Password URL access
161
159
Connection c = cipherDatabaseOpen (dbfile , Key1 );
162
160
assertTrue (
163
161
String .format ("1. Be sure the database with config %s can be read with the key '%s'" , "SQLCipher" , Key1 )
164
162
, databaseIsReadable (c ));
165
163
c .close ();
166
164
167
- //3. Ensure not readable with wrong key
168
- Connection c2 = cipherDatabaseOpen (dbfile , Key2 );
169
- assertFalse (
170
- String .format ("2. Be sure the database with config %s cannot be read with the key '%s'" , "SQLCipher" , Key2 )
171
- , databaseIsReadable (c2 ));
172
- c .close ();
173
-
174
- }
175
-
176
-
177
- @ Test
178
- public void sqlCipherDatabaseSpacialKeyTest () throws SQLException , IOException {
179
- String dbfile = createFile ();
180
- String Key1 = URLEncoder .encode ("Key2&2ax" , "utf8" );
181
- String Key2 = "Key2&2ax" ;
182
- cipherDatabaseCreate (dbfile , Key1 );
183
-
184
- //2. Ensure db is readable with Key1 Password URL access
185
- Connection c = cipherDatabaseOpen (dbfile , Key1 );
165
+ //3. Make sure we can read the database using the SQL interface
166
+ c = new SQLiteMCSqlCipherConfig ().setLegacy (1 ).setKdfIter (4000 ).withKey (Key2 ).createConnection ("jdbc:sqlite:file:" + dbfile );
186
167
assertTrue (
187
- String .format ("1 . Be sure the database with config %s can be read with the key '%s'" , "SQLCipher" , Key1 )
168
+ String .format ("2 . Be sure the database is readable using PRAGMA method and key containing special characters" )
188
169
, databaseIsReadable (c ));
189
170
c .close ();
190
171
191
- //3. Make sure we can read the database using the SQL interface
192
- c = new SQLiteMCSqlCipherConfig ().setKdfIter (4000 ).setLegacy (1 ).withKey (Key2 ).useSQLInterface (true ).createConnection ("jdbc:sqlite:file:" + dbfile );
172
+ c = new SQLiteMCSqlCipherConfig ().setLegacy (1 ).setKdfIter (4000 ).withKey (Key2 ).useSQLInterface (true ).createConnection ("jdbc:sqlite:file:" + dbfile );
193
173
assertTrue (
194
- String .format ("2 . Be sure the database is readable using two method and key containing special characters" )
174
+ String .format ("3 . Be sure the database is readable using SQL method and key containing special characters" )
195
175
, databaseIsReadable (c ));
196
176
c .close ();
197
177
}
0 commit comments