Encryption API for Unreal SDK
PubNub Unreal SDK includes message encryption. This documentation covers crypto module configuration and utility methods for encrypting and decrypting messages using both legacy 128-bit and enhanced 256-bit AES-CBC encryption.
For general SDK configuration and initialization, refer to the Configuration page.
Configuration
The crypto system in Unreal SDK consists of three main components:
- Cryptors (
IPubnubCryptorInterface), which are individual encryption algorithms (AES, Legacy) - Provider interface (
UPubnubCryptoModule), which is the top-level interface used by PubNub subsystem. - Crypto module (
IPubnubCryptoProviderInterface), which manages multiple cryptors with automatic algorithm selection.
To configure the cryptoModule to encrypt all messages, you can use the following methods in the Unreal SDK:
Automatic message encryption/decryption
Once configured, the crypto module automatically handles encryption and decryption:
- All published messages are encrypted using the default cryptor
- Received messages and fetched history messages are automatically decrypted using the appropriate cryptor (determined by the 4-byte identifier in the message header)
Set crypto module
PubnubSubsystem->SetCryptoModule(CryptoModule)
* required
| Parameter | Description |
|---|---|
CryptoModule *Type: TScriptInterface<IPubnubCryptoProviderInterface> | The crypto module object that implements IPubnubCryptoProviderInterface. |
Sample code
To set crypto module and configure AES encryption/decryption for all messages:
Actor.h
Sep 3, 2025