We are happy to announce the SQLCipher 3.0.0 beta release. Included with this release are the following:
With this release the default iteration count used for PBKDF2 is 64000, up from the previous default of 4000 - an increase of 16 times our previous cycle count. The intent of this change is to provide an increased level of security and protection from brute force attacks by extending the work factor needed to derive a database key.
The KDF default iteration change establishes a new standard database setting, and thus existing databases must be migrated to the new version. To ease the process, we've introduced a new PRAGMA that will aid in the conversion process from an old SQLCipher database, given that default configurations were previously used during creation.
Below shows an example of migrating a 2x SQLCipher database to the new 3.0.0 format. SQLCipher will upgrade the database in place:
> ./sqlcipher 2xdatabase.db > PRAGMA key = 'YourKeyGoesHere'; > PRAGMA cipher_migrate;
cipher_migrate PRAGMA can migrate both standard SQLCipher 1.x and 2.x databases. Note that if non-default settings, such as a different cipher or kdf_iter were used in the original database, a manual migration would be required with the use of
In SQLite 3.8.0
sqlite3_rekey_v2 were added; specifically they introduce the alias name of the database during key and rekey operations. This further becomes available when accessing key and rekey commands via PRAGMA. To show an example scenario we will explicitly key the attached database using a separate PRAGMA command:
> ./sqlcipher database.db > ATTACH DATABASE ‘new.db’ as new; > PRAGMA new.key = ‘foobar’;
This release also changes the behavior of the ATTACH command. In previous versions, you could attach a database using same password as the main database by leaving the optional KEY parameter off of the ATTACH statement. For instance, the following statement would attach a database using the same password as the main database, but derived using the attached databases salt.
ATTACH ‘new.db’ AS new;
In the new version, ATTACH will not re-derive a key unless it is explicitly provided via the KEY parameter, like so:
ATTACH ‘new.db’ AS new KEY ‘password’;
In practice, this means that calling applications will need to provide the key on the ATTACH parameter, via
sqlite3_key_v2, or PRAGMA <db>.key, in order to set passphrase, or the salt and derived encryption key from the main database will be used instead.
The change to ATTACH is supported by a new feature for providing raw key material. In the new version, it is now possible to provide both a raw encryption key and a raw salt header value in the key using BLOB notation:
If the raw key data is formatted as x'hex' and there are exactly enough hex chars to fill the key (i.e., 64 hex chars for a 256 bit key) then the key data will be used directly. If the raw key data is formatted as x'hex' and there are exactly enough hex chars to fill the key and the salt (i.e 92 hex chars for a 256 bit key and 16 byte salt) then it will be unpacked as the key followed by the salt.
This allows a caller to specify a matching raw key and salt combination that can later be derived from a passphrase.
Together, these change allows SQLCipher to securely wipe the source passphrase from memory after key derivation.
Along with all the changes to SQLCipher, the source is now based off the latest SQLite 188.8.131.52 source. This release includes support for the new next generation query planner, partial indexes as well as an addition of the notindexed option within FTS4.blog comments powered by Disqus