Note that there are some explanatory texts on larger screens.

plurals
  1. POSqlcipher, Windows: encryption succeeds but produces strange results
    primarykey
    data
    text
    <p>I used <code>sqlcipher_export()</code>, exactly as specified <a href="http://sqlcipher.net/sqlcipher-api/#sqlcipher_export" rel="nofollow">here</a>, to encrypt an existing Sqlite database. It all went fine - no errors, the resulting database is created and has a reasonable size. However, I am not able to open the encrypted database, even though I specify the correct key using <code>PRAGMA key</code>. Unencrypted databases open without problems.</p> <p>Moreover, the encrypted database looks strange; the header seems to be encrypted, but not the data. See <a href="http://i.stack.imgur.com/HaBpS.png" rel="nofollow">http://i.stack.imgur.com/HaBpS.png</a>, it's an image showing binary comparison between encrypted (left) and unencrypted (right) databases.</p> <p>In the debugger I can see that, during the encryption, the program goes through <code>sqlcipher_page_cipher()</code>, but most of the time (every time except for 2 invocations) the following clause is executed, and the function returns early:</p> <pre><code> /* just copy raw data from in to out when key size is 0 * i.e. during a rekey of a plaintext database */ if(c_ctx-&gt;key_sz == 0) { memcpy(out, in, size); return SQLITE_OK; } </code></pre> <p>SQL issued during encryption:</p> <pre><code>ATTACH DATABASE 'encrypted.db' AS encrypted KEY '12345'; SELECT sqlcipher_export('encrypted'); DETACH DATABASE encrypted; </code></pre> <p>SQL issued during opening:</p> <pre><code>// open database PRAGMA key = '12345'; // try to read database - "file is encrypted or not a database" </code></pre> <p>CODEC_TRACE logs generated during encryption and decryption are <a href="http://yp.lviv.ua/tmp/sqlcipher_log.zip" rel="nofollow">here</a>.</p> <p>(In case it is important how I compiled Sqlcipher: I created an Sqlcipher amalgamation on a Linux machine, copied the resulting C file to a Windows machine, compiled it in Visual C++ Express, and linked to a precompiled OpenSSL DLL.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload