0

I'm trying to decrypt the SQLCipher database to look into it with the viewer app, buy when I use the command line tool to do as said in here:

>sqlcipher encrypted.db
sqlite> pragma key = 'key';
sqlite> ATTACH DATABASE 'plaintext.db' AS plaintext KEY '';
sqlite> SELECT sqlcipher_export('plaintext');

I get the error:

Error: no such collation sequence: COLLATION_NAME

And the plaintext.db only has one empty table.

Is there any other way to decrypt the database?

2 Answers 2

0

Well, SQLite has the handy backup capability outlined here: https://www.sqlite.org/backup.html

And you can use this in the command line tool with the .backup special command (see help here: https://www.sqlite.org/cli.html). Which does work in the sqlcipher command line tool and produces the unencrypted database as a result.

Here's how to decrypt the database:

>sqlcipher encrypted.db
sqlite> pragma key = 'key';
sqlite> .backup plaintext.db

Of course, you can also do it programmatically by loading the database and using the backup APIs found at the first link (scroll to "Example 2: Online Backup of a Running Database" section), but I didn't explore this option.

0

Was you database generated on the Android platform? If so, it may be using a collation sourced from ICU, which is linked into SQLCipher for Android. The basic build instructions for the SQLCipher command line tool do not include steps for including ICU. You may find it easier to perform a sqlcipher_export(…) on an Android device to take advantage of the presence of ICU.

1
  • It was generated on the Windows PC, but it's a good advice for the guys that did it on Android, thank you!
    – Gman
    Apr 17, 2015 at 15:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.