Add wosign root certificate to JDK

Source: Internet
Author: User

For some "well-known" reasons, the Azure China version uses a domestic wosign certificate--and the infamous cnnic has a fight. Apple does not trust the Wosign certificate, which is why the certificate is not trusted when you access www.azure.cn in Mac OS. Similarly, the JDK does not see the goods, which leads to the "PKIX Path building failed" error when calling Azure China API in Java.

Because the JDK does not use the Windows operating system's certificate store, Windows is trusted wosign, but still requires the Wosign root certificate to be manually added to the trusted certificate store of the JDK.

To http://www. Wosign. com/root/index.htm Download Wosign root certificate (this domain name unexpectedly is the forbidden word of cnblogs ... )。

Add wosign Root certificate to JDK:

Keytool-keystore C:\Java8\jdk1. 8. 0_92\jre\lib\security\cacerts-importcert-alias wosign-file C:\Users\hunte\Deskto P\ws_ca1_new.cer

Command format:

Keytool-keystore [java_home directory]\jre\lib\security\cacerts-importcert-alias wosign-file [WoSign root certificate file location]

You see a prompt similar to the following to indicate that the root certificate was added successfully.

If an error occurs, check to see if the local Path environment variable contains "%java_home%\bin". In addition, the JDK and JRE are installed as far as possible not to install to the "program Files" directory, this directory of spaces often cause some inexplicable trouble.

After the root certificate has been added successfully, add a line before you need to call the Java code for the Azure China API:

System.setproperty ("Javax.net.ssl.trustStore", "c:\\java8\\jdk1.8.0_92\\jre\\lib\\security\\cacerts");

Note here that the second parameter is consistent with the certificate store location that was written when the root certificate was added earlier, and the directory-delimited backslash in the Windows environment is escaped (\ \).

After the above steps, calling the Azure Chinese version of the API in Java will work as expected.

Add wosign root certificate to JDK

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.