forcedotcom / SalesforceMobileSDK-Android

Android SDK for Salesforce
Other
342 stars 388 forks source link

Android App is throwing this exception on some specific devices Encryptor: Error during asymmetric decryption #2519

Closed meta-krishna-meghwal closed 1 week ago

meta-krishna-meghwal commented 8 months ago

Please fill out the following details:

  1. Version of Mobile SDK Used: 10.2

  2. Issue found in Native App or Hybrid App: Hybrid

  3. OS Version: Android 13 and Android 14

  4. Device: Vivo V23

  5. Steps to reproduce: The app is not working properly on some specific devices, it is throwing below error.

  6. Error Log: 02-28 15:44:32.530 23292 23292 E Encryptor: Error during asymmetric decryption 02-28 15:44:32.530 23292 23292 E Encryptor: javax.crypto.IllegalBlockSizeException 02-28 15:44:32.530 23292 23292 E Encryptor: at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:613) 02-28 15:44:32.530 23292 23292 E Encryptor: at javax.crypto.Cipher.doFinal(Cipher.java:2056) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.analytics.security.Encryptor.decryptWithPrivateKey(Encryptor.java:530) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.analytics.security.Encryptor.decryptWithRSABytes(Encryptor.java:427) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.analytics.security.Encryptor.decryptWithRSA(Encryptor.java:408) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.security.SalesforceKeyGenerator.generateUniqueId(SalesforceKeyGenerator.java:164) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.security.SalesforceKeyGenerator.getUniqueId(SalesforceKeyGenerator.java:88) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.security.SalesforceKeyGenerator.getUniqueId(SalesforceKeyGenerator.java:77) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.security.SalesforceKeyGenerator.generateEncryptionKey(SalesforceKeyGenerator.java:145) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.security.SalesforceKeyGenerator.getEncryptionKey(SalesforceKeyGenerator.java:103) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.app.SalesforceSDKManager.getEncryptionKey(SalesforceSDKManager.java:1123) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.rest.ClientManager.createNewAccount(ClientManager.java:368) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.ui.OAuthWebviewHelper.addAccount(OAuthWebviewHelper.java:671) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.ui.OAuthWebviewHelper$BaseFinishAuthFlowTask.onPostExecute(OAuthWebviewHelper.java:622) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.salesforce.androidsdk.ui.OAuthWebviewHelper$BaseFinishAuthFlowTask.onPostExecute(OAuthWebviewHelper.java:546) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.os.AsyncTask.finish(AsyncTask.java:771) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.os.AsyncTask.-$$Nest$mfinish(Unknown Source:0) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.os.Handler.dispatchMessage(Handler.java:106) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.os.Looper.loopOnce(Looper.java:223) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.os.Looper.loop(Looper.java:324) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.app.ActivityThread.main(ActivityThread.java:8377) 02-28 15:44:32.530 23292 23292 E Encryptor: at java.lang.reflect.Method.invoke(Native Method) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582) 02-28 15:44:32.530 23292 23292 E Encryptor: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1059) 02-28 15:44:32.530 23292 23292 E Encryptor: Caused by: android.security.KeyStoreException: Unknown error (internal Keystore code: -1000 message: In KeystoreOperation::finish 02-28 15:44:32.530 23292 23292 E Encryptor: 02-28 15:44:32.530 23292 23292 E Encryptor: Caused by: 02-28 15:44:32.530 23292 23292 E Encryptor: 0: In finish: KeyMint::finish failed. 02-28 15:44:32.530 23292 23292 E Encryptor: 1: Error::Km(ErrorCode(-1000))) (public error code: 10 internal Keystore code: -1000) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:369) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:128) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181) 02-28 15:44:32.530 23292 23292 E Encryptor: at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:603) 02-28 15:44:32.530 23292 23292 E Encryptor: ... 24 more 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: Exception thrown while getting encryption key 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes(java.nio.charset.Charset)' on a null object reference 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.salesforce.androidsdk.security.SalesforceKeyGenerator.generateEncryptionKey(SalesforceKeyGenerator.java:146) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.salesforce.androidsdk.security.SalesforceKeyGenerator.getEncryptionKey(SalesforceKeyGenerator.java:103) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.salesforce.androidsdk.app.SalesforceSDKManager.getEncryptionKey(SalesforceSDKManager.java:1123) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.salesforce.androidsdk.rest.ClientManager.createNewAccount(ClientManager.java:368) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.salesforce.androidsdk.ui.OAuthWebviewHelper.addAccount(OAuthWebviewHelper.java:671) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.salesforce.androidsdk.ui.OAuthWebviewHelper$BaseFinishAuthFlowTask.onPostExecute(OAuthWebviewHelper.java:622) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.salesforce.androidsdk.ui.OAuthWebviewHelper$BaseFinishAuthFlowTask.onPostExecute(OAuthWebviewHelper.java:546) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at android.os.AsyncTask.finish(AsyncTask.java:771) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at android.os.AsyncTask.-$$Nest$mfinish(Unknown Source:0) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at android.os.Handler.dispatchMessage(Handler.java:106) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at android.os.Looper.loopOnce(Looper.java:223) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at android.os.Looper.loop(Looper.java:324) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at android.app.ActivityThread.main(ActivityThread.java:8377) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at java.lang.reflect.Method.invoke(Native Method) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582) 02-28 15:44:32.531 23292 23292 E SalesforceKeyGenerator: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1059) 02-28 15:44:32.927 23292 23938 E Encryptor: Error during asymmetric decryption 02-28 15:44:32.927 23292 23938 E Encryptor: javax.crypto.IllegalBlockSizeException

wmathurin commented 8 months ago

Can you give us more details:

meta-krishna-meghwal commented 8 months ago

Yes, the application was working previously on the same device and now it is consistently throwing erorr.

wmathurin commented 8 months ago

Was there a OS upgrade on the device?

meta-krishna-meghwal commented 8 months ago

No, there was not any OS upgrade

wmathurin commented 2 months ago

There was a fix in that area in MSDK 12. Could you try with the latest version of MSDK and let us know if you still see the problem?

wmathurin commented 1 week ago

Closing issue for lack of response from customer.