UE4 文件加密

Posted cartzhang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UE4 文件加密相关的知识,希望对你有一定的参考价值。

记录:

文件的加密和解密代码:

FString aa = "This is a test";
    uint8* Blob1; //we declere uint8 pointer
    uint32 Size1; //for size calculation
    Size1 = aa.Len();
    Size1 = Size1 + (FAES::AESBlockSize - (Size1 % FAES::AESBlockSize));
    Blob1 = new uint8[Size1];
    const TCHAR* KeyChars = AirLineBackNS::AirLinePrivateKey.GetCharArray().GetData();  
    StringToBytes(aa, Blob1, Size1);
    FAES::EncryptData(Blob1, Size1, TCHAR_TO_ANSI(KeyChars));

    FString bb = FString::FromHexBlob(Blob1, Size1);    
    uint8* Blob2; //we declere uint8 pointer
    uint32 Size2; //for size calculation
    Size2 = bb.Len();
    Size2 = Size2 - (FAES::AESBlockSize - (Size2 % FAES::AESBlockSize));
    Blob2 = new uint8[Size2];
    FString::ToHexBlob(bb,Blob2, Size2);
    FAES::DecryptData(Blob2, Size2, TCHAR_TO_ANSI(KeyChars));
    FString cc = BytesToString(Blob2, Size2);

    UE_LOG(LogTemp, Error, TEXT("Deserial %s"), *aa);
    UE_LOG(LogTemp, Error, TEXT("Deserial %s"), *bb);
    UE_LOG(LogTemp, Error, TEXT("Deserial %s"), *cc);

头文件

#include “Misc/AES.h”
#include “Misc/Paths.h”

以上是关于UE4 文件加密的主要内容,如果未能解决你的问题,请参考以下文章

Virbox LM 软件加密保护

[UE4]创建游戏加入游戏

ue4怎么打开vstar

解决UE4缓存使C盘膨胀的问题

如何隐藏UE4引擎目录?

UE4配置文件详解