X509Certificate not passed to webservice.

From: Matthew (matthew_glen_evans_at_hotmail.com)
Date: 10/28/04


Date: 28 Oct 2004 08:18:46 -0700

Hi all,

I have the following scenario (XP / IIS 5, FX v1.1.4322) Both the
client app and web service are running on my local development
machine.

I am using a straightforward HTTPWebRequest, and WSE 2 to add an X509
certificate, as follows:

==================================================================
Private Function CreateWebRequest() As HttpWebRequest

        Dim objRequest As HttpWebRequest = WebRequest.Create(m_URL &
"/" & m_Operation)

        SetProxy(objRequest.Proxy)

        objRequest.Method = "POST"
        objRequest.ContentType = "application/x-www-form-urlencoded"
        objRequest.Timeout = 300000
        
        Dim certStore As X509CertificateStore
        certStore = X509CertificateStore.LocalMachineStore(X509CertificateStore.RootStore.ToString)
        certStore.OpenRead()

        Dim cert As X509Certificates.X509Certificate
        If certStore.FindCertificateBySubjectString("XYZ").Count > 0
Then
            cert = certStore.FindCertificateBySubjectString("XYZ")(0)
        End If

        objRequest.ClientCertificates.Add(cert)

        Return objRequest

    End Function

==================================================================

This is using a test cert generated with makecert, and imported into
the local machine root store. When in debug mode, I can see the cert
is retrieved and added to the request's clientcertificates collection
fine.

However when inspecting the Context.Request.ClientCertificate property
in the WebService code, there is only an HTTPClientCerticate object
there with its properties unpopulated . ( this seems to be present
irrespective of whether or not the certificate is added client side)

I have attempted a similar exercise with the following test code which
I found here : http://www.15seconds.com/issue/020312.htm
to test a straightforward web service scenario, with the same result.
(The cert does not seem to be passed to the service...)

==================================================================

private void TestService_Click(object sender, System.EventArgs e)
                {
                         CSWebservices.CCWebservice objws ;
                         objws = new CSWebservices.CCWebservice() ;

                         X509Certificate objCert ;
                         objCert = X509Certificate.CreateFromCertFile("xyz.cer") ;

                         objws.ClientCertificates.Add(objCert) ;

                         CSWebservices.ClientCertificateDetails objCertDetails ;
                         objCertDetails = objws.GetCertificateDetails() ;

                }

==================================================================

Server Side:

[WebMethod]
                public ClientCertificateDetails GetCertificateDetails()
                {
                        HttpClientCertificate objCertificate =
HttpContext.Current.Request.ClientCertificate ;
                        ClientCertificateDetails objCertificateDetails = new
ClientCertificateDetails() ;
                        objCertificateDetails.Cookie = objCertificate.Cookie ;
                        objCertificateDetails.IsPresent = objCertificate.IsPresent ;
                        objCertificateDetails.Issuer = objCertificate.Issuer ;
                        objCertificateDetails.IsValid = objCertificate.IsValid ;
                        objCertificateDetails.KeySize = objCertificate.KeySize ;
                        objCertificateDetails.SecretKeySize = objCertificate.SecretKeySize
;
                        objCertificateDetails.SerialNumber = objCertificate.SerialNumber ;
                        objCertificateDetails.ServerIssuer = objCertificate.ServerIssuer ;
                        objCertificateDetails.ServerSubject = objCertificate.ServerSubject
;
                        objCertificateDetails.ValidFrom = objCertificate.ValidFrom ;
                        objCertificateDetails.ValidUntil = objCertificate.ValidUntil ;
                        
                        return objCertificateDetails ;
                }

======================================================================

If I configure IIS to require Client certificates: I experience HTTP
403.7 ( cert required ) errors.

Any ideas / pointers would be appreciated.

Thanks,

Matthew



Relevant Pages

  • Re: Radius Server
    ... > so I'm guessing the client needs the Server Certificate, ... > export it from the server and import it to the client. ... >> But if you deployed EAP-TLS, you need a server cert and a client ...
    (microsoft.public.windows.server.networking)
  • Re: OWA Form Resetting
    ... Depends on the client browsers... ... The reason why you are getting alerts regarding the certificate being ... both the ISA server computer as well as the external ... I can view the cert and the certs ...
    (microsoft.public.isa)
  • Re: Crypto iffpar
    ... I reconfigured my test client to be a "strict client" (to use your ... > and 0x1 (meaning trusted cert) on server cryptostats. ... | The certificate signature has been verified. ...
    (comp.protocols.time.ntp)
  • Re: Somewhat Urgent - Exchange 2007 Configuration Question
    ... public cert> ... to resolved the internal / external certificate issue. ... for "Exchange" so Outlook clients no longer get the certificate warning. ... The client computers having this issue are located across a security ...
    (microsoft.public.exchange.admin)
  • Re: Wireless WPA on SBS not authenticating
    ... Automatic certificate enrollment for local system failed to contact the ... Guess that means im not gettin anything so it must be my client or router. ... you could try updating the NIC drivers on the wireless ... I can see on a client machine that the cert is there and it is the ...
    (microsoft.public.windows.server.sbs)