merge 3.5 (closes #25939)
diff --git a/Misc/NEWS b/Misc/NEWS
index 70ec592..467b876 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -186,6 +186,8 @@
 Library
 -------
 
+- Issue #25939: On Windows open the cert store readonly in ssl.enum_certificates.
+
 - Issue #25995: os.walk() no longer uses FDs proportional to the tree depth.
 
 - Issue #25994: Added the close() method and the support of the context manager
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 529d2f0..c96237e 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -4198,7 +4198,9 @@
     if (result == NULL) {
         return NULL;
     }
-    hStore = CertOpenSystemStore((HCRYPTPROV)NULL, store_name);
+    hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, (HCRYPTPROV)NULL,
+                            CERT_STORE_READONLY_FLAG | CERT_SYSTEM_STORE_LOCAL_MACHINE,
+                            store_name);
     if (hStore == NULL) {
         Py_DECREF(result);
         return PyErr_SetFromWindowsErr(GetLastError());
@@ -4284,7 +4286,9 @@
     if (result == NULL) {
         return NULL;
     }
-    hStore = CertOpenSystemStore((HCRYPTPROV)NULL, store_name);
+    hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, (HCRYPTPROV)NULL,
+                            CERT_STORE_READONLY_FLAG | CERT_SYSTEM_STORE_LOCAL_MACHINE,
+                            store_name);
     if (hStore == NULL) {
         Py_DECREF(result);
         return PyErr_SetFromWindowsErr(GetLastError());