Getting "unimplemented" when trying to encrypt by including CBL project in Xcode workspace?

21 views
Skip to first unread message

Brendan Duddridge

unread,
Aug 9, 2016, 5:52:47 PM8/9/16
to Couchbase Mobile
Hi Jens,

I'm trying to debug an encryption problem that you probably have seen me talking about in the Github issues.

I want to be able to run Couchbase Lite from source embedded within my Xcode 7 workspace. So I dragged the Couchbase Lite project file into my workspace and setup embedding of the CouchbaseLite.framework and the CouchbaseLiteListener.framework. I know there's two CouchbaseLite.framework Products, and I've chosen the one that was in the Debug-sqlcipher folder. So I'm pretty sure I'm using the correct version of the framework. Plus when I look inside my built app, I do see the file size of the one I'm using is the same as the file size of the one built from the CBLMac+SQLCipher target.

But when I try to read an encrypted database or encrypt a database, I'm getting an "unimplemented" error.

It's returning NO on this line in CBL_SQLiteStorage:

BOOL hasRealEncryption = sqlite3_compileoption_used("SQLITE_HAS_CODEC") != 0;


I assumed that the CouchbaseLite project would take care of having all of the build settings setup correctly for SQLCipher. And that is in fact the case if I archive the framework from the CouchbaseLite Xcode project. But it just doesn't see it with my embedded version.


I put -DSQLITE_HAS_CODEC in my own "Other C Flags" build setting in my target and that didn't make a difference. 


Have you tried using the CouchbaseLite project from another workspace?


Thanks,


Brendan

Brendan Duddridge

unread,
Aug 9, 2016, 5:59:13 PM8/9/16
to Couchbase Mobile
Specifically the error message is:

Error Domain=CBLHTTP Code=501 "unimplemented" UserInfo={NSLocalizedFailureReason=unimplemented, NSLocalizedDescription=unimplemented}

Brendan Duddridge

unread,
Aug 9, 2016, 6:04:29 PM8/9/16
to Couchbase Mobile
Oh, and one more message:

WARNING: CBL_SQLiteStorage: encryption not available (app not built with SQLCipher) {at -[CBL_SQLiteStorage decryptWithKey:error:]:248}



It's just obviously not able to find the right framework, but I have no idea why right now.


On Tuesday, August 9, 2016 at 3:52:47 PM UTC-6, Brendan Duddridge wrote:

Brendan Duddridge

unread,
Aug 9, 2016, 6:27:21 PM8/9/16
to Couchbase Mobile
By the way, the purpose of me trying to run CouchbaseLite from source this way is so I can see what temporary path it's using when it encrypts the database. I'm trying to see if the WAL file is being encrypted along with the .sqlite3 database file.

If it is, then it could be the copy process isn't copying the .wal file to the original document's path, thus corrupting the database.

Thanks

Brendan


On Tuesday, August 9, 2016 at 3:52:47 PM UTC-6, Brendan Duddridge wrote:

Brendan Duddridge

unread,
Aug 10, 2016, 4:01:40 AM8/10/16
to Couchbase Mobile
I discovered that if you just have a development build of the frameworks you can put breakpoints into the source which created the development builds. So that was new to me. I guess I had not tried that before.

So I don't need to run with the source project embedded within my workspace.

Jens Alfke

unread,
Aug 10, 2016, 1:09:33 PM8/10/16
to mobile-c...@googlegroups.com

On Aug 10, 2016, at 1:01 AM, Brendan Duddridge <bren...@gmail.com> wrote:

I discovered that if you just have a development build of the frameworks you can put breakpoints into the source which created the development builds. So that was new to me. I guess I had not tried that before.

Right, the debug info in the binary contains the paths of the source files it was compiled from, so if you have the files at the same paths, Xcode will be able to match them to the binary and set breakpoints.

It definitely sounds like CBL wasn’t being linked with SQLCipher, but I’m glad we don’t have to debug that now :)

—Jens
Reply all
Reply to author
Forward
0 new messages