Hi Raj,
I have replied to your questions inline:
On 8/27/13 2:38 AM, Raj wrote:
> Hi Nick,
>
> Thanks for your reply. I have existing sqlite file with many tables and
> integrated FMDB for DB operations. Now, i want to include sqlcipher for
> encryption.
>
> I referred this url
http://sqlcipher.net/ios-tutorial/
> <
http://sqlcipher.net/ios-tutorial/> to integrate the sqlcipher without
> no issues.
>
> *configure this one*
> openssl-1.0.1e]$ ./configure --enable-tempstore=yes
> CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="/PATH/openssl-1.0.1e/libcrypto.a"
> Usage: Configure [no-<cipher> ...] [enable-<cipher> ...]
> [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx]
> [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic]
> [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR]
> [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity]
> os/compiler[:flags]
> [Raj@ openssl-1.0.1e]$ make
>
> *Used following commands to encrypt*
> ./sqlcipher /path/to/database/retail_db.sqlite
> SQLCipher version 3.7.17 2013-05-20 00:56:22
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> ATTACH DATABASE 'encrypted.sqlite' AS encrypted KEY 'test';
> sqlite> SELECT sqlcipher_export('encrypted');
> sqlite> DETACH DATABASE encrypted;
> sqlite>
>
> Questions :
> 1.Above commands should be use in code or command line?
The above commands appear to have been run via the command line shell,
however you could also execute them within your iOS application using
the C API exposed from integrating SQLCipher with your iOS application.
> 2.Can i replace this encrypted sqllite(encrypted.sqlite) to original
> one(retail_db.sqlite)?
You can use the encrypted.sqlite file within your iOS application, note
that you will need to make sure your application is bundling SQLCipher,
not just creating the SQLCipher shell as above.
> 3.Should be decrypt the database when i perform the db operations such
> as insert, update function or sqlite open?
When you have SQLCipher integrated within your iOS application, using
the API, SQLCipher will handle decrypting the content as needed from the
database. More information on the SQLCipher design can be found here [1].
> 4..Is this the right way to encrypt? if not, please explain the correct
> steps?
>
The example you gave above uses the command line shell, this is fine but
your application requirements will dictate exactly how things need to
operate. For example, you may need to encrypt content directly on your
iOS application so integration of SQLCipher within your application
would be important. The difference being that you performed the
encryption above on using the shell on your computer.
1.
http://sqlcipher.net/design
> Can you please reply this?
>
> On Monday, 26 August 2013 16:21:23 UTC+5:30, Raj wrote:
>
> Hi All,
> I have successfully integrated SQLCipher in iOS application without
> build issue and tried to encrypt the existing sqlite file, but
> unable to encrypt it.
>
> I referred following links.
>
http://sqlcipher.net/ios-tutorial/ <
http://sqlcipher.net/ios-tutorial/>
>
http://sqlcipher.net/sqlcipher-api/#sqlcipher_export
> <
http://sqlcipher.net/sqlcipher-api/#sqlcipher_export>
>
> Configure this one also in command line
> ./configure -enable-tempstore=yes
> --prefix=/path/to/install/target/sqlcipher
> CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
> make
>
>
> and tried use following command,
> ./sqlite3 /pat/to/database
> Got error : -bash: ./sqlite3: No such file or directory
>
> I dont know abt this issue. Can you please give solution for this issue?
>
>
>