Proposal
My idea/proposal to make EncryptedSQLStore is create 2 tables to store Encrypted. One for
Data and other to something we have store to decrypt later
My idea/proposal for creating EncryptedSQLStore is to use two tables: one for ciphertext
and other for metadata needed for decryption.
2 Tables
1) SameOfTheModelNameENCRYPTHELPER
ID (Text)
DATA (BLOB)
INSERT INTO SameOfTheModelName_ENCRYPT_HELPER (ID, DATA) VALUES ('IV',
IV_BYTE[]);
INSERT INTO SameOfTheModelName_ENCRYPT_HELPER (ID, DATA) VALUES ('SALT',
SALT_BYTE[]);
2) SameOfTheModelName
ID (Text)
DATA (BLOB)
Encryption Process
Get Entity Instance, Parse it to JSON, Encrypt that and Store
Android Implementation
public void onCreate(SQLiteDatabase sqLiteDatabase) {
// Create SameOfTheModelName_ENCRYPT_HELPER Table
// Store IV
// Store Salt
// Create SameOfTheModelName Table
}
public void onOpen(SQLiteDatabase db) {
// TODO This process will be moved to KeyServices
http://aerogear-dev.1069024.n5.nabble.com/aerogear-dev-Android-Crypto-API...
// Retrive IV from table
// Retrive Salt from table
// Create/Recreate PrivateKey
// Create CryptoUtils/Cryptobox
}
-- Daniel Passos