ANN: Experimental database encryption feature (iOS)

204 views
Skip to first unread message

Jens Alfke

unread,
Aug 7, 2014, 7:03:48 PM8/7/14
to mobile-c...@googlegroups.com
I've just checked in support for local database encryption. It will appear in a future release of Couchbase Lite, for all supported platforms, but right now it's on a branch and for iOS/Mac-only. (And, of course, experimental.)

As I've said before, this isn't for everyone. In general, the default filesystem encryption on iOS is good enough. But some apps have to guarantee full security even if the user hasn't set a passphrase, and are willing to put up with the annoyance of prompting the user for a passcode on every launch. (Also, this would be useful on Mac OS, since it would protect the database against even other apps on the computer. In this environment it's safe to store the key in the Keychain.)

Features:
  • Uses AES-256 encryption algorithm. (No one says "military-grade" anymore, but this is basically the go-to algorithm for highly secure but fast encryption. It's approved by the US Government for Top-Secret data, and used by Apple for iOS file encryption and Mac FileVault.)
  • Protects the entire database file (using SQLCipher, a widely used fork of SQLite), and attachments.
  • Should be only a few percent slower than normal.
  • You can provide the key as either a passphrase, or a raw 256-bit AES key.

I've written a wiki page that explains how to build and use it. You absolutely should not put this into a shipping app yet, but we'd greatly appreciate it if people tried it out and reported any issues.

—Jens

Kevin Rejko

unread,
Sep 3, 2014, 5:36:17 PM9/3/14
to mobile-c...@googlegroups.com

This is great! Do you know if there is a timeline for when this is shipping ready? We would really like to use Couchbase Mobile for an app we are working on but encryption is a must. 

I tried downloading and running this branch but I have run into a problem where the "__Assert"'s can't be found for any of the specified architectures. Have you run into this issue before?

Ragu Vijaykumar

unread,
Sep 4, 2014, 3:15:15 PM9/4/14
to mobile-c...@googlegroups.com
This is excellent for us developing healthcare applications. Would you know how one might be able to link this with touchID?

Jens Alfke

unread,
Sep 4, 2014, 4:31:50 PM9/4/14
to mobile-c...@googlegroups.com

On Sep 4, 2014, at 12:15 PM, Ragu Vijaykumar <ra...@scrxpt.com> wrote:

This is excellent for us developing healthcare applications. Would you know how one might be able to link this with touchID?

In iOS 8 I believe you can store Keychain items that require a TouchID scan to unlock. So you'd just need to store the database's AES key in such a Keychain item. (I've tried and failed to store symmetric keys in the Keychain as such, so I suggest base64-encoding it and just storing it as a regular password item.)

—Jens

David Quon

unread,
Sep 5, 2014, 4:03:34 PM9/5/14
to mobile-c...@googlegroups.com
This would also be helpful for us in the education industry where sensitive school data is located on the devices.  Keep up the good work Jens!

CouchbaseLover

unread,
Sep 6, 2014, 1:06:31 PM9/6/14
to mobile-c...@googlegroups.com
This is great! Keep it up Jens :)

dyowee

unread,
Sep 6, 2014, 6:38:10 PM9/6/14
to mobile-c...@googlegroups.com
Wow. CBL just keeps getting better. :) Hope all these features will be in the Windows version. :)
Reply all
Reply to author
Forward
0 new messages