Download

can not load encrypted .pak files

I use UnrealPak.exe to encrypt my uassets which are loaded at runtime , the encrypt command is something like

UnreakPak.exe targetPak.pak -create=“directory of uassets” -encrypt -compress

I defined AES_KEY in file Core.Build.cs:



 Definitions.Add("AES_KEY=\"128bitkey\"");


then I use the following code to mount Pak files:


      
m_PakPlatform = new FPakPlatformFile;
IPlatformFile& InnerPlatform = FPlatformFileManager::Get().GetPlatformFile();
m_PakPlatform->Initialize(&InnerPlatform, TEXT(""));
FPlatformFileManager::Get().SetPlatformFile(*m_PakPlatform);

m_PakPlatform->Mount(*pakFilePath, 0, *mountingPath))


then load uasset:



TSet<FString> fileList;
PakFile.FindFilesAtPath(fileList, *PakFile.GetMountPoint(), true, false, true);
FStreamableManager * m_Stream = new FStreamableManager ;

for (const auto & file : fileList) {
    m_Stream->SynchronousLoad(file );
}



the output is

when I remove the ‘-encrypt’ option, everything works fine.

can anyone help me .

I am having trouble getting any encrypted pak files to mount.