如何使用PKCS12密钥库以SSL模式运行Jetty服务器? [英] How to run jetty server in SSL mode using PKCS12 keystore?
问题描述
我正在尝试使用PKCS12密钥库以SSL模式运行Jetty Web服务器.代码如下:
Jetty能够正常运行.但是,当我尝试在Web浏览器中使用https连接到jetty时,会收到以下消息. javax.net.ssl.SSLHandshakeException:没有通用的密码套件
但是,如果我使用JKS密钥库文件,则可以使用https连接到码头服务器. 谁能告诉我使用JKS以外的其他密钥库类型时可能是问题所在,或者需要注意哪些事情.
有两个使用KeyStore
中的私钥的密码:商店密码和密钥密码.对于PKCS#12密钥库,该商店和密钥的密码相同.
密钥库的密码是通过SslSelectChannelConnector
中的setPassword(String)
设置的.尝试添加此内容:
connector.setPassword(keyPass);
I am trying to run jetty web server in SSL mode using PKCS12 keystore. The code is as follows:
import org.mortbay.jetty.Server; import org.mortbay.jetty.security.SslSelectChannelConnector;
class MyClass { public static void main(String[] args) { Server server = new Server(); SslSelectChannelConnector connector = new SslSelectChannelConnector(); connector.setKeystore(keyStore); connector.setKeyPassword(keyPass); connector.setKeystoreType("PKCS12"); server.addConnector(connector); server.start(); } }
Jetty is able to run correctly. But when I try to connect to jetty using https in a web browser, I get the following message. javax.net.ssl.SSLHandshakeException: no cipher suites in common
But if I use a JKS keystore file, I am able to connect to jetty server using https. Can anyone tell me what could be the problem or what things need to be taken care while using keystore types other than JKS.
There are two passwords to use a private key from a KeyStore
: the store password and the key password. For PKCS#12 keystores, the password is the same for the store and the key.
The keystore's password is set via setPassword(String)
in SslSelectChannelConnector
. Try adding this:
connector.setPassword(keyPass);
这篇关于如何使用PKCS12密钥库以SSL模式运行Jetty服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!