jeroentrappers / flutter_keychain

A flutter plugin for secure storage on Android via KeyStore and iOS via Keychain
Other
56 stars 41 forks source link

BAD_DECRYPT Exception #12

Closed Vanethos closed 10 months ago

Vanethos commented 5 years ago

Sometimes on debug mode, and more often in release mode, the following occurs:

E/flutter_keychain(13452): error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452): Failed to handle method call
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452): java.lang.IllegalArgumentException: Unsupported value: javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at be.appmire.flutterkeychain.FlutterKeychainPlugin.onMethodCall(FlutterKeychainPlugin.kt:323)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:90)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:234)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at android.app.ActivityThread.main(ActivityThread.java:6940)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
E/MethodChannel#plugin.appmire.be/flutter_keychain(13452):      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter (13452): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, Unsupported value: javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT, null)

when using the get method

// get - get the value for a given key
  static Future<String> get({@required String key}) async =>
      await _channel.invokeMethod('get', {'key': key});
pythoneer commented 5 years ago

due to the fact that both libs use a similar approach i think this issue is related https://github.com/mogol/flutter_secure_storage/issues/53

nyarian commented 4 years ago

I started getting this error today, too

It worked okay before (for 2 months)

penhorwood commented 2 years ago

I am getting this error also. I have followed all of the settings in flutter_secure_stroage but nothing seems to help this issue.

E/flutter_keychain(10622): error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT

I have test apps that work but on my main app which is storing a number of values then waiting for a response from a server and storing a follow up value. When I restart the app to see if the values persisted I get this DECRYPT error.

latest versions of Dart, Flutter and plugin.

[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19042.1288], locale en-US) • Flutter version 2.5.3 at D:\android\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (3 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at C:\Users\andrew\AppData\Local\Android\sdk • Platform android-31, build-tools 30.0.2 • Java binary at: D:\AndroidStudio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189) • All Android licenses accepted.

[√] Android Studio (version 2020.3) • Android Studio at D:\AndroidStudio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] Connected device (2 available) • SM G973U1 (mobile) • RF8M216A2RT • android-arm64 • Android 11 (API 30) • Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 9 (API 28) (emulator)

• No issues found!

benoitskipr commented 2 years ago

28 should fix this

TheCarpetMerchant commented 1 year ago

@jeroentrappers This should probably be closed.