Failed to unwrap key exception android O on Diffie-Hellman encryption - android

I am using Diffie-Hellman encryption and decryption algorithm for my app username and password.I am using my keystore to store information and retrieving It is working properly working in below android O.Recently i am facing this issue please help me
java.security.InvalidKeyException: Failed to unwrap key
java.security.InvalidKeyException: Failed to unwrap key\n
Caused by: com.sample.example.sdk.manager.utils.CustomException: java.security.InvalidKeyException: Failed to unwrap key\n\tat
com.sample.example.sdk.manager.KeyPairHelper.getDevicePrivatekKey(KeyPairHelper.java:60)\n\tat
com.sample.example.sdk.manager.SampleTask.buildAesKey(SampleTask.java:100)\n\tat
com.sample.example.sdk.manager.SampleTask.call(SampleTask.java:186)\n\tat
com.sample.example.sdk.manager.SampleTask.call(SampleTask.java:66)\n\tat
io.reactivex.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:42)\n\tat
io.reactivex.Observable.subscribe(Observable.java:10842)\n\tat
io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)\n\tat
io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)\n\tat io.reactivex.internal.
schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)\n\tat
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)\n\tat
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)\n\tat
java.lang.Thread.run(Thread.java:764)\n
Caused by: java.security.InvalidKeyException: Failed to unwrap key\n\tat
android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:682)\n\tat
javax.crypto.Cipher.unwrap(Cipher.java:2121)\n\tat
com.sample.example.sdk.manager.utils.Custom.getEncryptionKey(Custom.java:312)\n\tat
com.sample.example.sdk.manager.utils.Custom.\u003cinit\u003e(Custom.java:108)\n\t
... 15 more\nCaused by: javax.crypto.IllegalBlockSizeException\n\tat
android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)\n\tat
android.security.keystore.AndroidKeyStoreCipherSpiBase.engineUnwrap(AndroidKeyStoreCipherSpiBase.java:680)\n\t... 18 more\n
Caused by: android.security.KeyStoreException: Unknown error\n\tat
android.security.KeyStore.getKeyStoreException(KeyStore.java:1137)\n\tat android.security.keystore.KeyStoreCryptoOp

Related

Gradle project sync failed in Flutter project

Every time my gradle is syncing it gets errors like this. Can someone help me?
Error cause after adding firebase_ml_vision dependency.
Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
Caused by: java.lang.RuntimeException: com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
Caused by: com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
Caused by: org.gradle.api.internal.tasks.DefaultTaskContainer$TaskCreationException: Could not create task ':app:packLibsflutterBuildDebug'.
org.codehaus.groovy.runtime.metaclass.MissingMethodExecutionFailed: No signature of method: org.gradle.api.tasks.bundling.Jar.destinationDir() is applicable for argument types: (File) values: [C:\Users\37499\AndroidStudioProjects\flutter_ml_demo\build\app\intermediates\flutter\debug]
I tried changing gradle, java and firebase versions but that don't help.

Anddroid: Execution failed for task ':libhos:kaptKotlin'

How can I resolve this error, I get this after upgrading my kotlin to 1.6.10
Is there any concrete way resolve this
Caused by: java.lang.IllegalStateException: Could not parse metadata! This should only happen if you're using Kotlin <1.1.
at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.readKotlinClassMetadata(KotlinPoetMetadata.kt:83)
at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.toImmutableKmClass(KotlinPoetMetadata.kt:113)
at com.squareup.moshi.kotlin.codegen.MoshiCachedClassInspector.toImmutableKmClass(MoshiCachedClassInspector.kt:37)
at com.squareup.moshi.kotlin.codegen.MetadataKt.targetType(metadata.kt:137)
at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.adapterGenerator(JsonClassCodegenProcessor.kt:148)
at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.process(JsonClassCodegenProcessor.kt:114)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt:90)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:188)

MSAL - Exception two- Failed to load instance discovery metadata Android 31

