在Glassfish Application Server中导入SSL证书

问题描述 投票:0回答:3

我正在尝试在Netbeans IDE上的项目上启用SSL并使用Glassfish应用程序服务器。

对于SSL;我按照下面的程序。

  1. 生成密钥库> keytool -genkey -alias client_keystore -keyalg RSA -keystore client_keystore.jks -keysize 2048
  2. 生成CSR> keytool -certreq -alias client_keystore -file yourcsrname.csr -keystore client_keystore.jks
  3. 将CSR提交给另一方。
  4. 从聚会上收到三张.pem证书。我将.pem转换为.crt为openssl x509 -outform der -in your-cert.pem -out your-cert.crt
  5. 将证书导入我的密钥库,如下所示;

keytool -import -trustcacerts -alias intermediate -file GoDaddy_Intermediate.crt -keystore client_keystore.jks

keytool -import -trustcacerts -alias root -file GoDaddy_Root.crt -keystore client_keystore.jks

keytool -import -trustcacerts -alias BizSwitch -file BizSwitch.crt -keystore client_keystore.jks

  1. 将密钥库导入默认的glassfish密钥库> keytool -importkeystore -srckeystore ~/Downloads/ipay/client_keystore.jks -destkeystore keystore.jks
  2. 重启glassfish服务器。

我不确定这是否全部,但我得到了sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target例外。

重新启动时,从glassfish日志中我看不到加载的证书。

我错过了什么吗?

java ssl-certificate netbeans-8 glassfish-4
3个回答
0
投票

你的密钥库是在/ domains / domain1 / config文件夹中吗?

看起来像glassfish没有指向正确的密钥库,因为您正确导入了证书。


0
投票

您在别名client_keystore下创建了密钥对条目,因此您需要将服务器证书导入该别名和条目。假设BizSwitch是您的服务器名称,您需要-importcert -file BizSwitch.crt -alias client_keystore -keystore client_keystore.jks。如果你弄错了那个命令的输出应该是Certificate reply was installed NOT Certificate was added。 (后者适用于单独的CA证书,但不适用于服务器证书。)

此外,您不需要转换为DER。 keytool(或者更确切地说是CertificateFactory)已经能够阅读PEM证书超过十年,甚至是自2012年j7以来的PEM-comments评论。(对于其他一些加密对象,例如私钥,情况并非如此。)


© www.soinside.com 2019 - 2024. All rights reserved.