mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 12:18:01 +01:00
#2834: Wrong cancelation of the fix: incorrect type of store name parameter in CertOpenStore API call into NetSSL_Win. Release 1.10.0
This commit is contained in:
@@ -163,14 +163,14 @@ Poco::Net::X509Certificate Context::certificate()
|
|||||||
|
|
||||||
void Context::loadCertificate()
|
void Context::loadCertificate()
|
||||||
{
|
{
|
||||||
std::wstring wcertStore;
|
std::wstring wcertStoreName;
|
||||||
Poco::UnicodeConverter::convert(_certStoreName, wcertStore);
|
Poco::UnicodeConverter::convert(_certStoreName, wcertStoreName);
|
||||||
if (!_hCertStore)
|
if (!_hCertStore)
|
||||||
{
|
{
|
||||||
if (_options & OPT_USE_MACHINE_STORE)
|
if (_options & OPT_USE_MACHINE_STORE)
|
||||||
_hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, _certStoreName.c_str());
|
_hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, wcertStoreName.c_str());
|
||||||
else
|
else
|
||||||
_hCertStore = CertOpenSystemStoreW(0, wcertStore.c_str());
|
_hCertStore = CertOpenSystemStoreW(0, wcertStoreName.c_str());
|
||||||
}
|
}
|
||||||
if (!_hCertStore) throw CertificateException("Failed to open certificate store", _certStoreName, GetLastError());
|
if (!_hCertStore) throw CertificateException("Failed to open certificate store", _certStoreName, GetLastError());
|
||||||
|
|
||||||
|
|||||||
@@ -381,13 +381,13 @@ void* X509Certificate::nid2oid(NID nid)
|
|||||||
|
|
||||||
void X509Certificate::loadCertificate(const std::string& certName, const std::string& certStoreName, bool useMachineStore)
|
void X509Certificate::loadCertificate(const std::string& certName, const std::string& certStoreName, bool useMachineStore)
|
||||||
{
|
{
|
||||||
std::wstring wcertStore;
|
std::wstring wcertStoreName;
|
||||||
Poco::UnicodeConverter::convert(certStoreName, wcertStore);
|
Poco::UnicodeConverter::convert(certStoreName, wcertStoreName);
|
||||||
HCERTSTORE hCertStore;
|
HCERTSTORE hCertStore;
|
||||||
if (useMachineStore)
|
if (useMachineStore)
|
||||||
hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, certStoreName.c_str());
|
hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, wcertStoreName.c_str());
|
||||||
else
|
else
|
||||||
hCertStore = CertOpenSystemStoreW(0, wcertStore.c_str());
|
hCertStore = CertOpenSystemStoreW(0, wcertStoreName.c_str());
|
||||||
|
|
||||||
if (!hCertStore) throw CertificateException("Failed to open certificate store", certStoreName, GetLastError());
|
if (!hCertStore) throw CertificateException("Failed to open certificate store", certStoreName, GetLastError());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user