.NET Driver SSL Does Not Work in Windows XP (GridServer 3.2)

.NET Driver SSL Does Not Work in Windows XP (GridServer 3.2)

book

Article ID: KB0086658

calendar_today

Updated On:

Products Versions
TIBCO DataSynapse GridServer -
Not Applicable -

Description

Resolution:
When using the .NET Driver with Windows XP, SSL will not work, and fails with an error such as Could not establish trust relationsship with remote server.
Use the following new class to use SSL with the .NET Driver on Windows XP. The original solution always returned true; this class will check certificates, but allow hostname mismatches, which is the same as the Java GridServer client. To call this class, use HostnameIgnoreCertificatePolicy.Enable();
HostnameIgnoreCertificatePolicy.cs:
using System;
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class HostnameIgnoreCertificatePolicy : System.Net.ICertificatePolicy
{
public HostnameIgnoreCertificatePolicy()
{}
public bool CheckValidationResult(ServicePoint sp,X509Certificate cert,WebRequest req, int problem)
{
  return (problem == HOSTNAME_MISMATCH) || (problem == OK);
}
public static void Enable()
{
  ServicePointManager.CertificatePolicy = new HostnameIgnoreCertificatePolicy();
}
private const int HOSTNAME_MISMATCH = -2146762481;
private const int OK = 0;
}

Issue/Introduction

.NET Driver SSL Does Not Work in Windows XP (GridServer 3.2)