To improve data security, developers can encrypt users' media streams during the real-time engagement. Agora supports built-in encryption, and you can set the encryption mode and encryption secret.

  • Both the communication and live interactive streaming scenarios support encryption, but Agora does not support pushing encrypted streams to the CDN in a live-streaming channel.
  • Eure that both the receivers and senders use the same encryption scheme. Otherwise, undefined behaviors such as no voice and black screen may occour.
  • The following diagram describes the encrypted data transmission process:


    Before proceeding, ensure that you have implemented basic real-time functions in your project. See Start a Call or Start Live Interactive Streaming for details.

    Before joining a channel, call setEncryptionMode and setEncryptionSecret to set the encryption mode and encryption secret.

    All users in the same channel must use the same encryption mode and encryption secret.

    Agora supports the following encryption modes:

    • aes-128-xts: 128-bit AES encryption, XTS mode.
    • aes-256-xts: 256-bit AES encryption, XTS mode.
    • aes-128-ecb: 128-bit AES encryption, ECB mode.
    //Sets encryption mode to aes-128-xts.
    //Sets encryption secret.

    API reference