播放2.1 SSL配置 [英] Play 2.1 SSL Configuration
问题描述
我是Play的新手,也是为生产配置SSL的新手。我可以使用自签名证书在开发模式下成功运行,但是当我尝试使用签名证书时,初始客户端握手失败并且Play生成以下堆栈跟踪:
I'm new to Play and in the process of configuring SSL for production. I can successfully run in dev mode with a self signed certificate, but when I try to use a signed certificate the initial client handshake fails and Play generates the following stack trace:
play - Error loading HTTPS keystore from conf/keystore.jks
java.security.NoSuchAlgorithmException: RSA KeyManagerFactory not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159) ~[na:1.7.0_11]
at javax.net.ssl.KeyManagerFactory.getInstance(KeyManagerFactory.java:139) ~[na:1.7.0_11]
at play.core.server.NettyServer$PlayPipelineFactory$$anonfun$sslContext$1.apply(NettyServer.scala:74) [play_2.10.jar:2.1.1]
at play.core.server.NettyServer$PlayPipelineFactory$$anonfun$sslContext$1.apply(NettyServer.scala:62) [play_2.10.jar:2.1.1]
at scala.Option.map(Option.scala:145) [scala-library.jar:na]
at play.core.server.NettyServer$PlayPipelineFactory.sslContext$lzycompute(NettyServer.scala:62) [play_2.10.jar:2.1.1]
我正在运行Play 2.1.1和Java 1.7.0_11。我已经按如下方式配置了ssl支持:
I'm running Play 2.1.1 and Java 1.7.0_11. I've configured ssl support as follows:
//生成一个csr
//generate a csr
keytool -certreq -alias server -keyalg RSA -file server.csr -keystore keystore.jks
//加载root和中间证书
//load root and intermediate certs
keytool -import -alias godaddy -keystore keystore.jks -file gd_bundle.crt
//加载签名证书
keytool -import -alias server -keystore keystore.jks -file server.crt
//启动播放系统参数运行ssl
//launch play with system parameters to run ssl
sudo ../../jars/play-2.1.1/play -Dhttps.port=443 -Dhttps.keyStore="conf/keystore.jks" -Dhttps.keyStorePassword=REDACTED -Dhttps.keyStoreAlgorithm="RSA" run
有谁知道java.security.NoSuchAlgorithmException:RSA KeyManagerFactory如何不可用错误?
Does anyone know how java.security.NoSuchAlgorithmException: RSA KeyManagerFactory not available error?
推荐答案
删除 -Dhttps.keyStoreAlgorithm = RSA
来自你的命令。 @gma是对的,这是密钥库的算法,而不是密钥。
Remove the -Dhttps.keyStoreAlgorithm=RSA
from your command. @gma is right, this is the algorithm for the key store, not the key.
我使用以下命令用我生成的密钥启动我的播放应用程序:
I used the following commands to start my play application with a key I generated:
keytool -genkey -alias MyKey -keyalg RSA -keysize 2048 -keystore keystore.jks
play -Dhttps.port=9443 -Dhttps.keyStore=keystore.jks -Dhttps.keyStorePassword=password run
然后我的浏览器指向 https:// localhost:9443
这篇关于播放2.1 SSL配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!