Hi,
I enabled encryption through cocoapods installation:
pod 'couchbase-lite-ios', '~> 1.3.1' pod 'couchbase-lite-ios/SQLCipher', '1.3.1'
Database encryption is successful, while i’m getting these errors when decrypting the database:
DB Error: 26 "file is encrypted or is not a database"
WARNING: CBL_SQLiteStorage: database is unreadable (err 26) {at -[CBL_SQLiteStorage decryptWithKey:error:]:284}
Error code: 401
Error message: unauthorized
Here’s the complete Database log:
18:11:29.720| Database: Created CBLManager[0x6080002ef280 /Users/.../data/Containers/Data/Application/.../Library/Application Support/CouchbaseLite]
18:11:35.393| Database: Opening CBLDatabase[<0x600000338880>katsynctest2]
18:11:35.393| Database: Using CBL_SQLiteStorage for db at /Users/…/data/Containers/Data/Application/…/Library/Application Support/CouchbaseLite/katsynctest2.cblite2; upgrade=0
18:11:35.457| Couchbase Lite using SQLite version 3.8.10.2 (2015-05-20 18:17:19 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4)
18:11:35.458| Database: Opening <CBL_SQLiteStorage: 0x60000046e380>
18:11:35.458| Database: Open /Users/.../data/Containers/Data/Application/.../Library/Application Support/CouchbaseLite/katsynctest2.cblite2/db.sqlite3 with SQLite (flags=6, encryption key given)
2017-02-05 18:11:35.502 Suites[15160:248939] DB Error: 26 "file is encrypted or is not a database"
2017-02-05 18:11:35.503 Suites[15160:248939] DB Query: SELECT count(*) FROM sqlite_master
18:11:35.503| WARNING: CBL_SQLiteStorage: database is unreadable (err 26) {at -[CBL_SQLiteStorage decryptWithKey:error:]:284}
2017-02-05 18:11:35.503 Suites[15160:248939] Cannot open database. Error message: unauthorized
Here is how I create the CBL Manager with CBLManagerOptions hoping to fix the current error:
NSError *error; CBLManagerOptions options = {NO, NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication};
self.manager = [[CBLManager alloc] initWithDirectory: [CBLManager defaultDirectory] options: &options error: &error];