1

I have dumped a sqlite3 database into a .sql file. Afterwards I have import the files like this:

cat databasedump.sql | sqlcipher encrypted_database

Then I've opened the encrypted database and set the key with:

pragma key="12345"

then I close the database and reopen it, it's still not encrypted.

How can I load the dump in the database and encrypt it?

2 Answers 2

1
$ sqlcipher plaintext.db
sqlite> ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'my password';
sqlite> SELECT sqlcipher_export('encrypted');
sqlite> DETACH DATABASE encrypted;
Sign up to request clarification or add additional context in comments.

1 Comment

This works, but how can I decrypt the database? Normally its pragma key='my password'; but it's not decrypted afterwards I just get the following message: Error: file is encrypted or is not a database. I see only the similiar way back.. so attaching new databas.. decrypting.. selecting.. detaching.. etc. Is there a way to decrypt it and load it directly in ram?
1
$ ./sqlcipher encrypted.db
sqlite> PRAGMA key = 'my password';
sqlite> ATTACH DATABASE 'plaintext.db' AS plaintext KEY '';  -- empty key will disable encryption`
sqlite> SELECT sqlcipher_export('plaintext');
sqlite> DETACH DATABASE plaintext;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.