Unfortunately after spending a couple of days building SQLCipher in a 
billion different ways, I'm no further ahead than I was at the start.

So I have no idea how to properly integrate SQLCipher with Couchbase Lite 
such that I don't have to have my libsqlcipher.dylib in a fixed location on 
my drive. I've tried all the suggestions in the SOF post, but have yet to 
find a proper solution.

I did eventually get libsqlcipher to load from a relative location (I 
think), but then it doesn't actually work. That is, the call to set the 
encryption key on the database returns NO. So I'm still at a loss of how to 
proceed. At this point in time I'm thinking my only solution is to just 
stick with ForestDB which doesn't require SQLCipher for encryption.  My 
only concern with that is I don't have any proper database admin tools to 
use with a ForestDB database. Perhaps there's some that I'm not aware of 
other than CouchbaseLite Viewer. With SQLite I've been using SQLite Studio 
and SQLite Manager.

Mind you, I am using SQLCipher in my app outside of Couchbase Lite access 
too, so that adds one more level of complexity. The reason for this is I 
have a migration routine where I read my old SQLCipher encrypted database 
file via FMDB and then convert the data and store it in Couchbase Lite.

I got libsqlcipher.dylib to load by setting its "Dynamic Library Install 
Name" property to "@rpath/libsqlcipher.dylib" and the "Dynamic Library 
Install Name Base" to just @"rpath". So according to the log output, it is 
loading:

*dyld: loaded: 
/Users/brendan/Projects/xcode-build/Tap_Forms_Mac-gmfcnfvjlruxgkapuehplefkxifo/Build/Products/Debug/Tap
 
Forms.app/Contents/MacOS/../Frameworks/libsqlcipher.dylib*

I did tell my build to copy the libsqlcipher.dylib into my Frameworks 
directory just as a place to store it so it could find it. And I have my 
"Runpath search paths" set to find it there: @loader_path/../Frameworks and 
@executable_path/../Frameworks

If anyone has any further ideas of what I could try that would be greatly 
appreciated.

Or should I not bother with SQLCipher since I don't know when or if 
Couchbase will stop supporting SQLite and go with ForestDB support only.

Thanks,

Brendan

On Sunday, October 4, 2015 at 11:23:47 AM UTC-6, Brendan Duddridge wrote:
>
> I think this Stack Overflow post will help me figure it out:
>
>
> http://stackoverflow.com/questions/7562793/how-do-i-create-a-working-framework-with-dylib-files-in-xcode-4
>
>
> On Saturday, October 3, 2015 at 11:38:27 PM UTC-6, Brendan Duddridge wrote:
>>
>> Hi,
>>
>> So I've successfully managed to use SQLCipher from within Couchbase Lite 
>> for Mac and encrypt one of my databases. I compiled SQLCipher as a .dylib 
>> dynamic library and linked it in to CBL Mac in the Link Libraries and 
>> Frameworks area and added -DSQLITE_HAS_CODEC to Other C Flags.
>>
>> Now, this isn't necessarily directly a CBL issue, other than the fact 
>> that I can't compile it as a static library into CBL due to some symbol 
>> naming conflicts, so I have to use a dynamic library.
>>
>> How do I get the dynamic library linked into my application so that the 
>> library doesn't need to be installed at any specific location on a user's 
>> drive?
>>
>> It seems that the .dylib needs to be sitting in the location where it's 
>> first installed when built otherwise the application can't find it. It's 
>> not finding it from within the Xcode project itself.
>>
>> Maybe I'm going about it all wrong and it needs to be a framework instead 
>> of a single .dylib file?
>>
>> Thanks,
>>
>> Brendan
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/4a20b0bb-f88c-4a4b-a681-03c1bb1da5d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to