Commit 4dae8f50 authored by Alexey Golubev's avatar Alexey Golubev Committed by GitHub

Merge pull request #47 from ONLYOFFICE/feature/ooxmlsign

Feature/ooxmlsign
parents 549e3dc5 9cc5ed1d
...@@ -219,7 +219,7 @@ public: ...@@ -219,7 +219,7 @@ public:
HCRYPTPROV hCryptProv = NULL; HCRYPTPROV hCryptProv = NULL;
bResult = CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL); bResult = (NULL != m_context) ? CryptAcquireCertificatePrivateKey(m_context, 0, NULL, &hCryptProv, &dwKeySpec, NULL) : FALSE;
if (!bResult) if (!bResult)
bResult = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); bResult = CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
...@@ -252,7 +252,7 @@ public: ...@@ -252,7 +252,7 @@ public:
return ""; return "";
} }
BYTE* pDataHashRaw = new BYTE[dwCount]; BYTE* pDataHashRaw = (BYTE*)malloc(cbHashSize);
bResult = CryptGetHashParam(hHash, HP_HASHVAL, pDataHashRaw, &cbHashSize, 0); bResult = CryptGetHashParam(hHash, HP_HASHVAL, pDataHashRaw, &cbHashSize, 0);
...@@ -270,7 +270,7 @@ public: ...@@ -270,7 +270,7 @@ public:
std::string sReturn(pBase64_hash, nBase64Len_hash); std::string sReturn(pBase64_hash, nBase64Len_hash);
delete [] pBase64_hash; delete [] pBase64_hash;
//delete [] pDataHashRaw; free(pDataHashRaw);
CryptDestroyHash(hHash); CryptDestroyHash(hHash);
CryptReleaseContext(hCryptProv, 0); CryptReleaseContext(hCryptProv, 0);
......
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