TLS握手及其报文详细分析,服务器视角

1、客户端的Client Hello开始

发送此消息的时间:

当客户端首次连接到服务器时,它必须发送ClientHello作为其第一条消息。客户端还可以响应HelloRequest消息或主动发送ClientHello消息以重新协商现有连接中的安全参数。

记录层 1字节 2字节 3字节 4字节 5字节
Content Type: Handshake Version: TLS 1.2 Length
0x22 0x0303 ---
握手层 Handshake Type: Client Hello  Length Version: TLS 1.2 
0x01   0x0303
Version: TLS 1.2 Random: (GMT Unix Time: Jun 26, 2024 11:04:47.000000000 中国标准时间)
0x0303  
Random: (Random Bytes)
 
Random: (Random Bytes)
 
Random: (Random Bytes)
 
Random: (Random Bytes)
 
Random: (Random Bytes)
 
Random: (Random Bytes) Session ID Length: 0    
       

接着上面就是密钥,压缩算法

Cipher Suites Length: 208Cipher Suites Length: 208(密钥长度) Cipher Suites (104 suites)(密钥)
Compression Methods Length: 1(压缩算法长度) Compression Methods (1 method)(压缩算法)
Extensions Length: 80(扩展长度) Extensions (扩展)

 

接下来我们用python进行组包

from scapy.all import *

from scapy.layers.tls.all import *
from scapy.layers.inet import *

tls_ClientHello =TLS(type=22,version=0x0303,msg=TLSClientHello(version="TLS 1.2"))
tls_ClientHello.show()
sip = Ether() / IP(src=ip, dst=ip) / TCP(sport=port,

                                                           dport=port)/tls_ClientHello

sendp(sip)
print(sip.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值