SRTP: Allow multiple keying methods in SDP offer. #4653
+20
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR attempts to allow multiple keying methods to be offered by a caller that has both SDES and DTLS keying methods enabled.
The purpose is to have a PJSIP-based client that can call an endpoint that only supports one keying method.
i.e. Caller enables keying[SDES, DTLS] and attempts to call a client that only accepts DTLS. The SDP line should include both
cryptoandfingerprintand not just crypto.This prevents having to agree ahead of time on what key exchange method to use between clients.
For example:
The main change is to remove the
offerer_sidecheck intransport_media_createthat forces selection of the first keying method. This allows both keying methods to be added during the SDP creation.This works for the caller. However, if PJSIP is the callee,
transport_srtp_sdeswill exclude itself because the media line is the fullUDP/TLS/RTP/SAVPand not exactlyRTP/SAVP. So the second change is to 'drop' theUDP/TLSflags from the remote protocol line when checking the SDP in the callee in a few places.^^^ this allows
transport_srtp_sdesandtransport_srtp_dtlsto accept the SDP as valid sincecryptoandfingerprintare both available.A few alternatives to sprinkling this in
transport_srtp_sdesis perhaps to:UDP/TLSflags from the caller side but that doesn't seem quite right.&instead of!=for checkingrem_proto != PJMEDIA_TP_PROTO_RTP_SAVP.m=audioline that also hasUDP/TLSbut maybe that complicates other aspects.In the end the callee should select the first keying method that it supports (in
transport_media_start).So all the permutations should work:
I can't find anything in the standard that prevents both keying methods to be offered RFC-4568 (SDP) and RFC-8842(SDP DTLS). Though, AI searches beg to differ. But maybe it's hallucinating.
I do see a
sippscenario (tests/pjsua/scripts-sipp/uac-srtp-dtls.xml) that offers both. But maybe that is to do some negative testing.I'm still testing this with various clients as caller/callee. Please let me know if you have any input or if there is another approach to enabling this functionality. Also, any pointers to add tests for this would be great.
Thanks!