Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was archived by the owner on May 15, 2024. It is now read-only.

Android 4.4.2 API 19 throws Javax.Crypto.BadPaddingException #709

@kdongare

Description

@kdongare

Description

Steps to Reproduce

  1. Launch app
  2. Lock phone
  3. Unlock phone
  4. Access Secure storage using await SecureStorage.GetAsync(key)

Expected Behavior

Should retrieve the correct value

Actual Behavior

Does not return value but throws exception:
{Javax.Crypto.BadPaddingException: mac check in GCM failed
at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00089] in <8acc8089c2ed40d08469fbaa6710a44c>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeNonvirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001f] in <8acc8089c2ed40d08469fbaa6710a44c>:0
at Javax.Crypto.Cipher.DoFinal (System.Byte[] input, System.Int32 inputOffset, System.Int32 inputLen) [0x00052] in <6f8818d6ffa14f4bad6fb5f5d0f0e665>:0
at Xamarin.Essentials.AndroidKeyStore.Decrypt (System.Byte[] data) [0x0005f] in C:\agent_work\78\s\Xamarin.Essentials\SecureStorage\SecureStorage.android.cs:318
at Xamarin.Essentials.SecureStorage.PlatformGetAsync (System.String key) [0x0003e] in C:\agent_work\78\s\Xamarin.Essentials\SecureStorage\SecureStorage.android.cs:31
at Xamarin.Essentials.SecureStorage.GetAsync (System.String key) [0x00013] in C:\agent_work\78\s\Xamarin.Essentials\SecureStorage\SecureStorage.shared.cs:16
--- End of managed Javax.Crypto.BadPaddingException stack trace ---
javax.crypto.BadPaddingException: mac check in GCM failed
at com.android.org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(BaseBlockCipher.java:739)
at javax.crypto.Cipher.doFinal(Cipher.java:1239)
at md51558244f76c53b6aeda52c8a337f2c37.PageRenderer.n_onAttachedToWindow(Native Method)
at md51558244f76c53b6aeda52c8a337f2c37.PageRenderer.onAttachedToWindow(PageRenderer.java:55)
at android.view.View.dispatchAttachedToWindow(View.java:12752)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2577)
at android.view.ViewGroup.addViewInner(ViewGroup.java:3757)
at android.view.ViewGroup.addView(ViewGroup.java:3564)
at android.view.ViewGroup.addView(ViewGroup.java:3509)
at android.view.ViewGroup.addView(ViewGroup.java:3485)
at mono.java.lang.RunnableImplementor.n_run(Native Method)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
}

Basic Information

  • Version with issue: 1.0.1
  • Last known good version: none
  • IDE:
  • Platform Target Frameworks:
    • iOS:
    • Android: 8.1
    • UWP:
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions