react-native-keychain
react-native-keychain copied to clipboard
android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherPadding.finalize() timed out after 10 seconds
Hey, first of all great library! Managed to get it working with ease!
We have noticed the following issue on some old Android version 7 devices the last few weeks:
Fatal Exception: java.util.concurrent.TimeoutException: android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds
at android.os.BinderProxy.transactNative(Binder.java)
at android.os.BinderProxy.transact(Binder.java:615)
at android.security.IKeystoreService$Stub$Proxy.abort(IKeystoreService.java:1341)
at android.security.KeyStore.abort(KeyStore.java:519)
at android.security.keystore.AndroidKeyStoreCipherSpiBase.finalize(AndroidKeyStoreCipherSpiBase.java:744)
at android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize(AndroidKeyStoreUnauthenticatedAESCipherSpi.java)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)
Here are the devices details from Crashlytics:
Anyone else experiencing this issue?
I've been also faced with the same issue.
java.util.concurrent.TimeoutException android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds
Binder.java:-2 android.os.BinderProxy.transactNative
Binder.java:615 android.os.BinderProxy.transact
IKeystoreService.java:1341 android.security.IKeystoreService$Stub$Proxy.abort
KeyStore.java:519 android.security.KeyStore.abort
AndroidKeyStoreCipherSpiBase.java:744 android.security.keystore.AndroidKeyStoreCipherSpiBase.finalize
AndroidKeyStoreUnauthenticatedAESCipherSpi.java:-1 android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize
Daemons.java:222 java.lang.Daemons$FinalizerDaemon.doFinalize
Daemons.java:209 java.lang.Daemons$FinalizerDaemon.run
Thread.java:761 java.lang.Thread.run
- react-native: 0.61.5
- react-native-keychain: 1.6.1
Same thing here
java.util.concurrent.TimeoutException android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds
Binder.java:-2 android.os.BinderProxy.transactNative
Binder.java:615 android.os.BinderProxy.transact
IKeystoreService.java:1341 android.security.IKeystoreService$Stub$Proxy.abort
KeyStore.java:531 android.security.KeyStore.abort
AndroidKeyStoreCipherSpiBase.java:744 android.security.keystore.AndroidKeyStoreCipherSpiBase.finalize
AndroidKeyStoreUnauthenticatedAESCipherSpi.java:-1 android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize
Daemons.java:222 java.lang.Daemons$FinalizerDaemon.doFinalize
Daemons.java:209 java.lang.Daemons$FinalizerDaemon.run
Thread.java:761 java.lang.Thread.run
"react-native": "0.60.0",
"react-native-keychain": "6.0.0"
Me as well
react-native 0.61.5 react-native-keychain 6.0.0
Me as well
Change version kotlin 1.4.0
I´m use EncryptedSharedPreferences
Error Android Studio:
2020-08-20 20:14:39.526 27756-27756/red.chesco.su E/AndroidRuntime: FATAL EXCEPTION: main
Process: red.chesco.su, PID: 27756
java.lang.RuntimeException: Unable to create application red.chesco.su.data.shared.SharedApp: com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5408)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: com.google.crypto.tink.shaded.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
at com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:1566)
at com.google.crypto.tink.shaded.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:1664)
at com.google.crypto.tink.proto.Keyset.parseFrom(Keyset.java:957)
at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.read(SharedPrefKeysetReader.java:84)
at com.google.crypto.tink.CleartextKeysetHandle.read(CleartextKeysetHandle.java:58)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:321)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:280)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:230)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:153)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:119)
at red.chesco.su.data.shared.Shared.
020-08-20 20:14:39.520 27756-27756/red.chesco.su W/AndroidKeysetManager: cannot decrypt keyset:
javax.crypto.AEADBadTagException
at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:517)
at javax.crypto.Cipher.doFinal(Cipher.java:2114)
at com.google.crypto.tink.integration.android.AndroidKeystoreAesGcm.decrypt(AndroidKeystoreAesGcm.java:89)
at com.google.crypto.tink.KeysetHandle.decrypt(KeysetHandle.java:206)
at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:107)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:304)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:280)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:230)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:153)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:119)
at red.chesco.su.data.shared.Shared.
Sorry, the case that the xml file where you save the SharedPreferences is created and encodes it perfectly, yesterday it worked fine...
In API version 7.0 the app gives an error but encrypts the SharedPreferences with higher versions it works fine but does not encrypt ...
same issue
react-native: 0.60.6
react-native-keychain: 6.0.0
Have you got any updates ?
Same here on : Device: Moto E (4) OS: 7.1.1 xx-keychain: 6.1.1
java.util.concurrent.TimeoutException android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds Binder.java:-2 android.os.BinderProxy.transactNative Binder.java:615 android.os.BinderProxy.transact IKeystoreService.java:1341 android.security.IKeystoreService$Stub$Proxy.abort KeyStore.java:519 android.security.KeyStore.abort AndroidKeyStoreCipherSpiBase.java:744 android.security.keystore.AndroidKeyStoreCipherSpiBase.finalize AndroidKeyStoreUnauthenticatedAESCipherSpi.java:-1 android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize Daemons.java:222 java.lang.Daemons$FinalizerDaemon.doFinalize Daemons.java:209 java.lang.Daemons$FinalizerDaemon.run Thread.java:761 java.lang.Thread.run
FYI: I spun up AWS Device Farm and tested on a 7.1.1 device (Samsung Galaxy Note8). No problems
Same issue. This is affecting a lot of our users in production. FYI, the affected users had android version 7.1.2 and below and the most affected android version was 7.0
java.util.concurrent.TimeoutException: android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds
Same issue here. Any solutions?
java.util.concurrent.TimeoutException: android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds
at android.os.BinderProxy.transactNative(Binder.java)
at android.os.BinderProxy.transact(Binder.java:503)
at android.security.IKeystoreService$Stub$Proxy.abort(IKeystoreService.java:1360)
at android.security.KeyStore.abort(KeyStore.java:809)
at android.security.keystore.AndroidKeyStoreCipherSpiBase.finalize(AndroidKeyStoreCipherSpiBase.java:680)
at android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize(AndroidKeyStoreUnauthenticatedAESCipherSpi.java:73)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:217)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:200)
at java.lang.Thread.run(Thread.java:818)
Same issue. Any news?
Also running into this issue!
From Firebase's suggestions, it says that this is an inevitable error, but one that can be improved on!
Our stacktrace looks like:
Fatal Exception: java.util.concurrent.TimeoutException
android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds
android.os.BinderProxy.transactNative (Binder.java)
android.os.BinderProxy.transact (Binder.java:615)
android.security.IKeystoreService$Stub$Proxy.abort (IKeystoreService.java:1341)
android.security.KeyStore.abort (KeyStore.java:531)
android.security.keystore.AndroidKeyStoreCipherSpiBase.finalize (AndroidKeyStoreCipherSpiBase.java:744)
android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize (AndroidKeyStoreUnauthenticatedAESCipherSpi.java)
java.lang.Daemons$FinalizerDaemon.doFinalize (Daemons.java:222)
java.lang.Daemons$FinalizerDaemon.run (Daemons.java:209)
java.lang.Thread.run (Thread.java:761)
Although we're on version 6.0.0 of this package and react native version "0.63.3"
Any solution on this issue ?
same here: react-native-keychain: 7.0.0 Android version: 10 Models: Galaxy A50 (SM-A505F)
I solve this problem with a workaround. It happens when the app tries to call the function getGenericPassword() when the app state is background
You guys can use this hook:
import { useState, useEffect } from 'react';
import { AppState } from 'react-native';
export default function useAppState(settings) {
const { onChange, onForeground, onBackground } = settings || {};
const [appState, setAppState] = useState(AppState.currentState);
useEffect(() => {
function handleAppStateChange(nextAppState) {
if (
nextAppState === 'active' &&
appState !== 'active' &&
isValidFunction(onForeground)
)
onForeground();
else if (
appState === 'active' &&
nextAppState.match(/inactive|background/) &&
isValidFunction(onBackground)
)
onBackground();
setAppState(nextAppState);
if (isValidFunction(onChange)) onChange(nextAppState);
}
const appStateListener = AppState.addEventListener(
'change',
handleAppStateChange,
);
return () => appStateListener?.remove();
}, [onChange, onForeground, onBackground, appState]);
// settings validation
function isValidFunction(func) {
return func && typeof func === 'function';
}
return { appState };
}
And after that:
const { appState } = useAppState();
if (appState === 'active') {
getGenericPassword({ ...options });
}