http 协议之安全--------https

 

大家都知道,在浏览器里输入一个web网址,浏览器会发送一个http请求,请求远方服务器上的资源。浏览器发送的http包信息会经过多个路由器或者交换机才能到达远方服务器。在网络传输的过程中,如果有黑客入侵到路由器或者交换机(比如家里的路由器被黑),估计经过这些路由器的网络数据,很容易就被网络抓包(特别是抓出http 头部的信息里的cookie信息,然后把cookie信息在写入自己的浏览器冒充受害者,后果就不说了……)

 

关于怎样用java进行加解密,推荐学习梁栋的《Java加密与解密的艺术》

 

https,可以理解为socket+SSL+http(https是在SSL上的http,底层用了SSL,应用层协议还是http。SSL底层用的是socket,对socket传输的数据进行加解密)

SSL主要提供了以下几个功能

1)认证用户和服务器,确保数据发送到正确的客户机和服务器

2)加密数据以防止数据中途被窃取

3)维护数据的完整性,确保数据在传输过程中不被改变。

 

         在SSL中,主要是用非对称算法交换对称密钥,后续的通信过程都是用对称密钥和对称算法进行加解密(对称算法的加解码耗时,比非对称算法低很多;但是非对称算法的破解可能性比对称算法低很多。)

         非对称算法有以下几个特性:

              公钥加密,只能用私钥解密;私钥加密,只能用公钥解密

  

SSL通信大概过程(很简陋的单向验证)

             首先客户端发送自己的SSL版本号,支持的算法,随机数等发给服务端

 

             服务端收到请求后,发送自己的证书(带有公钥),支持的算法等信息给客户端

 

             客户端验证服务端发过来的证书(比如证书的合法性,或者到第三方验证机构验证其合法性,证书里的域名是否和访问的域名相同,是否过期等)

 

             客户端生成一个“对称密钥”,然后用服务端证书里的公钥对其加密(注意公钥加密只能私钥解密,而私钥在服务端),并把加密算法等信息也发给服务端

 

            服务端收到客户端用公钥加密的“对称密钥”进行解密

 

             客户端和服务端通信将使用协商的“对称密钥”和对称算法进行加解密。

<script type="text/javascript"> /*iteye博客内页Banner-468*60,创建于2016-5-31*/ var cpro_id = "u1405021"; </script> <script type="text/javascript" src="http://cpro.baidustatic.com/cpro/ui/c.js"></script>
分享到:
参考知识库
语音识别与合成知识库 110  关注 | 141  收录
计算机视觉知识库 197  关注 | 187  收录
自然语言理解和处理知识库 125  关注 | 55  收录
Android知识库 32586  关注 | 2675  收录
评论
<script type="text/javascript"> dp.SyntaxHighlighter.HighlightAll('code', true, true); $$('#main .blog_content pre[name=code]').each(function(pre, index){ // blog content var post_id = 2237026; var location = window.location; source_url = location.protocol + "//" + location.host + location.pathname + location.search; pre.writeAttribute('codeable_id', post_id); pre.writeAttribute('codeable_type', "Blog"); pre.writeAttribute('source_url', source_url); pre.writeAttribute('pre_index', index); pre.writeAttribute('title', 'http 协议之安全--------https'); }); fix_image_size($$('div.blog_content img'), 700); function processComment() { $$('#main .blog_comment > div').each(function(comment){// comment var post_id = comment.id.substr(2); $$("#"+comment.id+" pre[name=code]").each(function(pre, index){ var location = window.location; source_url = location.protocol + "//" + location.host + location.pathname + location.search; source_url += "#" + comment.id; pre.writeAttribute('codeable_id', post_id); pre.writeAttribute('codeable_type', "BlogComment"); pre.writeAttribute('source_url', source_url); pre.writeAttribute('pre_index', index); pre.writeAttribute('title', 'http 协议之安全--------https'); }); }); } function quote_comment(id) { new Ajax.Request('/editor/quote', { parameters: {'id':id, 'type':'BlogComment'}, onSuccess:function(response){editor.bbcode_editor.textarea.insertAfterSelection(response.responseText); Element.scrollTo(editor.bbcode_editor.textarea.element);} }); } code_favorites_init(); processComment(); new WeiboShare({share_buttons: $('share_weibo'), img_scope: $('blog_content')}); </script>
liuwenjie517333
  • 浏览: 8830 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值