Requests the passphrase with a popup. As from GPGME 1.15.0, the loopback pinentry is functional when exporting secret keys. It works fine when the exact passphrase is provided. If it's a wrong passphrase, GPGME does not generate an ::Error, but the app crashes with 'free(): double free detected in tcache 2'. Hence, this patch cannot be committed to master. Status : dangerous Result : works and works not Reason : a wrong passphrase means a crash
65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
/*
|
|
* File: PopupExportSecretKey.h
|
|
* Author: SET - nmset@yandex.com
|
|
* License : GPL v2
|
|
* Copyright SET - © 2019
|
|
*
|
|
* Created on November 19, 2020, 9:01 PM
|
|
*/
|
|
|
|
#ifndef POPUPEXPORTSECRETKEY_H
|
|
#define POPUPEXPORTSECRETKEY_H
|
|
|
|
#include <Wt/WPopupWidget.h>
|
|
#include <Wt/WContainerWidget.h>
|
|
#include <Wt/WLineEdit.h>
|
|
#include <Wt/WPushButton.h>
|
|
#include "TransientMessageWidget.h"
|
|
|
|
using namespace Wt;
|
|
|
|
class PopupExportSecretKey : public WPopupWidget
|
|
{
|
|
public:
|
|
PopupExportSecretKey(WWidget * anchorWidget,
|
|
TransientMessageWidget * txtMessage,
|
|
const WLength& width = 300);
|
|
virtual ~PopupExportSecretKey();
|
|
void Create();
|
|
/**
|
|
* Used to forward the passphrase to the loopback passphrase provider.
|
|
* @return
|
|
*/
|
|
const string GetPassphrase()
|
|
{
|
|
return m_lePassphrase->text().toUTF8();
|
|
}
|
|
/**
|
|
* Caller binds its function here to add a link to the apply button.
|
|
* @return
|
|
*/
|
|
WPushButton* GetPreApplyButton()
|
|
{
|
|
return m_btnPreApply;
|
|
}
|
|
/**
|
|
* Expects a link with a shared resource that generates the secret key
|
|
* and forwards it to the browser.
|
|
* @return
|
|
*/
|
|
WPushButton* GetApplyButton()
|
|
{
|
|
return m_btnApply;
|
|
}
|
|
private:
|
|
TransientMessageWidget * m_tmwMessage;
|
|
WContainerWidget * m_cwMain;
|
|
WLineEdit * m_lePassphrase;
|
|
WPushButton * m_btnPreApply;
|
|
WPushButton * m_btnApply;
|
|
WText * m_lblPassphrase;
|
|
};
|
|
|
|
#endif /* POPUPEXPORTSECRETKEY_H */
|
|
|