Using a Java Keytool created certificate in HTTPWebRequest.ClientCertificates
- From: bigAPE <alex.maddern@xxxxxxxxx>
- Date: Wed, 3 Dec 2008 14:07:13 -0800 (PST)
I am writing some code to connect to a custom Java HTTP server. I have
a working version where I POST in a multi-part form including a file,
etc, using HTTPWebRequest. Works fine via HTTP, however I now want to
ge tit working over HTTPS.
The instructions to enable HTTPS on this custom server require you to
install a certificate created using the Java Keytool with the
following parameters
keytool -selfcert -genkey -keystore certs -alias myalias -dname
"cn=www.somedomain.com,ou=SomeUnit,o=Some
Pty.Ltd.,l=Melbourne,st=Victoria,c=AU" -keyalg "RSA" –validity 365
In the above example command line I have replaced the alias and dname
with some other non-relevant text but apart from that it's all
correct.
The output is a file called "certs" which I then install into the HTTP
engine. This all seems to work fine.
However, I can't quite figure out how to get the "certs" keystore
installed on my Vista client so that the following code can read it
string certificateName = "SomeCertName";
X509Store store = new X509Store(StoreName.My,
StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certificates = store.Certificates.Find
(X509FindType.FindBySubjectName, certificateName, true);
X509Certificate certificate = certificates[0];
webRequest.ClientCertificates.Add(certificate);
I have looked everywhere for some information on this, but the best I
could come up with was installing the certificate using "Internet
Options > Content > Certificates > Import..." but this requires the
"certs" keystore file to be of a certain type when importing and I
can't work out which.
Am I going about this in the wrong way? Can anyone point me at a good
resource for this kind of stuff ? At the very least does anyone know
which type of Certificate the Java Keytool creates ?
Any help very much appreciated
Al
.
- Follow-Ups:
- Prev by Date: Re: Don't understand System.Security.SecurityException
- Next by Date: Re: Using a Java Keytool created certificate in HTTPWebRequest.ClientCertificates
- Previous by thread: Don't understand System.Security.SecurityException
- Next by thread: Re: Using a Java Keytool created certificate in HTTPWebRequest.ClientCertificates
- Index(es):
Relevant Pages
|