Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

379
Vistas
How to use a self-signed SSL certificate without ServicePointManager.ServerCertificateValidationCallback?

I have an HttpClient which uses a self-signed SSL certificate which is saved on the client computer as a .cer file. To validate the certificate, I use ServicePointManager.ServerCertificateValidationCallback in the following way (not my actual code, just the essence):

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, errors) =>
{
    if (errors == SslPolicyErrors.None) return true;
    if (cert.Subject == "CN=CertificateCommonName")
        return CertificatesMatch(cert, GetSavedCertificateFromFile());
    else
        return false;
};

However, I noticed that this function only gets called once for any certificate per process (more exactly per AppDomain, probably), which means that once a certificate has been validated, it is stored somewhere in a "valid certificates cache". Is there a way I can simply add my saved certificate to that cache?

I wish I could simply use an HttpClientHandler with my HttpClient and add the certificate to the ClientCertificates property, however I am targeting .NET Framework 4.5, and that feature is only available from .NET Framework 4.7.1, so that is not an option.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda