Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServerCertificateValidationCallback Being Ignored

Tags:

c#

.net

ssl

I have the following code, which results in a WebException and I can't figure out why for the life of me. VS2012 / .Net 4.5 RTM on Windows 8 RTM.

    ServicePointManager.CertificatePolicy = null;
    ServicePointManager.CheckCertificateRevocationList = false;
    ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

    var request = WebRequest.Create(url) as HttpWebRequest;
    request.ServerCertificateValidationCallback = delegate { return true; };

    var response = request.GetResponse();

    WebException was unhandled
    The request was aborted: Could not create SSL/TLS secure channel.

I originally had the callback as its own method, which was never called. Any ideas why I am unable to ignore SSL validation errors and send all my sensitive data to an unknown web server?

like image 330
Joe Avatar asked Oct 14 '12 03:10

Joe


People also ask

What is ServicePointManager ServerCertificateValidationCallback?

ServicePointManager. ServerCertificateValidationCallback is a function, that is used to validate a server certificate. Our application uses custom validation by the client.

How do you ignore the remote certificate is invalid according to the validation procedure?

Right click your application name in Web Site. Select "Properties---Directory Security---Secure Communications---Edit----Cient Certificates---Ignore client certificates"

What is in a SSL certificate?

An SSL certificate is a digital certificate that authenticates a website's identity and enables an encrypted connection. SSL stands for Secure Sockets Layer, a security protocol that creates an encrypted link between a web server and a web browser.


1 Answers

Microsoft wont allow it. It damages the platform, because it is the reason why we arent developing apps for it. (we have millions of happy customers)

http://social.msdn.microsoft.com/Forums/windowsapps/en-US/f5821194-4c40-48e7-976c-3dec8864ac59/servicepointmanagerservercertificatevalidationcallback?forum=winappswithcsharp

You need a valid certificate or a real workaround. It is a big drawback for security reason.

like image 56
Karsten Avatar answered Sep 18 '22 15:09

Karsten