Importing Self-Signed Certificates into Java Keystore for Universal Trust
To establish a default trust for a self-signed certificate in all Java applications, it is necessary to import the certificate into the Java keystore, accessible to all Java programs.
Instructions for Windows
Using Portecle is the most straightforward method:
- Download and install Portecle.
- Determine the JRE or JDK used by your program.
- Copy JAVA_HOMElibsecuritycacerts to a separate location.
- Open cacerts in Portecle (File > Open Keystore File) with the password "changeit".
- Import the certificate from the .pem file (Tools > Import Trusted Certificate).
- Accept the trust path warning and the certificate details.
- Provide an alias and click "OK".
- Save the changes by overwriting the original cacerts file.
Instructions for Linux
Alternatively, for Linux systems, follow these steps:
- Retrieve the SSL certificate from a trusted server using OpenSSL.
- Verify the certificate information (optional).
- Import the certificate into the Java keystore using keytool, providing the keystore location, password, alias, and certificate file.
The above is the detailed content of How to Import Self-Signed Certificates into the Java Keystore for Universal Trust?. For more information, please follow other related articles on the PHP Chinese website!