1

Im trying to integrate Fingerprint in one of my android applications.

To generate a key by user authentication i’m using the below code

KeyGenerator generator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES,"AndroidKeyStore");

generator.init(new KeyGenParameterSpec.Builder ("AndroidKeyStore",
        KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
        .setBlockModes(KeyProperties.BLOCK_MODE_CBC)
        .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7)
        .setUserAuthenticationRequired(true)
        .build()
);

generator.generateKey();

The issue I’m facing here is that the generator.init & generator.generateKey methods are taking some time to execute (~5 secs) in OS 8.0(Oreo) in Samsung devices.

The methods are executed good in rest of devices & OS versions.

Any one who can shed some light on this are greatly appreciated.

Thanks much.

iOSTech
  • 77
  • 1
  • 8
  • What's `"KeyStore"`? That's not listed as a `SecurityProvider` on my Galaxy S7 Edge. Did you intend to use Android's hardware-backed keystore, i.e. `"AndroidKeyStore"`? – Michael Jul 12 '18 at 08:30
  • @Michael True its "AndroidKeyStore", corrected my question. – iOSTech Jul 12 '18 at 14:28
  • Which device are you testing on, specifically? I'm pretty sure I've created keys the same way (except I use `BLOCK_MODE_GCM` if it's available) on the Galaxy S9+ running Android 8, and I haven't noticed any issues. – Michael Jul 12 '18 at 14:40
  • @Michael S9+ is good. I'm facing this issue specifically on Note8 & S8 – iOSTech Jul 12 '18 at 15:39

0 Answers0