TrustedCertificatePolicy.cs
1 using System.Diagnostics;
2 using System;
3 using System.Text;
4 using System.Reflection;
5 
6 
10  internal class TrustedCertificatePolicy : System.Net.ICertificatePolicy
11  {
12  #region ICertificatePolicy Members
13 
14  public bool CheckValidationResult(System.Net.ServicePoint srvPoint, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Net.WebRequest request, int certificateProblem)
15  {
16  return true;
17  }
18 
19  public static bool CheckValidationResult(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
20  System.Security.Cryptography.X509Certificates.X509Chain chain,
21  System.Net.Security.SslPolicyErrors sslPolicyErrors)
22  {
23  //En un futuro descomentar estas líneas para hacer la verificación del certificado TLS (vulnerabilidad encontrada en S200 que también está aquí en S50)
24 
25  // Validate the certificate
26  //System.Security.Cryptography.X509Certificates.X509Certificate2 loCertificate = (System.Security.Cryptography.X509Certificates.X509Certificate2)certificate;
27  //var chainIsValid = loCertificate.Verify();
28  //if (!chainIsValid)
29  //{
30  // return false;
31  //}
32  //else
33  //{
34  return true;
35  //}
36  }
37 
38 
39  #endregion
40  }
41