Overview
概述
WebRTC uses DTLS in two ways:
WebRTC以两种方式使用DTLS:
- to negotiate keys for SRTP encryption using DTLS-SRTP
- 使用DTLS-SRTP协商SRTP加密的密钥
- as a transport for SCTP which is used by the Datachannel API
- 作为数据通道API使用的SCTP的传输
The W3C WebRTC API represents this as the DtlsTransport.
W3C WebRTC API将其表示为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.
DTLS握手发生在ICE传输变为可写并找到有效对之后。它导致为DTLS-SRTP导出一组密钥,以及将远程证书的指纹与SDP a=fingerprint:行中给出的指纹进行比较。
This documentation provides an overview of how DTLS is implemented, i.e how the following classes interact.
本文档概述了DTLS是如何实现的,即以下类是如何交互的。
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.
webrtc::DtlsTransport类是 cricket::DtlsTransportInternal
的包装器,允许注册实现webrtc::DtlsTransportObserverInterface的观察者。webrtc::DtlsTransportObserverInterface将向观察者提供更新,将传输状态的快照(如连接状态、远程证书和SRTP密码)作为DtlsTtransportInformation传递。
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.
cricket::DtlsTransportInternal类是一个接口。它的实现是cricket::DtlsTransport。cricket::DtlsTransport通过ICE传输发送和接收网络数据包。它还根据RFC 5764中描述的方案对DTLS分组和SRTP分组进行解复用。
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.
webrtc::DtlsSrtpTransport类负责在DTLS握手后提取SRTP密钥,以及通过其cricket::SrtpSession保护和取消保护SRTP数据包。