As I mentioned earlier, I was confronted with the problem of replacing SSL certificates, and the first thing I found was to use code to mask SSL authentication.
In this way, all validation is skipped, which is equivalent to agreeing to all SSL certificates.
This is obviously not appropriate ... So I started looking for a way back. Import the SSL certificate into the library of the JRE ... In this way, you can manage your own certification certificate.
First step, download security certificate
View the certificate in the browser (preferably in IE browser) ... In the details bar, click Copy Files.
Select Base64 encoding ... Click Next!
Export the generated certificate!
Step two, import the certificate into the Java Cacerts Certificate Library
Log on to the machine where Tomcat resides, switch to directory ${java_home}/jre/lib/security, and execute the following command:
Keytool-import-alias Test-keystore Cacerts-file ${java_home}/jre/lib/security/test.cer
which
-alias Specify alias (recommended and certificate with the same name)
-keystore Specify storage file (fixed here)
-file specify the full path to the certificate file (the directory where the certificate file resides)
Note: When you switch to the directory where the Cacerts file is located, you can specify-keystore cacerts, otherwise you should specify a full path;
At this point the command line prompts you to enter the Cacerts Certificate library password, type Changeit, this is the Java Cacerts Certificate Library default password, of course, can also be modified.
You can view certificate information using the following command:
Keytool-list-keystore Cacerts-alias Test
To update the certificate, you should delete the original certificate and then import the new certificate:
CD ${java_home}/jre/lib/security
keytool-delete-alias test-keystore cacerts
keytool-import-alias test- KeyStore cacerts-file ${java_home}/jre/lib/security/test.cer
keytool-list-keystore cacerts-alias test
Reference: http://www.mamicode.com/info-detail-99920.html