You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, recently we started observing a larger amount of problems when connecting to TTP that lead to crashes with an exception: KeyStoreException: Signature/MAC verification failed (internal Keystore code: -30 message: system/security/keystore2/src/operation.rs:850: KeystoreOperation::finish. After a brief research, I found out that this error is caused by an attempt to decrypt the shared preferences with an outdated key.
Such a case, I believe, can occur when an app that has the allowBackup manifest flag is set to true, and the user does a device-to-device restore, which restores the shared preferences, but since they were encrypted using another device keystore, they now cannot be decrypted.
The simplest solution would be to set the allowBackup flag to false, but since we would like to keep the backup feature, the other solution (which is advised by the Android documentation) is to explicitly exclude the specific shared prefs (in that case a list of what shared_prefs files should not be backed up will be needed).
Another solution would be to clear the app/SDK data after receiving this error which resolves the error, but this ideally require a method to reset all the SDK data (but it would be a nice addition since we sometimes experience other KeyStoreExceptions).
Code to reproduce
The 1:1 reproduction requires two devices, so to simulate such a case, we can just delete the asp_key (that leads to a mismatch between the key used to encrypt and the key used to decrypt) and try to connect to Tap to Pay:
Summary
Hi, recently we started observing a larger amount of problems when connecting to TTP that lead to crashes with an exception:
KeyStoreException: Signature/MAC verification failed (internal Keystore code: -30 message: system/security/keystore2/src/operation.rs:850: KeystoreOperation::finish.
After a brief research, I found out that this error is caused by an attempt to decrypt the shared preferences with an outdated key.Such a case, I believe, can occur when an app that has the
allowBackup
manifest flag is set to true, and the user does a device-to-device restore, which restores the shared preferences, but since they were encrypted using another device keystore, they now cannot be decrypted.The simplest solution would be to set the
allowBackup
flag to false, but since we would like to keep the backup feature, the other solution (which is advised by the Android documentation) is to explicitly exclude the specific shared prefs (in that case a list of what shared_prefs files should not be backed up will be needed).Another solution would be to clear the app/SDK data after receiving this error which resolves the error, but this ideally require a method to reset all the SDK data (but it would be a nice addition since we sometimes experience other KeyStoreExceptions).
Code to reproduce
The 1:1 reproduction requires two devices, so to simulate such a case, we can just delete the
asp_key
(that leads to a mismatch between the key used to encrypt and the key used to decrypt) and try to connect to Tap to Pay:Android version
14/13 (does not matter)
Impacted devices (Android devices or readers)
Tap to Pay
SDK version
3.9.5
Other information
The whole stacktrace
The text was updated successfully, but these errors were encountered: