Opening DB on different computers


I’m using sqlcipher for a project and when I copied the database onto another computer I was unable to access it even with the PRAGMA key. I keep getting the “file is encrypted or is not a database” error. The original computer was a Mac running OS 10.12.5 and the other computer is running Mint. The Mac had sqlcipher installed using homebrew and the Mint computer installed it using apt-get.


Hello @fedorareis

I have a few follow up questions to help understand the situation at bit better:

  • What version of SQLCipher was used to create the database?
  • What version of SQLCipher are you using to access the database now?
  • You can determine this by executing the SQL command PRAGMA cipher_version;
  • Were there any adjustments to the runtime configuration of SQLCipher when the database was created (i.e., custom KDF iteration length, alternative cipher, different cipher page size, etc)?


It appears that apt-get provides a different version than homebrew does. There were no adjustments.

Homebrew on Mac:
SQLCipher --version = 3.15.2 2016-11-28
PRAGMA cipher_version = 3.4.1

Apt-Get on Mint:
SQLCipher --version = 2.2.1 2013-05-20
PRAGMA cipher_version = 2.2.1


Hello @fedorareis

Currently, the latest release of SQLCipher is 3.4.1. There are a couple options moving forward since it appears the database was created on the macOS side, correct? You might consider following the steps to build SQLCipher from source on your Mint machine. Another option is to adjust the key derivation length from the default in the 2.x database format of 4,000 to the default used in the 3.x format to 64,000 on your Mint machine while still using the 2.x binary. You can do this with the PRAGMA kdf_iter command.


I ended up building from source on the Mint machine. But it is nice to know about the kdf_iter difference in case I run into this on a different machine in the future.