One of our android app is using MSAL library (com.microsoft.identity.client:msal:0.2.+) to validate the user with Microsoft AD. When we run the app in Android 12 - Google pixel device, I am getting an exception.
E/AdalMigrationAdapter:loadCloudDiscoveryMetadata: [2021-11-28 12:03:12 - thread_name : pool-45-thread-1, correlation_id : UNSET] Failed to load instance discovery metadata Android 31
javax.net.ssl.SSLHandshakeException: Chain validation failed
at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:363)
at com.android.org.conscrypt.ConscryptEngine.convertException(ConscryptEngine.java:1134)
at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1089)
at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:876)
at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:747)
at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:712)
at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:858)
at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.access$100(ConscryptEngineSocket.java:731)
at com.android.org.conscrypt.ConscryptEngineSocket.doHandshake(ConscryptEngineSocket.java:241)
at com.android.org.conscrypt.ConscryptEngineSocket.startHandshake(ConscryptEngineSocket.java:220)
at com.android.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:196)
at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:153)
at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:116)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:186)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:106)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:30)
at com.google.firebase.perf.network.InstrURLConnectionBase.getInputStream(InstrURLConnectionBase.java:137)
at com.google.firebase.perf.network.InstrHttpsURLConnection.getInputStream(InstrHttpsURLConnection.java:79)
at com.microsoft.identity.common.internal.net.UrlConnectionHttpClient.executeHttpSend(UrlConnectionHttpClient.java:263)
at com.microsoft.identity.common.internal.net.UrlConnectionHttpClient.access$100(UrlConnectionHttpClient.java:73)
at com.microsoft.identity.common.internal.net.UrlConnectionHttpClient$2.call(UrlConnectionHttpClient.java:176)
at com.microsoft.identity.common.internal.net.UrlConnectionHttpClient$2.call(UrlConnectionHttpClient.java:174)
at com.microsoft.identity.common.internal.net.NoRetryPolicy.attempt(NoRetryPolicy.java:42)
at com.microsoft.identity.common.internal.net.NoRetryPolicy.attempt(NoRetryPolicy.java:36)
at com.microsoft.identity.common.internal.net.UrlConnectionHttpClient.method(UrlConnectionHttpClient.java:174)
at com.microsoft.identity.common.internal.net.AbstractHttpClient.get(AbstractHttpClient.java:47)
at com.microsoft.identity.common.internal.providers.microsoft.azureactivedirectory.AzureActiveDirectory.performCloudDiscovery(AzureActiveDirectory.java:188)
at com.microsoft.identity.common.internal.migration.AdalMigrationAdapter.loadCloudDiscoveryMetadata(AdalMigrationAdapter.java:238)
at com.microsoft.identity.common.internal.migration.AdalMigrationAdapter.adapt(AdalMigrationAdapter.java:119)
at com.microsoft.identity.common.internal.migration.TokenMigrationUtility$1.run(TokenMigrationUtility.java:67)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
Caused by: java.security.cert.CertificateException: Chain validation failed
at com.android.org.conscrypt.TrustManagerImpl.verifyChain(TrustManagerImpl.java:719)
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:549)
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:570)
at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:615)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:505)
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:425)
at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:353)
at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:90)
at com.android.org.conscrypt.ConscryptEngineSocket$2.checkServerTrusted(ConscryptEngineSocket.java:163)
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:255)
at com.android.org.conscrypt.ConscryptEngine.verifyCertificateChain(ConscryptEngine.java:1638)
at com.android.org.conscrypt.NativeCrypto.ENGINE_SSL_read_direct(Native Method)
at com.android.org.conscrypt.NativeSsl.readDirectByteBuffer(NativeSsl.java:569)
at com.android.org.conscrypt.ConscryptEngine.readPlaintextDataDirect(ConscryptEngine.java:1095)
at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1079)
... 37 more
Caused by: java.security.cert.CertPathValidatorException: Response is unreliable: its validity interval is out-of-date
at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:135)
at sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:222)
at sun.security.provider.certpath.PKIXCertPathValidator.validate(PKIXCertPathValidator.java:140)
at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:79)
at java.security.cert.CertPathValidator.validate(CertPathValidator.java:301)
at com.android.org.conscrypt.TrustManagerImpl.verifyChain(TrustManagerImpl.java:715)
... 52 more
Caused by: java.security.cert.CertPathValidatorException: Response is unreliable: its validity interval is out-of-date
at sun.security.provider.certpath.OCSPResponse.verify(OCSPResponse.java:619)
at sun.security.provider.certpath.RevocationChecker.checkOCSP(RevocationChecker.java:709)
at sun.security.provider.certpath.RevocationChecker.check(RevocationChecker.java:363)
at sun.security.provider.certpath.RevocationChecker.check(RevocationChecker.java:337)
at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:125)
... 57 more
Suppressed: java.security.cert.CertPathValidatorException: Could not determine revocation status
at sun.security.provider.certpath.RevocationChecker.buildToNewKey(RevocationChecker.java:1092)
Another error is showing is "Unable to perform cloud discovery"
I am facing this issue only in Android 12.

