Protect .pak file from Unpack

Hi
I want to know how can i protect my packaged pak file from unpacking. people can easily extract assets from pak file and use it on another project…

Now, there is a small app that extract pak file (UE Viewer | Gildor's Homepage). is there any way to at least make it difficult to this app from unpacking?

Thanks

Hi.

To protect your content from exploration/extraction you can either modify a package/mesh etc formats or use encrypted UE4 paks. UModel doesn’t support encrypted paks and will never support.

Without that, anyone can open assets with unmodified or modified version of UE4 editor because the source code is available for everyone.

Best regards,

Gildor (author of that tool “umodel”).

Hi, thank you very much for your answer. I searched the net for encrypted paks and modify a package/mesh formats but unfortunately I couldn’t find any document. Do you know any doc or tutorial about encrypted paks and modify a package/mesh formats?
Again, Glidor, thanks a lot for your helpful answer :wink:

Hi.

Try this (found at UDN):

  • Add #define AES_KEY “Some_Long_Key_String”
    to the project’s build settings or to AES.h file.
  • Force “-encrypt” option for UnrealPak in some way (there’s no GUI for that). Either modify UAT call to UnrealPak, or modify UnrealPak itself (look for “bNeedEncryption” in UnrealPak.cpp). Also you may execute UnrealPak with this option using the command line.
  • Rebuild UE4 and UnrealPak projects.
  • Remove “Saved” directory at project.
  • Package your game.
1 Like

thanks a lot. I should test it but it seem to be right solution.

I had tried these steps,but enable to encrypt .pak file.

I had tried too, but nothing happened. How can I enable encrypt .pak file?

Did you put #define into aes.h?

yes, but I think it just define a key for EncryptData function.

and there is no relation between EncryptData Function and encrypting pak file.

I see from the source code that UnrealPak tool requires a command line option “-encrypt”. I’m unsure how it could be passed there from UnrealEd’s GUI, perhaps you will need to modify engine’s source code to include it.

yes, I saw it, but the main question is that how we can set engine to use the command line option inside engine. which file should modify and …

One of possible places for modifications is UnrealPak tool itself. Modify it so it will think about all produced paks as encrypted. See “ProcessCommandLine” function, look for “Input.bNeedEncryption |= bEncrypt;” code there.

Just in case, source file location is:
Engine\Source\Programs\UnrealPak\Private\UnrealPak.cpp

I have no “Program” folder in my Engine\Source\ location.

I think you have partial source code from Launcher. You should obtain the full source then from GitHub.

yes, I have launcher version. So, I’ll download and check the source. thanks again Gildor :slight_smile:

Yes.

I had add AES_KEY in AES.h file and build Unreal Engine and My Project and delete ‘save’ directory. As per your suggestion.

After those steps I had tried to extract pak files using UnrealPak.exe and UE4PakUnpacker.exe,both are extracting generated pak file.

Is there any other workaround ?

You should follow discussion from this page - lots of information was pushed yesterday. Most likely you didn’t add “-encrypt” option to your UnrealPak.

I had found both "Engine\Source\Programs\UnrealPak\Private\UnrealPak.cpp " and “Input.bNeedEncryption |= bEncrypt;”.

What is necessary modification to enable encryption?

Required changes are trivial, but okay … For instance,
“Input.bNeedEncryption = true;”
should work.

Thanks for Reply.

I had tried all these steps.

  • Add #define AES_KEY “Some_Long_Key_String” to the AES.h file
  • Modify “Input.bNeedEncryption |= bEncrypt;” to “Input.bNeedEncryption |= true;”
  • Rebuild Engine and Project
  • Remove “Saved” directory at project.
  • Package Game

After that I tried to UnrealPak.exe to unpack.
Still it can extract .pak file.

I also tried “[path]UnrealPak.exe -encrypt [path_of_pakfile]” and “[path]UnrealPak.exe [path_of_pakfile] -encrypt”

I had tried path for UnrealPak.exe for both Build from source and from launcher.

But still It is extracting .pak file.