Agora RTC Objective-C API Reference Refactor

Properties
AgoraEncryptionConfig Class Reference

Inherits <NSObject>.

## Properties
AgoraEncryptionMode | encryptionMode
NSString *_Nullable | encryptionKey
NSData *_Nullable | encryptionKdfSalt
BOOL | datastreamEncryptionEnabled

## Property Documentation

## ◆ encryptionMode

- (AgoraEncryptionMode) encryptionMode
| read write nonatomic assign

The built-in encryption mode. See `AgoraEncryptionMode`. Agora recommends using `AgoraEncryptionModeAES128GCM2` or `AgoraEncryptionModeAES256GCM2` encrypted mode. These two modes support the use of salt for higher security.

## ◆ encryptionKey

- (NSString* _Nullable) encryptionKey
| read write nonatomic copy

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

Note
  If you do not set an encryption key or set it as `nil`, you cannot use the built-in encryption, and the SDK returns `-2`.

## ◆ encryptionKdfSalt

- (NSData* _Nullable) encryptionKdfSalt
| read write nonatomic strong

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

Note
  This parameter takes effect only in `AgoraEncryptionModeAES128GCM2` or `AgoraEncryptionModeAES256GCM2` encrypted mode. In this case, ensure that this parameter is not `0`.

## ◆ datastreamEncryptionEnabled

- (BOOL) datastreamEncryptionEnabled
| read write nonatomic assign

Whether to enable data stream encryption:

- `YES`: Enable data stream encryption.
- `NO`: (Default) Disable data stream encryption.