Crash instantiating encrypted Couchbase Lite database

Rolling out a release of our Android app with a Couchbase Lite encrypted database, SDK v2.8.5, we’ve had 2 users crash with this exception:

Fatal Exception: java.lang.UnsatisfiedLinkError: No implementation found for byte[] com.couchbase.lite.internal.core.C4Key.pbkdf2(java.lang.String, byte[], int, int) (tried Java_com_couchbase_lite_internal_core_C4Key_pbkdf2 and Java_com_couchbase_lite_internal_core_C4Key_pbkdf2__Ljava_lang_String_2_3BII)
       at com.couchbase.lite.internal.core.C4Key.pbkdf2(
       at com.couchbase.lite.internal.core.C4Key.getPbkdf2Key(
       at com.couchbase.lite.EncryptionKey.<init>(

Both users are on Android 11 either Samsung Galaxy S20 5G or Google Pixel 4 devices, although it’s a small sample size at this point. I haven’t seen this crash on my own Android 11 Google Pixel 5 device.

The documented way to access PBKDF2 on Android is through the SecretKeyFactory.

SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt, rounds, keysize);
SecretKey secretKey = secretKeyFactory.generateSecret(keySpec);
byte[] key = secretKey.getEncoded();

Is the call to static native byte[] pbkdf2(String password, byte[] salt, int rounds, int keysize); expecting a native implementation embedded in the Couchbase Lite C library?

Just had a third user running Android 10 on a Samsung Galaxy S20 FE 5G experience the crash.

As this is regarding an enterprise feature I suggest you reach to you support contact.

1 Like

@jeff.lockhart : yeah, please get a ticket open for this.

That is, as you can probably see, a native function implemented in JNI code. The function exists and is implemented in a file that contains several other functions that would have been called well before that one: It isn’t as simple as simply missing the definition.

The first thing I’m going to want is the exact binary you are using. Did you pull the zip file or get it from Maven?

@blake.meike we get the dependency from the Maven artifact in Gradle. I’ll open a support ticket.