FEncryptionConfig

Built-in encryption configurations.

USTRUCT(BlueprintType)
struct FEncryptionConfig
{
	GENERATED_BODY()
public:
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig")
	EENCRYPTION_MODE encryptionMode = EENCRYPTION_MODE::AES_128_GCM;
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig")
	FString encryptionKey = "";
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig")
	FString encryptionKdfSalt = "";
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|EncryptionConfig")
	bool datastreamEncryptionEnabled = false;
	FEncryptionConfig(){}
	FEncryptionConfig(const agora::rtc::EncryptionConfig & AgoraData){
		encryptionMode = static_cast<EENCRYPTION_MODE>(AgoraData.encryptionMode);
		encryptionKey = UTF8_TO_TCHAR(AgoraData.encryptionKey);
		char valencryptionKdfSalt[32] = {0};
		int AgoraCount = 32;
		for (int i = 0; i < AgoraCount; i++) {
			encryptionKdfSalt[i] = AgoraData.encryptionKdfSalt[i];
		}
		encryptionKdfSalt = valencryptionKdfSalt;
		datastreamEncryptionEnabled = AgoraData.datastreamEncryptionEnabled;
	}
	agora::rtc::EncryptionConfig CreateAgoraData() const {
		agora::rtc::EncryptionConfig AgoraData;
		AgoraData.encryptionMode = static_cast<agora::rtc::ENCRYPTION_MODE>(encryptionMode);
		SET_UABT_FSTRING_TO_CONST_CHAR___MEMALLOC(AgoraData.encryptionKey,this->encryptionKey)

		std::string StdencryptionKdfSalt = TCHAR_TO_UTF8(*encryptionKdfSalt);
		int AgoraCount = 32;
		for (int i = 0; i < AgoraCount; i++) {
			if(i >= StdencryptionKdfSalt.size()){
				break;
			}
			AgoraData.encryptionKdfSalt[i] = StdencryptionKdfSalt[i];
		}
		AgoraData.datastreamEncryptionEnabled = datastreamEncryptionEnabled;
		return AgoraData;
	}
	void FreeAgoraData(agora::rtc::EncryptionConfig & AgoraData) const {
		SET_UABT_FSTRING_TO_CONST_CHAR___MEMFREE(AgoraData.encryptionKey)
	}
};

Attributes

encryptionMode

The built-in encryption mode. See EENCRYPTION_MODE. Agora recommends using AES_128_GCM2 or AES_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 as NULL, 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 in AES_128_GCM2 or AES_256_GCM2 encrypted mode. In this case, ensure that this parameter is not 0.
datastreamEncryptionEnabled
Whether to enable data stream encryption:
  • true: Enable data stream encryption.
  • false: (Default) Disable data stream encryption.