简体   繁体   English

Tomcat 7(7.0.10)上的SSL,此处我使用Thawte SGC证书

[英]SSL on tomcat 7 (7.0.10) here I am using Thawte SGC Certificate

I have problem configuring SSL on tomcat 7 (7.0.10) here I am using Thawte SGC Certificate , please read below description carefully help me out . 我在tomcat 7(7.0.10)上配置SSL时遇到问题,我在使用Thawte SGC证书,请仔细阅读以下说明,以帮助我。 I have followed below step 我已经按照以下步骤

1)Generated key using below command 1)使用以下命令生成密钥

keytool -genkey -keysize 2048 -alias test_self_certificate -keyalg RSA -keystore test_self_certificate.jks -validity 730

this command generated “ test_self_certificate.jks ” file in current folder 此命令在当前文件夹中生成“ test_self_certificate.jks ”文件

2)This generated CSR using below command 2)使用以下命令生成CSR

keytool -certreq -alias test_self_certificate -file my_application.csr -keystore test_self_certificate.jks

this command generated “ my_application.csr ” file in current folder 此命令在当前文件夹中生成“ my_application.csr ”文件

3)Then I have submitted this CSR to Thawte and got certificate from them in PKCS#7 format , I have copied that certificate text in notepad and saved that file as “ signed_certificate.p7b 3)然后我将此CSR提交给Thawte,并以PKCS#7格式从他们那里获得证书,我已将该证书文本复制到记事本中,并将该文件另存为“ signed_certificate.p7b

4)Then i created New JKS keystore and imported certificate received from Thawte using below command 4)然后我创建了新的JKS密钥库并使用以下命令从Thawte接收了导入的证书

keytool -import -alias signed_cert -trustcacerts -file signed_certificate.p7b -keystore tomcat_application.jks

this command generated “tomcat_application.jks ” file in current folder 此命令在当前文件夹中生成“ tomcat_application.jks ”文件

5)I have update tomcat server.xml as below ( I have provided correct .jks file path and keystore password ) 5)我更新了tomcat server.xml,如下所示(我提供了正确的.jks文件路径和密钥库密码)

<Connector port="8001" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
                            maxThreads="150" scheme="https" secure="true"
               keystoreFile="/export/home/parsupport/Tomcat_certs/ tomcat_application.jks " keystorePass="parlive" clientAuth="false" sslProtocol="TLS" /> 

6)After this change when I start Tomcat I get below Exception and tomcat does not start with SSL 6)在完成此更改后,当我启动Tomcat时,出现以下异常,并且tomcat无法以SSL开头

Caused by: javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL cipher suites which are enabled.
    at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.checkEnabledSuites(SSLServerSocketImpl.java:310)
    at com.sun.net.ssl.internal.ssl.SSLServerSocketImpl.accept(SSLServerSocketImpl.java:255)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.checkConfig(JSSESocketFactory.java:774)

Important Note : but if I import certificate received from Thawte in keystore (test_self_certificate.jks -- mentioned as first step above) that I have created to generate KeyPair and CSR , and use that keystore to configure tomcat (as described in step 6 as above ) then Tomcat start in SSL mode but when in try to launch HTTPS URL I get untrusted certificate warning . 重要说明:但是,如果将我从Thawte接收到的证书导入到我创建的用于生成KeyPair和CSR的密钥库中(test_self_certificate.jks-上面提到的第一步),并使用该密钥库配置tomcat(如上述步骤6中所述) ),然后Tomcat以SSL模式启动,但是在尝试启动HTTPS URL时,出现不可信证书警告。

 keytool -genkey -keysize 2048 -alias test_self_certificate [...] 

Here, -genkey generates a public/private key pair and stores in into the "test_self_certificate" alias entry, thereby making this a private key entry. 在此, -genkey生成一个公共/专用密钥对,并将其存储在“ test_self_certificate”别名条目中,从而使其成为专用密钥条目。 (If you use keytool -list , you'll see some private key entries and some certificate entries). (如果使用keytool -list ,则会看到一些私钥条目和一些证书条目)。 -genkey also generates a self-signed certificate to associate with this private key automatically (this is also how the public key is effectively stored by default). -genkey还会生成一个自签名证书,以自动与此私钥关联(这也是默认情况下有效存储公钥的方式)。

 keytool -import -alias signed_cert [...] 

If you get a certificate issued for a private key that is stored in a keystore, you need to store this certificate against the right private key entry, not just any entry. 如果您获得针对存储在密钥库中的私钥颁发的证书,则需要针对正确的私钥条目(而不只是任何条目)存储此证书。 Here, you should have used -alias test_self_certificate instead (which may also mean that it wasn't the best choice of alias name, but that's just a detail). 在这里,您应该使用-alias test_self_certificate代替(这也可能意味着它不是别名的最佳选择,但这只是一个细节)。 (In some cases, you may also need to make sure you import the full chain .) (在某些情况下,您可能还需要确保导入完整链 。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM