webrtc/pc/g3doc/dtls_transport.md
Artem Titov 3eceaf4669 Migrate WebRTC documentation to new renderer
Bug: b/258408932
Change-Id: Ib96f39fe0c3912f9746bcc09d079097a145d6115
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290987
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39205}
2023-01-26 14:58:00 +00:00

2.9 KiB
Raw Blame History

Overview

WebRTC uses DTLS in two ways:

  • to negotiate keys for SRTP encryption using DTLS-SRTP
  • as a transport for SCTP which is used by the Datachannel API

The W3C WebRTC API represents this as the DtlsTransport.

The DTLS handshake happens after the ICE transport becomes writable and has found a valid pair. It results in a set of keys being derived for DTLS-SRTP as well as a fingerprint of the remote certificate which is compared to the one given in the SDP a=fingerprint: line.

This documentation provides an overview of how DTLS is implemented, i.e how the following classes interact.

webrtc::DtlsTransport

The webrtc::DtlsTransport class is a wrapper around the cricket::DtlsTransportInternal and allows registering observers implementing the webrtc::DtlsTransportObserverInterface. The webrtc::DtlsTransportObserverInterface will provide updates to the observers, passing around a snapshot of the transports state such as the connection state, the remote certificate(s) and the SRTP ciphers as DtlsTransportInformation.

cricket::DtlsTransportInternal

The cricket::DtlsTransportInternal class is an interface. Its implementation is cricket::DtlsTransport. The cricket::DtlsTransport sends and receives network packets via an ICE transport. It also demultiplexes DTLS packets and SRTP packets according to the scheme described in RFC 5764.

webrtc::DtlsSrtpTranport

The webrtc::DtlsSrtpTransport class is responsіble for extracting the SRTP keys after the DTLS handshake as well as protection and unprotection of SRTP packets via its cricket::SrtpSession.