How can I establish a secure channel for SSL/TLS from a handheld device?

前端 未结 2 1538
被撕碎了的回忆
被撕碎了的回忆 2020-12-18 08:37

I am trying to call a REST method from a handheld device (Windows CE / Compact framework) with this code:

public static HttpWebRequest SendHTTPRequestNoCrede         


        
相关标签:
2条回答
  • 2020-12-18 09:30

    Look at my answer Here

    In a nutshell certificate management and security is not implemented well in CE and you will need to create your own web request object from Microsofts object. More details can be found at this link http://labs.rebex.net/HTTPS

    0 讨论(0)
  • 2020-12-18 09:35

    The .NET Compact Framework does not have ServerCertificateValidationCallback.
    What you could do is to set a CertificatePolicy class to validate the certificate.

    public class TrustAllCertificatePolicy : ICertificatePolicy
    {
      public TrustAllCertificatePolicy()
      {
      }
    
      public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest req, int problem)
      {
        return true;
      }
    }
    
    ...
    
    System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
    

    See this link for more information.

    0 讨论(0)
提交回复
热议问题