Narigo/keepass-diff

BlockModeError

hubitor opened this issue ยท 12 comments

When I run:

$ keepass-diff pwds1.kdbx pwds2.kdbx --passwords

I'm getting following error:

thread 'main' panicked at 'Error opening database A: DatabaseIntegrity { e: Crypto { e: BlockMode { e: BlockModeError } } }', src/main.rs:151:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I can open both databases in KeePassXC without an issue.

Hi @hubitor,

can you try running it with the kdbx files switched?

keepass-diff pwds2.kdbx pwds1.kdbx --passwords

Does it still say Error opening database A or would it say Error opening database B? The error message sounds like it cannot open it at all, so I'd suspect it should still say Error opening database A to confirm that it has an issue opening any of these files.

Hi @Narigo,

can you try running it with the kdbx files switched?
keepass-diff pwds2.kdbx pwds1.kdbx --passwords
Does it still say Error opening database A or would it say Error opening database B?

Yes. It still says Error opening database A regardless the order.

Do you have trouble opening other .kdbx files as well? I'm trying to find out what's different with your files versus the files I've been testing with. You're not using file keys or things like that I suppose, only the two files with the same password for both then.

Is this maybe happening because of a very old or very new databases that may not be implemented in the underlying keepass-rs library (yet)?

Do you have trouble opening other .kdbx files as well?

Yes.

I'm trying to find out what's different with your files versus the files I've been testing with. You're not using file keys or things like that I suppose, only the two files with the same password for both then.

only the two files with the same password for both.

Is this maybe happening because of a very old or very new databases that may not be implemented in the underlying keepass-rs library (yet)?

Taken from KeePassXC:
Database format: KDBX 3.1

Could you maybe test the example files from the repository and see if it works?
Is it possible for you to create a reproducer file with just one, two entries that show this issue without sharing your real password databases?

Just tested with the example files:

$ keepass-diff Test1.kdbx Test2.kdbx --password-a Test1 --password-b Test2 --no-color                                                                                                                                                                                                                                              
thread 'main' panicked at 'Error opening database A: DatabaseIntegrity { e: InvalidKDBXIdentifier }', src/main.rs:151:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

and

$ keepass-diff test2.kdbx test.kdbx --passwords demopass --no-color --verbose                                                                                                                                                                                                                                                      
thread 'main' panicked at 'Error opening database A: DatabaseIntegrity { e: InvalidKDBXIdentifier }', src/main.rs:151:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The lowercase test.kdbx and test2.kdbx are the ones from the repository over here? They don't work as well? ๐Ÿค” That shouldn't be the case at all... let me check on the weekend whether there is something weird going on...

The lowercase test.kdbx and test2.kdbx are the ones from the repository over here?

Yes.

They don't work as well?

Yes.

That shouldn't be the case at all... let me check on the weekend whether there is something weird going on...

Ok. Thanks.

I tried reinstalling the package, but it didn't help. I'm seeing same errors on another system of mine.
BTW. I'm installing it via the AUR.

BTW. I'm installing it via the AUR.

Nice, it seems to even be maintained by someone ๐Ÿ˜…

So I've been checking their PKGBUILD file and it seems to correctly set the RUSTFLAGS before building, so I suppose that's not the problem we had with issue #24. I can't test the AUR version directly, so I've tried to mimick what they do (as far as I understand the PKGBUILD file). Since you've said KDBX version 3.1 and using the build from AUR, I ran this to build it:

RUSTFLAGS="-C target-cpu=native" cargo build --release --locked --all-features

...and then run it like this:

# target/release/keepass-diff --no-color --verbose --password-a Test1 --password-b Test2 test/issue-24-kdbx-3.1/Test1.kdbx test/issue-24-kdbx-3.1/Test2.kdbx
~ Group 'Root'
~   Entry 'Test1'
-     Field 'Password' = 'Test1'
+     Field 'Password' = 'Test2'
-     Field 'Title' = 'Test1'
+     Field 'Title' = 'Test2'
-     Field 'UserName' = 'Test1'
+     Field 'UserName' = 'Test2'

It's pretty slow to run with my Docker setup, but it doesn't show the issue you've mentioned.

I see you have a different error later when testing the Test1.kdbx and Test2.kdbx files, which worked for me. I see the same error message from the initial message though when I assumed the wrong passwords:

# target/release/keepass-diff --passwords demopass test/issue-24-kdbx-3.1/Test1.kdbx test/issue-24-kdbx-3.1/Test2.kdbx 
thread 'main' panicked at 'Error opening database A: DatabaseIntegrity { e: Crypto { e: BlockMode { e: BlockModeError } } }', src/main.rs:151:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm pretty much lost what else I can do to debug this then... ๐Ÿ™

OK. Thanks nevertheless. I will try to upgrade my database files. Maybe it'll help.

If you can't open the files in this repository (test/issue-24-kdbx-3.1/Test1.kdbx and test/issue-24-kdbx-3.1/Test2.kdbx) with the passwords Test1 and Test2 respectively, I don't think changing something on your database files will help.

If you have/use Docker or podman on your machine, maybe you could try to run it through that, either like me, using a bash inside a rust:latest image and build / run it in there or like it was suggested in pull request #38 recently

I'm going to close this now as there is no real reproducer for me currently. I assume it may be some kind of environment issue that we cannot debug easily.

@hubitor if you find a way how I can test and see this issue, please let me know and reopen this. If you could get it to run, I wouldn't mind getting a heads up as well ๐Ÿ™‚ Thanks for your report!