aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/security/MCCertificateUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/security/MCCertificateUtils.cpp')
-rw-r--r--src/core/security/MCCertificateUtils.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core/security/MCCertificateUtils.cpp b/src/core/security/MCCertificateUtils.cpp
index 42b75916..f2345e90 100644
--- a/src/core/security/MCCertificateUtils.cpp
+++ b/src/core/security/MCCertificateUtils.cpp
@@ -110,7 +110,26 @@ err:
goto free_certs;
}
- status = X509_STORE_set_default_paths(store);
+#ifdef _MSC_VER
+ HCERTSTORE systemStore = CertOpenSystemStore(NULL, L"ROOT");
+
+ PCCERT_CONTEXT previousCert = NULL;
+ while (1) {
+ PCCERT_CONTEXT nextCert = CertEnumCertificatesInStore(systemStore, previousCert);
+ if (nextCert == NULL) {
+ break;
+ }
+ X509 * openSSLCert = d2i_X509(NULL, (const unsigned char **)&nextCert->pbCertEncoded, nextCert->cbCertEncoded);
+ if (openSSLCert != NULL) {
+ X509_STORE_add_cert(store, openSSLCert);
+ X509_free(openSSLCert);
+ }
+ previousCert = nextCert;
+ }
+ CertCloseStore(systemStore, 0);
+#endif
+
+ status = X509_STORE_set_default_paths(store);
if (status != 1) {
printf("Error loading the system-wide CA certificates");
}