Sqlcipher 'open' with corridor and Cordova-SQLitePlugin

I have sqlcipher SQL code that is relatively complex (27 tables) but with few records (between 50-200 records per table). When I run a SELECT statement (the same as in the corresponding view), joining 3 tables, executing a pair of "LIKE" (optimized using EXPLAIN), the desktop client CPU (with sqlcipher) takes 3 ms to query.

However, the same Android query with Cordova-SQLitePlugin takes almost 1900 ms - due to the fact that opening the database costs about 1800 ms , which, obviously, is repeated after each page load.

Requests are issued as follows:

var db = window.sqlitePlugin.openDatabase({name: "myDatabase", key: "mySecret", bgType: 1});
    db.transaction(function(transaction) {
        transaction.executeSql(query, [],function(transaction, result) {
        callback(result);
    }, null);
    },null,null);

Is there anything I can do? Thanks in advance for any tips and tricks ...

Greetings from Chris

+4
source share
1 answer

SQLCipher's performance for opening a database is deliberately slow. SQLCipher uses the PBKDF2 key to perform key derivation (i.e. Thousand SHA1 operations) to protect against brute force and dictionary attacks. See http://sqlcipher.net/design for more details .

, , . , . , .

, - . SQLCipher PBKDF2 . , . , . , , KDF:

http://sqlcipher.net/sqlcipher-api/#kdf_iter

+3

Source: https://habr.com/ru/post/1526099/


All Articles