How to import a security certificate into the Cacerts certificate library in Java

Source: Internet
Author: User

How to import a security certificate into the Java Cacerts certificate store prompt:
Javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX Path Building failed: Sun.security.provider.certpath.SunCertPathBuilderException:unable to find valid certification path to requested target

Every step: Go to a website that starts with a https://www.xxx.com, download the certificate you want to import,
On the page, right-click >> properties >> Tap Certificates >>
Then click on the "more info" Toggle bar above >>
Then click on the "Copy to File" button in the lower right corner.
It will pop up a Certificate Export Wizard dialog box, follow the prompts step by step to complete the line.
For example: Save As Wcceca.cer, placed under D-disk

The second step: How to import the above step (wcceca.cer) This certificate into the Cacerts certificate library in Java?

For example: My JDK installs this directory in

C:\Program files\java\jdk1.8.0_131

Start >> run >> input cmd into DOS command line >>
Then use the CD to enter the C:\Program files\java\jdk1.8.0_131\jre\lib\security directory.
Enter the following command to execute

Keytool-import-alias Cacerts-keystore Cacerts-file D:\wcceca.cer

You just typed in Changeit, which is the default password for the Cacerts certificate store in Java,

use after import -list View

Keytool-list-keystore Cacerts

When you update later, delete the original certificate, and then import the new certificate
Keytool-delete-alias Akazam_email-keystore Cacerts
Keytool-import-alias akazam_email-file Akazam_email.cer-keystore Cacerts

Note that if there are spaces in the java_home settings, Java execution errors can be java_home in the C: \ ProgramFiles in the environment variable c:\progra~1

Ext.: https://www.cnblogs.com/jpt00/p/6915586.html

How to import a security certificate into the Cacerts certificate Library in Java (GO)

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.