diff --git a/tls/openssl/gtlsbackend-openssl.c b/tls/openssl/gtlsbackend-openssl.c
index f118c53..4b44e1d 100644
--- a/tls/openssl/gtlsbackend-openssl.c
+++ b/tls/openssl/gtlsbackend-openssl.c
@@ -187,12 +187,15 @@ g_tls_backend_openssl_real_create_database (GTlsBackendOpenssl  *self,
   GTlsDatabase *database;
 
 #ifdef G_OS_WIN32
-  gchar *module_dir;
   gchar *cert_path;
+  const char *cert_file;
 
-  module_dir = g_win32_get_package_installation_directory_of_module (NULL);
-  cert_path = g_build_filename (module_dir, "bin", "cert.pem", NULL);
-  g_free (module_dir);
+  cert_file = g_getenv (X509_get_default_cert_file_env ());
+
+  if (!cert_file)
+    cert_path = g_strdup (X509_get_default_cert_file ());
+  else
+    cert_path = g_strdup (cert_file);
 
   if (g_file_test (cert_path, G_FILE_TEST_IS_REGULAR))
     anchor_file = cert_path;
