Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformException(Exception encountered, read, javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT #248

Closed
Yongle-Fu opened this issue Jul 13, 2021 · 12 comments · Fixed by #328

Comments

@Yongle-Fu
Copy link

flutter_secure_storage: 4.2.0

Android 11
M2102K1C 1050

Crashed in non-app: message_codecs.dart in StandardMethodCodec.decodeEnvelope within flutter
flutter_secure_storage.dart in FlutterSecureStorage.read at line 50 within flutter_secure_storage
Called from:
flutter_secure_storage.dart in FlutterSecureStorage.containsKey at line 71 within flutter_secure_storage

PlatformException
PlatformException(Exception encountered, read, javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
at com.android.org.conscrypt.NativeCrypto.EVP_CipherFinal_ex(Native Method)
at com.android.org.conscrypt.OpenSSLEvpCipher.doFinalInternal(OpenSSLEvpCipher.java:152)
at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:374)
at javax.crypto.Cipher.doFinal(Cipher.java:2055)
at com.it_nomads.fluttersecurestorage.ciphers.StorageCipher18Implementation.decrypt(StorageCipher18Implementation.java:91)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.decodeRawValue(FlutterSecureStoragePlugin.java:162)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.read(FlutterSecureStoragePlugin.java:143)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin.access$400(FlutterSecureStoragePlugin.java:30)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin$MethodRunner.run(FlutterSecureStoragePlugin.java:200)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:233)
at android.os.HandlerThread.run(HandlerThread.java:67)

@142hitesh
Copy link

Facing same issue

@juliansteenbakker
Copy link
Collaborator

Closing this as duplicate of #210

@NamanShergill
Copy link

Closing this as duplicate of #210

Why close this issue as a duplicate of a CLOSED issue when the problem is still ongoing and not fixed?

@juliansteenbakker
Copy link
Collaborator

My bad, i thought it was open.

@nombrekeff
Copy link

Hey, how's this issue going? I'm facing the issue and have not found any fix or workaround yet!

@dakr0013
Copy link

dakr0013 commented Sep 6, 2021

@nombrekeff adding custom backup rules fixed the error for me:

  1. i added android:fullBackupContent="@xml/my_backup_rules" to application tag in AndroidManifest.xml
  2. i created the file my_backup_rules.xml in main/res/xml with following content:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
    <include domain="sharedpref" path="."/>
    <exclude domain="sharedpref" path="FlutterSecureStorage"/>
</full-backup-content>

see also https://pub.dev/packages/flutter_secure_storage#configure-android-version and https://developer.android.com/guide/topics/data/autobackup#IncludingFiles

@nombrekeff
Copy link

@dakr0013 thanks, I will try that! I've seen this solution a lot, so everything points that it works!

@nombrekeff
Copy link

The solution @dakr0013 told me did not work for me, I'm still facing the issue. Any updates on this?

@dala00
Copy link

dala00 commented Nov 10, 2021

I temporary fixed. First, readAll always throws exception. So use read only.

And when a key doesn't exist (or no data exist?), exception is thrown. So catch.

    try {
      return await storage.read(key: myKey);
    } catch (e) {
      return null;
    }

And targetSdkVersion 30 may cause this. (Or android version?)

@novas1r1
Copy link

novas1r1 commented Dec 6, 2021

Still the same issue with Pixel4a Android 12 and flutter_secure_storage 5.0.2

"PlatformException(Exception encountered, read, javax.crypto.BadPaddingException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT"

Problem occurs with read AND readAll

@fede1295
Copy link

Same issue for me .. please reopen the ticket and fix it

@shubham-vunet
Copy link

Same issue for me .. please reopen the ticket and fix it

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants