Skip to content

java.lang.IllegalArgumentException: invalid date string: Unparseable date: "ag`habagagdfGMT+00:00" (at offset 0)  #944

@anuj-mehta

Description

@anuj-mehta

Hello,

I know that this issue has been resolved as this is a known issue from
Common-Issues-With-AndroidKeyStore.

We already have the suggested mitigation implementation in our code

SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithSHA256And256BitAES-CBC-BC");
SecretKey generatedSecretKey = keyFactory.generateSecret(new PBEKeySpec(your_password, byte-code-for-your-salt, 100, 256));
SecretKey secretKey = new SecretKeySpec(generatedSecretKey.getEncoded(), algorithm);
AuthenticationSettings.INSTANCE.setSecretKey(secretKey.getEncoded());

However, I am still getting this error for Android APK version for Android 5.1 and up (API level 22+).
The key is being used from Android Key store and I am still getting this error. (I believe it works fine for API level 18 and below since we don't have any logs for those)

Someone has used a work around that was posted on Google's Issuetracker WebSite

The proposed fix was to temporarily change the locale to English, generate the Keys and then change it back.

Please refer to lines 68

private void generateRSAKey(@Nonnull final String keyAlias) throws Exception {
   final Locale localeBeforeFakingEnglishLocale = Locale.getDefault();
    setFakeEnglishLocale();
    ...
    setLocale(localeBeforeFakingEnglishLocale);
}

I was wondering if there is anything that you can help me with :)

let me know if you need anything else

Thanks

Anuj

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions