【问题标题】:TOMCAT 6 SSL Error: Alias name does not identify a key entryTOMCAT 6 SSL 错误:别名不能识别密钥条目
【发布时间】:2018-02-24 12:02:05
【问题描述】:

我正在尝试在收到 CA 后配置密钥库。 我收到了一份中间 CA 和 CA。我已使用此命令导入它们

keytool -delete -alias tomcat -keystore B1i.keystore

keytool -import -alias root -keystore ".\B1iXcellerator\B1i.keystore" -trustcacerts -file ".\B1iXcellerator\int.crt"

keytool -import -alias tomcat -keystore ".\B1iXcellerator\B1i.keystore" -trustcacerts -file ".\B1iXcellerator\ssmobile2.crt"

您的访问密钥文件包含 2 个条目

root,2017 年 9 月 14 日,trustedCertEntry, Empreinte du certificat (SHA1) : 55:83:E3:E1:A7:51:17:21:1E:AF:C8:5E:D1:15:BB:C1 :AC:96:9D:B5

tomcat,2017 年 9 月 14 日,trustedCertEntry, Empreinte du certificat (SHA1) : DF:1C:D4:79:02:D5:59:D2:94:1D:DE:D5:73:99:2D:1A :25:09:BC:49

在 server.xml 中我改变了这个:

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" keystoreFile="./webapps/B1iXcellerator/B1i.keystore" keyAlias="tomcat" keystorePass="******"/>

但我得到了错误 LifecycleException: service.getName(): "Catalina";协议处理程序启动失败:java.io.IOException:别名 tomcat 无法识别密钥条目

我做错了什么?

【问题讨论】:

    标签: tomcat ssl


    【解决方案1】:
    keytool -delete -alias tomcat -keystore B1i.keystore
    

    您可能通过此步骤删除了您的私钥。您应该省略这一步,并在接下来的步骤中使用tomcat 唉:见下文。

    keytool -import -alias root -keystore ".\B1iXcellerator\B1i.keystore" -trustcacerts -file ".\B1iXcellerator\int.crt"
    keytool -import -alias tomcat -keystore ".\B1iXcellerator\B1i.keystore" -trustcacerts -file ".\B1iXcellerator\ssmobile2.crt"
    

    除非已经有一个别名为“root”的私钥条目,否则这些步骤不会产生预期的效果。

    您可能不得不重新开始,生成一个新的密钥对、一个新的 CSR,然后重新签名。这一次,不带 -trustcacerts 选项导入签名证书,使用与密钥对相同的别名,并导入根证书 -trustcacerts 和不同的别名(谢谢@dave_thompson_085)。

    当你不知道它们是什么时,不要删除它们。

    【讨论】:

    • int.crt 可能是作为trustedcert 导入的中间体,因此its 别名“root”不应该存在;它是此处用于(新)叶证书“tomcat”的别名,它必须存在并且是/包含私钥。
    • 所以我申请了一个新证书,我只需执行 keytool -import -alias tomcat -keystore ".\B1iXcellerator\B1i.keystore" -trustcacerts -file ".\B1iXcellerator\int.crt" keytool -import -alias tomcat -keystore ".\B1iXcellerator\B1i.keystore" -trustcacerts -file ".\B1iXcellerator\ssmobile2.crt"?它是如何工作的,他们怎么知道哪个是中间体和 CA?
    • 我按照你说的做了,但是我得到了以下错误:keytool error: java.lang.Exception: Public keys in reply and keystore don't match when trying to import the intermediate certificate
    • 好的,我重新开始了。现在我有一个别名为 tomcat 的 PrivateKEYEntry。我无法使用别名 tomcat 导入中间和 CA,所以我使用其他别名导入。导入成功。现在我在密钥库中有 3 个条目。但它仍然不起作用(浏览器中的验证错误)这是日志文档中的错误 Protocol handler start failed: java.io.IOException: Alias name tomcat does not identify a key entry
    • 所以您仍然没有别名为“tomcat”的PrivateKeyEntry。这就是错误信息的含义。您的 cmets 中没有足够的信息来进一步研究。
    猜你喜欢
    • 2012-02-06
    • 2021-07-16
    • 2013-07-09
    • 2012-07-03
    • 2018-07-01
    • 2018-05-06
    • 2013-09-12
    • 2014-03-11
    • 2012-02-08
    相关资源
    最近更新 更多