I'm trying to test a HTTPS SSL connection from my local machine as I'm facing some issues implementing the same in my server.
Steps I followed
I downloaded the third party HTTPS server SSL certificate from the browser (DER format) and I see its issued by Comodo RSA
I tried to import the key as .jks with the command from the command prompt, but it failed with the error 'certificate.jks file not found'/ keytool -importcert -alias testCert -file c:\desktop\testCert.cer -keystore "C:\Program Files\Java\jre1.6.0\lib\security\certificate.jks" -storepass changeit
So I googled and created the keystore with the command
keytool -genkey -alias mykey -keystore "C:\Program Files\Java\jre1.6.0\lib\security\certificate.jks"
And now I executed the same command (step 2), which ran successfully. I could even list and see the certificate in certificate.jks file.
But when I try to access the certificate.jks in my java program as the keystore, it fails with the error 'file not found - certificate.jks'.
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(new FileInputStream ("C:/Program Files/Java/jre1.6.0/lib/security/certificate.jks"), passw );
Please clarify what am I doing wrong here.
Also, I'm trying not to use cacerts since it gets refreshed automatically in my server. And I beleive if I create my own .jks, it won't get refereshed. Please help.
Thanks