Extract actual keys - Decrypt SRTP traffic

216 views
Skip to first unread message

Chandramouli P

unread,
May 29, 2025, 6:20:28 AM5/29/25
to discuss...@googlegroups.com
Hi,

I am trying to decrypt SRTP traffic from a WebRTC call. I captured keys using SSLKEYLOG and opened .pcap file in Wireshark. But, i found fingerprint only in SDP and it indicates that the key is exchanged/exported from DTLS. But, I wasn't able to find actual keys used in DTLS-SRTP. Can any one help me how to extract the actual keys? Thank you.

Best Regards,
Chandramouli.

Harald Alvestrand

unread,
May 29, 2025, 11:01:20 AM5/29/25
to discuss...@googlegroups.com
The DTLS-SRTP encryption keys are generated from the DTLS keys using the key derivation method documented in the DTLS-SRTP RFC.


--
This list falls under the WebRTC Code of Conduct - https://webrtc.org/support/code-of-conduct.
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/discuss-webrtc/CAKYJ-7C3AaJsWqosXeFPkHjM%2BMzkuT26RznVs8ZaYs-MHZ214A%40mail.gmail.com.

[MSFT] Diego Perez Botero

unread,
May 30, 2025, 10:26:22 AM5/30/25
to discuss-webrtc
If one of the peers involved in your WebRTC call is a Chrome browser instance, you can access the call's unencrypted RTP payload without having to mess with cryptographic keys:  Capture & Replay WebRTC video streams for debugging – video_replay 2025 update - webrtcHacks

Chandramouli P

unread,
May 30, 2025, 11:18:06 AM5/30/25
to discuss...@googlegroups.com
Hello Harald,

Thank you for your reply and I do understand after going through RFC. But, I don't have access to our code base. Is there any way to capture or extract the key by participating in an active call from .har file or .pcap file after completion of the call using Wireshark? Thank you.

Best Regards,
Chandramouli.

Philipp Hancke

unread,
May 30, 2025, 11:44:34 AM5/30/25
to discuss...@googlegroups.com
Retroactive decryption is explicitly not supported

Chandramouli P

unread,
Jun 3, 2025, 2:58:14 AM6/3/25
to discuss...@googlegroups.com
Hello Diego,

Thank you for your reply. I have gone through the URL and this is not our use case. 

Best Regards,
Chandramouli.

Chandramouli P

unread,
Jun 3, 2025, 2:58:19 AM6/3/25
to discuss...@googlegroups.com
Hello Phillipp,

Thank you for your reply. If I understand correctly, what you are saying is, It is not possible to decrypt UDP packets and not possible to capture or extract the actual keys. Am I right? 

Best Regards,
Chandramouli.


Harald Alvestrand

unread,
Jun 3, 2025, 4:00:41 AM6/3/25
to discuss...@googlegroups.com
If you use the SSLKEYLOG function (telling the browser to log the keys, a facility I didn't know existed), you should be able to derive the SRTP key using the RFC method, and then use that SRTP key to decrypt the packets. But AFAIK, there is no software that will currently do that for you, you have to write the code yourself.


Chandramouli P

unread,
Jun 3, 2025, 4:41:50 AM6/3/25
to discuss...@googlegroups.com
Hello Harald,

Thank you very much for your reply. I just double checked the SSLKEYLOG file and found many keys. I am not sure which key I need to pick up to decrypt. I am herewith enclosing two files i.e. one is the keylog file which is captured for an inbound call and another is outbound call. Could you please go through once and help which keys I need to pick up? Thank you, once again.

Best Regards,
Chandramouli.


OutboundCall-ssl-key.log
Inbound-ssl-key.log

Harald Alvestrand

unread,
Jun 5, 2025, 3:36:41 AM6/5/25
to discuss...@googlegroups.com
Sorry, you're now well beyond webrtc expertise and into TLS / boringssl expertise, which I don't think you'll find on this list.
Good luck in finding other sources of expertise!

Harald

Chandramouli P

unread,
Jun 5, 2025, 4:53:40 AM6/5/25
to discuss...@googlegroups.com
Hello Harald,

Any help would be appreciated. Thank you.

Best Regards,
Chandramouli.

Kelly Kinyama

unread,
Jun 10, 2025, 12:45:58 PM6/10/25
to discuss-webrtc
Extracting DTLS session keys using this link is a piece of cake. See the examples in the readme:
https://github.com/KellyKinyama/dart-webrtc

Chandramouli P

unread,
Jun 12, 2025, 5:23:50 AM6/12/25
to discuss...@googlegroups.com
Hello Harald,

Good morning and thank you for your reply. I have gone through RFC5764 and finally, I believe that I have extracted the keys by adding some code into code base. But, I am facing two issues while decrypting the .pcap using these keys using rtp_decoder (libsrtp). Please find the below data:

Extracted Keys:
Server SRTP Master Key: 031bc5fed658271e4f612240074c3aee6b2b9073fa1c77e0c28169524e425287
Server SRTP Master Salt: efdf044df29da031490b4ee9
Client SRTP Master Key: 30fe74f23edcd7816e6609cc5f81400f146ce6b557657fcc6383aeeb17510de4
Client SRTP Master Salt: 55950d4e9b809416b9e681a4

libsrtp/test$ ./rtp_decoder -a -t 10 -e 256 -k "031bc5fed658271e4f612240074c3aee6b2b9073fa1c77e0c28169524e425287efdf044df29da031490b4ee9" < dev2.pcap > dev.txt
Using libsrtp3 3.0.0-pre [0x3000000]
security services: confidentiality message authentication
setting tag len 10
error: too few digits in key/salt (should be 92 digits, found 88)

./rtp_decoder -a -t 10 -e 256 -b "30fe74f23edcd7816e6609cc5f81400f146ce6b557657fcc6383aeeb17510de455950d4e9b809416b9e681a4" < dev2.pcap > dev.txt
Using libsrtp3 3.0.0-pre [0x3000000]
security services: confidentiality message authentication
setting tag len 10
set master key/salt to df47deef87f6dde75c77bf35e9eebad3d71ce5ff35e34d1fd78e9c7ba6f9e7be/b9edf71ceb7f3769e79bd7be75d1
Starting decoder
*** buffer overflow detected ***: terminated

This is where I am stuck. Could you suggest and help me to resolve? Thank you.

Best Regards,
Chandramouli.


Chandramouli P

unread,
Jun 16, 2025, 4:02:04 AM6/16/25
to discuss...@googlegroups.com
Hello Harald,

Good morning and any help would be appreciated. Thank you.

Best Regards,
Chandramouli.

Chandramouli P

unread,
Jun 16, 2025, 4:02:22 AM6/16/25
to discuss...@googlegroups.com
Hello Kelly,

Good morning and thank you for sharing your repository and thoughts. I am not sure whether it will fulfill my requirement or not. But, I will go through and update you. Thank you.

Best Regards,
Chandramouli.


Reply all
Reply to author
Forward
0 new messages