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 get it 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
