android.security.keystore.KeyNotYetValidException: Key not yet valid on Android 11

Viewed 256

Recently upgraded my Pixel 2 to Android 11 and now am starting to see this exception when trying to decrypt a string that was encrypted with the same keystore and keypair: android.security.keystore.KeyNotYetValidException: Key not yet valid

The same code was working correctly on the previous version of Android (Android 8) that was on the phone. Tried uninstalling and reinstalling the app to clear out data but even a string encrypted a minute ago fails decryption with the key not valid exception. The date and time on the phone are correct.

Error decrypting string: 
    android.security.keystore.KeyNotYetValidException: Key not yet valid
        at android.security.KeyStore.getInvalidKeyException(KeyStore.java:1318)
        at android.security.KeyStore.getInvalidKeyException(KeyStore.java:1388)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getInvalidKeyExceptionForInit(KeyStoreCryptoOperationUtils.java:54)
        at android.security.keystore.KeyStoreCryptoOperationUtils.getExceptionForCipherInit(KeyStoreCryptoOperationUtils.java:89)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:265)
        at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineInit(AndroidKeyStoreCipherSpiBase.java:148)
        at javax.crypto.Cipher.tryTransformWithProvider(Cipher.java:2980)
        at javax.crypto.Cipher.tryCombinations(Cipher.java:2891)
        at javax.crypto.Cipher$SpiAndProviderUpdater.updateAndGetSpiAndProvider(Cipher.java:2796)
        at javax.crypto.Cipher.chooseProvider(Cipher.java:773)
        at javax.crypto.Cipher.init(Cipher.java:1288)
        at javax.crypto.Cipher.init(Cipher.java:1223)
0 Answers
Related