Bug 481645 - XML-Storage plugin unable to decrypt from a security key (probably should use "pinentry-qt" for decryption)
Summary: XML-Storage plugin unable to decrypt from a security key (probably should use...
Status: REPORTED
Alias: None
Product: kmymoney
Classification: Applications
Component: database (show other bugs)
Version: 5.1.3
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-22 01:07 UTC by ex9qee8u
Modified: 2024-02-22 01:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
here you see "explorer... .jpg" from KMyMoney's XML-Storage plugin. Other two are when trying to decrypt with Kleopatra or within application with SmartCard / security key (69.09 KB, application/x-zip-compressed)
2024-02-22 01:07 UTC, ex9qee8u
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ex9qee8u 2024-02-22 01:07:12 UTC
Created attachment 165986 [details]
here you see "explorer... .jpg" from KMyMoney's XML-Storage plugin. Other two are when trying to decrypt with Kleopatra or within application with SmartCard / security key

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
When decrypting PGP encrypted vault with a security key, I get following error: 
### Cannot read the file: path/to/my/file /home/abuild/rpmbuild/BUILD/kmymoney-5.1.3/kmymoney/plugins/xml/xmlstorage.cpp:140

When I use OpenPGP keys that are stored on the device, so that cleopatra lists them, it works fine. 
If I have the same private keys on the security key (such as nitrokey), it gives me this error.

*Please read additional information.*

STEPS TO REPRODUCE
1. Generate keys on device or directly on the security key / smartcard.
2. When exporting the vault to XML, encrypt it with public key, whose private key resides only on the smartcard /security key.
3. Try to open the vault, the error appears.

OBSERVED RESULT

The same as in Summary

EXPECTED RESULT
The same result as with private key stored on device.


SOFTWARE/OS VERSIONS
Windows: 10 Pro
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
I tried to achieve this with other programs that support PGP encryption and it worked.
I think the reason for this is the version of gpg interface used by plugin. I think this is correct, because the UI looks much older than when I'm trying on other programs. It may be because the GPA is not shipped within gpg4win anymore. Probably if Kleopatra would be used for decryption, it should work. 
If you look at screenshots the plugin KMyMoney uses is called "pinentry" and kleopatra uses "pinentry-qt".
Comment 1 Jack 2024-02-22 01:30:26 UTC
Minor point only, in case it might help.  There are multiple pinentry programs (in my case -curses, -qt, -qt5, -tty, -gnome3) and on Linux, the plain "pinentry" is just a symbolic link (shortcut in Windows terms, I think) to one of the others.  Is it possible on Windows that either there is already a mechanism for this, or you can create a shortcut to pinentry-qt called pinentry?  Have you looked through the gpg4win docs?