Built-in encryption configurations.

public class EncryptionConfig
        public ENCRYPTION_MODE encryptionMode;
        public string encryptionKey;
        public byte[] encryptionKdfSalt;
        public bool datastreamEncryptionEnabled;



The built-in encryption mode. See ENCRYPTION_MODE. Agora recommends using AES_128_GCM2 or AES_256_GCM2 encrypted mode. These two modes support the use of salt for higher security.


Encryption key in string type with unlimited length. Agora recommends using a 32-byte key.

Attention: If you do not set an encryption key or set it as NULL, you cannot use the built-in encryption, and the SDK returns -2.

Salt, 32 bytes in length. Agora recommends that you use OpenSSL to generate salt on the server side. See Media Stream Encryption for details.

Attention: This parameter takes effect only in AES_128_GCM2 or AES_256_GCM2 encrypted mode. In this case, ensure that this parameter is not 0.
Whether to enable data stream encryption:
  • true: Enable data stream encryption.
  • false: (Default) Disable data stream encryption.