Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Security Level: Public
-
None
Description
Library Version
2.5.x and onwards
Operating System / Device Details
Android
Expected behavior
copy method should copy encrypted db with proper db config
Actual behavior
copy method is not copying encrypted db with proper db config
E/CouchbaseLite/DATABASE: SQLite error (code 26): file is not a database in "SELECT count(*) FROM sqlite_master" |
{DB#25} Could not decrypt database with no encryption |
W/SERVER: Request failed
|
java.lang.reflect.InvocationTargetException
|
at java.lang.reflect.Method.invoke(Native Method)
|
at com.couchbase.CouchbaseLiteServ.server.Server.handle(Server.java:209) |
at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:418) |
at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75) |
at java.lang.Thread.run(Thread.java:761) |
Caused by: CouchbaseLiteException{CouchbaseLite,20,'file is not a database (or encryption key is invalid/missing)'} |
at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:81) |
at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:32) |
at com.couchbase.lite.AbstractDatabase.copy(AbstractDatabase.java:180) |
at com.couchbase.CouchbaseLiteServ.server.RequestHandler.DatabaseRequestHandler.copy(DatabaseRequestHandler.java:340) |
at java.lang.reflect.Method.invoke(Native Method)
|
at com.couchbase.CouchbaseLiteServ.server.Server.handle(Server.java:209) |
at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:418) |
at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75) |
at java.lang.Thread.run(Thread.java:761) |
Caused by: LiteCoreException{domain=1, code=20, msg=file is not a database (or encryption key is invalid/missing)} |
at com.couchbase.lite.internal.core.C4Database.copy(Native Method)
|
at com.couchbase.lite.AbstractDatabase.copy(AbstractDatabase.java:169) |
at com.couchbase.CouchbaseLiteServ.server.RequestHandler.DatabaseRequestHandler.copy(DatabaseRequestHandler.java:340) |
at java.lang.reflect.Method.invoke(Native Method)
|
at com.couchbase.CouchbaseLiteServ.server.Server.handle(Server.java:209) |
at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:418) |
at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75) |
at java.lang.Thread.run(Thread.java:761) |
Steps To Reproduce
1. create a db with encryption (use config.setEncryptionKey(encryptionKey) setting password).
2. Add few docs to db, just to assert the db is functioning properly.
3. Copy this db to create a new db. (use Database.copy(path, name, config)) <-- Test is failing here
def test_db_copy_encrypted_db(params_from_base_suite_setup): |
base_url = params_from_base_suite_setup["base_url"] |
db = Database(base_url) |
db_config = db.configure(password="password") // |
cbl_db = db.create("PrebuiltDB-encrypted", config=db_config) |
db.create_bulk_docs(number=5, id_prefix="cbl", db=cbl_db) |
db.create_bulk_docs(number=5, id_prefix="cbl2", db=cbl_db) |
print db.getCount(cbl_db) |
path = db.getPath(cbl_db) |
db.copyDatabase(path, "new_copied_db", db_config) // <-- Test is failing here |