Trusting A Certificate

How to make JDK trust a Certificate 

 How to copy a certificate to your disk? 

  1. Hit the HTTPS URL, it would pup up a Security Alert window - that means browser doesn’t trust the certificate that site has. 
  1. Click on View Certificate button on that window. 
  1. Click on Install Certificate…
  1. Follow the default options and finish the task. 
  1. Go to Tools -> Internet Options -> Content -> Certificates…
  1. You can see recently installed certificate in Intermediate Certificate Authority tab. 
  1. Select the certificate you want to export and click on Export...
  1. Follow the default options, give the name & location for the cer file and save it at your disk.


 How to make a certificate trusted by JDK? 

  1. To make a certificate trusted by a JDK, it has to added to JRE’s trust keystore. 
  1. To view the trusted certificate list, go to JRE’s security folder (jre1.5.0_06\lib\security) and issue following command: keytool -list -keystore cacerts
  1. To add a certificate in this list: keytool -import -alias mycert -keystore cacerts -file d:\mycert.cer
  1. The default password for cacerts is changeit.