RTMP複雜握手(Complex handshake)

complex handshake c1和s1的結構
c1s1包含兩種數據:key和digest, digest對咱們是重要的是須要進行驗證的,c1s1分爲四個部分html

// 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的驗證dom

// 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.htmlide

相關文章
相關標籤/搜索