SQLCipher interroperability: Error: file is encrypted or is not a database

230 views
Skip to first unread message

SyF

unread,
May 13, 2013, 10:24:25 AM5/13/13
to sqlc...@googlegroups.com
Dears,

I started to use SQL Cipher community version as an encryption solution for my sqlite3 database a while ago. It worked perfectly until I tryed to open my encrypted database from an other environment.

I did some basic tests this way:
PRAGMA key = 'passphrase';
Create table test_table(field1 int(11) not null default '0');
insert into test_table(field1) values(1);
insert into test_table(field1) values(2);
insert into test_table(field1) values(3);
select * from test_table;

While I have no probleme to open a database in its creation environment, I cannot manage to open it from an other platform.

Here is some information about each environment
  • Platform 1:
Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
sqlite3 --version => 3.7.2
openssl version => OpenSSL 0.9.7a Feb 19 2003
gcc --version => gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
  • Platform 2:
CentOS release 6.4 (Final)
sqlite3 --version => 3.7.14.1 2012-10-04 19:37:12 091570e46d04e84b67228e0bdbcd6e1fb60c6bdb
openssl version => OpenSSL 1.0.0-fips 29 Mar 2010
gcc --version => gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)

Unfortunatelly, I havn't found any reliable information on the web so far...

Thanks in advance, any help is appreciated!

Stephen Lombardo

unread,
May 14, 2013, 8:47:12 AM5/14/13
to sqlc...@googlegroups.com
Hello Julien,

You mentioned that you've been using SQLCipher for a while. Do you recall what version of SQLCipher you are using on the first machine? It's possible that your databases on Platform 1 were created usingSQLCipher 1.1.x, while your new platform 2 is using the newer SQLCipher 2. By default version 1 and 2 have slightly different and incompatible database formats, with the latter adding a MAC.

You can check if this is the case by calling "PRAGMA cipher_use_hmac = OFF;" after opening the database on Platform 2, before any queries, but after specifying the key. This will make SQLCipher library to open a 1.1.x database with HMAC disabled, allowing interoperability with the version on Platform 1.

Please let us know if that works for you. If so, we could provide some information on how to convert to the newer version permanently, since it has some substantial improvements. Thanks!

Cheers,
Stephen



--
 
---
You received this message because you are subscribed to the Google Groups "SQLCipher Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlcipher+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages