EncryptionConfig
Built-in encryption configurations.
public class EncryptionConfig { public EncryptionConfig() { encryptionMode = ENCRYPTION_MODE.MODE_END; encryptionKey = ""; encryptionKdfSalt = new byte[32]; } public EncryptionConfig(ENCRYPTION_MODE encryptionMode, string encryptionKey, byte[] encryptionKdfSalt) { this.encryptionMode = encryptionMode; this.encryptionKey = encryptionKey; this.encryptionKdfSalt = encryptionKdfSalt; } public ENCRYPTION_MODE encryptionMode { set; get; } public string encryptionKey { set; get; } private byte[] encryptionKdfSalt32 = new byte[32]; public byte[] encryptionKdfSalt { set { Buffer.BlockCopy(value, 0, encryptionKdfSalt32, 0, 32); } get { return encryptionKdfSalt32; } } }
Attributes
- encryptionMode
-
The built-in encryption mode. See ENCRYPTION_MODE. Agora recommends using
AES_128_GCM2
orAES_256_GCM2
encrypted mode. These two modes support the use of salt for higher security. - encryptionKey
-
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 asNULL
, you cannot use the built-in encryption, and the SDK returns-2
. - encryptionKdfSalt
-
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 inAES_128_GCM2
orAES_256_GCM2
encrypted mode. In this case, ensure that this parameter is not0
.