locked
How to get server certificate from a give url?

    Question

  • Hello,

    I need to match fingerprint with the server certificate, I can easily do that with ServicePointManager class in WF, but don't know how it can be achieved in Windows store app.

    Any suggestions please?

    Thanks in advance.


    • Edited by zee_patel Friday, June 13, 2014 7:01 AM
    Friday, June 13, 2014 7:00 AM

Answers

  • I don't think we have any solutions that work on 8.0.

    A good question to answer for everyone who wonders which OS version to target: how many customers do you think you might have that (a) will download your program but (b) weren't willing to download the free 8.0 to 8.1 update?

    Past companies I've worked for discovered that most people purchase apps when they get a new machine. This means that the value of supporting "old" OSes is lower than you might think. 


    Network Developer Experience Team (Microsoft)

    • Marked as answer by zee_patel Friday, June 20, 2014 6:17 AM
    Tuesday, June 17, 2014 10:26 PM

All replies

  • Use the Windows.Web.Http HttpClient API; it's very similar to the System.Net one that you might be familiar with.  The server certificate is placed on the request object (not the response because in the case of a rejected certificate, there is no response)

    If you're adding additional security, a great programming pattern to use is place your additional validation inside a filter; you can build a simple filter that just does the check you want.  You then place the filter into the overall HTTP processing pipeline.  Result: your normal business logic can just deal directly with simple HTTP commands without having to fiddle with the cert checking while doing everything else.  The cert checking is placed into its own small, specialized bit of code.

    We have a set of posters for some of the most popular Network APIs including HttpClient; you can download it from http://www.microsoft.com/en-us/download/details.aspx?id=40018


    Network Developer Experience Team (Microsoft)

    Friday, June 13, 2014 9:28 PM
  • Thanks for the reply,

    But it seems that the Api I need to use is only available for Windows 8.1 and not for Windows 8.

    Is there any Api for Windows 8, I only need to get some properties value like Issuer, ValidFrom , ValidTo and HashValue of server certificate.

    Tuesday, June 17, 2014 5:43 AM
  • I don't think we have any solutions that work on 8.0.

    A good question to answer for everyone who wonders which OS version to target: how many customers do you think you might have that (a) will download your program but (b) weren't willing to download the free 8.0 to 8.1 update?

    Past companies I've worked for discovered that most people purchase apps when they get a new machine. This means that the value of supporting "old" OSes is lower than you might think. 


    Network Developer Experience Team (Microsoft)

    • Marked as answer by zee_patel Friday, June 20, 2014 6:17 AM
    Tuesday, June 17, 2014 10:26 PM
  • I tried this in Windows 8.1 but didn't find the right way to get get SSL certificate info of a given URL,

    Please can you share some code snippet to achieve this, as mention in my above post I want some property values like Issuer, ValidFrom , ValidTo and HashValue.

    Thanks in advance.

    Wednesday, June 25, 2014 11:45 AM