godot: Turning on "Encrypt Index" option in Export window produces binary that can't be launched

Godot version

v4.1.1.stable.mono.official [bd6af8e0e]

System information

Godot v4.1.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 Ti with Max-Q Design (NVIDIA; 31.0.15.3640) - Intel® Core™ i7-9750H CPU @ 2.60GHz (12 Threads)

Issue description

When “Encrypt Index” option is enabled in Export window exported binary throws error when launched. Turning “Encrypt Index” off will export properly and exported binary works as expected.

Error: Couldn't load project data at path ".". Is the .pck file missing?
If you've renamed the executable, the associated .pck file should also be renamed to match the executable's name (without the extension).

image

When binary is launched with --verbose flag, this is full error.

PS C:\Tmp\exported> .\expo.exe --verbose
PS C:\Tmp\exported> ERROR: The MD5 sum of the decrypted file does not match the expected value. It could be that the file is corrupt, or that the provided decryption key is invalid.
   at: (core\io\file_access_encrypted.cpp:94)
ERROR: Can't open encrypted pack directory.
   at: (core\io\file_access_pack.cpp:231)
ERROR: The MD5 sum of the decrypted file does not match the expected value. It could be that the file is corrupt, or that the provided decryption key is invalid.
   at: (core\io\file_access_encrypted.cpp:94)
ERROR: Can't open encrypted pack directory.
   at: (core\io\file_access_pack.cpp:231)
Error: Couldn't load project data at path ".". Is the .pck file missing?
If you've renamed the executable, the associated .pck file should also be renamed to match the executable's name (without the extension).

Steps to reproduce

I have this configured: Editor Settings -> Export -> Window -> C:/tools/rcedit.exe (from https://github.com/electron/rcedit/releases)

  1. Generate key and add it to the environment variable like described in Compiling with PCK encryption key.
  2. Follow these first 3 commands (Build editor binary, Build export templates) in Compiling with .NET to compile export templates with encryption key. (Use Godot 4.1.1 source code)
  3. Create new project with MeshInstance3D and Camera that you gonna export.
  4. Click Project -> Export. Add Windows Desktop.
  5. In Custom Template section provide path to compiled templates (ex. C:/Godot/Godot-4.1.1/bin/godot.windows.template_debug.x86_64.mono.exe)
  6. In Encryption tab turn on “Encrypt Exported PCK”, “Encrypt Index” and provide “Encryption Key”
  7. Click Export project and try to launch it with --verbose flag.
  8. Export again with “Encrypt Index” turned off to make binary launch properly.

My Export settings (mostly default) 261833767-dfc4b81b-49ac-4216-a0dd-b73f7c750661

Remove .txt extension, couldn’t upload this file othervise: export_presets.cfg.txt

Minimal reproduction project

NA

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Usually this error happens when a wrong template is used. Re-check if you have set encryption key env. variable during template build (also check core/script_encryption_key.gen.cpp generated file after the build for the correct key).