http Agreement

Summary:

  • HTTP protocol (HyperText Transfer Protocol, Hypertext Transfer Protocol) is the most widely used on the Internet A network transport protocol, all the WWW (World Wide Web) document must comply with this standard. The most common site I, H5 on the phone, or even a lot of back-end server-side interfaces are based on the HTTP protocol.
    http: plain text transmission.
    http transmission, with a simple, flexible features, but the disadvantage is transmitted in clear text, in response to the request and does not confirm the communication party does not protect the integrity of the data, transmitting the content easily stolen.
    Clear-text description
    https: encrypted transmission
    HTTPS (full name: Hyper Text Transfer Protocol over SecureSocket Layer ), is safe for the target HTTP channel, on the basis of HTTP to ensure the security of the transmission through the transmission encryption and authentication.
    Encrypted transmission

Content of the page using https transfer, the client and the server using the "asymmetric encryption algorithm" secret key exchange. Server, which is red in the figure above, the first will generate a public key, a secret key. After the public key certificate and then packaged, the certificate to the user, the image above is Bob.

What is a Certificate:

CA证书,是指由证书颁发机构(CA, Certificate Authority)即颁发数字证书的机构,颁布给对应公司用的数字证书。CA是负责发放和管理数字证书的权威机构,并作为电子商务交易中受信任的第三方,承担公钥体系中公钥的合法性检验的责任。一般来说,证书业务都是要收费的。
世界上很有多家证书颁发机构,程序猿哥哥们也可以生成自己的证书,但是很多证书是“不受信任的”,我们使用的微信、Google Chrome浏览器、iPhone的iOS系统等,都只选择信任那些具备公信力的证书颁发机构颁发的证书。
证书颁发机构就像我们用的四通一达快递一样,大家选择他们就是因为觉得信得过,快递被掉包的可能性低。而那些小公司、或自行颁发的证书,就像一家没听说过的快递公司一样,大家去选择他们收发快递时,也不是不能用,但是碰上快递被盗的概率就可能上升。
用户在获得服务器给的证书后,觉得这个证书值得信任,就打开它获得里面的公钥,与此同时,用户端会生成一串随机的字符串,然后用服务器的公钥对字符串进行加密,把加密完的内容发给服务费。

服务器在获得用户发送的密文后,用私钥解密,就获得了用户端的密码。这个过程就叫做非对称加密。

服务器知道了用户的密码后,双方传输数据前,都先用用户生成的那个密码对数据进行加密,然后再传输给对方,然后对方用这个密码进行解密。加密解密都用同一个秘钥的时候,这个过程就叫做对称加密。

https的传输过程就是如此,先用非对称加密传输让双方获得一个对称加密的秘钥,然后双方再用这个对称秘钥进行数据的传输加密,这样能兼顾安全和快速。由于采用了密文传输,这时候第三方就不能窃听用户和服务器之间传输的内容了,这时候网站的安全性就获得了提高。
启示
电脑和手机上不要乱装软件,网站虽然用了https加密传输的内容,但是如果自己手机上装了一个类似抓包软件的病毒软件,这时候就相当于把自己的账号密码、聊天内容都拱手送了出去呀!
抓包
我们网站用了https协议后,数据就被加密了,那传了什么就不知道啦,那以后遇到bug怎么办呢?然后程序员哥哥会心一笑说:其实并没有什么,https也是可以抓包的,只需要安装一个证书就可以了。
程序猿哥哥说的“装一个证书”,其实就是信任抓包软件的第三方证书,然后这个“黑心的快递员”,就会作为一个不老实的中间人,窃取了用户端生成的对称秘钥,然后不断的记录下用户与服务器之间传输的密文,并且用窃取到的秘钥进行解密,这样就知道了双方之间传输的内容了。
技术难点:
公钥:用于加密。
私钥:用于解密。
用户,客户端,非对称加密算法。

用户取得服务器证书,感觉可以信任,打开它获得公钥,生成随机字符串,用服务器的公钥对字符串进行加密。
服务器获得用户密文,用私钥解密,获得用户端密码,称为非对称加密。
加密解密同时在一个密钥时,对称加密。

Released eight original articles · won praise 1 · views 3044

Guess you like

Origin blog.csdn.net/hello250sunshine/article/details/104067480