Tomcat 9 上的 SSL Windows 认证错误
SSL Windows Certification Error on Tomcat 9
我的服务器 Tomcat 7.0.108 启用了 SSL。我按照这个回答启用了
我在 serverx.xml 中的连接器是:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxHttpHeaderSize="65536"
maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
clientAuth="false"
sslProtocol="TLS"
keyAlias="tomcat"
keystoreFile=""
keystorePass=""
keystoreType="Windows-My">
</Connector>
但是,在Tomcat 9.0.45 中同样的配置有错误。
org.apache.tomcat.util.net.openssl.OpenSSLContext.init Error initializing SSL context
java.lang.NullPointerException
at java.util.Base64$Encoder.encode(Base64.java:261)
at java.util.Base64$Encoder.encodeToString(Base64.java:315)
at org.apache.tomcat.util.net.openssl.OpenSSLContext.addCertificate(OpenSSLContext.java:405)
at org.apache.tomcat.util.net.openssl.OpenSSLContext.init(OpenSSLContext.java:250)
是否有人使用 Windows 证书启用 Tomcat 9 的 SSL?
错误是由Tomcat选择的SSLImplementation
引起的:OpenSSLImplementation
需要直接访问私钥,如果使用Windows-MY
是不可能的密钥库。
你只需要切换到JSSEImplementation
,结果如下配置:
<Connector port="8443"
sslImplementationName="org.apache.tomcat.util.net.jsse.JSSEImplementation"
scheme="https" secure="true" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreType="Windows-MY"
certificateKeystoreFile=""
certificateKeyAlias="tomcat" />
</SSLHostConfig>
</Connector>
只要存在 Tomcat 本机库(这在 Windows 上很常见),sslImplementationName
的默认值会自动从 JSSEImplementation
切换到 OpenSSLImplementation
):比照。 Tomcat Documentation.
请注意,自 Tomcat 8.5 以来,SSL 配置语法已更改。您在问题中使用的那个已在 Tomcat 8.5 中弃用并从 Tomcat 10.0.
中删除
我的服务器 Tomcat 7.0.108 启用了 SSL。我按照这个回答启用了
我在 serverx.xml 中的连接器是:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxHttpHeaderSize="65536"
maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
clientAuth="false"
sslProtocol="TLS"
keyAlias="tomcat"
keystoreFile=""
keystorePass=""
keystoreType="Windows-My">
</Connector>
但是,在Tomcat 9.0.45 中同样的配置有错误。
org.apache.tomcat.util.net.openssl.OpenSSLContext.init Error initializing SSL context
java.lang.NullPointerException
at java.util.Base64$Encoder.encode(Base64.java:261)
at java.util.Base64$Encoder.encodeToString(Base64.java:315)
at org.apache.tomcat.util.net.openssl.OpenSSLContext.addCertificate(OpenSSLContext.java:405)
at org.apache.tomcat.util.net.openssl.OpenSSLContext.init(OpenSSLContext.java:250)
是否有人使用 Windows 证书启用 Tomcat 9 的 SSL?
错误是由Tomcat选择的SSLImplementation
引起的:OpenSSLImplementation
需要直接访问私钥,如果使用Windows-MY
是不可能的密钥库。
你只需要切换到JSSEImplementation
,结果如下配置:
<Connector port="8443"
sslImplementationName="org.apache.tomcat.util.net.jsse.JSSEImplementation"
scheme="https" secure="true" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreType="Windows-MY"
certificateKeystoreFile=""
certificateKeyAlias="tomcat" />
</SSLHostConfig>
</Connector>
只要存在 Tomcat 本机库(这在 Windows 上很常见),sslImplementationName
的默认值会自动从 JSSEImplementation
切换到 OpenSSLImplementation
):比照。 Tomcat Documentation.
请注意,自 Tomcat 8.5 以来,SSL 配置语法已更改。您在问题中使用的那个已在 Tomcat 8.5 中弃用并从 Tomcat 10.0.
中删除