CryptographicException

Discussion and help for Easy Save 3
Post Reply
plourdegui
Posts: 2
Joined: Thu May 03, 2018 1:36 am

CryptographicException

Post by plourdegui »

I am trying to save/load my game data with AES encryption with Easy Save 3.

I am getting the following exception:
System.Security.Cryptography.CryptographicException : Bad PKCS7 padding. Invalid length

This doesn't happen in Unity Editor, but when I deploy the game on Android.

We are using the following:
Unity Version: Unity 2018.1.1f1
Build System: Cloud Build
Scripting Runtime Version: .NET 3.5 Equivalent
Scripting Backend: Mono
Api Compatibility Level: .NET 2.0 Subset

As per the following link, "It appears that not every encryption mode is supported by .net 2.0 subset, switching to full .net 2.0 api compatibility or choosing a different encryption mode might work."
https://forum.unity.com/threads/android ... -0.430075/

Is AES encryption supported for the settings we are using?
Does anyone have a work-around for this?

Thanks and regards
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: CryptographicException

Post by Joel »

Hi there,

Encryption appears to be working fine for me on Android using 2017.4.3f1 and .NET 2.0 Subset.

First, to check that it's not an initialisation issue, try deleting the save data in the Editor to see if this causes the error to happen in the Editor. You can do this by going to Window > Easy Save 3 > Tools > Open Persistent Data Path and delete the data from there.

If this doesn't replicate the issue, it might be that there's old save data still on the device. Use ES3.DeleteFile when your app first loads to delete the save data and see if this fixes the issue.

If this does not fix your issue, please could you make a new project with the bare minimum code to replicate the issue and PM it to me? Then hopefully I can test to see what is happening.

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