Hi,
The problem i experience is quite easy to reproduce.
1) Have a KeePass 1 database (kdb). This is the database i created and used it with KeePassX 0.4 series.
2) In order to use KeePassX 2, import the database. Save the database.
3) The new kdbx database works fine in KeePassX 2.
4) However, this kdbx doesn't work with kpcli. It opens fine, i can browse it fine, but all passwords are garbled. I see nonsense unicode symbols and question marks (and the copied password doesn't work).
I can see the same problem with KeePass2. This happens even with kdbx files created from scratch. Basically, kdbx files are not usable for me at all.
Did i do something wrong, because i read that people used kdbx files with kpcli?
This problem is either with your environment or with the perl module File::KeePass, not with kpcli itself.
I have this problem as well. It is not present when using a V1 .kdb file (ie v1 files work OK). On Arch Linux using UTF-8.
Please include the output of kpcli's vers and stats commands.
*With a kdbx file:
Please provide the master password: *******
KeePass CLI (kpcli) v3.0 is ready for operation. ' for details on individual commands.
Type 'help' for a description of available commands.
Type 'help
kpcli:/> vers
VERSIONS
ReadLine being used: Term::ReadLine::Gnu
Operating system: linux
kpcli:/> stats
File: ***.kdbx
Key file: N/A
Name: Home2
Description:
|
KeePass file version: 2
Encryption type: rijndael
Encryption rounds: 6000
Cipher:
Compression:
Number of groups: 3
Number of entries: 179
Entries with passwords of length:
*With a kdb file:
Please provide the master password: *******
KeePass CLI (kpcli) v3.0 is ready for operation. ' for details on individual commands.
Type 'help' for a description of available commands.
Type 'help
kpcli:/> vers
VERSIONS
ReadLine being used: Term::ReadLine::Gnu
Operating system: linux
kpcli:/> stats
File: ***.kdb
Key file: N/A
KeePass file version: 1
Encryption type: rijndael
Encryption rounds: 150000
Number of groups: 3
Number of entries: 179
Entries with passwords of length:
Thanks. If you open the kdb in kpcli and saveas foo.kdbx, does that kdbx then work fine? If so, does it also work fine in KeePassX2, etc? In other words, does the original creator of the kdbx file matter to the appearance of this problem?
If I save as .kdbx, that then works fine in kpcli. If I open that new kdbx in keepassx2, it's garbled again...
I took some time and ran this experiment myself:
1) Used KeePassX-2.0.2 to import my large kdb file and saved it as a kdbx.
2) Opened it using the latest KeePass2 and verified that it works just fine.
3) Opened it with kpcli and verified that it works just fine (passwords are correct).
4) Saved the file in kpcli.
5) Opened the file in the latest Keepass2 and verified that it works just fine.
6) Opened the file in KeePassX-2.0.2 and verified that it works just fine.
...and so, I cannot replicate your problem.
Here is my environment:
I tested it with kpcli-3.0, also, even though what I copy/pasted above was DEVELOPMENT.
If it is just the password field that you guys are having trouble with, note that File::KeePass does encrypt just that one field while it is held in RAM and kpcli has to "unlock" the data held in RAM in order to display the password field. Perhaps there is a problem with Crypt::Rijndael on Arch Linux, as that is what is used by File::KeePass to encrypt/decrypt the passwords in RAM. You can see the lock and unlock functions in the File::KeePass sourcecode. To test my theory, you could comment out all of the contents of those two functions (have them do nothing other than "return 1;") and see if your problem goes away.
In trying to export my kdbx file to kdb using kpcli (so that I can just use the old version files which work fine), I got this error - maybe it helps? I realise that if the passwords couldn't be decrypted then the export would have been useless anyway ;)
Wide character in subroutine entry at /usr/share/perl5/vendor_perl/File/KeePass.pm line 747
Would it be possible for you to attach a sample file that exhibits this problem with some instructions on how to reproduce it?
BTW, I suspect that you have one or more passwords that hold one or more characters that cannot be represented by an 8-bit character encoding. I do not believe that is supported by File::KeePass.