Hi, I used to create two files for every saved game in 3.x. One is my save data, which is encrypted by a simple string password. It is created by save_encrypted_pass(path, password)
from a ConfigFile
. The other is a screenshot.
Now in Godot 4 beta, I'm now able to use ZIPPacker
to pack the screenshot and save data together as one single zip file. And ZIPPacker.write_file
only supports PackedByteArray
. I use config_file.encode_to_text().to_utf_buffer()
to convert it to PackedByteArray
. But how do I encrypt PackedByteArray
?
I know CryptoKey
. However, it seems to support only RSA encryption, not simple a string like save_encrypted_pass
does.
I could save it to disk then use FileAccess.open_encrypted_with_pass(path, FileAccess.WRITE, password)
, then load it as PackedByteArray
. But I don't want to do unnecessary IOs.