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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章