private static bool ValidateServerCertficate(
object sender,
X509Certificate cert,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
if (sslPolicyErrors == SslPolicyErrors.None)
{
return true;
}
bool certMatch = false;
byte[] certHash = cert.GetCertHash();
if (certHash.Length == ApiCertHash.Length)
{
certMatch = true;
for (int idx = 0; idx < certHash.Length; idx++)
{
if (certHash[idx] != ApiCertHash[idx])
{
certMatch = false;
break;
}
}
}
return certMatch;
}