Kunzisoft / KeePassDX

Lightweight vault and password manager for Android, KeePassDX allows editing encrypted data in a single file in KeePass format and fill in the forms in a secure way.
https://www.keepassdx.com/
GNU General Public License v3.0
4.55k stars 269 forks source link

Database is 0 Byte if Yubikey save is canceled #1680

Closed J-Jamet closed 3 months ago

J-Jamet commented 10 months ago

Describe the bug

When we save a database with a Yubikey, if the recognition fails, the database is deleted.

KeePass Database

KeePassDX:

Additional context Key Driver 0.1.4

J-Jamet commented 4 months ago

The best solution is to save the database with an empty challenge response key, as the write workflow is already running. I've added a toast warning indicating that the action is performed with an empty key.

J-Jamet commented 4 months ago

I've just found a much better way of solving the problem. There was an issue with the outputstream of the save method. It first tested in a temporary file, but opening the outputstream caused a 0byte, so I made a lambda to invoke the outpustream only when no exception was thrown.