PhilippC / keepass2android

Password manager app for Android
https://play.google.com/store/apps/details?id=keepass2android.keepass2android
GNU General Public License v3.0
4.81k stars 389 forks source link

The input is not a valid Base-64 string as it contains... #2065

Open ChrisB85 opened 2 years ago

ChrisB85 commented 2 years ago

Today I tried to open my DB file as usual, but I get error message: "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or illegal character among the padding characters." On two other KeePass clients (KeePassXC and Keeweb on Nextcloud) I can open that DB file normally. How can I find which entry causes that problem? How to resolve it?

Here's debug log

jmevel commented 1 year ago

Hi, same issue happened to me today both with KeePass and KeePass2Android. However KeePassXC was still able to open my database.

Try changing your database's master password using KeePassXC and save the changes. You should then be able to open it again with KeePass2Android 😉

Flova commented 1 year ago

I have the same issue and will give your fix a try!

Flova commented 1 year ago

Resetting the master password to the same password fixed the issue.

PhilippC commented 1 year ago

do you have "password only" or are you using a key file? can anybody create a sample database with this behavior?

Flova commented 1 year ago

I only have a password. But I did not observe the issue since I changed the master password once.

oxivanisher commented 1 year ago

I just ran into the exact same issue, but since I found this before doing anything, I made a copy of the "not working" database. I obviously will not send you my database, but I can try stuff. At the first glance, I can not see a reason for this issue.

Almamu commented 1 year ago

+1 on this. Seems to be a common issue with how KeeWeb handles the database file. All my other apps (KeePassXC and KeeWeb can open and edit the database), but Keepass2Android shows this error message.

A good way of creating a repro is to create a database, add some records and then open it with KeeWeb, add a user, save it and try to use it in Keepass2Android. I might be able to provide a repro in a couple of hours once I'm in front of a computer

jakezatecky commented 11 months ago

@Almamu You might be on to something. I encountered the error after juggling between KeeWeb and KeePassXC while evaluating the latter. Prior to that, I had been using KeeWeb with Keepass2Android with no issue.

The suggestion on changing the password did solve the issue.

jmevel commented 11 months ago

@Almamu You might be on to something. I encountered the error after juggling between KeeWeb and KeePassXC while evaluating the latter. Prior to that, I had been using KeeWeb with Keepass2Android with no issue.

The suggestion on changing the password did solve the issue.

Definitely not related to KeeWeb. I had the issue without ever using KeeWeb...

PhilippC commented 11 months ago

again: if there is a way to reproduce this using KeeWeb or any other tool, please let me know or share a demo database with this behavior.

jmevel commented 11 months ago

again: if there is a way to reproduce this using KeeWeb or any other tool, please let me know or share a demo database with this behavior.

I actually regularly commit my KeePass database to a private git repository so I have commits both right before (when this issue occurs on both KeePass2Android and KeePass) and right after (after resetting the master password to the same as the old one using KeePassXC).

I guess I could delete all entries from my database and empty the recycle bin. Could you confirm that the database would be completely empty and that no data would be kept in history? Otherwise is there another way to completely wipe all data?

But even if I do that, I still can't change my master password before sharing my database otherwise the issue on KeePass2Android would be gone so you wouldn't be able to check exactly what was the issue...

Could we please continue this conversation privately? You can contact me by LinkedIn

Thanks

iestynapmwg commented 11 months ago

This is now at least the third time this bug has caused problems for me. I had entered a new database entry on my laptop, and tried to read it later using keepass2android, but it wasn't there. I used the synchronise database option (not sure that's what it's called as i can no longer see it), but got the error message in a toast message. I tried re-opening the database, but kept getting the error (again, in a toast message, so no way to capture it).

I finally tried to clear all storage and start over, but on opening the database i run into the same problem. The app prompts me for the password, i enter it, and then the error appears in an actual pop up window i can read (as opposed to the transient toast messages that are truncated anyway). It's telling me i'm entering non-base 64 characters or an illegal character in "the input". I'm guessing that "input" is the password i just entered on my phone's keyboard. The same password that was working just fine 2 days ago. And is still working on both programs i use to access my database on my laptop (KeeWeb and KeePassXC).

Now i'm completely locked out of my database on my phone. Any suggestions on how to get access again? Anyone have a preferred app that doesn't throw these error messages and choke every few months?

scoronado12 commented 9 months ago

It's rare for me to save passwords with KeepWeb, but I use it a lot to access passwords alongside KeePassXC. I had just come across this issue by adding in a new entry and was able to resolve by also resetting the password

oscarcp commented 8 months ago

Just run into this issue myself. I was trying to open a database from Nextcloud (DB+Key) and it doens't let me, but it lets me do it if I have a local copy of the DB on the phone.

Update: Scratch that. I have two DBs on Nextcloud, one opens without issue, the other one turns out my local copy is old, so at some point Keeweb did something that made it impossible to open in Keepass2Android.

Update2: I opened the failing DB in KeepassXC and got welcomed by a "Key format too old and incompatible, please generate a new one". Did that and now I can open the DB from K2A (resetting the master password did not work for me)

Xen4n commented 6 months ago

I also catch this error. I use KeeWeb + KeePassDX.

Fix: Change key generation algorithm from Argon2d (10 cycles, 64mib, 4 parallelism) to AES and back to Argon2d (3 cycles, 16mib, 4 parallelism).

PhoneixS commented 6 months ago

Testing42.zip

That file contains a cleared database with the problem. The password is Testing42. By the way, changing the master password doesn't solve the problem for me.

I hope it's useful and that doesn't contain any real key ;D

PhilippC commented 6 months ago

@PhoneixS thanks for sharing! I cannot open this file with KeePass2 on Windows (same error which you see in the app). So I did some Google search on this regarding KeePass2 and found this message which indicates that this is a KeeWeb bug:

https://sourceforge.net/p/keepass/discussion/329221/thread/fc9b406781/?page=1#16a5

Do you agree?

PhoneixS commented 6 months ago

Yes, I agree.

The fix of KeeWeb is scheduled for 1.19, and it is still moving forward at https://github.com/keeweb/keeweb/pull/2168.

In the meantime, is it possible to make keepass2android more tolerable to this specific corruption of the file?