On 09/04/2024 23.14, Alex Balashov via sr-users wrote:
Exchanging keys directly in the SDP body is rather
suboptimal from a security standpoint, even if the signalling is encrypted, but it's
certainly simpler.
I suppose that makes DTLS "more secure", but in every other sense, I'm not
sure DTLS is "better". W3C WebRTC standards mandate DTLS-SRTP, as far as I know,
so I suppose it's more fit for that purpose.
To add to that, one benefit DTLS has over SDES is that key exchange can
happen as soon as media can flow, which theoretically can be immediately
after the initial offer (invite), especially if ICE is also in use, as
is the case with WebRTC. Whereas with SDES, since key exchange happens
in-line with the signalling, key exchange can only be completed once an
answer to the initial offer has been received. Which means that at least
in theory DTLS is faster to establish media than SDES is. (Caveat: Not
all DTLS clients actually allow this.)
As for security: The most commonly used SRTP key types that can be
exchanged are the same between SDES and DTLS, so in this aspect neither
is more secure than the other. As for key exchange itself, DTLS is more
sophisticated as it uses a peer-to-peer (with rtpengine being one of the
peers in your case) public-key exchange to set up SRTP, whereas SDES
relies on the signalling transport to be encrypted, which almost
certainly isn't the case peer-to-peer (i.e. any involved signalling
gateway or proxy can inspect or possibly modify the keys).
In theory DTLS also allows extra trust to be established via
verification of the DTLS certificates, but in practice this isn't
usually done as the certificates are often self-signed.
Cheers