locked
ServicePointManager.ServerCertificateValidationCallback

    Question

  • How can I automaticaly accept a SSL certificate in WinRT has I was doing in .NET ?

     static ClientProxyHelper()
     {
         ServicePointManager.ServerCertificateValidationCallback += AcceptAnyCertificate;
     }
    
     private static bool AcceptAnyCertificate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
     {
         return true;
     }
    

     

    Thank you.
    Wednesday, October 12, 2011 9:45 AM

Answers

All replies

  • Hi Aleks,

    You cannot do this in WinRt.  There is no ServicePointManager exposed and no way to do your own certificate validation.  Your server cert will need to be valid and verifiable.

    -Jeff

     


    Jeff Sanders (MSFT)
    Wednesday, October 12, 2011 8:03 PM
    Moderator
  • Hummm ... bad news.

    This is a development environment scenario that you should enable. No ?

     

    Moreover, I'm disappointed to see that, contrary to what we were told during the Build, the client part of WCF is not totaly the same.

    There is some minor differences (method or property renamed witch is very frustrating when you port an existing code) and some bigger (less binding, some classes disapeared, etc.)

     

    Aleks

    Wednesday, October 12, 2011 8:46 PM
  • Hi Aleks,

    Could you please tell me which APIs in WCF did you find missing which you would find useful to be added? Thanks.


    - Piyush
    Friday, October 14, 2011 4:22 PM
  • Hi PiyushJo,

     

    I don't have a list of features that is missing in my pocket.

    For now, what is really blocking is not having the possibility to accept an auto-sign certificate. In a developpment environment, I think that almost all company use this type of certificate.

     

    Aleks

    Thursday, December 01, 2011 12:37 PM
  • You can use fiddler web debugger to bypass the SSL issues.

    Thursday, December 22, 2011 6:00 AM
  • Hi Aleks, you can unblock yourself by installing the server certificate in the client certificate trusted store.
    - Piyush
    Tuesday, January 24, 2012 1:34 AM
  • Hi Aleks,

       I am creating a Win 8 Apps which access the WCF service to retrieve the data. I am also facing the same Issue with the SSL Certificate as your facing in the AcceptAnyCertificate. Any solution for this SSL certificate issue.

    Thanks,

    Nazeer.

    Wednesday, October 10, 2012 1:20 PM
  • No Sorry Nazeer I didn't find any solutions.

    Aleks

    Wednesday, October 17, 2012 9:45 AM
  • Facing the same issue... And currently a no-go in one of projects I was planning to build. I'm writing a client app and protocol implementation requires SSL but not a valid certificate (allowing any user to setup a server easily without extra costs). I need to support any server. Requiring a valid certificate from hosts will at this point make my client application pointless.

    I'm a little bit disappointed at this time :(


    Cyprien Autexier

    Sunday, November 11, 2012 1:21 AM
  • Jeff,

    It's been a year and still no thing from MS about supporting self-signed certificates? First WinRt don't support WS-* so we have to use BasicHttpBinding, then on Basic, you don't allow us to test on self-signed cert so we can't test on our development environment.

    Is this platform just for game, reading news and not for business apps?

    For guys that don't know, you can use Fiddler to bypass the problem (per Yue Zhang)

    http://www.marauderzstuff.com/PermaLink,guid,8a9b23b7-ac68-4531-8488-7bddb88d6821.asp

    • Edited by Eric Nguyen Thursday, November 22, 2012 3:52 AM
    Thursday, November 22, 2012 3:34 AM
  • Bad news.

    关注我的新浪微博:http://weibo.com/haitch SystemCenter中文社区:http://wicresoft.azurewebsites.net

    Monday, November 26, 2012 7:45 AM