Re: RTSP/SRTP in gstreamer (MIKEY vrl2rtspserver)

Nicolas Dufresne via gstreamer-devel <[email protected]> Fri, 28 Mar 2025 16:04:34 -0400
Newsgroups gmane.comp.video.gstreamer.devel
Message-ID <[email protected]>
--=-re3Yl0PY/vVsg2XfTGoK
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Le jeudi 27 mars 2025 =C3=A0 06:24 +0000, Manikandan Valaguru via gstreamer=
-
devel a =C3=A9crit=C2=A0:
>=20
> Hi,
> I am currently working with a custom v4l2rtspserver built on Live555,
> aiming to enable RTSPS (RTSP over TLS) and SRTP (Secure RTP) for
> secure video streaming. My objective is to stream encrypted video and
> successfully decode it in GStreamer.

You may have used GstRtspServer library instead, which already
implement all this security.

>=20
>=20
> Based on my understanding:
>=20
>=20
> =C2=A0 =C2=A0 RTSPS encryption and decryption rely on TLS certificates.
>=20
>=20
> =C2=A0 =C2=A0 SRTP requires a decryption key, which can be extracted from=
 the
> MIKEY data in the SDP (Session Description Protocol) of the RTSP
> response.
>=20
>=20
> =C2=A0 =C2=A0 Using this key, I need to construct a GStreamer pipeline to
> decrypt SRTP packets.
>=20
>=20
> Could you confirm if this approach is correct?
>=20
>=20
> Currently, I am extracting the SRTP key from the SDP session and
> embedding it into the GStreamer pipeline as follows:
>=20
>=20
> GST_DEBUG=3D3 gst-launch-1.0 rtspsrc
> location=3Drtsps://econ:[email protected]:5005/routecam tls-validation-
> flags=3D4 protocols=3Dudp \
> =C2=A0 =C2=A0 ! application/x-srtp, srtp-
> key=3Da053ace0edcaba09192bff35fa01da6170317cd36af12b87be015f416701, \
> =C2=A0 =C2=A0 =C2=A0 srtp-cipher=3Daes-128-icm, srtp-auth=3Dhmac-sha1-80,=
 roc=3D0 \
> =C2=A0 =C2=A0 ! srtpdec \
> =C2=A0 =C2=A0 ! rtph264depay \
> =C2=A0 =C2=A0 ! avdec_h264 \
> =C2=A0 =C2=A0 ! xvimagesink -v

Decryption is implemented inside rtspsrc element. In the RFC defined
protocol, the keys are provision by the server. Though we also have a
non-compliant mode where the keys are managed by the client. =C2=A0Here's
pointer to the doc. Note that there is very little to no activity on
the mailing. We encourage to use discourse.gstreamer.org for future
questions.

-
=C2=A0https://gstreamer.freedesktop.org/documentation/rtsp/rtspsrc.html?gi-=
language=3Dc#rtspsrc:client-managed-mikey
-
=C2=A0https://gstreamer.freedesktop.org/documentation/rtsp/rtspsrc.html?gi-=
language=3Dc#example-launch-line



>=20
>=20
> However, I am encountering issues during playback. I have attached
> the error logs and MIKEY data for reference. Could you please review
> them and let me know if I am missing anything?
>=20
>=20
> Looking forward to your insights.
>=20
> Regards,
> Manikandan
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Taking any action in
> reliance on the contents of this information is strictly prohibited.
> Please notify the sender immediately by e-mail if you have received
> this e-mail by mistake and delete this e-mail from your system.
> WARNING: Although the company has taken reasonable precautions to
> ensure no viruses are present in this email, e-con cannot accept
> responsibility for any loss or damage arising from the use of this
> email or attachment.


--=-re3Yl0PY/vVsg2XfTGoK
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html><head>

<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
<style>pre,code,address {
  margin: 0px;
}
h1,h2,h3,h4,h5,h6 {
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}
ol,ul {
  margin-top: 0em;
  margin-bottom: 0em;
}
blockquote {
  margin-top: 0em;
  margin-bottom: 0em;
}
</style></head>
<body dir=3D"ltr"><div>Le jeudi 27 mars 2025 =C3=A0 06:24 +0000, Manikandan=
 Valaguru via gstreamer-devel a =C3=A9crit&nbsp;:</div><blockquote type=3D"=
cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-lef=
t:1ex">
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">Hi,<br>I am currently working with a custom v4l2rtspse=
rver built on Live555, aiming to enable RTSPS (RTSP over TLS) and SRTP (Sec=
ure RTP) for secure video streaming. My objective is to stream encrypted vi=
deo and successfully decode it in GStreamer.</div></blockquote><div><br></d=
iv><div>You may have used GstRtspServer library instead, which already impl=
ement all this security.</div><div><br></div><blockquote type=3D"cite" styl=
e=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><di=
v class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFont,=
 Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; colo=
