ES3 SaveRaw/LoadRaw AES Encryption problem

Discussion and help for Easy Save 3
Post Reply
Romkij
Posts: 2
Joined: Mon Mar 19, 2018 3:01 pm

ES3 SaveRaw/LoadRaw AES Encryption problem

Post by Romkij »

Hello, thank you for good asset.

I found a problem:

1) Configure ES3 with AES in settings.
2) Save file with ES3.SaveRaw(bytes, path);
3) Load file with ES3.LoadRawBytes(path);
4) Data was broken.

Cause: we save file with previous configuration (AES enabled in default settings), but method ES3.LoadRawBytes - simple load file from path without any decryption.
Solved by replace (in ES3.cs):
if (settings.location == Location.File)
{
     ES3IO.ReadAllBytes(settings.FullPath)
}
with:
if (settings.location == Location.File)
{
	using (var stream = ES3Stream.CreateStream(settings, ES3FileMode.Read))
	 {
	        var bytes = new byte[stream.Length];
	        stream.Read(bytes, 0, bytes.Length);
	        return bytes;
	 }
}
if has any other solution, will glad to hear. :)
Thank you!
User avatar
Joel
Moodkie Staff
Posts: 4871
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3 SaveRaw/LoadRaw AES Encryption problem

Post by Joel »

Well spotted, many thanks for the bug report. It looks we updated the SaveRaw method but forgot to update the LoadRaw methods. Needless to say it will be fixed in the next update.

Your changes are indeed correct, though you don't need to load differently based on the location anymore.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply