MuntashirAkon / AppManager

A full-featured package manager and viewer for Android
https://muntashirakon.github.io/AppManager/
Other
4.91k stars 277 forks source link

AM Does Not Open #466

Closed RickyM7 closed 3 years ago

RickyM7 commented 3 years ago

Describe the bug The app does not open, it just keeps asking for the keystore password (I have no password, so I just click on the notification and i press ok).

To Reproduce Steps to reproduce the behaviour:

  1. Open the app
  2. Open the keystore notification and press Ok.
  3. See error

Expected behavior The app should just open normally as in v2.6.0.

Device info

MuntashirAkon commented 3 years ago

Click on the notification, create new password and proceed.

RickyM7 commented 3 years ago

@MuntashirAkon I've tried, it didn't work. The notification simply reappears every time I put the password.

MuntashirAkon commented 3 years ago

The notification simply reappears every time I put the password.

Unfortunately, it's not reproducible on my side. So, I suggest opening an issue with all necessary information. The password is mandatory, if you leave it blank, it won't work.

RickyM7 commented 3 years ago

Last comment on that. It seems that the AM can not save the keystore password on my phone. I tested both v2.6.0 and v2.6.1 and both versions, when I put a password and click OK the notification only reappears instantly. If I do not put any password and just press the OK the Am takes a while, but the notification reappears anyway. I will simply continue using am v2.6.0 for now.

MuntashirAkon commented 3 years ago

It seems that the AM can not save the keystore password on my phone. I tested both v2.6.0 and v2.6.1 and both versions, when I put a password and click OK the notification only reappears instantly.

No idea why this is happening. Try to take some logs if you have access to ADB. Use the v2.6.1 debug build to take logs which is identical to the release build.

RickyM7 commented 3 years ago

@MuntashirAkon This is the am.log of v2.6.1-DEBUG#1315 which is in /storage/emulated/0/Android/data/io.github.muntashirakon.AppManager.debug/cache. I hope this helps with something.

2021-06-08 08:42:01.074 W/KSManager: Using keystore BKS
2021-06-08 08:42:14.483 I/CompatUtil: Loading local protection key
2021-06-08 08:42:14.488 I/CompatUtil: Generating AES key with keystore
2021-06-08 08:42:14.557 E/KS: Could not get encrypted password
java.lang.IllegalStateException: IV has already been used. Reusing IV in encryption mode violates security best practices.
    at android.security.keystore.AndroidKeyStoreAuthenticatedAESCipherSpi.addAlgorithmSpecificParametersToBegin(AndroidKeyStoreAuthenticatedAESCipherSpi.java:292)
    at android.security.keystore.AndroidKeyStoreAuthenticatedAESCipherSpi$GCM.addAlgorithmSpecificParametersToBegin(AndroidKeyStoreAuthenticatedAESCipherSpi.java:215)
    at android.security.keystore.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:237)
    at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:495)
    at javax.crypto.Cipher.doFinal(Cipher.java:1939)
    at javax.crypto.CipherOutputStream.close(CipherOutputStream.java:202)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreManager.getEncryptedPassword(KeyStoreManager.java:258)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreManager.savePass(KeyStoreManager.java:234)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreActivity.savePass(KeyStoreActivity.java:98)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreActivity.lambda$onNewIntent$0$KeyStoreActivity(KeyStoreActivity.java:58)
    at io.github.muntashirakon.AppManager.crypto.ks.-$$Lambda$KeyStoreActivity$XHTE60Zkrk32fdA171eap3KW2uc.onClick(lambda)
    at io.github.muntashirakon.AppManager.types.TextInputDialogBuilder.lambda$setPositiveButton$0$TextInputDialogBuilder(TextInputDialogBuilder.java:103)
    at io.github.muntashirakon.AppManager.types.-$$Lambda$TextInputDialogBuilder$tKo_1QwVTk4yr_IK6zS88R9KqNY.onClick(lambda)
    at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:165)
    at android.app.ActivityThread.main(ActivityThread.java:6375)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
MuntashirAkon commented 3 years ago

Seems to be a false-negative issue. Is there anyway to reproduce it? What exactly did you do that brought this issue?

RickyM7 commented 3 years ago

I simply opened the AM, clicked on the notification to put the keystore password, i put a password and clicked Ok.

MuntashirAkon commented 3 years ago

This appears to be an Android bug, seems to be present in Android 6.0-8.1. Try this build: 8aa9a07f. I can't promise anything.

RickyM7 commented 3 years ago

A debug build was not generated in the artifacts, so I have no way to test these changes, sorry.

MuntashirAkon commented 3 years ago

A debug build was not generated in the artifacts, so I have no way to test these changes, sorry.

https://github.com/MuntashirAkon/AppManager/actions/runs/924348819

RickyM7 commented 3 years ago

It did not work, the same previous log is generated in am.log.

2021-06-10 06:09:18.919 W/KSManager: Using keystore BKS
2021-06-10 06:09:32.086 I/CompatUtil: Loading local protection key
2021-06-10 06:09:32.090 I/CompatUtil: Generating AES key with keystore
2021-06-10 06:09:32.197 E/KS: Could not get encrypted password
java.lang.IllegalStateException: IV has already been used. Reusing IV in encryption mode violates security best practices.
    at android.security.keystore.AndroidKeyStoreAuthenticatedAESCipherSpi.addAlgorithmSpecificParametersToBegin(AndroidKeyStoreAuthenticatedAESCipherSpi.java:292)
    at android.security.keystore.AndroidKeyStoreAuthenticatedAESCipherSpi$GCM.addAlgorithmSpecificParametersToBegin(AndroidKeyStoreAuthenticatedAESCipherSpi.java:215)
    at android.security.keystore.AndroidKeyStoreCipherSpiBase.ensureKeystoreOperationInitialized(AndroidKeyStoreCipherSpiBase.java:237)
    at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:495)
    at javax.crypto.Cipher.doFinal(Cipher.java:1939)
    at javax.crypto.CipherOutputStream.close(CipherOutputStream.java:202)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreManager.getEncryptedPassword(KeyStoreManager.java:258)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreManager.savePass(KeyStoreManager.java:234)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreActivity.savePass(KeyStoreActivity.java:98)
    at io.github.muntashirakon.AppManager.crypto.ks.KeyStoreActivity.lambda$onNewIntent$0$KeyStoreActivity(KeyStoreActivity.java:58)
    at io.github.muntashirakon.AppManager.crypto.ks.-$$Lambda$KeyStoreActivity$XHTE60Zkrk32fdA171eap3KW2uc.onClick(lambda)
    at io.github.muntashirakon.AppManager.types.TextInputDialogBuilder.lambda$setPositiveButton$0$TextInputDialogBuilder(TextInputDialogBuilder.java:103)
    at io.github.muntashirakon.AppManager.types.-$$Lambda$TextInputDialogBuilder$tKo_1QwVTk4yr_IK6zS88R9KqNY.onClick(lambda)
    at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:165)
    at android.app.ActivityThread.main(ActivityThread.java:6375)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
MuntashirAkon commented 3 years ago

Fixed in 2042d764

RickyM7 commented 3 years ago

Just to confirm, I just tested the latest debug build (v2.7.0-DEBUG#1327) and now everything is working perfectly, thank you very much.