Commit 38ce5586 authored by Oleg Korshul's avatar Oleg Korshul

ooxml signing developing...

parent f6d9ce83
......@@ -36,6 +36,7 @@ public:
static int LoadKey(std::wstring file, std::string password);
static int LoadCert(std::wstring file, std::string password);
static void SetOpenSslDialogApplication(ICertificateSelectDialogOpenSsl* pDialog);
};
class Q_DECL_EXPORT CCertificateInfo
......@@ -131,7 +132,7 @@ public:
public:
static int GetOOXMLHashAlg(const std::string& sAlg);
static ICertificate* CreateInstance();
static ICertificate* CreateInstance();
};
#endif // _XML_SERTIFICATE_BASE_H_
#ifdef WIN32
#include "./XmlSigner_mscrypto.h"
#define CCertificate CCertificate_mscrypto
int ICertificateSelectDialogOpenSsl::LoadKey(std::wstring file, std::string password)
{
return 0;
}
int ICertificateSelectDialogOpenSsl::LoadCert(std::wstring file, std::string password)
{
return 0;
}
#endif
#if defined(_LINUX) && !defined(_MAC)
......@@ -13,6 +24,16 @@
#define CCertificate CCertificate_openssl
#endif
namespace
{
ICertificateSelectDialogOpenSsl* g_application_openssl_gialog = NULL;
}
void ICertificateSelectDialogOpenSsl::SetOpenSslDialogApplication(ICertificateSelectDialogOpenSsl* pDialog)
{
g_application_openssl_gialog = pDialog;
}
int ICertificate::GetOOXMLHashAlg(const std::string& sAlg)
{
if ("http://www.w3.org/2000/09/xmldsig#rsa-sha1" == sAlg ||
......@@ -24,25 +45,25 @@ int ICertificate::GetOOXMLHashAlg(const std::string& sAlg)
ICertificate* ICertificate::CreateInstance()
{
return new CCertificate();
ICertificate* pCert = new CCertificate();
pCert->SetOpenSslDialog(g_application_openssl_gialog);
return pCert;
}
CCertificateInfo ICertificate::GetDefault()
{
CCertificateInfo info;
#ifdef WIN32
// detect user name
std::wstring sUserName;
#ifdef WIN32
DWORD dwUserNameLen = 1024;
wchar_t* _name = new wchar_t[dwUserNameLen + 1];
GetUserNameW(_name, &dwUserNameLen);
sUserName = std::wstring(_name);
delete []_name;
#endif
////////////////////
#ifdef WIN32
HANDLE hStoreHandle = CertOpenSystemStoreA(NULL, "MY");
if (!hStoreHandle)
return info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment