Replace SSL certificate authentication Issue--Configuration version

Source: Internet
Author: User
Tags ssl certificate

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.