X509Certificate

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Kinsella

    X509Certificate

    I'm porting a small piece of Java that will fetch HTML from a secured web
    page. The Java code was purposely written to accept any client
    certificate - even out of date certificates. This was accomplished by
    implementing an X509TrustManage r that accepted any certificate.

    I'm trying to understand how to do the equivalent in .Net.

    Does anyone know how to do this? Help would be very much appreciated.
    Thanks in advance.

    Joe


  • Luke Zhang [MSFT]

    #2
    RE: X509Certificate

    In VS.NET, we can retrieve HTML with a HttpWebRequest object, it has a
    property named "ClientCertific ates", we can specify the certificates here.
    Here is some sample code:

    wreq.Method = "POST";
    string poststring = postParameters ;
    wreq.ContentTyp e = "text/xml";

    X509Certificate A2WCert = X509Certificate .CreateFromCert File("c:\c1.cer ");
    wreq.ClientCert ificates.Add(A2 WCert);

    HttpWebResponse wresp= (HttpWebRespons e)wreq.GetRespo nse();

    Client certificates Accepted by serverside replys on IIS. By default, it
    will reject a out-of-date client certificate.

    For more information, you may check docuements on following namespace in
    MSDN:

    System.Security .Cryptography.X 509Certificates

    Luke

    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Comment

    Working...