r: rgb(0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">Based on my understanding:</div><div class=
=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_=
MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(=
0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">&nbsp; &nbsp; RTSPS encryption and decryptio=
n rely on TLS certificates.</div><div class=3D"elementToProof" style=3D"fon=
t-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetic=
a, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">&nbsp; &nbsp; SRTP requires a decryption key=
, which can be extracted from the MIKEY data in the SDP (Session Descriptio=
n Protocol) of the RTSP response.</div><div class=3D"elementToProof" style=
=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, H=
elvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">&nbsp; &nbsp; Using this key, I need to cons=
truct a GStreamer pipeline to decrypt SRTP packets.</div><div class=3D"elem=
entToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontSe=
rvice, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0)=
;">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">Could you confirm if this approach is correc=
t?</div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_Em=
beddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size:=
 12pt; color: rgb(0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">Currently, I am extracting the SRTP key from=
 the SDP session and embedding it into the GStreamer pipeline as follows:</=
div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_Embedd=
edFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12p=
t; color: rgb(0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">GST_DEBUG=3D3 gst-launch-1.0 rtspsrc locatio=
n=3Drtsps://econ:[email protected]:5005/routecam tls-validation-flags=3D4 p=
rotocols=3Dudp \</div><div class=3D"elementToProof" style=3D"font-family: A=
ptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-ser=
if; font-size: 12pt; color: rgb(0, 0, 0);">&nbsp; &nbsp; ! application/x-sr=
tp, srtp-key=3Da053ace0edcaba09192bff35fa01da6170317cd36af12b87be015f416701=
, \</div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_E=
mbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size=
: 12pt; color: rgb(0, 0, 0);">&nbsp; &nbsp; &nbsp; srtp-cipher=3Daes-128-ic=
m, srtp-auth=3Dhmac-sha1-80, roc=3D0 \</div><div class=3D"elementToProof" s=
tyle=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibr=
i, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">&nbsp; &nb=
sp; ! srtpdec \</div><div class=3D"elementToProof" style=3D"font-family: Ap=
tos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-seri=
f; font-size: 12pt; color: rgb(0, 0, 0);">&nbsp; &nbsp; ! rtph264depay \</d=
iv><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_Embedde=
dFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt=
; color: rgb(0, 0, 0);">&nbsp; &nbsp; ! avdec_h264 \</div><div class=3D"ele=
mentToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontS=
ervice, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0=
);">&nbsp; &nbsp; ! xvimagesink -v</div></blockquote><div><br></div><div>De=
cryption is implemented inside rtspsrc element. In the RFC defined protocol=
, the keys are provision by the server. Though we also have a non-compliant=
 mode where the keys are managed by the client. &nbsp;Here's pointer to the=
 doc. Note that there is very little to no activity on the mailing. We enco=
urage to use discourse.gstreamer.org for future questions.</div><div><br></=
div><div>-&nbsp;<a href=3D"https://gstreamer.freedesktop.org/documentation/=
rtsp/rtspsrc.html?gi-language=3Dc#rtspsrc:client-managed-mikey">https://gst=
reamer.freedesktop.org/documentation/rtsp/rtspsrc.html?gi-language=3Dc#rtsp=
src:client-managed-mikey</a></div><div>-&nbsp;<a href=3D"https://gstreamer.=
freedesktop.org/documentation/rtsp/rtspsrc.html?gi-language=3Dc#example-lau=
nch-line">https://gstreamer.freedesktop.org/documentation/rtsp/rtspsrc.html=
?gi-language=3Dc#example-launch-line</a></div><div><br></div><div><br></div=
><div><br></div><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; borde=
r-left:2px #729fcf solid;padding-left:1ex"><div class=3D"elementToProof" st=
yle=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri=
, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">However, I am encountering issues during pla=
yback. I have attached the error logs and MIKEY data for reference. Could y=
ou please review them and let me know if I am missing anything?</div><div c=
lass=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFont, Ap=
tos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: =
rgb(0, 0, 0);">
<br></div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_=
EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-siz=
e: 12pt; color: rgb(0, 0, 0);">Looking forward to your insights.<br><br>Reg=
ards,</div><div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos=
_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-si=
ze: 12pt; color: rgb(0, 0, 0);">Manikandan</div><div>This email and any fil=
es transmitted with it are confidential and intended solely for the use of =
the individual or entity to whom they are addressed. If you are not the nam=
ed addressee you should not disseminate, distribute or copy this e-mail. Ta=
king any action in reliance on the contents of this information is strictly=
 prohibited. Please notify the sender immediately by e-mail if you have rec=
eived this e-mail by mistake and delete this e-mail from your system. WARNI=
NG: Although the company has taken reasonable precautions to ensure no viru=
ses are present in this email, e-con cannot accept responsibility for any l=
oss or damage arising from the use of this email or attachment.</div></bloc=
kquote><div><br></div><div><span></span></div></body></html>

--=-re3Yl0PY/vVsg2XfTGoK--