Skip to main content

EFMCrypto

File and data encryption/decryption using AES-256 in CBC mode, built on Unreal's own Core AES implementation. Any string works as a key, it gets hashed into a proper 256-bit key internally. A random IV is generated on every call, so encrypting the same data twice never produces the same output.

Note: This is encryption only, there's no integrity check on the encrypted data, so it's meant for save games and local config rather than anything that needs tamper detection.

Functions​

EncryptFile​

Callable Encrypts a file and saves to a new location.

C++

bool EncryptFile(const FString& SourceFile, const FString& DestinationFile, const FString& Key)
ParameterTypeDescription
SourceFileFStringPath to the source file
DestinationFileFStringPath for the encrypted output
KeyFStringEncryption key

Returns: true if encryption succeeded

Category: EFM|Crypto

Blueprint Node

ƒEncrypt File
Source File
Destination File
Key
Return Value

DecryptFile​

Callable Decrypts a file and saves to a new location.

C++

bool DecryptFile(const FString& SourceFile, const FString& DestinationFile, const FString& Key)

Category: EFM|Crypto

Blueprint Node

ƒDecrypt File
Source File
Destination File
Key
Return Value

EncryptBytes​

Callable Encrypts a byte array.

C++

TArray<uint8> EncryptBytes(const TArray<uint8>& Data, const FString& Key)

Category: EFM|Crypto

Blueprint Node

ƒEncrypt Bytes
Data
Key
Return Value

DecryptBytes​

Callable Decrypts a byte array.

C++

TArray<uint8> DecryptBytes(const TArray<uint8>& Data, const FString& Key)

Category: EFM|Crypto

Blueprint Node

ƒDecrypt Bytes
Data
Key
Return Value

EncryptString​

Callable Encrypts a string.

C++

bool EncryptString(const FString& PlainText, const FString& Key, FString& OutEncrypted)
ParameterTypeDirectionDescription
PlainTextFStringInText to encrypt
KeyFStringInEncryption key
OutEncryptedFStringOutEncrypted output

Returns: true if encryption succeeded

Category: EFM|Crypto

Blueprint Node

ƒEncrypt String
Plain Text
Key
Out Encrypted
Return Value

DecryptString​

Callable Decrypts a string.

C++

bool DecryptString(const FString& EncryptedText, const FString& Key, FString& OutDecrypted)

Category: EFM|Crypto

Blueprint Node

ƒDecrypt String
Encrypted Text
Key
Out Decrypted
Return Value

Example​

// Encrypt a save file
EncryptFile(
GetGameSavedDirectory() + "save.dat",
GetGameSavedDirectory() + "save.enc",
"MySecretKey123"
)

// Encrypt a string
Encrypted = ""
EncryptString("SensitiveData", "MySecretKey123", Encrypted)
// Store Encrypted somewhere...

// Decrypt later
Decrypted = ""
DecryptString(Encrypted, "MySecretKey123", Decrypted)
// Decrypted now contains "SensitiveData"