+ if (TestConnection.SSLVerify() == COSSL_UNABLETOVERIFY){
+#if defined(__APPLE__)
+
+ TestConnection.BypassSSLVerification(true);
+
+ COConnectResult TestConnectionResult = TestConnection.Connect(false);
+
+ TestConnection.BypassSSLVerification(false);
+
+ int SSLResult = DisplayTrustPanel(&TestConnection);
+
+ if (SSLResult != NSOKButton){
+
+ wxMessageBox(_("An error occured whilst connnecting: ") + TestConnection.GetErrorMessage(), _("Failed"), wxOK+wxICON_ERROR);
+ return;
+
+ }
+
+#elif defined(__WIN32__)
+
+ TestConnection.BypassSSLVerification(true);
+
+ COConnectResult TestConnectionResult = TestConnection.Connect(false);
+
+ TestConnection.BypassSSLVerification(false);
+
+ BOOL ModifiedCertificateData = false;
+ CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&TestConnection, (HWND)this->GetHandle());
+
+ if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)) {
+ wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog"));
+ return;
+ }
+
+ if (ModifiedCertificateData == false) {
+ wxMessageBox(_("An invalid certificate was received from the server."), _("Invalid certificate"));
+ return;
+ } else {
+ TestConnection.BypassSSLVerification(true);
+ COConnectResult TestConnectionResult = TestConnection.Connect(true);
+ TestConnection.BypassSSLVerification(false);
+ }
+
+#else
+
+ // Connect again and fetch SSL certificate information.
+
+ TestConnection.BypassSSLVerification(true);
+
+ COConnectResult TestConnectionResult = TestConnection.Connect(false);
+
+ TestConnection.BypassSSLVerification(false);
+
+ SSLCertCollectionString CertData = TestConnection.BuildSSLCollection();
+ frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
+
+ frmICPtr->LoadDataNew(CertData, txtAddress->GetValue().ToStdString());
+ frmICPtr->ShowModal();
+
+ int SSLResult = frmICPtr->GetResult();
+
+ // Clean up before processing response.
+
+ delete frmICPtr;
+ frmICPtr = NULL;
+
+ // Process the response from the user.
+
+ if (SSLResult == 1){
+
+ // Accept the Certificate.
+
+ UsingSSLBypass = true;
+ TestConnection.BypassSSLVerification(true);
+
+ COConnectResult TestConnectionResult = TestConnection.Connect(true);
+
+ TestConnection.BypassSSLVerification(false);
+
+ } else if (SSLResult == 2){
+
+ // Reject the certificate, abort the task.
+
+ wxMessageBox(_("Server certficiate rejected. Unable to detect the prefix."), _("Failed"), wxOK+wxICON_ERROR);
+
+ return;
+
+ }
+
+#endif
+ }