Slide 1

Slide 1 text

WebRTCを支えるマイナーなプロトコル SRTP/DTLS/SCTPを分かった気になる - kind of feel like understanding SRTP/DTLS/SCTP - @iwashi86 2014/08/01 WebRTC Meetup Tokyo #3

Slide 2

Slide 2 text

●Attribute  Name Yoshimasa Iwase      @iwashi86  web  iwashi.co ●Work  ・Web Engineer@NTT Com  ・HTML5 Experts.jp Editor ●Recently  ・has become PHPer for 2 months   (ついにぺちぱーになりました)

Slide 3

Slide 3 text

Takeaway 本日お持ち帰りいただくこと

Slide 4

Slide 4 text

IP UDP DTLS SRTP SCTP Audio/Video Data WebRTC protocol stack

Slide 5

Slide 5 text

IP UDP DTLS SRTP SCTP Audio/Video Data Understanding…

Slide 6

Slide 6 text

After this talk you’ll be able to answer このお話が終わる頃には 次の質問に答えられるように

Slide 7

Slide 7 text

What’s DTLS? What’s SRTP? What’s SCTP? DTLS,SRTP,SCTP? 何それ美味しいの?

Slide 8

Slide 8 text

Caveat ※注

Slide 9

Slide 9 text

Feel like understanding (Please check RFC for further information) 分かった気になってるだけ (詳細はRFC読んでね)

Slide 10

Slide 10 text

Main Topic ここから本題

Slide 11

Slide 11 text

IP UDP DTLS SRTP SCTP Audio/Video Data Let’s start with SRTP ではSRTPから

Slide 12

Slide 12 text

SRTP

Slide 13

Slide 13 text

S + RTP

Slide 14

Slide 14 text

S + RTP Secure

Slide 15

Slide 15 text

S + RTP Secure Real-time Transport Protocol

Slide 16

Slide 16 text

RTP?

Slide 17

Slide 17 text

Protocol for Send/Receive and Audio/Video Real-time 音声映像をリアルタイムに送受信するプロトコルのこと

Slide 18

Slide 18 text

Why? How? 何で必要なの?どう動くの?

Slide 19

Slide 19 text

H e l l o Ideal(理想)

Slide 20

Slide 20 text

Real world with UDP/IP

Slide 21

Slide 21 text

H e l l o Jitter(ゆらぎ) Real world with UDP/IP

Slide 22

Slide 22 text

H e l l o Jitter(ゆらぎ) Out-of-order (ホレルになった) H o l e l Real world with UDP/IP

Slide 23

Slide 23 text

H e l l o Jitter(ゆらぎ) Out-of-order (ホレルになった) Loss (まさかの地獄行き) H e l l o H o l e l Real world with UDP/IP

Slide 24

Slide 24 text

Problem and Solutions of RTP 課題とその解決方法 Jitter (ゆらぎ) Out-of-order (順序逆転) Loss (消失)

Slide 25

Slide 25 text

Jitter (ゆらぎ) Out-of-order (順序逆転) Loss (消失) Timestamp タイムスタンプでいつ送ったか記録しておけば タイミングよく再生できるよ Problem and Solutions of RTP 課題とその解決方法

Slide 26

Slide 26 text

Jitter (ゆらぎ) Out-of-order (順序逆転) Loss (消失) Timestamp タイムスタンプでいつ送ったか記録しておけば タイミングよく再生できるよ Sequence Number シーケンス番号があれば並べ替えできるよ Problem and Solutions of RTP 課題とその解決方法

Slide 27

Slide 27 text

Jitter (ゆらぎ) Out-of-order (順序逆転) Loss (消失) Timestamp タイムスタンプでいつ送ったか記録しておけば タイミングよく再生できるよ Sequence Number シーケンス番号があれば並べ替えできるよ Give up (don’t have time of retransmission) 再送するほど暇じゃない Problem and Solutions of RTP 課題とその解決方法

Slide 28

Slide 28 text

