Artem Zinnatullin
Artem Zinnatullin

Reputation: 4447

Manually check server's certificate using HttpWebRequest

I am using HttpWebRequest to work with service's https API, now I need to check https certificate manually on client side (Windows Phone 8 application), how could I do it?

I have got certificate.cert file, so I can put it to the Assets folder and then compare it to the server's certificate, but I do not know how

Upvotes: 3

Views: 3113

Answers (2)

dixus
dixus

Reputation: 478

I use a commercial library that you can test. Its possible to read server certificates! I had a similiar question about certificates and WP8.

Read SSL Certificate Details on WP8

Regards Holger

Upvotes: 0

Artem Zinnatullin
Artem Zinnatullin

Reputation: 4447

I have read some tutorials about manually checking SSL certificates in .NET using ServicePointManager, and when I started implement it in Windows Phone 8 application, I realized that .NET Framework for WP8 (and 7) just has not got API to handle SSL certificates validating. We just can't have access to ServicePointManager...

Then I found this post: "Self Signed Certification SSL HTTPS" on wpdev.uservoice.com, where developers are asking Microsoft to add this API into next WP SDK updates, of course I have spent my 3 votes on that, so if you want to see ServicePointManager in WP .NET framework, please vote for that.

Also, I want to notice you about strange behavior of HttpWebRequest on WP, when you trying to work with self-signed https resource, HttpWebRequest will throw 404 exception! Very strange, yes?

Upvotes: 8

Related Questions