Skip to content

End‐to‐end encryption in WebRTC audio call

Mukesh edited this page Sep 21, 2024 · 1 revision

Overview

The SDK facilitates end-to-end encrypted audio call using WebRTC's RTCRtpSender and RTCRtpReceiver along with the Window Crypto API for encryption. The encryption and decryption of media streams are handled using AES-GCM, providing a robust mechanism to encrypt audio data end-to-end.

  • Audio streams are encrypted before being transmitted to the peer.
  • Decryption of the streams occurs on the receiver’s end, ensuring confidentiality.
  • The encryption keys are generated using the Web Crypto API.

Encryption and Decryption Flow

Sender:

The media stream (audio) is intercepted before transmission using RTCRtpSender.createEncodedStreams(). The data is encrypted using AES-GCM with a unique IV for each chunk. The encrypted data is passed back to the RTP sender for transmission.

Receiver:

The encrypted media stream is intercepted using RTCRtpReceiver.createEncodedStreams(). The encrypted data is decrypted using the remote peer’s AES key and the IV. The decrypted data is then passed to the media player for playback.

Clone this wiki locally