Encrypte existing db

Hi, is it possible to encrypt an existing regular sqlite database file? I am using V 3.4.1

Thanks

@phunction

You can use the sqlcipher_export() convenience function to encrypt an already existing plain text sqlite database. Specifically, you’ll want to have a look at “Example 1: Encrypt a Plaintext Database” from that link.

Thanks, is there an example that shows how to do this through .net, I normally use SqliteConnection and SqliteCommand. I believe I can just pass SELECT sqlcipher_export(‘encrypted’); through SqliteCommand however I am not sure how to implement the ATTACH part?

Nevermind, I figured it out.

@phunction

Glad to hear you were able to get it to work.