yakivmospan / scytale

One tool to manage key generation, key storing and encryption on different APIs of Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getSymmetricKey() is null

eitanaviv opened this issue · comments

Hi there,
After calling generateSymmetricKey() for the first time the user's runs the app, and when reopening the app i'm calling getSymmetricKey() everything seems to be working fine.
But when restarting the device, getSymmetricKey() return null and app stops working of course.
I'm using this library with Realm.

My code:

Store store = new Store(getApplicationContext());
        Crypto crypto = new Crypto(Options.TRANSFORMATION_SYMMETRIC);
        SecretKey key;

        if (!store.hasKey(getALString())) {
            freshStart = true;

            key = store.generateSymmetricKey(getALString(), null);
        } else {
            freshStart = false;

            key = store.getSymmetricKey(getALString(), null);
        }

The above code get called on: public class MyApplication extends MultiDexApplication

Appreciate the help.

Hello, thanks for your reply, can you please provide information about the API level of the device you are facing this issue on?

commented

I have that same problem too.

could you help?