Using a Java Keytool created certificate in HTTPWebRequest.ClientCertificates



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
.



Relevant Pages

  • Re: Connect AD Server 636 to access LDAP SSL
    ... Because i was able to install the cert to the keystore of java and was ... The problem is with windows certificate ... ...
    (microsoft.public.windows.server.active_directory)
  • Re: Outllook over http, sharepoint versions, and www publishing se
    ... Install the cert by browsing to the specific trusted root and install it there. ... The name on the security certificate is invalid or does not match the name of the target site mydomain.com. ... Let me reiterate - the certificate works for everything except Outlook over http. ... And, if I stop the World Wide Web Publishing Service, then Outlook over http WILL work. ...
    (microsoft.public.windows.server.sbs)
  • Re: Connect AD Server 636 to access LDAP SSL
    ... Because i was able to install the cert to the keystore of java and was ... The problem is with windows certificate ... ...
    (microsoft.public.windows.server.active_directory)
  • Re: RPC over HTTP
    ... Where did you install it *to*? ... Are you getting a certificate prompt when you open OWA from outside the ... network rpc over http works. ... when outside the network rpc over http fails - I am assuming this ...
    (microsoft.public.exchange.setup)
  • Re: remote access to email
    ... Have you ensured that the certificate is ... over HTTP will work. ... then you just need to install the cert on each tablet. ...
    (microsoft.public.windows.server.sbs)

Quantcast