I want to encrypt an database using sqlcipher.
I have done with the integration os openssl and sqlcipher integration and the build works perfect.
But my issue is
With SQLCipher make sure you have a brand new SQLite database. Trying to pragma the database with a key while it already has data for some reason just tries to decrypt it.
Here is some additional information on working with an existing SQLite database or here. In this example encrypted.db is that brand new database you create and pragma.
ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'secret'; -- create a new encrypted database
CREATE TABLE encrypted.t1(a,b); -- recreate the schema in the new database (you can inspect all objects using SELECT * FROM sqlite_master)
INSERT INTO encrypted.t1 SELECT * FROM t1; -- copy data from the existing tables to the new tables in the encrypted database
DETACH DATABASE encrypted;