Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

使用 PCK 加密密钥编译

The export dialog gives you the option to encrypt your PCK file with a 256-bit AES key when releasing your project. This will make sure your scenes, scripts and other resources are not stored in plain text and can not easily be ripped by some script kiddie.




如果你使用官方预编译的导出模板,是不会起作用的。要使用 PCK 加密,绝对必须自己编译导出模板。


By default, Android exports store assets directly in the APK file and aren't affected by PCK encryption. To use PCK encryption on Android, enable APK expansion in the export options.


  1. 生成十六进制的 256 位 AES 密钥。你可以使用此服务的 aes-256-cbc 版本。

    或者,你可以通过使用 OpenSSL 命令行工具自己生成:

    openssl rand -hex 32 > godot.gdkey

    godot.gdkey 中的输出应该类似:

    # NOTE: Do not use the key below! Generate your own key instead.


  2. 在控制台中将此处的密钥(key)设置为环境变量,编译 Godot 时会用到,如下所示:

    export SCRIPT_AES256_ENCRYPTION_KEY="your_generated_key"
  3. 编译 Godot 导出模板,并在导出预设的选项中将它们设置为自定义导出模板。

  4. Set the encryption key in the Encryption tab of the ex