RTP is a thin wrapper of UDP RTPはUDPの薄皮みたいなもの http://www.cl.cam.ac.uk/~jac22/books/mm/book/node159.html

Slide 29

Slide 29 text

SRTP is a just secure RTP SRTPはRTPを安全にしただけ Encrypted Payload 暗号化されたペイロード http://flylib.com/books/2/110/1/html/2/images/ct402614.jpg

Slide 30

Slide 30 text

Hey, where is encryption key? あれ? 暗号化の鍵はどこにあるの?

Slide 31

Slide 31 text

IP UDP DTLS SRTP SCTP Audio/Video Data That’s why we have DTLS そこでDTLSですよ

Slide 32

Slide 32 text

DTLS

Slide 33

Slide 33 text

D + TLS Datagram (UDPの)

Slide 34

Slide 34 text

D + TLS Datagram (UDPの) Transport Layer Security

Slide 35

Slide 35 text

TLS?

Slide 36

Slide 36 text

You know! 知らないとは言わせない

Slide 37

Slide 37 text

This one! ここ!

Slide 38

Slide 38 text

Under the food of HTTPS 内部ではこう動いている https://devcentral.f5.com/Portals/0/images/metapost/News-Articles/ltwagnon/2013/Jun/Windows-Live-Writer-525a2ddcdc82_787C-Modif ied%20TLS%20Handshake_2.jpg

Slide 39

Slide 39 text

What if there is a packet loss パケロスがあったら… https://devcentral.f5.com/Portals/0/images/metapost/News-Articles/ltwagnon/2013/Jun/Windows-Live-Writer-525a2ddcdc82_787C-Modif ied%20TLS%20Handshake_2.jpg

Slide 40

Slide 40 text

What if there is a packet loss パケロスがあったら… https://devcentral.f5.com/Portals/0/images/metapost/News-Articles/ltwagnon/2013/Jun/Windows-Live-Writer-525a2ddcdc82_787C-Modif ied%20TLS%20Handshake_2.jpg Can’t share key 鍵を共有できない

Slide 41

Slide 41 text

We need reliability! 信頼性さえあれば!

Slide 42

Slide 42 text

So we’ve added TCP functions to TLS そこでTLSにTCPの機能をつけてみた

Slide 43

Slide 43 text

DLTS = TLS + TCP (ex. Seq, Order-control) DTLSはTLSにTCPの機能つけたようなもの Retransmission 再送する

Slide 44

Slide 44 text

IP UDP DTLS SRTP SCTP Audio/Video Data End with SCTP 最後は SCTP

Slide 45

Slide 45 text

You’re using now! 使ってないとは言わせない

Slide 46

Slide 46 text

STCP is running in LTE core NW SCTPはLTEキャリアコア網の中で動いている https://www.nttdocomo.co.jp/binary/pdf/corporate/technology/rd/technical_journal/bn/vol19_1/vol19_1_011jp.pdf

Slide 47

Slide 47 text

SCTP ≒ TCP 結構似てる(似せられる) SCTP ≒ HTTP2 レイヤは違えど考え方が似ている

Slide 48

Slide 48 text

Handshake SYN SYN + ACK ACK INIT INIT-ACK COOKIE COOKIE-ECHO TCP SCTP

Slide 49

Slide 49 text

Difference between STCP and TCP で、何が違うの? SCTP TCP UDP(参考) Reliability 到達保証 Configurable 選べる Yes No Order 順序制御 Configurable 選べる Yes No Transmission 転送志向 Message メッセージ志向 Byte バイト志向 Message メッセージ志向 Multi Stream マルチストリーム有無 Yes No - Flow / Congestion Control 流量/輻輳制御 Yes Yes No

Slide 50

Slide 50 text

Now you might be able to answer そろそろなんとなく答えられるはず?

Slide 51

Slide 51 text

What’s DTLS? What’s SRTP? What’s SCTP?

Slide 52

Slide 52 text

Thanks! おしまい