An SSL connection between a client and server is set up by a handshake, the goals of which are:

  • To satisfy the client that it is talking to the right server (and optionally visa versa)
  • For the parties to have agreed on a “cipher suite”, which includes which encryption algorithm they will use to exchange data
  • For the parties to have agreed on any necessary keys for this algorithm

Once the connection is established, both parties can use the agreed algorithm and keys to securely send messages to each other. We will break the handshake up into 3 main phases - Hello, Certificate Exchange and Key Exchange.

  1. Hello - The handshake begins with the client sending a ClientHello message. This contains all the information the server needs in order to connect to the client via SSL, including the various cipher suites and maximum SSL version that it supports. The server responds with a ServerHello, which contains similar information required by the client, including a decision based on the client’s preferences about which cipher suite and version of SSL will be used.

  2. Certificate Exchange - Now that contact has been established, the server has to prove its identity to the client. This is achieved using its SSL certificate, which is a very tiny bit like its passport. An SSL certificate contains various pieces of data, including the name of the owner, the property (eg. domain) it is attached to, the certificate’s public key, the digital signature and information about the certificate’s validity dates. The client checks that it either implicitly trusts the certificate, or that it is verified and trusted by one of several Certificate Authorities (CAs) that it also implicitly trusts. Much more about this shortly. Note that the server is also allowed to require a certificate to prove the client’s identity, but this typically only happens in very sensitive applications.

  3. Key Exchange - The encryption of the actual message data exchanged by the client and server will be done using a symmetric algorithm, the exact nature of which was already agreed during the Hello phase. A symmetric algorithm uses a single key for both encryption and decryption, in contrast to asymmetric algorithms that require a public/private key pair. Both parties need to agree on this single, symmetric key, a process that is accomplished securely using asymmetric encryption and the server’s public/private keys.

The client generates a random key to be used for the main, symmetric algorithm. It encrypts it using an algorithm also agreed upon during the Hello phase, and the server’s public key (found on its SSL certificate). It sends this encrypted key to the server, where it is decrypted using the server’s private key, and the interesting parts of the handshake are complete. The parties are sufficiently happy that they are talking to the right person, and have secretly agreed on a key to symmetrically encrypt the data that they are about to send each other. HTTP requests and responses can now be sent by forming a plaintext message and then encrypting and sending it. The other party is the only one who knows how to decrypt this message, and so Man In The Middle Attackers are unable to read or modify any requests that they may intercept.

https://robertheaton.com/2014/03/27/how-does-https-actually-work/

最新文章

  1. 读取MP3专辑图片
  2. iOS 给NSString文字上添加横线 中间和下划线
  3. Think Python - Chapter 8 - Strings
  4. Activiti初学者教程
  5. 基于jsp+servlet图书管理系统之后台用户信息修改操作
  6. BASE64的实现
  7. Oracle EBS-SQL (SYS-15):查询表空间2.sql
  8. mysql的触发器
  9. CrossBridge介绍
  10. Java I/O 总结
  11. PHP----------线程安全和非线程安全的介绍
  12. zabbix 添加自动发现端口并监控
  13. html5 javascript 表单练习案例
  14. 安卓开发笔记①:利用高德地图API进行定位、开发电子围栏、天气预报、轨迹记录、搜索周边(位置)
  15. const define static extern 关键词详解
  16. 天梯赛 L2-013. (并查集) 红色警报
  17. javascript代码在线测试
  18. The FLARE On Challenge
  19. Node.js笔记07——不使用generator自定义一个项目,深入了解项目结构
  20. Question | 你所遇到的验证码问题可能都在这里了

热门文章

  1. FreeMarker-简单示例
  2. Oops, 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error
  3. php 生成订单号
  4. 关于uboot下data abort的问题
  5. [React Native] Prevent the On-screen Keyboard from Covering up Text Inputs
  6. UltraEdit UE如何设置自动换行
  7. unity3d-23种设计模式全解析
  8. HDU 5325 Crazy Bobo(思路+dfs 记忆化)
  9. 2015南阳CCPC A - Secrete Master Plan A.
  10. 通过adb push 从电脑里复制文件到手机里