14
Netty 报文解析长度加密
source link: https://www.v2ex.com/t/806056
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Netty 报文解析长度加密
用 netty 解析 tcp 报文 格式是 固定 4 字节长度+消息体, 准备用 LengthFieldBasedFrameDecoder 解析的 但是这个消息头的 4 个字节也是加密的,要先解密一下才能获取到消息体的正确长度 这个要怎么搞呢
6 条回复 • 2021-10-07 16:35:12 +08:00
pmsg863 1 天前
加密后消息长度不会变吧?如果加密和解析后的 byte[]长度一致就比较简单,修改下 LengthFieldBasedFrameDecoder 源码,做个解密即可,对消息长度做个校验,超范围或解密失败跳过相关流数据或链路重置。
darkengine 18 小时 15 分钟前
这个协议定的有问题吧。完整消息包的长度是加密的,那么就无法知道应该取多长的 byte[]下来进行解密,然后不解密又不知道前 4 个字节的里保存的消息体长度是多少。。。这个项目已经跑起来了吗?好奇插个眼。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK