0

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

Anthony Horne
  • 2,522
  • 2
  • 29
  • 51
Safari
  • 11,437
  • 24
  • 91
  • 191

1 Answers1

1

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; 
Nick Parker
  • 1,378
  • 1
  • 7
  • 10