gpt4 book ai didi

java - 带有 goDaddy 证书的 Tomcat8.5 SSL 连接器

转载 作者:行者123 更新时间:2023-11-28 23:54:58 24 4
gpt4 key购买 nike

我已按照说明生成 key 和证书。我能够成功导入证书。我无法正确获取连接器。

这是步骤和消息。

  1. 生成 key

    keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore myKey.jks -dname "CN=dnsName.com
  2. 生成证书签名请求。

    keytool -certreq -alias server -file myCSR.csr -keystore myKey.jks 
  3. 从CA下载证书:复制myCSR内容,past到goDaddy,下载3个文件:serialNumber-root.crt, bundle-intermediate.crt, *.pem

  4. Tomcat Web 服务器 SSL 证书安装:

    keytool -import -alias root -keystore myKey.jks -trustcacerts -file serialNumber-root.crt
    keytool -import -alias intermed -keystore myKey.jks -trustcacerts -file bundle-intermediate.crt
    keytool -import -alias tomcat -keystore myKey.jks -trustcacerts -file serialNumber-root.crt

此时一切都成功了。

  1. 修改tomcat/conf/server.xml

一个。给我 java.lang.Exception: 无法加载证书 key E:\tomcat\certificate\myKey.jks (error:0906D06C:PEM routines:PEM_read_bio:no start line)

<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="E:\tomcat\certificate\myKey.jks"
certificateFile="E:\tomcat\certificate\serialNumber-root.crt"
certificateChainFile="E:\tomcat\certificate\serialNumber-root.crt"
type="RSA" />
</SSLHostConfig>
</Connector>

<Connector port="8443" scheme="https" secure="true" SSLEnabled="true" 
SSLCertificateFile="E:\tomcat\certificate\serialNumber-root.crt"
SSLCertificateKeyFile="myKey.jks"
SSLPassword="password"
SSLCertificateChainFile="E:\tomcat\certificate\serialNumber-root.crt"
keyAlias="server" SSLProtocol="TLSv1"/>

给我 java.lang.IllegalArgumentException: java.io.IOException: Alias name [server] does not identify a key entry

<Connector 
port="8443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="E:\tomcat\certificate\myKey.jks"
keystorePass="password"
keyAlias="server"
clientAuth="false" sslProtocol="TLS"
/>

java.lang.IllegalArgumentException:索引 2 处不透明部分中的非法字符:c:\certificate\myKey.jks

<Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" 
maxSpareThreads="150" scheme="https" secure="true" SSLEnabled="true"
clientAuth="false" sslProtocol="TLS" keyAlias="server"
keystoreFile="c:\certificate\myKey.jks"
keystorePass="password" />

最佳答案

您是否尝试过使用“org.apache.coyote.http11.Http11NioProtocol”而不是“org.apache.coyote.http11.Http11AprProtocol”?

    <Connector executor="tomcatThreadPool"
port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
<Connector
port="443"
protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true"
maxThreads="150"
scheme="https"
secure="true"
clientAuth="false"
sslProtocol="TLS"
keystoreFile="mySSL.jks"
keystorePass="changeit" />

关于java - 带有 goDaddy 证书的 Tomcat8.5 SSL 连接器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50124568/

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