Tomcat中的SSL 7

问题描述:

我试图按照本地应用程序的setting up SSL in Tomcat 7的说明操作。我真的不明白我在这里做什么,所以请原谅我的方法。我创建了一个密钥存储,像这样:Tomcat中的SSL 7

keytool -genkey -alias tomcat -keyalg RSA 
Enter keystore password: changeit 
Re-enter new password: changeit 
What is your first and last name? 
    [Unknown]: Robert Bram 
What is the name of your organizational unit? 
    [Unknown]: Developers 
What is the name of your organization? 
    [Unknown]: MyBusiness 
What is the name of your City or Locality? 
    [Unknown]: Melbourne 
What is the name of your State or Province? 
    [Unknown]: Victoria 
What is the two-letter country code for this unit? 
    [Unknown]: AU 
Is CN=Robert Bram, OU=Developers, O=MyBusiness, L=Melbourne, ST=Victoria, C=AU correct? 
    [no]: yes 

Enter key password for <tomcat> 
     (RETURN if same as keystore password): 

我加入一个连接器端口,以我的server.xml:

<Connector port="8443" maxThreads="200" 
     scheme="https" secure="true" SSLEnabled="true" 
     keystoreFile="${user.home}/.keystore" keystorePass="changeit" 
     clientAuth="false" sslProtocol="TLS"/> 

我导出的证书:

keytool -export -alias tomcat -file tomcatcertfile.cer 
Enter keystore password: changeit 
Certificate stored in file <tomcatcertfile.cer> 

我重新启动Tomcat的。我在IE中加载我的应用程序https://localhost:8443/blah/myapp。它显示证书错误。

我点击地址栏中的“证书错误”>点击查看证书>点击安装证书>下一步>勾选将所有证书放入下列存储区>点击浏览>点击信任的根证书颁发机构>下一步>完成>是>确定>确定。

现在,当我转到页面时,我看到“本网站提供的安全证书是针对不同网站的地址发布的”。

那么..我究竟做错了什么?

感谢您的任何建议!

罗布 :)

,而不用输入你的名字,输入服务器的主机名。

+0

谢谢 - 就是这样。 :) –

+0

我有一个问题..如果我先安装证书,它永远不会工作。它只适用于如果我去IE浏览器,看到错误,然后安装证书。这是为什么? –

+1

我写了这个:[获取HTTPS在Tomcat上为localhost工作](http://robertmarkbramprogrammer.blogspot.com/2011/09/get-https-to-work-for-localhost-on.html)。 –