Quick answer: Godot 4 encrypted PCK refusing to load with key mismatch error? Key must be set in both the editor encryption settings and as an environment variable at build time.
Built an encrypted PCK. Run the binary; could not load PCK; decryption failed.
Set GODOT_SCRIPT_ENCRYPTION_KEY
export GODOT_SCRIPT_ENCRYPTION_KEY=AABB...
godot --export-pck Windows game.pckBuild template must be built with the matching key. Export-time env var alone isn't enough.
Build custom export template
Compile Godot with scons platform=windows custom_modules='...' deprecated=no SCRIPT_AES256_ENCRYPTION_KEY=.... Template embeds the key; PCK can be decrypted.
Verify with godotpcktool
godotpcktool refuses to list contents of mismatched-key PCKs. Quick check for whether the keys agree.
“PCK encryption needs the key in two places. Either alone is insufficient.”
Don't bother with PCK encryption for casual obfuscation. The setup is painful; the protection is shallow. Spend the energy on server-side validation instead.