Skip to content

[Bug]: Cannot unlock kdbx (v4) with the key file only #306

@zhang-stephen

Description

@zhang-stephen

Overview

I create a keepass database (v4) on PC by KeepassXC, with key file only, no password, then it cannot be opened by this app on Android. The database could be unlocked by Keepass 2 itself.

The parameter for encrypting is shown in the screenshot:
Image

Keepass 2 could open it:
Image

The error is shown in the screenshot:
Image

The empty database and its key file are attached here for reproducing: Test.zip

The backtrace is attached here:

Wrong key used for decryption.
app.keemobile.kotpass.errors.CryptoError$InvalidKey: Wrong key used for decryption.
	at app.keemobile.kotpass.database.DecoderKt.decode(Decoder.kt:92)
	at app.keemobile.kotpass.database.DecoderKt.decode$default(Decoder.kt:27)
	at com.ivanovsky.passnotes.data.repository.keepass.kotpass.KotpassDatabase$Companion.open(KotpassDatabase.kt:553)
	at com.ivanovsky.passnotes.data.repository.keepass.KeepassDatabaseRepository.openDatabase(KeepassDatabaseRepository.kt:234)
	at com.ivanovsky.passnotes.data.repository.keepass.KeepassDatabaseRepository.open(KeepassDatabaseRepository.kt:63)
	at com.ivanovsky.passnotes.domain.interactor.unlock.UnlockInteractor$openDatabase$2.invokeSuspend(UnlockInteractor.kt:114)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

How to reproduce

  1. open the app
  2. add database from External Storage (System File Picker)
  3. add key file from External Storage (System File Picker)
  4. click the unlock button
  5. then the error shown in the screenshot would be reported

Version

1.14.0

Android Version

Android 15

Device Model

Xiaomi Redmi K80 Pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions