Hi,
I managed to do it in SGS2 but with my tab 10.1 it didn't work ..
I edited the file sec_power_key.kl and removed the WAKE command from POWER.
the reason I want this is for security because I don't want any one to turn off the device if my tab is locked.
Thanks.
logic5 said:
Hi,
I managed to do it in SGS2 but with my tab 10.1 it didn't work ..
I edited the file sec_power_key.kl and removed the WAKE command from POWER.
the reason I want this is for security because I don't want any one to turn off the device if my tab is locked.
Thanks.
Click to expand...
Click to collapse
Without that key edit I am not sure. In source it could be done by doing something like:
Line 317:
https://github.com/CyanogenMod/andr...droid/internal/policy/impl/GlobalActions.java
That creates the list you see when its called. You could create an intent to override those default settings.
Code:
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//screen locked
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
//screen unlocked
}
}
Then you update the code in 317 to check the variable assigned at that public void. If true it wouldn't display that list, meaning phone locked. If false it would show that list meaning phone awake.
Other then that. I am not sure. I will let you know if I come up with anything else though.
Related
Hello, Im working on a applicatiopn that will help me and my friends in school with allot of things, and i have a problem programming a "on screen back button". later when i get home i will post the codes I´ve wrote so fare. (im not a skilld programmer so i gess i haven´t used the best codes)
I would be realy super happy if someone could help me out
Im working in eclipse and I have sucsesfully made a button to gett to a new View but when i press the back button on my S3 it closes the app and my on screen back button, I just can´t get it to work.
Please help me out!
Thanks
Fix
I found a way to fix my the problem
Button backButton = (Button)this.findViewById(R.id.back);
backButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
devise stock back button
this.dispatchKeyEvent(new Keyevent(ACTION_DOWN, KEYCODE_BACK));
Hey guys. I am working with @MohammadAG to bring back the widgets on secure lock screen. He successfully done this on android 4.1 and 4.2 and 4.3. However, he does not have the ability to test for android 4.4. So I downloaded his repo from github and am trying to make it work again.
However, i have no idea where the control is being made. I have the Google source code downloaded as well. I can't find anything that controls the adding of the widgets based off the security. I've grepped over the whole thing using keywords like "addWidgets" and "secure" etc. I can't figure out where the call is being made to show the widgets.
Any help would be greatly appreciated! Thanks everyone!
frameworks/base/packages/Keyguard/src/com/android/keyguard
Code:
[email protected] /media/broodplank/linuxdata/AOSP-KK/frameworks/base/packages/Keyguard/src/com/android/keyguard $ ls | grep Widget
CameraWidgetFrame.java
KeyguardWidgetCarousel.java
KeyguardWidgetFrame.java
KeyguardWidgetPager.java
I think you're searching or this? Or am I wrong?
oh btw, I am wrong, I think I know what you mean.
Do you mean this?
https://github.com/CyanogenMod/andr.../base/packages/Keyguard/res/values/config.xml
or
https://github.com/CyanogenMod/andr...ages/SettingsProvider/res/values/defaults.xml
<string name="def_lockscreen_targets">#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.android.mms/.ui.ConversationList;S.icon_resource=ic_lockscreen_sms_normal;end|#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.andrew.apollo/.ui.activities.HomeActivity;S.icon_resource=ic_lockscreen_music_normal;end|#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.android.dialer/.DialtactsActivity;S.icon_resource=ic_lockscreen_phone_normal;end|#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.android.browser/.BrowserActivity;S.icon_resource=ic_lockscreen_browser_normal;end</string>
So thats the place where it gets added
broodplank1337 said:
frameworks/base/packages/Keyguard/src/com/android/keyguard
Code:
[email protected] /media/broodplank/linuxdata/AOSP-KK/frameworks/base/packages/Keyguard/src/com/android/keyguard $ ls | grep Widget
CameraWidgetFrame.java
KeyguardWidgetCarousel.java
KeyguardWidgetFrame.java
KeyguardWidgetPager.java
I think you're searching or this? Or am I wrong?
oh btw, I am wrong, I think I know what you mean.
Do you mean this?
https://github.com/CyanogenMod/andr.../base/packages/Keyguard/res/values/config.xml
or
https://github.com/CyanogenMod/andr...ages/SettingsProvider/res/values/defaults.xml
<string name="def_lockscreen_targets">#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.android.mms/.ui.ConversationList;S.icon_resource=ic_lockscreen_sms_normal;end|#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.andrew.apollo/.ui.activities.HomeActivity;S.icon_resource=ic_lockscreen_music_normal;end|#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.android.dialer/.DialtactsActivity;S.icon_resource=ic_lockscreen_phone_normal;end|#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.android.browser/.BrowserActivity;S.icon_resource=ic_lockscreen_browser_normal;end</string>
So thats the place where it gets added
Click to expand...
Click to collapse
Actually, you were more on track in the first segment of your post
I need to figure out where the call is being made to disable the widgets on the secure lockscreen. If i use what MohammadAG already has, and just change the classes to match the new ones, i can get the "add widget" plus sign, but none of my other already added widgets are present. Nor, when i add a widget, it does not get shown on the secure lockscreen, however, when i set the lockscreen to "swipe" i can see the newly added widget that was added..
I think his method of allowing the widgets works, and enabling the add widget option, but it doesn't save them or let the already added widgets show. Which is where i am having the difficulty. I can't figure out what is preventing the saved ones from being added.
Thanks for your reply!! All replies help and juggle my mind through everything.
elesbb said:
Actually, you were more on track in the first segment of your post
I need to figure out where the call is being made to disable the widgets on the secure lockscreen. If i use what MohammadAG already has, and just change the classes to match the new ones, i can get the "add widget" plus sign, but none of my other already added widgets are present. Nor, when i add a widget, it does not get shown on the secure lockscreen, however, when i set the lockscreen to "swipe" i can see the newly added widget that was added..
I think his method of allowing the widgets works, and enabling the add widget option, but it doesn't save them or let the already added widgets show. Which is where i am having the difficulty. I can't figure out what is preventing the saved ones from being added.
Thanks for your reply!! All replies help and juggle my mind through everything.
Click to expand...
Click to collapse
Ok lol
I think I found it this time
in Settings (SecuritySettings.java)
Code:
// Enable or disable keyguard widget checkbox based on DPM state
mEnableKeyguardWidgets = (CheckBoxPreference) root.findPreference(KEY_ENABLE_WIDGETS);
if (mEnableKeyguardWidgets != null) {
if (ActivityManager.isLowRamDeviceStatic()
|| mLockPatternUtils.isLockScreenDisabled()) {
// Widgets take a lot of RAM, so disable them on low-memory devices
PreferenceGroup securityCategory
= (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY);
if (securityCategory != null) {
securityCategory.removePreference(root.findPreference(KEY_ENABLE_WIDGETS));
mEnableKeyguardWidgets = null;
}
} else {
final boolean disabled = (0 != (mDPM.getKeyguardDisabledFeatures(null)
& [B]DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL[/B]));
if (disabled) {
mEnableKeyguardWidgets.setSummary(
R.string.security_enable_widgets_disabled_summary);
} else {
mEnableKeyguardWidgets.setSummary("");
}
mEnableKeyguardWidgets.setEnabled(!disabled);
}
}
so the rest of the implementation should be in frameworks/base/policy or anything like that
broodplank1337 said:
Ok lol
I think I found it this time
in Settings (SecuritySettings.java)
Code:
// Enable or disable keyguard widget checkbox based on DPM state
mEnableKeyguardWidgets = (CheckBoxPreference) root.findPreference(KEY_ENABLE_WIDGETS);
if (mEnableKeyguardWidgets != null) {
if (ActivityManager.isLowRamDeviceStatic()
|| mLockPatternUtils.isLockScreenDisabled()) {
// Widgets take a lot of RAM, so disable them on low-memory devices
PreferenceGroup securityCategory
= (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY);
if (securityCategory != null) {
securityCategory.removePreference(root.findPreference(KEY_ENABLE_WIDGETS));
mEnableKeyguardWidgets = null;
}
} else {
final boolean disabled = (0 != (mDPM.getKeyguardDisabledFeatures(null)
& [B]DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL[/B]));
if (disabled) {
mEnableKeyguardWidgets.setSummary(
R.string.security_enable_widgets_disabled_summary);
} else {
mEnableKeyguardWidgets.setSummary("");
}
mEnableKeyguardWidgets.setEnabled(!disabled);
}
}
so the rest of the implementation should be in frameworks/base/policy or anything like that
Click to expand...
Click to collapse
Yes that is the part for the settings activity to allow one to enable widgets. I got that one working
I actually found a method called "isSecure" that is controlling a lot. I am getting closer!
I have it working perfectly
However camera isnt working yet. I think i know where to look for that though. Thanks broodPlank!! I love having someone to converse about this stuff with! My brothers are useless they are like.. smali.. what? methods what? lol thank you!
elesbb said:
Yes that is the part for the settings activity to allow one to enable widgets. I got that one working
I actually found a method called "isSecure" that is controlling a lot. I am getting closer!
I have it working perfectly
However camera isnt working yet. I think i know where to look for that though. Thanks broodPlank!! I love having someone to converse about this stuff with! My brothers are useless they are like.. smali.. what? methods what? lol thank you!
Click to expand...
Click to collapse
Oh ok nice, I actually thought you had that working already since it was pretty easy to find
Nice that you found it! the isSecure string returned this for me:
Code:
[email protected] /media/broodplank/linuxdata/AOSP-KK/frameworks/base/packages $ grep -r 'isSecure' ../Keyguard/src/com/android/keyguard/KeyguardService.java: public boolean isSecure() {
./Keyguard/src/com/android/keyguard/KeyguardService.java: return mKeyguardViewMediator.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: mShowing = (mUpdateMonitor.isDeviceProvisioned() || mLockPatternUtils.isSecure())
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: if (mScreenOn && mLockPatternUtils.isSecure()) {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: public boolean isSecure() {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: return mLockPatternUtils.isSecure()
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: if (isSecure()) {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: + " isSecure=" + isSecure() + " --> flags=0x" + Integer.toHexString(flags));
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: return mKeyguardDonePending || !isSecure();
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: if (lockPatternUtils.isSecure()) {
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: boolean isSecure = lockPatternUtils.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: if (!isSecure || showsWhileLocked) {
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: if (!isSecure) {
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: return getLockPatternUtils().isSecure() ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
./Keyguard/src/com/android/keyguard/EmergencyButton.java: enabled = mLockPatternUtils.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardSelectorView.java: boolean secureCameraDisabled = mLockPatternUtils.isSecure()
./Keyguard/test/src/com/android/keyguard/test/KeyguardTestActivity.java: public boolean isSecure() {
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: public boolean isSecure() {
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: return service.isSecure();
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: Slog.e(TAG, "RemoteException calling keyguard.isSecure()!", e);
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: Slog.w(TAG, "isSecure(): NO SERVICE!");
./SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java: && KeyguardTouchDelegate.getInstance(getContext()).isSecure();
Great!
Also good that you know where to look for the camera part, I also have that, I don't know the fix directly but atleast I always know where to look (that differ a lot from not having a clue whatsoever). And you're welcome, programming is indeed a subject that can only be discussed with people that are a programmer. people who are not will either not get it at all or totally overflow immediately by the amount of "unknown" information they have heard just now hehe
I'm always active in this forum so if you open up a new thread ill be there
solved?
broodplank1337 said:
Oh ok nice, I actually thought you had that working already since it was pretty easy to find
Nice that you found it! the isSecure string returned this for me:
Code:
[email protected] /media/broodplank/linuxdata/AOSP-KK/frameworks/base/packages $ grep -r 'isSecure' ../Keyguard/src/com/android/keyguard/KeyguardService.java: public boolean isSecure() {
./Keyguard/src/com/android/keyguard/KeyguardService.java: return mKeyguardViewMediator.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: mShowing = (mUpdateMonitor.isDeviceProvisioned() || mLockPatternUtils.isSecure())
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: if (mScreenOn && mLockPatternUtils.isSecure()) {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: public boolean isSecure() {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: return mLockPatternUtils.isSecure()
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: if (isSecure()) {
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: + " isSecure=" + isSecure() + " --> flags=0x" + Integer.toHexString(flags));
./Keyguard/src/com/android/keyguard/KeyguardViewMediator.java: return mKeyguardDonePending || !isSecure();
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: if (lockPatternUtils.isSecure()) {
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: boolean isSecure = lockPatternUtils.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: if (!isSecure || showsWhileLocked) {
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: if (!isSecure) {
./Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java: return getLockPatternUtils().isSecure() ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
./Keyguard/src/com/android/keyguard/EmergencyButton.java: enabled = mLockPatternUtils.isSecure();
./Keyguard/src/com/android/keyguard/KeyguardSelectorView.java: boolean secureCameraDisabled = mLockPatternUtils.isSecure()
./Keyguard/test/src/com/android/keyguard/test/KeyguardTestActivity.java: public boolean isSecure() {
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: public boolean isSecure() {
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: return service.isSecure();
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: Slog.e(TAG, "RemoteException calling keyguard.isSecure()!", e);
./SystemUI/src/com/android/systemui/statusbar/phone/KeyguardTouchDelegate.java: Slog.w(TAG, "isSecure(): NO SERVICE!");
./SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java: && KeyguardTouchDelegate.getInstance(getContext()).isSecure();
Great!
Also good that you know where to look for the camera part, I also have that, I don't know the fix directly but atleast I always know where to look (that differ a lot from not having a clue whatsoever). And you're welcome, programming is indeed a subject that can only be discussed with people that are a programmer. people who are not will either not get it at all or totally overflow immediately by the amount of "unknown" information they have heard just now hehe
I'm always active in this forum so if you open up a new thread ill be there
Click to expand...
Click to collapse
This says solved? Is there a download avaliable? I really miss this. Thanks
DrUnkeN_TiGeR said:
This says solved? Is there a download avaliable? I really miss this. Thanks
Click to expand...
Click to collapse
Its an xposed module. Search for it. This thread is discussion, not releasing
The only exposed module I can find is for 4.3 not 4.4.2 could you point me in the right direction?
Sent from my SM-N900V using Tapatalk
DrUnkeN_TiGeR said:
The only exposed module I can find is for 4.3 not 4.4.2 could you point me in the right direction?
Sent from my SM-N900V using Tapatalk
Click to expand...
Click to collapse
All you had to do was click my profile and see the recent threads i've created
http://forum.xda-developers.com/xpo...gmultiplewidgets-kitkat-t2690190/post53476720
Hi,
For example, we have API: Toast.show(params). I need to hook this API and get class/method name which uses this API (who calls it). Btw, how to check if method is hooked? I dont want re-hook things many times with the same hook.
pyler said:
Hi,
For example, we have API: Toast.show(params). I need to hook this API and get class/method name which uses this API (who calls it). Btw, how to check if method is hooked? I dont want re-hook things many times with the same hook.
Click to expand...
Click to collapse
I used a code like this to hook a method in a View:
Code:
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
XposedHelpers.findAndHookMethod(View.class,
"onTouchEvent",
MotionEvent.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param)
throws Throwable {
//things...
}
}
});
}
So, in your case, you may use this with Toasts, for example, and then:
- if you want to obtain information for you, use XposedBridge.log
- if you want to use the informations in your module, you can use intents and broadcast receivers
It's an idea, let me know if it was what you were looking for :fingers-crossed:
Thank you for help
But.. I need to know who (method in app's code) calls it after hooking, not before.
pyler said:
Thank you for help
But.. I need to know who (method in app's code) calls it after hooking, not before.
Click to expand...
Click to collapse
Mm..I don't understand. You want to know what method in what app cals a method in an other app. But do you want this because you want to use this information IN your module (dinamically) or to develop your app?
Sent from my Vodafone 875
In the module.
pyler said:
In the module.
Click to expand...
Click to collapse
So, you want to obtain the name of the method which called the method you are hooking... Am I right?
Is the method an instance method?
Sent from my Vodafone 875
Exactly. Yes.
pyler said:
Exactly. Yes.
Click to expand...
Click to collapse
I think this information is normally held in the call stack but I dont know how to get that information from within the hook.
Haven't used it but
StackTraceElement has getClassName(), getFileName(), getLineNumber() and getMethodName().
Hello
My phone is the moto x 2014 running CM12.1 nightly.
i was trying to learn how to develop modules for my rom using this tut.
Everything was fine using this code
Code:
package de.robv.android.xposed.mods.tutorial;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
public class Tutorial implements IXposedHookLoadPackage {
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals("com.android.systemui"))
return;
});
}
}
but when i add the hook method
Code:
findAndHookMethod("com.android.systemui.statusbar.policy.Clock", lpparam.classLoader, "updateClock", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
// this will be called before the clock was updated by the original method
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
// this will be called after the clock was updated by the original method
}
System UI crashes on startup and i need to reboot to recovery and disable xposed.
The Questionwhat is going wrong? is this tutorial outdated for 5.1 am i missing something?
logs are in attachement, for more info plz don't hesitate to ask.
Use latest build
http://forum.xda-developers.com/xposed/super-alpha-posted-permission-xposed-t3072979
For me it doesn't work.
I flashed the zip with twrp, the phone rebooted successfully but I can't find the xposed program from the app menu. Maybe I missed something?
I am on g3 with 5.1.1 cyanidel.
Thanks!
half cooked
Stefano Bottari said:
For me it doesn't work.
I flashed the zip with twrp, the phone rebooted successfully but I can't find the xposed program from the app menu. Maybe I missed something?
I am on g3 with 5.1.1 cyanidel.
Thanks!
Click to expand...
Click to collapse
Your food is half cooked....
After flashing it through twrp you have to install xposed 3.0 alpha apk .
Hello!
I am not allowed to post under Software forum yet, hence posting this question here. Sorry for that.
We have developed a support of biometric authentication in our mobile app using BiometricPrompt API. We decided to go with CryptoObjects as it allows us to comply with regulations.
After implementation we are facing an issue that on Samsung devices after some device software updates and after almost every Security Patch our Key is getting corrupted/invalidated. This forces us generating a new key pair, leading to a terrible user experience (having to re-enable a feature again and again).
Error log:
Caused by java.security.UnrecoverableKeyException: Failed to obtain information about key
at android.security.keystore.AndroidKeyStoreProvider.getKeyCharacteristics(AndroidKeyStoreProvider.java:238)
at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(AndroidKeyStoreProvider.java:360)
at android.security.keystore.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:116)
at java.security.KeyStore.getKey(KeyStore.java:1062)
at com.app_name.mobile.data.crypto.CryptoRepositoryImpl.getSignature(CryptoRepositoryImpl.java:527)
at com.app_name.mobile.business.biometric.authentication.BiometricAuthenticationPromptInteractorImpl$getSignatureForAuthentication$1.subscribe(BiometricAuthenticationPromptInteractorImpl.java:52)
Caused by android.security.KeyStoreException: User authentication required
at android.security.KeyStore.getKeyStoreException(KeyStore.java:1151)
at android.security.keystore.AndroidKeyStoreProvider.getKeyCharacteristics(AndroidKeyStoreProvider.java:240)
at android.security.keystore.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(AndroidKeyStoreProvider.java:360)
at android.security.keystore.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:116)
at java.security.KeyStore.getKey(KeyStore.java:1062)
Click to expand...
Click to collapse
Has anyone experienced similar issues? How to prevent our key getting invalidated/corrupted after Samsung security patches? Is it actually a normal behavior and outcome of Security patches?
We are generating a key pair using following code (fallback is used as we discovered that cheaper Samsung devices not supporting EC, hence we use RSA on such devices) :
Code:
@RequiresApi(Build.VERSION_CODES.M)
override fun createSigningKey(keyBaseName: KeyBaseName, useFallbackAlgorithm: Boolean): Either<Throwable, JavaPublicKey> = try {
deleteKey(keyBaseName)
when {
useFallbackAlgorithm -> KeyPairGenerator
.getInstance(KEY_ALGORITHM_RSA, ANDROID_KEY_STORE_PROVIDER)
.apply {
initialize(KeyGenParameterSpec.Builder(keyBaseName, PURPOSE_SIGN or PURPOSE_VERIFY)
.setAlgorithmParameterSpec(RSAKeyGenParameterSpec(KEY_SIZE, RSAKeyGenParameterSpec.F4))
.setDigests(DIGEST_SHA256, DIGEST_SHA512)
.setSignaturePaddings(SIGNATURE_PADDING_RSA_PKCS1)
.setUserAuthenticationRequired(true)
.build())
}
else -> KeyPairGenerator
.getInstance(KEY_ALGORITHM_EC, ANDROID_KEY_STORE_PROVIDER)
.apply {
initialize(KeyGenParameterSpec.Builder(keyBaseName, PURPOSE_SIGN or PURPOSE_VERIFY)
.setDigests(DIGEST_SHA256, DIGEST_SHA512)
.setUserAuthenticationRequired(true)
.build())
}
}.generateKeyPair()
.public
.right()
} catch (e: Exception) {
firebaseRepository.logException(RuntimeException(“createSigningKey”, e))
e.left()
}
Thank you!