EncryptionConfig
Built-in encryption configurations.
@JsonSerializable(explicitToJson: true, includeIfNull: false) class EncryptionConfig { const EncryptionConfig( {this.encryptionMode, this.encryptionKey, this.encryptionKdfSalt, this.datastreamEncryptionEnabled}); @JsonKey(name: 'encryptionMode') final EncryptionMode? encryptionMode; @JsonKey(name: 'encryptionKey') final String? encryptionKey; @JsonKey(name: 'encryptionKdfSalt', ignore: true) final Uint8List? encryptionKdfSalt; @JsonKey(name: 'datastreamEncryptionEnabled') final bool? datastreamEncryptionEnabled; factory EncryptionConfig.fromJson(Map<String, dynamic> json) => _$EncryptionConfigFromJson(json); Map<String, dynamic> toJson() => _$EncryptionConfigToJson(this); }
Attributes
- encryptionMode
-
The built-in encryption mode. See EncryptionMode. Agora recommends using
aes128Gcm2
oraes256Gcm2
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 inaes128Gcm2
oraes256Gcm2
encrypted mode. In this case, ensure that this parameter is not0
. - datastreamEncryptionEnabled
- Whether to enable data stream encryption:
true
: Enable data stream encryption.false
: (Default) Disable data stream encryption.