-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWSKeyValueStore: Error during encryption key generation or key loading #137
Comments
@watanabethais Sorry for the inconvenience caused. From the stacktrace, I could see that loading the refresh token from the cache (SharedPreferences) failed because we couldn't successfully decrypt the data. From the exception messages you have posted, I can see this happening when the key used for encryption cannot be loaded from the keystore or the IV used for encrypting the data is not the right IV or IV is null. Do you see any exception messages in Logcat such as
|
@kvasukib Thank you for your quick response! I found these exceptions before the error in decrypting data:
About the Android KeyStore in Logcat:
Am I missing some library in my project? |
@watanabethais Thank you for the logs. I couldn't spot any occurrence of key load/create failing. Can you describe how have you configured your app for authentication? What are the libraries you are depending on in your app for accomplishing authentication? Can you post a sample code snippet? Have you tried running your app on other emulators besides API 24? Is the issue consistently reproducible on other API levels as well? |
Hi, We just SDK release 2.12.7 which should help make the error more clear. This is not a fix, but should help @kvasukib solve the issue. |
@kvasukib @minbi After testing with Emulator in API 24 instead of my Android device, only the ClassNotFound error appeared and I logged in normally. So I decided to restart my device and the decrypting error is now gone... sorry for causing this trouble!! Now I can normally log in, but the ClassNotFoundException still appears in API levels 24, 26 and 28.
I followed this tutorial for my App. I had to implement a Sign Out method, so I modified the onCreate method in AuthenticationActivity: @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_authentication);
if (AWSMobileClient.getInstance().getConfiguration() != null) {
UserStateDetails userStateDetails = AWSMobileClient.getInstance().currentUserState();
showSignInForUser(userStateDetails);
} else {
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() {
@Override
public void onResult(UserStateDetails userStateDetails) {
showSignInForUser(userStateDetails);
}
@Override
public void onError(Exception e) {
Log.e(TAG, e.toString());
}
});
}
} I'm sorry again about the decrypting issue... and about the ClassNotFoundException, is related to how am I initializing the client? |
Hi, We are looking into a way to silence the ClassNotFoundException, but it is an artifact of optional features that we built into the AWSMobileClient. It should not be a concern in this case. |
@minbi I got it, thanks! I'm not having this issue anymore, thank you for your patience! |
Sorry for reigniting this one, however I'm getting this on a Pixel 3 running Android 9 (API 28). I'm using the AWS Mobile SDK version 2.13.2 on Android Studio 3.4 (Kotlin 1.3.21). The issue was happening on 2.13.1, so I upgrade and it made no difference. I've uninstall the app and reinstall it, I've restart the phone and no luck. On some of the emulators I had the same issue that magically disappeared. I originally thought that it may have to do with me having a PIN on the phone, however a second phone a Pixel with the exact same PIN has no issue. The Pixel is also on Android 9. As best I can tell, at the moment the mobile SDK just doesn't like my Pixel 3. The error comes up when I call initialize. Seems like the SDK can't read from the Keystore?
The error is:
|
An other thing that is that when I try to login, I get the exception:
Also the in the android profiler, the request looks like this (this is from a different request):
Also noticed this error:
This seems to be a bug, since tracing through the code, I came across this code:
|
I relabeled this for @kvasukib to take a look. I'm not convinced this is the same root cause though, so we may want to open new issues for each of the two problems that @alphamu reported. If we do open new ones, we'll re-close this to avoid confusing the thread. |
What kind of screen lock settings the end-user with the device is using? From reading through online about Android KeyStore behavior, there are bugs filed with Android KeyStore with exceptions related to key generation and loading when the screen lock is set to NONE (No screen lock) or SWIPE (A regular swipe would unlock the screen). Also the same exception could happen if the screen lock mechanism was altered between key generation and loading. For example, changing from a stronger screen lock mechanism to NONE or SWIPE could potentially delete the keys in keystore. The screen lock mechanism used / transitioned during the occurrence of the exception could potentially inter-play with the key generation and loading. This information would be helpful for further diagnosis. |
Hey Mate, Let me know if there is some other way I can help. |
@alphamu Thank you for the detailed response. I will try to run our integration tests on Pixel 3 device to see if I can reproduce the issue you are encountering. Meanwhile, can you post a code snippet which reproduces the issue? |
The crash occurs on initialize as show below.
I was doing these steps across 3 different devices one at a time. So, 2 other devices may have been logged into the same account at the time.
the aws config file is setup a little differently:
After roughly 5 days, the issue has gone away on the pixel 3, I can't recall if there was a system update in this time. |
We are also seeing this issue with a number of our Android users, mainly with recent Samsung phones. Users are reporting various login related issues (being unable to authenticate with their credentials, finding that their tokens from an active session cannot be retrieved etc), and all the logs are similar:
|
@jamesatfish Sorry for the inconvenience caused. We are tracking this issue at: I am closing this issue in favor of #937. |
We are facing this issue on version 2.52.1 how to resolved it |
I'm using Authentication in my App with Drop-In Auth and I can't login.
Error:
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context
When I clear the memory and cache of the App in Application Settings in my device works, but when uninstalling and installing the App, the error comes back.
The text was updated successfully, but these errors were encountered: