# can not load encrypted .pak files

**URL:** <https://forums.unrealengine.com/t/can-not-load-encrypted-pak-files/69339>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [July 19, 2016, 5:57am UTC](https://forums.unrealengine.com/t/can-not-load-encrypted-pak-files/69339 "2016-07-19T05:57:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_6984ec7d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6984ec7d](https://forums.unrealengine.com/u/anonymous_user_6984ec7d)\
**Post date:** [July 19, 2016, 5:57am UTC](https://forums.unrealengine.com/t/can-not-load-encrypted-pak-files/69339/1 "2016-07-19T05:57:23Z")

</div>

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:

```auto

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

```

then I use the following code to mount Pak files:

```auto

      
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:

```auto

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

> [@](#):
>
> material1.uasset’ contains unrecognizable data, check that it is of the expected type

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

can anyone help me .

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_aca5c299](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_aca5c299](https://forums.unrealengine.com/u/anonymous_user_aca5c299)\
**Post date:** [November 20, 2018, 4:21pm UTC](https://forums.unrealengine.com/t/can-not-load-encrypted-pak-files/69339/2 "2018-11-20T16:21:12Z")

</div>

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