# How to use encrypted pak files?

**URL:** <https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497>\
**Category:** Platform & Builds\
**Tags:** pak, UE4-10, unreal-engine, Packaging, packaging-projects, question\
**Created:** [December 4, 2015, 2:46pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497 "2015-12-04T14:46:16Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![spiez](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spiez](https://forums.unrealengine.com/u/spiez)\
**Post date:** [December 4, 2015, 2:46pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/1 "2015-12-04T14:46:16Z")

</div>

I would like to know some information about the UnrealPak.exe pak files singning method (with -sign=hex\_key\_values, etc).

1. Is it production ready? Because it’s pretty much undocumented.
2. How can I set the keyfile in UnrealAutomationTool? Is there a GUI or a way to inject the -signpak command?
3. Does it work in PIE? (I’m having problems hardcoding the keys in PublicKey.inl, editor crashes)
4. How’s the performance overhead? Is it an on-demand cypher?
5. Currently I’m not even able to make a packeged project start with signedpak turned on…

Any help would be appreciated.  
Thank you

---

<div class="post-metadata">

**Author:** ![LeFxGuy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LeFxGuy](https://forums.unrealengine.com/u/LeFxGuy)\
**Post date:** [December 8, 2015, 5:39pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/2 "2015-12-08T17:39:32Z")

</div>

I would also be interested in this 🙂

---

<div class="post-metadata">

**Author:** ![spiez](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spiez](https://forums.unrealengine.com/u/spiez)\
**Post date:** [December 17, 2015, 11:58pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/3 "2015-12-17T23:58:51Z")

</div>

Any news on this? Thank you!

---

<div class="post-metadata">

**Author:** ![TooLazyCat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TooLazyCat](https://forums.unrealengine.com/u/TooLazyCat)\
**Post date:** [December 25, 2015, 3:36pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/4 "2015-12-25T15:36:00Z")

</div>

bumping a topic

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [July 20, 2016, 5:29pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/5 "2016-07-20T17:29:37Z")

</div>

Hi spiez,

Due to the large volume of questions and comments concerning the Engine, we did not have a chance to respond to your post at the time you submitted it. However, if you are still interested, in addition to introducing some new features, some discussion of how encrypted pak files are used is touched upon in the [Unreal Engine 4.12 Release Notes](https://docs.unrealengine.com/latest/INT/Support/Builds/ReleaseNotes/2016/4_12/).

Since, admittedly, this is not the detailed information you are requesting, I have also entered the following documentation request: UEDOC-3144. If approved and incorporated into later documentation, we will notify you with an update to this post.

-.

---

<div class="post-metadata">

**Author:** ![Jake1337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jake1337](https://forums.unrealengine.com/u/Jake1337)\
**Post date:** [December 6, 2016, 10:59pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/6 "2016-12-06T22:59:45Z")

</div>

Hello, any news on this matter?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [December 7, 2016, 9:48pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/7 "2016-12-07T21:48:06Z")

</div>

Hi Jake1337,

This issue has not been closed but has been designated as a lower priority based on the number of documentation requests with greater community interest in addition to documentation for new features.

However, I have increased the community interest based on your query into this subject.

.

---

<div class="post-metadata">

**Author:** ![Muzaheed](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/muzaheed/32/778940_2.png) [@Muzaheed](https://forums.unrealengine.com/u/Muzaheed)\
**Post date:** [March 22, 2017, 9:14am UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/8 "2017-03-22T09:14:10Z")

</div>

hi .  
i followed your suggestion about 4.12 release not. and figure out about

> Build\NoRedis\Keys.txt

but the problem is that i tried with several private/public password exponent and modulas. but all of them failed to pass the password Testing phase and was rejected by unrealpak.exe.  
so can u plz provide 3 acceptable sample key to put in Keys.txt .

i tried to generate them using unrealpak.exe. but after 2 hour still it is keep running.  
i have opened a thread also about this generate part:

> **[FKeyPair -how to generate a valid key pair for pak signing?](https://forums.unrealengine.com/questions/578661/fkeypair-how-to-generate-a-valid-key-pair-for-pak.html)**
>
> here are the 3 keys i have put inside: C:\\0.ue4\\UnrealEngine\\MyApp\\Build\\NoRedist\\Keys.txt 0x123456789abcdef 0x1234567 0x12345abc but i am always getting this: Loading key pair from C:\\0.ue4\\UnrealEngine\\MyApp\\Build\\NoRedist\\Keys.txt ...

but so far nothing.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [March 23, 2017, 8:13pm UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/9 "2017-03-23T20:13:16Z")

</div>

After digging deeper into this subject I was able find a little more information that may be helpful (Some of this is translated from Chinese, so while jumbled a bit, it looks like there are some clues that might help get you past the problem you are having generating key pairs:) It is difficult to find information on this as “The code in UnrealPak was mostly meant to be a quick test when developing the pak encryption…”

"I suggest using one of the available online options for generating these keys. You can easily find a page to check if a big number is prime (P and Q should be prime) and there’s a few solutions that will generate the key pairs online too (and they’re much faster).

That creates a very large number of random numbers whose value can be designated to test the key pair… Other online tools do not recommend that you use the **-sing = filename**"

" … it is difficult to give a specific recommendation tools to find the n-th prime number to find two moderately large values in the order specified by a handful of sites, etc. (ie 1,000,000,000,000 29,996,224,275,833 first minority) on the command line

-GenerateKeys = Filename -P {first} -Q {decimal} second minority

.ssby using a key pair made -sign = filename to the four innings. If you are certain that you use a valid one in two minority here, you can shorten the process by using the keys to make -NoVerifyPrimes options.

As the value added by entering the area {} minority use the Hex value."

---

<div class="post-metadata">

**Author:** ![Muzaheed](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/muzaheed/32/778940_2.png) [@Muzaheed](https://forums.unrealengine.com/u/Muzaheed)\
**Post date:** [March 24, 2017, 11:08am UTC](https://forums.unrealengine.com/t/how-to-use-encrypted-pak-files/340497/10 "2017-03-24T11:08:18Z")

</div>

i tested packaging with **Keys.txt**. content of Keys.txt:

```
0x2F405A91B1
0xBEA1C7540F
0x10001

```

and here was the output:

> Collecting files to add to pak file…  
> UATHelper: Packaging (Windows  
> (64-bit)): UnrealPak:  
> LogPakFile:Display: Collected 1260  
> files in 0.01s. UATHelper: Packaging  
> (Windows (64-bit)): UnrealPak:  
> LogPakFile:Display: Loading key pair  
> from  
> C:\0.ue4\UnrealEngine\myApp\Build\NoRedist\Keys.txt  
> UATHelper: Packaging (Windows  
> (64-bit)): UnrealPak:  
> LogPakFile:Display: Testing signature  
> keys. UATHelper: Packaging (Windows  
> (64-bit)): UnrealPak:  
> LogPakFile:Display: Signature keys  
> check completed successfuly.

so from that 4 line basically it is saying that **it was able to encrypt contents inside pak file.**

**Testing phase:**

so for testing i used this command to extract the contents from encrypted pak file :

> “%CD%/UnrealPak.exe”  
> “C:/0.ue4/UnrealEngine/myApp/Saved/StagedBuilds/WindowsNoEditor\_withpak/myApp/Content/Paks/myApp-WindowsNoEditor.pak”  
> -extract “%CD%/pakExtractedContentes”
> 
> pause

_ **test1:** _  
after that i replaced some of the extracted meshes with one of my other game and **it was able to load those meshes and show them in screen**!!!  
so basically it was proofed that unrealPak actually did not encrypt anything . am i right?

_ **test2:** _  
this time i swapped the encrypted pak with another package build of same game where unrealpak did not use encryption(during this packaging i just removed Keys.txt and so it just bypass the encryption step). \*\*that version of package app also was able to mount the encrypted pak. Should not it fail to mount it ?because i did remove the key file during the packaging of this version of app \*\*

So the big question is :  
**is the unrealpak actually doing its encryption part correctly or i am doing something wrong ?**
