RTMP复杂握手(Complex handshake)

complex handshake c1和s1的结构
c1s1包含两种数据:key和digest, digest对我们是重要的是需要进行验证的,c1s1分为四个部分

// c1s1 schema0  
time:4 bytes
version:4 bytes
key:764 bytes
digest:764 bytes
//c1s1 schema1
time: 4bytes  
version: 4bytes  
digest: 764bytes  
key: 764bytes 

key和digest的结构

// 764 bytes key结构
random-data:(offset)bytes
key-data:128bytes
random-data:(764-offset-128-4)bytes
offset:4bytes
// 764 bytes digest结构
offset:4bytes
random-data:(offset)bytes
digest-data:32bytes
random-data:(764-4-offset-32)bytes

服务器收到c1后会根据上面的规则,找到key和digest,找到后进行验证,验证的算法是:
将digest的前后的字符进行拼接操作得到p=p1+p2
然后对p进行HMACsha256(p,GENUINE_FP_KEY[:30])得到的结果跟digest进行对比
RTMP复杂握手(Complex handshake)

C2S2主要是提供对C1S1的验证

// 1536bytes C2S2结构  
random-data: 1504bytes  
digest-data: 32bytes  

http://www.jianshu.com/p/379e53e49e33
http://blog.csdn.net/win_lin/article/details/13006803
https://thompsonng.blogspot.com/2010/11/rtmp-part-10-handshake.html

转载于:https://blog.51cto.com/xwandrew/2050995

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值