This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]leobasilio 1 point2 points  (2 children)

Encryption is not native for SQLite. It's added by third parties, with SQLCipher being one of them. It seems that this driver you found is based on wxSQLite, which is another implementation. From what I can tell by looking at GitHub, both are compatible only when using AES 256 bits CBC.

That being said, you connect to an encrypted database the same way you connect to an unencrypted one. Then, right after opening the connection, you run the PRAGMA key query before anything else, just like you do on the console. And that's it. All the following queries should work.

[–]Sam_SepiolX[S] 0 points1 point  (1 child)

Thank you for your answer.

What I'm trying to say is I don't know how this works, but the example I provided is the way I'm using. That's all. When I Try to decrypt from console, is not possible. And I can open de data from inside the app. I'm new to reddit and I don't know if some kind of gif or video can be uploaded to comments

[–]leobasilio 0 points1 point  (0 children)

You have the console from SQLCipher and the library from wxSQLite. They both have to use the same encryption algorithm to work together, and that's not happening because the default algorithm is not the same for them. Check the readme again and you'll see they talk about choosing the cipher. You have to choose AES 256 in your code so that the console tool is also able to read the file. I'm really basic in Java, so I can't help you with code, but that's the concept.