How do you import an SSL certificate created by java into a project in Eclipse?
Right-click on the certificate you want to backup and select ALL TASKS > Import. Follow the certificate import wizard to import your primary certificate from the . pfx file. When prompted, choose to automatically place the certificates in the certificate stores based on the type of the certificate.
Probably you want to import a "fake" SSL cert in JRE's trustcacerts for avoiding not-a-valid-certificate issues. Isn't it?
As Jon said, you can do the job with keytool:
keytool -import -alias <provide_an_alias> -file <certificate_file> -keystore <your_path_to_jre>/lib/security/cacerts
Use "changeit" as the default password when asked (thanks Brian Clozel). Ensure to use this runtime at your server or launch configuration.
In case you have the certificate already in your Windows' certificate store (this is common in company deployments with MITM certificates), you can also use the following steps (with help from another Stackoverflow answer with more detailed explaination):
Locate the eclipse.ini
file in your Eclipse installation and open it
Below the line -vmargs
, add the following lines, then save the file:
-Djavax.net.ssl.trustStore=NUL -Djavax.net.ssl.trustStoreType=Windows-ROOT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With