WebRTC encryption mechanism of SRTP

Viewed 773

WebRTC uses DTLS for encryption of SCTP (data). Furthermore it uses DTLS for key exchange of SRTP (media). But I do not quite understand, whether it also uses DTLS for encryption of SRTP. So my question: Does WebRTC use DTLS solely for key exchange (DTLS-SRTP) or does it encrypt SRTP additionally to its internal encryption mechanism (at least optionally)?

Why I am asking:
RFC 6904 as well as RFC 3711 state that SRTP provides authentication, but not encryption, of the headers of RTP packets. So only the payload of SRTP is encrypted by design.

What confuses me:
Many sources claim WebRTC to be fully end-to-end encrypted.

I am especially interested in the implementation of WebRTC in gstreamer.

1 Answers

DTLS is used for the handshake, but then the keys are extracted and a SRTP context is initialized.

I am not familiar with GStreamer, but in Pion WebRTC we connect via DTLS here. The WebRTC clients negotiate which side is a DTLS Server and which is a DTLS Client via the SDP.

When the DTLS handshake is complete you then export the keying material, you can see that here

If you are interested in seeing how SRTP works you can check out pion/srtp. It is pretty simple though, it is just AES and then you generate an authentication tag. You can see it all here

Related