So far I have used to store my application secrets in KeyStore with the following code:
// creating a instance KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); // generating a secret key SecretKey secretKey = KeyGenerator.getInstance("AES").generateKey(); // store the secret key KeyStore.Entry keyStoreEntry = new KeyStore.SecretKeyEntry(secretKey); ProtectionParameter keyPassword = new PasswordProtection("myPassword".toCharArray()); keyStore.setEntry("mySecretKey", keyStoreEntry, keyPassword);
According to this, the https://stackoverflow.com/a/16718/... in API 14+, the KeyStore credential KeyStore is protected by a device unlock password, so there is no need for ProtectionParameter .
But how to set up a KeyStore entry without providing a third parameter?
source share