Reviving this topic one last time.
Ryex told me that he can encrypt and obfuscate the final .exe and Python code for the editor which basically means we can implement the encryptor in Python without problem. I will take care of that as I will also implement the decryptor in the engine. This means that things are simplified a lot. These are the procedures.
Encryption (Python):
1. generate a "static" encryption key using several method calls (for obfuscation, just to be sure) where the actual private key will be preselected (done only once)
2. read file (from here on, this is done for every file)
3. encrypt read data
4. create SHA-1 hash from encrypted data and append it to the end of the encrypted data stream
5. add 128 to the first byte (HURR HURR HURR)
6. write it all in a final file with .ade (data), .aae (audio) or .age (graphic) extension.
Decryption (C++):
1. generate a "static" decryption key using several method calls (for obfuscation, just to be sure) where the actual public key will be preselected matching the private key in the encryptor (again done only once)
2. read encrypted .ade, .aae or .age file (again done for every fiel)
3. add 128 to the first byte (same step for encryption and decryption HURR HURR HURR LITTLE HACK)
4. read file data, separating data and SHA-1 hash
5. create SHA-1 hash from encrypted data and compare it to the previously stored SHA-1 hash (check if data was messed with)
6. decrypt the data using the public key
7. write a temporary file, load the data and delete the temporary file by first overwriting it (simply opening it again in 'wb' mode) and then deleting it properly
As for the scripts encryption...
Obviously the scripts will be encrypted with RSA and hashed with SHA-1 as well. But additionally to that we will create a special key file that is shipped with the game. In this key file we will store the hash values for all scripts + each file. Basically we will have a file that has the hashes for every file combined with the main scripts file. This will result in as many keys as there are files. When we load the game, we randomly select a couple of these keys (10 or 20) and calculate those few hashes again. This will prevent a big loading overhead. If everything is fine, nobody has tempered with the scripts file. If it is not fine, somebody was messing with it (or with the given files) and the application will simply close (no error message or anything!).
This is the final solution!
And the previous note is there so I don't have to go through the whole topic the next time to find it.