当前位置:网站首页>IPSec传输模式下ESP报文的装包与拆包过程
IPSec传输模式下ESP报文的装包与拆包过程
2022-06-23 12:01:00 【梦飞】
先上图
装包过程
- 在原IP报文中的payload(可能承载了是TCP报文)后面添加ESP trailer信息。
- ESP trailer包括三部分:Padding, Pad length, Next header。由于所选加密算法可能是块加密,所以可能需要进行填充(Padding);附上的填充长度(Pad length)方便在解包时移除填充的数据;Next Head用来表明原IP报文的payload的协议类型,如6表示TCP。
- 将原IP报文中的payload与ESP trailer作为整体进行加密,加密的算法与密钥由SA(Security Association)给出。
- 为第2步得到的加密数据添加ESP header,加密数据与ESP header 合称为“Enchilada”,对“Enchilada”做一个摘要,得到一个完整性度量值(ESP Message Authentication Data),并添加到最后面,完整性度量算法包括需 要的认证密钥由SA 给出。
- ESP header包括两部分:SPI (Security Parameter Index),Sequence number。 SPI用于与SA进行关联,从SAD中获得关于该IPSec包的协议算法和密钥等信息;Sequence number初始建立时为0,每发送一个数据包自增1,用于抵抗重发攻击。
- 把原IP头的protocol字段改为50(表示上层协议为ESP),并加到ESP header前面,完成装包。
拆包过程
- 接收方收到IP 报文后,发现协议类型是50,表明这是一个ESP 包。首先查看ESP header,通过SPI 决定数据报文所对应的SA ,获得对应的模式(tunnel/transport mode) 以及安全规范。
- 计算“enchilada” 部分的摘要,与附在末尾的Authentication Data做对比,验证数据完整性;检查顺序号,保证数据是“新鲜”的,防止回放攻击。
- 根据SA 所提供的加密算法和密钥,解密被加密过的数据,得到原IP报文的payload与ESP trailer。
- 根据ESP trailer的Next Header判断ESP所封装的报文协议类型(如TCP),并根据Padding Length填充长度信息,找出填充字段的长度,删去后得到原来的IP报文的payload。
- 将IP头和原IP报文的payload组合,便得到完整的原IP报文。
经典图示
注:payload(载荷数据)是相对的,对于IP协议报文而言,payload是TCP header + TCP payload,所以要注意区分以上文字和图片中出现的payload描述。
边栏推荐
- Localization information | aikesheng and China kefangde complete product compatibility and mutual certification
- 2D laser Slam (using laser scan matcher)
- ROS知识:librviz库的调用实践
- Oracle database's dominant position is gradually eroded by cloud competitors
- 凭借32量子比特!Rigetti Computing打入英国量子计算市场
- Open classes are short videos! Tonight, I will teach you how to realize accurately!
- Halcon principle: Auto_ Threshold operator
- 如何卸载Gazebo与重装
- 电脑坏了,换了台电脑,装node环境的时候出了问题,报错URL not defined
- The country has entered the main flood season. The Ministry of transport: the lines that do not meet the conditions for safe operation will be resolutely shut down!
猜你喜欢

国产化信息 | 爱可生与中科方德完成产品兼容互认证

“梦想童行” 2022年广汽本田儿童道路安全公益行走进东北

Oracle数据库的主导地位被云竞争对手逐渐侵蚀

HMS Core 视频编辑服务开放模板能力,助力用户一键Get同款酷炫视频

Introduction to redis - Chapter 3 - data structures and objects - Dictionary

开源之夏中选名单已公示,基础软件领域成为今年的热门申请

如何卸载Gazebo与重装

Ros2 knowledge (1): start practicing robots

With 32 qubits! Rigetti computing enters the UK quantum computing market

Analysis of six dimensional chart: analysis of enterprise growth of CSCEC
随机推荐
冷板式、浸没式、喷淋式液冷散热能否引领高性能计算发展?
CRMEB知识付费如何二开阿里云短信功能
【综合笔试题】30. 串联所有单词的子串
ROS2知识(2):网络设施
DuPont analysis: what is the investment value of Anyang Iron and Steel Co., Ltd?
Mysql, how to calculate the maximum value using stored procedures
Ecological Wanli database and Westone completed compatible certification to jointly build a network security ecosystem
With 32 qubits! Rigetti computing enters the UK quantum computing market
Where is the safest and most formal way to open an account at present?
Getting started with redis - Chapter 4 - data structures and objects - jump table
Redis 入门-第一篇-数据结构与对象-简单动态字符串(SDS)
Qt5 knowledge: string list qstringlistmodel
@Dark horse fans, haven't you received this "high temperature subsidy"?
Qt知识:视图框架QGraphicsWidget详解
公开课丨玩的就是短视频!今晚教你精准变现!
如何卸载Gazebo与重装
ROS observation [57]: configure arm robots to grasp things
go-zero微服务实战系列(六、缓存一致性保证)
Redis 入门-第三篇-数据结构与对象-字典
Qt5 knowledge: DNS query