当前位置:网站首页>TLS / SSL protocol details (28) differences between TLS 1.0, TLS 1.1 and TLS 1.2
TLS / SSL protocol details (28) differences between TLS 1.0, TLS 1.1 and TLS 1.2
2022-04-23 15:05:00 【Mrpre】
TLS 1.0 RFC http://www.ietf.org/rfc/rfc2246.txt
TLS 1.1 RFC http://www.ietf.org/rfc/rfc4346.txt
TLS 1.2 RFC http://www.ietf.org/rfc/rfc5246.txt
TLS 1.3 see :https://blog.csdn.net/mrpre/article/details/81532469
my TLS Realization , You can refer to :https://github.com/mrpre/atls/
Here, according to TLS The implementation of the , Summarize . As for which algorithms are discarded between version numbers 、 What algorithms are added , Look directly at RFC that will do , It doesn't matter here .
It's just about TLS What are the changes in the internal processing logic of the message , That is to analyze from the perspective of code . If you are right TLS I'm not familiar with the agreement , Then it is not recommended to read this article . To understand this article, you need to know TLS It is realized by a deeper understanding , Want to know TLS Basic knowledge of , I suggest starting from the beginning of this series .
difference 1: Yes finished message (Encrypted handshake message) influence
TLS 1.0 TLS 1.1 In the calculation finish when , What's going on is MD5+ SHA1 Combinatorial operation , And in the TLS 1.2 Next , The summary algorithm becomes a single SHA256.
The pseudocode is as follows
If(version >= TLS1_2)
{
If (cipher.mac == SHA384)
{
restult = SHA384(handshake_in );
}
Else
{
restult = SHA256(handshake_in);
}
}
Else
{
restult = md5(handshake_in) + sha1(handshake_in);
}
among handshake_in yes String constant + All handshake information ( The type is Handshake Of message).
for example
As client End handshake_in =“client finidhed” + all_handshake
As Server End handshake_in = “server finidhed” + all_handshake
notes : For the encryption suite, there are SHA384 And above , No matter what TLS Which version , Use both Encryption suite specified Handshake summary algorithm calculation Abstract , As shown in the pseudo code above (RFC For every new algorithm , All need to specify default still SHAXXX, But in terms of implementation , Are all based on MAC What is it? ,SHAXXX That's what ).
In fact, the digest algorithm specified in the encryption suite is used for encryption HMAC Of , It does not affect the operation in the handshake process , But if the encryption suite negotiated between the two sides supports SHAXXX, Then it must mean that both sides support SHAXXX Algorithm , So in SHAXXX Safety is higher than SHA256 Under the circumstances , If the handshake phase requires a digest algorithm, it is not necessary to be so ‘ die ’ Only SHA256. Of course, there is nothing better than SHA384 Higher .
difference 2: Yes PRF The impact of algorithms
First sort out the logic with pseudo code :
If(version >= TLS1_2)
{
If (cipher.mac == SHA384)
{
TLS1_2_PRF(SHA384, in, srcret);
}
Else
{
TLS1_2_PRF(SHA256, in, srcret);
}
}
Else
{
TLS1_PRF(MD5,SHA1, in, srcret);
}
1: about SHA384 The judgment of the , That was already said , No more details here .
2: You can see TLS1.2 and TLS 1.0 TLS 1.1 Of PRF It's different , Different parameters .
TLS 1.2 Of PRF
A single P_HASH,P_HASH It uses SHA256
TLS 1.1 Of PRF
two P_HASH, for the first time P_HASH It uses MD5, as well as secret First half of ; The second time P_HASH The use of SHA1, as well as secret The second half of . two P_HASH The result of or (xor), Get the final result .
Be careful secret If it's even , Just half each , If it's odd :
for example secret yes 1234567, Then the first half refer to 1234, The latter half refers to 4567, The middle byte is common .
difference 3: Yes Certificate verify Influence
Certificate vertify After the client sends the certificate , To show that you are the owner of the certificate , Use your own private key to pair the previously received 、 Sign the handshake information sent .( and finished similar ).
Also before signing , The handshake information needs to be HASH operation .
TLS1.0 TLS1.1:
Use MD5+SHA1 Abstract the handshake information in the form of , This process and calculation finished equally , Just don't add string constants ’XXX finished’.
notes : There is one exception , about ECDSA Signature algorithm ( The client certificate is ECC certificate ), Only one time SHA1 Calculation .
TLS 1.2:
TLS 1.2 Next , certificate verify The message format is different from that before , More 2 Bytes (Signature Hash Algorithm), Express hash_alg as well as sign_alg. The specific handshake summary is based on hash_alg Make a single calculation .
Again , If the encryption suite exists SHA384, Then use SHA384
TLS 1.2 Next Certificate verify The format of

The pseudocode is as follows :
If(version >= TLS1_2)
{
result = SHAXXX(all_handshake);
ADD_MD_INFO_TO_PACKET();// Two bytes are added to the message to indicate its signature algorithm
}
Else
{
If(ECDSA_SIGN)
{
result = SHA1(all_handshake);
}
Else
{
result = MD5(all_handshake) + SHA1(all_handshake)
}
}
In conclusion :
1:TLS 1.2 Need to increase the 2 Bytes indicate the type of signature algorithm ( Asymmetric + Abstract ). and TLS1.2 Use the previous default agreement md5+sha1 Calculation summary in the form of , The asymmetric algorithm must use the algorithm corresponding to the private key type , This does not need to show that .
2:ECDSA Signatures require special treatment .
difference 4: Yes server key exchange Influence
TLS1.2 Lower and certificate verify similar , The message format is different from the previous version . More 2 Byte representation HASH Algorithm and signature algorithm .

Summary logic and when signing certificate verify equally .
difference 5: Impact on encryption
The change is TLS1.1 Beginning to change , No TLS1.2.
To fight against beast attack ,SSL Before encrypting data , Need to fill in a BLOCK_SIZE(IV_SIZE) Random number of length , This random value is also encrypted as part of the data , When decrypting , Also decrypt , Then discard .
CBC Next , For the above scenario, we can actually optimize , This BLOCK_SIZE The data of can not be encrypted for the sender , Then the next block of data Write_IV Change to this random number , such CBC The pattern can work completely . For the decryptor , This BLOCK_SIZE The data can not be decrypted , Then decrypt the next block Read_IV Become this random number ,CBC Mode also works . One less BLOCK_SIZE The disclosure of the 、 Encrypt data . See my blog for detailed optimization scheme http://blog.csdn.net/mrpre/article/details/78093370
If it works , Please give me a reward N element :http://39.98.242.44
版权声明
本文为[Mrpre]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231409587572.html
边栏推荐
- Subnet division of flannel principle
- Reptile exercises (1)
- Set up an AI team in the game world and start the super parametric multi-agent "chaos fight"
- Little red book timestamp2 (2022 / 04 / 22)
- A series of problems about the best time to buy and sell stocks
- How to upload large files quickly?
- What is the effect of Zhongfu Jinshi wealth class 29800? Walk with professional investors to make investment easier
- nuxt项目:全局获取process.env信息
- Leetcode exercise - 396 Rotation function
- [thymeleaf] handle null values and use safe operators
猜你喜欢

Brute force of DVWA low -- > High

eolink 如何助力遠程辦公

Leetcode153 - find the minimum value in the rotation sort array - array - binary search

Is asemi ultrafast recovery diode interchangeable with Schottky diode

1 - first knowledge of go language

Set onedrive or Google drive as a drawing bed in upic for free

Tencent has written a few words, Ali has written them all for a month

How does eolink help telecommuting

Don't you know the usage scenario of the responsibility chain model?

UML learning_ Day2
随机推荐
LeetCode149-直线上最多的点数-数学-哈希表
Reptile exercises (1)
3、 Gradient descent solution θ
Design of digital temperature monitoring and alarm system based on DS18B20 single chip microcomputer [LCD1602 display + Proteus simulation + C program + paper + key setting, etc.]
Basic operation of sequential stack
A series of problems about the best time to buy and sell stocks
Leetcode exercise - 396 Rotation function
Tencent has written a few words, Ali has written them all for a month
多语言通信基础 06 go实现grpc的四种数据流模式实现
asp. Net method of sending mail using mailmessage
UML学习_day2
Epolloneshot event of epoll -- instance program
Thinkphp5 + data large screen display effect
8.5 concise implementation of cyclic neural network
Fill in the next right node pointer II of each node [classical hierarchy traversal | regarded as linked list]
Programming philosophy - automatic loading, dependency injection and control inversion
My raspberry PI zero 2W tossing notes record some problems encountered and solutions
封面和标题中的关键词怎么写?做自媒体为什么视频没有播放量
Async keyword
Mds55-16-asemi rectifier module mds55-16