Re: Attaching client certificates to http request in .NET
From: Michel Gallant \(MVP\) (neutron_at_istar.ca)
Date: 04/30/03
- Next message: JohnF: "Socket Server on a PDC"
- Previous message: Ted: "Appearing Icons"
- In reply to: Dan Barker: "Re: Attaching client certificates to http request in .NET"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 30 Apr 2003 10:20:30 -0400
The following technical note shows two ways (P/Invoke
or CAPICOM interop) to access system certificate stores
from .net:
http://pages.istar.ca/~neutron/CapiCert/
Also, I believe there is a bug in .net currently having to
do with using LM store HttpWebRequest and Certificates object.
- Michel Gallant
MVP Security
"Dan Barker" <dbarker@crowechizek.com> wrote in message
news:835077c6.0304300547.12976ef5@posting.google.com...
> Travis, Did you ever get this to work? I am trying to do the same
> thing. Any help would be great ly appreciated
>
>
> "Guogang" <nospam@no_such_domain.com> wrote in message
news:<Ovv5FGvADHA.2984@TK2MSFTNGP11.phx.gbl>...
> > 1. You need to export you certificate to DER encoded binary X.509 (.CER)
> > file. This is the only format the current .Net can recognize.
> > 2. In order to access certificate store, you need to install WSE (Web
> > Service Enhancement) 1.0 from Microsoft.
> >
> > "THR" <travis.robinson@oati.net> wrote in message
> > news:070801c2fee4$a2d2d580$3001280a@phx.gbl...
> > > I'm trying to access an https server that requires a
> > > client certificate.I'm trying this with .NET but I'm
> > > having trouble attaching the required client certificate
> > > to an HTTP request. I'm using the following code:
> > >
> > >
> > > X509Certificate cert;
> > > HttpWebRequest myHttpWebRequest = (HttpWebRequest)
> > > WebRequest.Create(url);
> > > X509CertificateCollection
> > > myCerts=myHttpWebRequest.ClientCertificates;
> > >
> > > // Some code to setup cert
> > >
> > > myCerts.Add(cert);
> > >
> > > I need to figure how you set the "cert" variable
> > > correctly. I am working with a .pfx certificate.
> > >
> > > Here are the things I tried.
> > > 1)cert= X509Certificate.CreateFromSignedFile
> > > (@"c:\certfile.pfx"); Error in creating cert
> > >
> > > 2)cert=X509Certificate.CreateFromCertFile
> > > (@"c:\certfile.pfx"); Error in creating cert
> > >
> > > 3)Converted .pfx to .cer file but could not export private
> > > key... cert=X509Certificate.CreateFromCertFile
> > > (@"c:\certfile.cer"); Created cert ok but server didn't
> > > like it I think because there was no private key.
> > >
> > > 4)Tried reading data from the .pfx into a byte array and
> > > user cert = new X509Certificate(byteArray); Error in
> > > creating cert
> > >
> > > 5) I did not try loading from Certificate Store...Does
> > > anyone know the class functions to do this?
> > >
> > > Thanks for any help.
> > >
> > >
- Next message: JohnF: "Socket Server on a PDC"
- Previous message: Ted: "Appearing Icons"
- In reply to: Dan Barker: "Re: Attaching client certificates to http request in .NET"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]