Java web加密之將應用從http換成https的方法

來源:互聯網
上載者:User

標籤:密碼   xml配置   client   cli   項目   details   cto   加密   conf   

感謝文章http://blog.csdn.net/zhangzuomian/article/details/50324395 

 但未測試過,先記錄下

大致分2步:1、擷取認證。2、修改tomcat的config/server.xml和項目中web.xml配置

開啟config/server.xml,取消下面8443連接埠代碼的注釋,並修改如下:

<Connector port="8443"protocol="HTTP/1.1" SSLEnabled="true"     maxThreads="150" scheme="https" secure="true"       clientAuth="false"keystoreFile="D:/AppServer/Tomcat/apache-tomcat-6.0.32/conf/tomcat.keystore"       keystorePass="deleiguo" sslProtocol="TLS" />   

  註:
keystoreFile:認證檔案的位置,keystorePass 是keystore的密碼(你在產生認證的時候,會有的keystore密碼和tomcat主密碼)

項目中web.xml添加如下:、

<security-constraint>          <web-resource-collection>                 <web-resource-name>SSL</web-resource-name>                 <url-pattern>/*</url-pattern>          </web-resource-collection>           <user-data-constraint>                 <transport-guarantee>CONFIDENTIAL</transport-guarantee>          </user-data-constraint>   </security-constraint>  

  轉載自http://blog.csdn.net/rainyspring4540/article/details/68925073

 

Java web加密之將應用從http換成https的方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.