Encrypting database
below link will help you to encrypt db
http://sqlcipher.net/sqlcipher-for-android/
Decryption of database
once you encrypted your db , you may need to decrypt your database
.
follow below steps to decrypt your database
you need linux system to decrypt your database or follow
http://thebugfreeblog.blogspot.in/2012/08/compiling-sqlcipher-for-windows.html this link
download sqlcipher_2.1.1.orig.tar.gz from the below site
https://launchpad.net/ubuntu/+source/sqlcipher/2.1.1-2
or run
$ wget
https://launchpad.net/ubuntu/+archive/primary/+files/sqlcipher_2.1.1.orig.tar.gz
#untar using below command
$ tar -zxvf sqlcipher_2.1.1.orig.tar.gz
$ apt-get install build-essential
$ sudo apt-get install libssl-dev
# $ cd sqlcipher-2.1.1
, go to that folder
$ ./configure
--enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC"
LDFLAGS="-lcrypto"
$ make
$ ./sqlite3 encrypted.db ;
sqlite> PRAGMA key = 'password'; -- you need to pass the password which is
used while creating db.
sqlite> ATTACH DATABASE 'plaintext.db' AS plaintext KEY
''; -- empty key will disable encryption
sqlite> SELECT sqlcipher_export('plaintext');
sqlite> DETACH DATABASE plaintext;
No comments:
Post a Comment