Safari
Safari

Reputation: 11965

Encryption of Sqlite database

I have a question about encryption of a Sqlite database. I integrated sqlcipher library into my iOS Application to decrypt a sqlite database. Now, how can I encrypt an existing sql database (plaintext). Can you give me all steps that I need to follow? Thanks

Upvotes: 0

Views: 1280

Answers (1)

Nick Parker
Nick Parker

Reputation: 1388

SQLCipher provides a convenience function called sqlcipher_export that will allow you to encrypt a plain text database. An example is below, however you can find out more information within the documentation available here.

$ ./sqlcipher plaintext.db 
sqlite> ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'testkey'; 
sqlite> SELECT sqlcipher_export('encrypted'); 
sqlite> DETACH DATABASE encrypted; 

Upvotes: 1

Related Questions