LibGDX game crash after migrating to Android Studio 3.4

After migrating to Android Studio 3.4, the game now crashed. It works fine on 3.3. What does this mean?
org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
at
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android:transformDexWithInstantRunSlicesApkForDebug'
...
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: /Users/limtc/AndroidStudioProjects/Space War/android/build/intermediates/instant_run_split_apk_resources/debug/instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
,,,
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /Users/limtc/AndroidStudioProjects/Space War/android/build/intermediates/instant_run_split_apk_resources/debug/instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
...
Caused by: java.io.FileNotFoundException: /Users/limtc/AndroidStudioProjects/Space War/android/build/intermediates/instant_run_split_apk_resources/debug/instantRunSplitApkResourcesDebug/out/slice_1/resources_ap
...
After switching off instant run, I can now deploy to phone! But trying to generate bundle I now have:
org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
...
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':android:lintVitalRelease'
...
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':android:lintClassPath'.
...
Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download groovy-all.jar
Maybe now something goes offline? Thanks!
Based on the messages:
java.io.FileNotFoundException: /.../instant_run_split_apk_resources
I'd say, try disabling Instant Run.

My app keeps stopping in Android Emulator with mpw error which I think is related to server connectivity

The logs, in this case, are very weird. I am not able to figure out the issues that are causing the connectivity errors with the servers. Please help me out with this mpw 29503 error:
09-06 17:08:37.756 2285-4073/com.google.android.gms.persistent E/NetRec: [239] abno.a: Could not retrieve server token for package com.google.android.apps.gcs
java.util.concurrent.ExecutionException: mpw: 29503:
at alfn.b(:com.google.android.gms#12521024#12.5.21 (040700-189987672):4)
at alfn.a(:com.google.android.gms#12521024#12.5.21 (040700-189987672):28)
at abno.a(:com.google.android.gms#12521024#12.5.21 (040700-189987672):1)
at abno.a(:com.google.android.gms#12521024#12.5.21 (040700-189987672):7)
at abnl.getHeaders(:com.google.android.gms#12521024#12.5.21 (040700-189987672):2)
at com.android.volley.toolbox.HttpClientStack.performRequest(:com.google.android.gms#12521024#12.5.21 (040700-189987672):15)
at nmb.performRequest(:com.google.android.gms#12521024#12.5.21 (040700-189987672):1)
at bdb.executeRequest(:com.google.android.gms#12521024#12.5.21 (040700-189987672):1)
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms#12521024#12.5.21 (040700-189987672):11)
at nmc.performRequest(:com.google.android.gms#12521024#12.5.21 (040700-189987672):8)
at com.android.volley.NetworkDispatcher.a(:com.google.android.gms#12521024#12.5.21 (040700-189987672):7)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms#12521024#12.5.21 (040700-189987672):2)
Caused by: mpw: 29503:
at mvf.a(:com.google.android.gms#12521024#12.5.21 (040700-189987672):3)
at aejp.b(:com.google.android.gms#12521024#12.5.21 (040700-189987672):4)
at aema.a(:com.google.android.gms#12521024#12.5.21 (040700-189987672):4)
at nof.a(:com.google.android.gms#12521024#12.5.21 (040700-189987672):6)
at noj.run(:com.google.android.gms#12521024#12.5.21 (040700-189987672):44)
at axja.run(:com.google.android.gms#12521024#12.5.21 (040700-189987672):2)
at nsg.run(:com.google.android.gms#12521024#12.5.21 (040700-189987672):27)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at nya.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
It's so wired, because of task invocation on ThreadExecutor. To get correct log of your issues, you should wrap action, which you submit in background with your tools (executor Service, Rx, or even AsyncTask) with try-cath block.

Categories

Resources