<html><head><style>body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}
h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}
h1 {
        color: #000000;
        font-size: 28pt;
}
h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}
h3 {
        font-size: 18px;
}
h4 {
        font-size: 16px;
}
h5 {
        font-size: 14px;
}
h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}
hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
}
p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}
a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}
#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}
button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}
code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}
code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}
pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}
pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}
#ws { background-color: #f8f8f8; }
.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><h1 id="proposal">Proposal</h1>
<p>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</p>
<p>My idea/proposal for creating EncryptedSQLStore is to use two tables: one for ciphertext and other for metadata needed for decryption.</p>
<h2 id="2tables">2 Tables</h2>
<p>1) SameOfTheModelName<em>ENCRYPT</em>HELPER</p>
<p>ID (Text) <br>
DATA (BLOB) <br></p>
<pre><code>INSERT INTO SameOfTheModelName_ENCRYPT_HELPER (ID, DATA) VALUES ('IV', IV_BYTE[]);
INSERT INTO SameOfTheModelName_ENCRYPT_HELPER (ID, DATA) VALUES ('SALT', SALT_BYTE[]);
</code></pre>
<p>2) SameOfTheModelName</p>
<p>ID (Text) <br>
DATA (BLOB) <br></p>
<h2 id="encryptionprocess">Encryption Process</h2>
<p>Get Entity Instance, Parse it to JSON, Encrypt that and Store </p>
<h2 id="androidimplementation">Android Implementation</h2>
<pre><code>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-sample-td5306.html
// Retrive IV from table
// Retrive Salt from table
// Create/Recreate PrivateKey
// Create CryptoUtils/Cryptobox
}
</code></pre>
<p>--
Daniel Passos</p></body></html>