美文网首页
给web项目添加安全证书

给web项目添加安全证书

作者: 测试老杨 | 来源:发表于2018-11-06 19:25 被阅读128次

    HTTP的缺点

    通信使用明文(不加密),内容可能会被窃听
    不验证通信方的身份,因此有可能遭遇伪装
    无法证明报文的完整性,所以有可能已遭篡改

    什么是HTTPS

    为了解决 HTTP 协议的以上缺点,网景(NetScape)公司设计了 SSL 协议。SSL 是“Secure Sockets Layer”的缩写,中文叫做“安全套接层”。
    所谓的 HTTPS 其实是“HTTP over SSL”或“HTTP over TLS”,它是 HTTP 与 SSL/TSL 的结合使用而已。
    参考资料:
    https://www.jianshu.com/p/21f8189edc7b

    给myerp网站添加证书的步骤

    1、使用jdk提供的keytool工具生成证书

    keytool -genkey -alias "tomcat" -keyalg "RSA" -keystore "d:\mykeystore" -dname "CN=localhost, OU=localhost, O=localhost, L=SH, ST=SH, C=CN "-keypass "changeit" -storepass "changeit"
    
    image.png

    2、eclipse里面修改tomcat的配置文件server.xml(支持HTTPS连接)

    <Connector SSLEnabled="true" acceptCount="100" clientAuth="false" disableUploadTimeout="true" enableLookups="false"
     keystoreFile="d:\mykeystore" keystorePass="changeit" maxThreads="25" port="8443" 
    protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" sslProtocol="TLS"/>
    
    image.png

    3、eclipse里面修改tomcat的配置文件web.xml(启用安全认证)

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>securedapp</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee><!-- 如果你希望关闭 SSL ,只需要将 CONFIDENTIAL 改为 NONE 即可。 -->
        </user-data-constraint>
    </security-constraint>
    
    image.png

    启动tomcat,访问myerp系统

    URL地址栏里面输入http://192.168.0.130:8080/myerp或者http://localhost:8080/myerp

    image.png
    image.png
    image.png

    参考资料

    https://www.cnblogs.com/cunkouzh/p/6912751.html

    相关文章

      网友评论

          本文标题:给web项目添加安全证书

          本文链接:https://www.haomeiwen.com/subject/dnqpxqtx.html