gpt4 book ai didi

java - 在 tomcat 中安装 GoDaddy SSL 证书...没有证书与私钥匹配

转载 作者:行者123 更新时间:2023-11-28 23:20:31 27 4
gpt4 key购买 nike

生成 Tomcat keystore

keytool -keysize 2048 -genkey -alias tomcat -keyalg RSA -keystore
tomcat.keystore

生成证书 keystore

keytool -genkey -alias tomcatCert -keyalg RSA -keystore tomcat.keystore

生成 key

keytool -certreq -alias tomcat -file csr.txt -keystore tomcat.keystore -storepass pa$$word

合并证书

cat mydomain.crt gd_bundle-g2-g1.crt > combinedcerts

创建 P12 keystore

keytool -importkeystore -srckeystore tomcat.keystore -destkeystore tomcatkey.p12 -deststoretype PKCS12 -storepass pa$$word

生成PEM

openssl pkcs12 -in tomcatkey.p12 -out tomcatkey.pem -nodes

正在将剩余的 CRT 文件导出到 keystore ...

openssl pkcs12 -export -chain -CAfile gd_bundle-g2-g1.crt -in combinedcerts -inkey tomcatkey.pem -out new.tomcat.keystore -name tomcat -passout pass:pa$$word

在这最后一步中,我收到以下错误:“没有证书与私钥匹配

同样的步骤在几年前就奏效了,服务器是一样的...只有 JDK 是 8u131 和以前的 8u45。

有人可以指导我我可能做错了什么吗?谢谢!

最佳答案

Generate the Tomcat KeyStore

keytool -keysize 2048 -genkey -alias tomcat -keyalg RSA -keystore
tomcat.keystore

没有。这一步创建了 keystore 文件,但更重要的是它创建了 RSA 类型的 key 对。

Generate the Certificate KeyStore

keytool -genkey -alias tomcatCert -keyalg RSA -keystore tomcat.keystore

没有。此步骤不会“生成证书 keystore ”,无论它应该是什么。除了在 相同 keystore 中以另一个别名创建另一个 key 对外,它什么都不做,并且在整个过程的其余部分中别名保持未使用状态。通过检查,它与上一步相同,除了毫无意义的别名更改和丢失的 key 大小,这使得它变得毫无用处。省略。

Generate the Keys

keytool -certreq -alias tomcat -file csr.txt -keystore tomcat.keystore -storepass pa$$word

您已经在第一步中生成了 key 。此步骤生成证书签名请求 (CSR)。

Merge certs

cat mydomain.crt gd_bundle-g2-g1.crt > combinedcerts

此处缺少您提交 CSR 并签署的步骤。据推测,此过程的结果是 mydomain.crt 和 Godaddy 捆绑文件。

Create P12 keystore

keytool -importkeystore -srckeystore tomcat.keystore -destkeystore tomcatkey.p12 -deststoretype PKCS12 -storepass pa$$word

为什么?如果您想要 P12 keystore ,您可以在步骤 1 和后续步骤中使用 -storetype PKCS12。这里缺少一个步骤,您将串联的证书导入回原始 keystore 。

Generate PEM

openssl pkcs12 -in tomcatkey.p12 -out tomcatkey.pem -nodes

为什么?

Exporting remaining CRT files to keystore...

openssl pkcs12 -export -chain -CAfile gd_bundle-g2-g1.crt -in combinedcerts -inkey tomcatkey.pem -out new.tomcat.keystore -name tomcat -passout pass:pa$$word

为什么?

我不知道您为什么要执行这些 OpenSSL 步骤。 Tomcat 已经可以处理 tomcat.keystoretomcat.p12 了。

And in this last step I'm getting the following error: "No certificate matches private key"

我不知道您为什么要执行这些步骤中的大部分。您从不使用 tomcatCert 别名,而是通过三个更无意义的步骤放置一个已经完全足够的 tomcat.keystore 文件。

This same steps worked a couple of years ago, server is the same... only JDK is 8u131 vs 8u45 from before.

我怀疑。它们贴错标签、多余、不完整且完全不连贯。更可能的是,有人只是无助地四处乱窜,直到某件事奏效,然后尽可能多地写下他们能记住的东西。根本不需要使用 OpenSSL 工具。您只需要:

  1. 生成 key 对:keytool -genkey
  2. 生成 CSR:keytool -certreq
  3. 签署 CSR。
  4. 连接证书,首先是您新签署的证书,然后是 bundle 。
  5. 使用与 (1) 和 (2) 相同的别名将串联文件导入相同的 keystore 。

关于java - 在 tomcat 中安装 GoDaddy SSL 证书...没有证书与私钥匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44468553/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com