1. 程式人生 > 其它 >在JDK11環境中,安裝GoDaddy SSL證書

在JDK11環境中,安裝GoDaddy SSL證書

技術標籤:JAVAjdk11

問題:JDK無法識別GoDaddy SSL證書

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
 at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:441)
 at javax.mail.Service.connect(Service.java:233)
 at javax.mail.Service.connect(Service.java:134)

1、GoDaddy SSL證書

godaddy認證

2、下載指定證書

curl --location --remote-name --silent 'https://certs.godaddy.com/repository/gdroot-g2.crt'
curl --location --remote-name --silent 'https://certs.godaddy.com/repository/gdig2.crt'

3、匯入指定證書

keytool -import -noprompt -file gdroot-g2.crt -alias gdroot-g2 -trustcacerts -keystore "/usr/local/openjdk-11/lib/security/cacerts" -storepass changeit

4、檢視指定證書

keytool -list -alias gdroot-g2 -keystore "/usr/local/openjdk-11/lib/security/cacerts" -storepass changeit