curl_easy_setopt(conn, CURLOPT_WRITEDATA, &PageData);
curl_easy_setopt(conn, CURLOPT_WRITEHEADER, &PageHeader);
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__WIN32__)
SetConnectionObject(conn);
-
+
#endif
conncode = (curl_easy_perform(conn));
curl_easy_setopt(connssldata, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(connssldata, CURLOPT_SSL_VERIFYHOST, 0L);
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__WIN32__)
SetConnectionObject(connssldata);
-
+
#endif
CURLcode certfetchcode;
certfetchcode = (curl_easy_perform(connssldata));
+#if !defined(__APPLE__) && !defined(__WIN32__)
+
VerifyCertCollection = BuildSSLCollection(connssldata);
if (certfetchcode == CURLE_OK){
}
+#endif
+
*ServerResult = FALSE;
} else {
SSLCopyPeerTrust((SSLContext*)TLSInfo->internals, &SecTrustObject);\r
}\r
\r
+#elif defined(__WIN32__)\r
+\r
+ const struct curl_tlssessioninfo *TLSInfo;\r
+ CURLcode TLSCode;\r
+ CURL *Connection = GetConnectionObject();\r
+ TLSCode = curl_easy_getinfo(Connection, CURLINFO_TLS_SSL_PTR, &TLSInfo);\r
+\r
+ std::string CertName;\r
+\r
+ if (TLSInfo->internals != nullptr && TLSCode == CURLE_OK){\r
+ PCtxtHandle SSLHandle = (PCtxtHandle)TLSInfo->internals;\r
+ SECURITY_STATUS GetData = QueryContextAttributes(SSLHandle, SECPKG_ATTR_REMOTE_CERT_CONTEXT, &CertificateData);\r
+ //QueryContextAttributesA(TLSInfo->internals, SECPKG_);\r
+ }\r
+\r
#endif\r
\r
return size * nmemb;\r
#if defined(__APPLE__)\r
SSLContext *CardDAV::SSLContextPointer;\r
SecTrustRef CardDAV::SecTrustObject;\r
+#endif\r
+#if defined(__WIN32__)\r
+PCCERT_CONTEXT CardDAV::CertificateData;\r
+#endif\r
+#if defined(__APPLE__) || defined(__WIN32__)\r
CURL *CardDAV::ConnectionObject;\r
#endif\r
\r
\r
}\r
\r
-#if defined(__APPLE__)\r
+#if defined(__APPLE__) || defined(__WIN32__)\r
\r
CURL* CardDAV::GetConnectionObject(){\r
\r
\r
}\r
\r
+#endif\r
+\r
+#if defined(__WIN32__)\r
+\r
+PCCERT_CONTEXT CardDAV::GetCertificateContextPointer(){\r
+\r
+ // Get the certificate data.\r
+\r
+ return CertificateData;\r
+\r
+}\r
+\r
+CERT_CONTEXT CardDAV::GetCertificateContext(){\r
+\r
+ // Get the certificate data.\r
+\r
+ return *CertificateData;\r
+\r
+}\r
+\r
#endif
\ No newline at end of file
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <curl/curl.h>
+#if defined(__WIN32__)
+#include <security.h>
+#include <schannel.h>
+#endif
#include "../vcard/vcard.h"
#include "../actmgr/frmActivityMgr.h"
#include "../common/sslcertstructs.h"
wxString ETagValueResult();
wxString GetErrorMessage();
static size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, wxString *stream);
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__WIN32__)
static CURL* GetConnectionObject();
static void SetConnectionObject(CURL *ConnectionObject);
+#endif
+
+#if defined(__APPLE__)
SecTrustRef GetTrustObject();
+#elif defined(__WIN32__)
+ PCCERT_CONTEXT GetCertificateContextPointer();
+ CERT_CONTEXT GetCertificateContext();
#endif
// SSL Verification tests when connecting.
//size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
private:
+#if defined(__APPLE__) || defined(__WIN32__)
+ static CURL* ConnectionObject;
+#endif
#if defined(__APPLE__)
static SSLContext *SSLContextPointer;
static SecTrustRef SecTrustObject;
- static CURL* ConnectionObject;
+#elif defined(__WIN32__)
+ static PCCERT_CONTEXT CertificateData;
#endif
static wxString ServerAddress;
static int ServerPort;