Java imports the SSL certificate into the system KeyStore

Source: Internet
Author: User
Tags ssl certificate

Before you install Jira and confluence, you experience an issue with the application link after you configure the SSL certificate:

SSL certificates are not trusted, resulting in jira and confluence not being associated.

Tried a lot of ways to give up after a fruitless attempt.

Finally gave up ...

You think this post is over?

In fact, it does not, I just want to make up a word, let the article look fuller.

Because the solution I have found, and very simple.

Start knocking on the blackboard ——————————— below —————————————

1. Log in to the server, download the Installcert.java locally, and compile through Java:

# git clone https://github.com/escline/InstallCert.git# javac installcert.git

2. Access the server and retrieve the certificate in the format:

Java installcert [domain]:[port]

# java Installcert www.test.abcd.com:443Loading keystore/usr/local/jdk1.8.0_161/jre/lib/security/cacerts ... Opening connection to www.test.abcd.com:443...Starting SSL handshake .... Added certificate to KeyStore ' Jssecacerts ' using alias ' www.test.abcd.com-1 '

3. Extract the certificate from the created Jssecacerts KeyStore in the format:

Keytool-exportcert-alias [domain]-1-keystore jssecacerts-storepass changeit-file [domain name].cer

# Keytool-exportcert-alias www.test.abcd.com-1-keystore jssecacerts-storepass changeit-file Www.test.abcd.com.Certificate stored in file <www.test.abcd.com.cer>

4. Import the certificate into the system KeyStore in the following format:

Keytool-importcert-alias [domain name]-keystore [System keystore Path]-storepass changeit-file [domain name]. cer

# Keytool-importcert-alias Www.test.abcd.com-keystore/usr/local/jdk1.8.0_161/jre/lib/security/cacerts-storepass Changeit-file Www.test.abcd.com.cer ... Owner ...  Enter Yes    Trust this certificate? [No]:  Yescertificate was added to KeyStore

  

Note: If you encounter an error similar to the following when importing the certificate,

Keytool Error: java.lang.Exception: Certificate not imported, alias <www.test.abcd.com> already exists

I'm afraid I can't play anymore.

I didn't know what to do because I had this problem for the first time.

may wish to try "Keytool--help", the result let me see the-delete parameter, as if see a glimmer of hope.

So I tried again "Keytool-delete--help", found the-alias, then I know a smile, it seems to understand what, since can be imported, it can be deleted.

# Keytool-delete-alias Www.test.abcd.com-keystore/usr/local/jdk1.8.0_161/jre/lib/security/cacerts-storepass Changeit

No output? No output is the best output, try importing the command again:

# Keytool-importcert-alias Www.test.abcd.com-keystore/usr/local/jdk1.8.0_161/jre/lib/security/cacerts-storepass Changeit-file Www.test.abcd.com.cer

It worked! Jira and confluence operate the same way.

5. Finally, don't forget to restart a service. Login page to view again:

It can be said to be perfect ~

Java imports the SSL certificate into the system KeyStore

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.