forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 0
Export Encrypt Scripts
ScyDev edited this page Jun 23, 2015
·
7 revisions
The export dialog gives you the option to encrypt your scripts with an 256bit AES key, when releasing your game. This will make sure your scripts are not stored in plain text and can not easily be ripped by some script kiddie. Of course the key needs to be stored in the binary, but if it's compiled optimized and without symbols, it would take some effort to find it.
For this to work, you need to build the export templates from source, with that same key.
- Generate a 256bit AES key in HEX. I've used the aes-256-cbc variant from this service: https://asecuritysite.com/encryption/keygen
- Set this key as environment variable in the console that you will use to compile Godot, like this:
export SCRIPT_AES256_ENCRYPTION_KEY="your_key"
- Compile Godot export templates
- Pack all those templates in a single ZIP, then rename it to *.TPZ
- Start Godot and use "Settings -> Install Export Templates"
- Set the encryption key from above in the export dialog
- Your exported game should run with encrypted scripts now
If you get an error like below, it means the key wasn't properly included in your Godot build. Godot is encrypting the scripts during export, but can't read them at runtime.
:~$ '/media/PROJECTS/Godot Projects/No Rest for the Wicked Ones/release/No Rest for the Wicked Ones - DEMO v0.94 - linux.32'
open and parse!
MAGIC: 1128612935
MODE: 1
ERROR: open_and_parse: Condition ' String::md5(md5.digest)!=String::md5(md5d) ' is true. returned: ERR_FILE_CORRUPT
At: core/io/file_access_encrypted.cpp:70.
ERROR: load_byte_code: Condition ' err ' is true. returned: err
At: modules/gdscript/gd_script.cpp:1994.
ERROR: load: Condition ' err!=OK ' is true. returned: RES()
At: modules/gdscript/gd_script.cpp:2671.
ERROR: load: Method/Function Failed, returning: RES()
At: core/io/resource_loader.cpp:209.
ERROR: poll: Method/Function Failed, returning: error
At: core/io/resource_format_xml.cpp:1437.
ERROR: load: Condition ' err!=OK ' is true. returned: RES()
At: core/io/resource_loader.cpp:136.
ERROR: load: Method/Function Failed, returning: RES()
At: core/io/resource_loader.cpp:209.
ERROR: start: Condition ' !scene ' is true. returned: false
At: main/main.cpp:1260.
ERROR: free: Attempt to free invalid ID
At: servers/spatial_sound/spatial_sound_server_sw.cpp:598.
ERROR: free: Attempt to free invalid ID
At: servers/spatial_sound_2d/spatial_sound_2d_server_sw.cpp:612.
freed code id 1
ERROR: cleanup: ObjectDB Instances still exist!
At: core/object.cpp:1783.