This commit is contained in:
Oleg Korshul
2017-06-08 18:15:43 +03:00
parent 227d4f18d6
commit 3ae52bd221
2 changed files with 33 additions and 5 deletions

View File

@ -8,6 +8,7 @@
#define OOXML_HASH_ALG_SHA1 0
#define OOXML_HASH_ALG_INVALID 1
class ICertificate;
class Q_DECL_EXPORT ICertificateSelectDialogOpenSsl
{
public:
@ -26,7 +27,7 @@ public:
virtual std::wstring GetKeyPassword() = 0;
virtual bool ShowSelectDialog() = 0;
virtual int ShowCertificate() = 0;
virtual int ShowCertificate(ICertificate* pCert) = 0;
};
class Q_DECL_EXPORT CCertificateInfo

View File

@ -281,14 +281,41 @@ public:
public:
virtual bool ShowSelectDialog()
{
if (m_pDialog)
return m_pDialog->ShowSelectDialog();
return false;
if (!m_pDialog)
return false;
bool bResult = m_pDialog->ShowSelectDialog();
std::wstring sKeyPath = m_pDialog->GetKeyPath();
std::wstring sKeyPasswordW = m_pDialog->GetKeyPassword();
std::string sKeyPassword = U_TO_UTF8(sKeyPasswordW);
std::wstring sCertPath = m_pDialog->GetCertificatePath();
std::wstring sCertPasswordW = m_pDialog->GetCertificatePassword();
std::string sCertPassword = U_TO_UTF8(sCertPasswordW);
if (sCertPath.empty())
{
sCertPath = sKeyPath;
sCertPassword = sKeyPassword;
}
int nErr = LoadKey(sKeyPath, sKeyPassword, &m_key);
if (nErr != OPEN_SSL_WARNING_OK && nErr != OPEN_SSL_WARNING_ALL_OK)
return false;
nErr = LoadCert(sCertPath, sCertPassword, &m_cert);
if (nErr != OPEN_SSL_WARNING_OK && nErr != OPEN_SSL_WARNING_ALL_OK)
return false;
return true;
}
virtual int ShowCertificate()
{
if (m_pDialog)
return m_pDialog->ShowCertificate();
return m_pDialog->ShowCertificate(this);
return 1;
}