Allow to export private keys.
Using a workaround that validates passphrase for a secret key. With GnuPG 2.2.23 and GpgME 1.1.15, a secret key can be exported when the right passphrase is provided. With a bad passphrase, application crashes. See https://dev.gnupg.org/T5151 Application may validate a passphrase before invoking engine. Until it is hopefully fixed in upstream and available in mainstream.
This commit is contained in:
@@ -297,6 +297,18 @@ void KeyringIO::OnPreExportSecretKey(const WString& fpr)
|
||||
{
|
||||
// On preExport button of popup
|
||||
WLink link;
|
||||
GpgMEWorker gpgw;
|
||||
Error e = gpgw.CheckPassphrase(fpr.toUTF8().c_str(),
|
||||
m_popupExportSecretKey->GetPassphrase());
|
||||
if (e.code() != 0)
|
||||
{
|
||||
m_tmwMessage->SetText(e.asString());
|
||||
m_popupExportSecretKey->GetApplyButton()->setLink(link);
|
||||
m_popupExportSecretKey->GetApplyButton()->disable();
|
||||
LGE(e);
|
||||
return;
|
||||
}
|
||||
|
||||
shared_ptr<ExportKeyStreamResource> shResource =
|
||||
make_shared<ExportKeyStreamResource>
|
||||
(fpr, true, "appliation/pgp-keys", m_tmwMessage);
|
||||
|
||||
Reference in New Issue
Block a user