当前位置:网站首页>TLS four handshakes
TLS four handshakes
2022-07-19 09:57:00 【Mountain Ghost ballad me】
tls
The first handshake
- The client sends client hello news :tls Version number , List of supported password conditions , And the random number generated .
| Field | explain |
|---|---|
| tls Version number | The version number supported by the client |
| Cipher suite | Client supported cipher Suites : What encryption algorithms are supported |
| Generate random number | Client generation 64 Bit random string |

The second handshake
The second handshake server hello
After the server receives the message , return server hello,

however , This time, the selected cipher suite is the same as RSA It's different. , Let's analyze the meaning of this cipher suite .
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
The key agreement algorithm uses :ECDHE
The signature algorithm uses :ECDSA
Use communication algorithm after handshake :AES Symmetric algorithm , Key length :128 position , Group mode :GCM
Abstract algorithm :SHA256
The certificate is issued under the second handshake
In order to prove their identity , send out 「Certificate」 news , The certificate will also be sent to the client .
The server exchange key of the second handshake
Because the server chose ECDHE Key agreement algorithm , So after sending the certificate , send out 「Server Key Exchange」 news .

In this process, the server does three things :
● You have chosen the name named_curve The elliptic curve of , The selected elliptic curve is equivalent to the base point of the elliptic curve G It's settled , These will be exposed to the client ;
● Generate a random number as the private key of the elliptic curve of the server , Keep it locally ;
● According to the base point G And the private key to calculate the elliptic curve public key of the server , This will be made public to the client .
To ensure that the public key of the elliptic curve is not tampered by a third party , The server will use RSA The signature algorithm makes a signature for the elliptic curve public key of the server .
And then , Namely 「Server Hello Done」 news , The server indicates to the client :“ That's what I'm offering , After the greeting ”.
The third handshake
The third handshake Client Key Exchange
After the client receives the certificate from the server , Naturally, we need to check whether the certificate is legal , If the certificate is legal , Then it's OK for the server to end to identity . Verify certificate to process , Will go through the certificate chain to verify level by level , Confirm the authenticity of the certificate , And then verify the signature with the public key of the certificate , In this way, the identity of the server can be confirmed , After confirmation , You can go on down .
The client will generate a random number as the private key of the client elliptic curve , And then according to the information given by the server , Generate the elliptic curve public key of the client , And then use 「Client Key Exchange」 The message is sent to the server .

thus , Both sides have each other's elliptic curve public key 、 My own elliptic curve 、 The base point of the elliptic curve G. therefore , Both sides worked out a point (x,y), among x The coordinate values are the same on both sides , I said before ECDHE When the algorithm , say x It's the session key , But in practice ,x It's not the final session key yet .
Remember TLS handshake phase , Will the client and server generate a random number to pass to each other ?
The final session key , Just use 「 Client random number + Server random number + x(ECDHE The shared key calculated by the algorithm ) 」 Three materials made of .
The reason why it's so troublesome , Because TLS Designers don't trust clients or servers 「 Pseudo random number 」 The reliability of the , To make sure that it's really completely random , Mix up three unreliable random numbers , that 「 Random 」 The degree is very high , The hacker cannot calculate the final session key , safer .
The third handshake Change Cipher Spec

The fourth handshake
Last , The server will have the same operation , Hair 「Change Cipher Spec」 and 「Encrypted Handshake Message」 news , If both sides verify that encryption and decryption are OK , So the handshake is officially complete . therefore , You can send and receive encrypted HTTP Request and respond to .
The fourth handshake , stay wireshark Not found in
Reference address :
The illustration ECDHE Key exchange algorithm
https://www.likecs.com/show-124371.html
边栏推荐
- Anaconda and jupyter notebook entry level detailed tutorial
- Memory LDA LDA in Blas level-3 sgemm cublesgemmex cubulassgemm
- Part I - Fundamentals of C language_ 4. Procedure flow structure
- 中国十大国民小吃,第一居然是它
- CLWY权限管理(一)--- 项目搭建
- v-mode
- 第十三章 STL 之 set/ multiset
- npm使用
- 2022.7.16-----leetcode.剑指offer.041
- rhcsa 第一天 7.11
猜你喜欢

第十一章 STL 之 queue

Develop the first Flink app

数组模拟队列

Chapter 4 - first order multi-agent system consistency - > switching topology system consistency
![[fishing artifact] UI library second low code tool - form part (II) sub control](/img/84/f6882fb703613693f85685f4942383.png)
[fishing artifact] UI library second low code tool - form part (II) sub control

【摸鱼神器】UI库秒变低代码工具——表单篇(二)子控件

第八章 STL 之 vector

Chapter 4 - consistency of first-order multi-agent systems - > consistency of continuous time systems with time delays

Part I - Fundamentals of C language_ 3. Operators and expressions

Es index, type (mapping), document, IK word breaker
随机推荐
氮杂环分子改性UiO-66-NH2|聚乙烯亚胺改性UiO-66-NH2|[email protected]@ZIF67纳米材料
对文本实现分词以及绘制词云
硫化镉负载MIL-125(Ti)|链霉亲和素(SA)-锆基卟啉MOF复合材料([email protected])|壳核结构
mof定制材料|超薄MOF纳米带|磁性Fe3O4 @Cd-MOF纳米复合材料|ZIF-8/石墨烯复合纳米颗粒
Among China's top ten national snacks, it is actually the first
The inflection point of eth may be just around the corner, which is how to
2022.7.16-----leetcode.剑指offer.041
Chapter IX deque of STL
es索引、类型(mapping)、文档、ik分词器
TLS四次握手
Mysqldump full recovery to another new instance, and then perform flush privileges analysis
【C语言】浅涉选择、循环语句、函数及数组
【565. 数组嵌套】
Programmer growth Article 21: when assigning tasks, we should consider the growth of employees.
浏览器的故事
第4章-一阶多智体系统一致性 -> 连续时间含时延系统一致性【程序代码】
[C language] summary of function knowledge points
Week 1: introduction to deep learning and foundation of pytorch
金纳米粒子修饰MIL-101骨架材料(AuNPs/MIL-101)/负载COF-TpPa-1(Au NPs/COF-TpPa-1)|齐岳试剂
Componentized advanced -- slot