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

[iOS] .RSA.generate Not working when published on TestFlight #19

Open
ZacharieAzoulai opened this issue Aug 19, 2021 · 25 comments
Open
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ZacharieAzoulai
Copy link

Hi

I've been using this package for a month now and had no issue with it but yesterday when I pushed my app on Testflight, the app was working as expected,

I get this error: 'dart.core_ArgumentError_toString (kind RegularFunction)' is accessed through Dart C API without being marked as an entry point; its tree-shaken signature cannot be verified. WARNING: See https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md

After multiple research, I found out that it happens when calling RSA.generate(2048);

I was able to reproduce this error when debugging in profile mode

Do you have an idea on how to fix this ?

@jerson
Copy link
Owner

jerson commented Aug 19, 2021

Hi @ZacharieAzoulai thanks for report the issue, im gonna try to reproduce it here in order to fix this issue

@jerson
Copy link
Owner

jerson commented Aug 19, 2021

@ZacharieAzoulai which version are you using ?

@ZacharieAzoulai
Copy link
Author

I'm using the version 3.0.0

@jerson
Copy link
Owner

jerson commented Aug 19, 2021

could you try with the previous one please https://pub.dev/packages/fast_rsa/versions/2.0.1

2.0.1 use protobuf
3.0.0 use flatbuffers (i think that generated files by flatc can be the issue)

@jerson
Copy link
Owner

jerson commented Aug 19, 2021

in addition to this, i tested on android release and profile mode and works for me but tomorrow i will take some time to test on ios profile and testflight

@ZacharieAzoulai
Copy link
Author

I didn't test on android but on IOS it still doesn't work with the version 2.0.1

Thanks for your help !

@ZacharieAzoulai
Copy link
Author

I had another error when changing to stable (I'm not sure if it's the reason) but it was also when calling RSA.generate(2048)

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'FutureOr<Uint8List>?' #0 Binding.callAsync.<anonymous closure> (package:fast_rsa/bridge/binding.dart:49) <asynchronous suspension>

Maybe it can help

@ZacharieAzoulai
Copy link
Author

And when I display the first element of the List I got Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found)

@jerson
Copy link
Owner

jerson commented Aug 19, 2021

seems like librsa_bridge.a was not loaded properly, i tested on ios, using profile also using an adhoc release, and seems works, im using beta channel with this example project https://github.com/jerson/flutter-rsa/tree/master/example

can you share more details about for example flutter version, also if are you using bitcode, also ios target version

about this warning: Unhandled Exception: type 'List' is not a subtype of type 'FutureOr?' i can fix that

but about the main issue i still need some time to research about

@ZacharieAzoulai
Copy link
Author

Here is my flutter doctor -v output:

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-arm, locale en-GB)
• Flutter version 2.2.3 at /Users/zhack013/bin/flutter
• Framework revision f4abaa0735 (7 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/zhack013/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1

[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• 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.8+10-b944.6916264)

[✓] VS Code (version 1.59.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0

[✓] Connected device (1 available)
• Zack’s iPhone (mobile) • 00008101-001D71610E51003A • ios • iOS 14.7.1

! Doctor found issues in 1 category.

My iOS target version is 9.0

@jerson
Copy link
Owner

jerson commented Aug 20, 2021

here is my flutter doctor -v , i havent tested before in darwin-arm im not sure if its related to this issue

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en)
    • Flutter version 2.2.3 at /Users/usuario/flutter
    • Framework revision f4abaa0735 (7 weeks ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/usuario/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/usuario/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/usuario/Android/Sdk
    • Java binary at: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (version 2020.3)
    • Android Studio at /Users/usuario/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7621141/Android Studio.app/Contents
    • 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
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
    • IntelliJ at /Users/usuario/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • 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

[✓] VS Code (version 1.59.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.25.0

[✓] Connected device (3 available)
    • iPhone de Stefani (mobile) • bd392d1f96cd42a46c757c355e45035718e8078b • ios            • iOS 12.5.4
    • macOS (desktop)            • macos                                    • darwin-x64     • macOS 11.5.2 20G95 darwin-x64
    • Chrome (web)               • chrome                                   • web-javascript • Google Chrome 92.0.4515.159

! Doctor found issues in 1 category.

@ZacharieAzoulai
Copy link
Author

So how did you make it work on your Mac ?

@jerson
Copy link
Owner

jerson commented Aug 22, 2021

mm for me just works without any additional change in(profile, and release mode android and ios) using this example https://github.com/jerson/flutter-rsa/tree/master/example, tested using stable, and beta channels, maybe im testing in a wrong way, but for profile im using

flutter run --profile

and for release im using xcode archive and then export using adhoc provision profile

have you tested using this example or maybe can you provide me an example project and the steps to reproduce it?

@ZacharieAzoulai
Copy link
Author

I'll test with this example and if it works with it and not my project I'll give you an example project

@ZacharieAzoulai
Copy link
Author

ZacharieAzoulai commented Aug 22, 2021

So it works with your example but not with my project, could be the fact that I'm using the flutter sdk sdk: ">=2.7.0 <3.0.0" ??

Does your package requires non-null safety ? or everything above 2.12 ?

UPDATE:

After 2 hours of migrating to null safety it still doesn't work, I'll try to create an example from my project

@jerson
Copy link
Owner

jerson commented Aug 23, 2021

I migrated to null-safety from 2.0.1 so you can try with an older version like

1.3.6 or below (but since is an older version im not sure if still works)

@ZacharieAzoulai
Copy link
Author

Hi,

I know it's been a while, I figured it out that it worked for the RSA.generated(2048) but now it doesn't work with await RSA.decryptPKCS1v15, still on version 3.0.0 and I can't test on newer version because of the path bug...

@jerson jerson added bug Something isn't working help wanted Extra attention is needed labels Sep 22, 2021
@jerson
Copy link
Owner

jerson commented Sep 22, 2021

Hi @ZacharieAzoulai since #22 was closed, this seems related, is this fixed for you too? or is still an issue?

@ZacharieAzoulai
Copy link
Author

Hi @jerson, it wasn't related to it, but the only way I could fix this error was by commenting all the code and removing all my pub dependencies and uncommenting widget by widget and adding dependencies, one at a time, but I didn't found reason of this issue

I think there is like a compatibility between your packages and a mysterious one but sorry I don't know which one, the weird thing was that it wasn't causing the bug for the same method as last time...

@mohammadkarbalaee
Copy link

Guys why do you keep closing tasks that are not resolved?
It's 2025 and I am facing it.

@jerson
Copy link
Owner

jerson commented Feb 6, 2025

@mohammadkarbalaee could you include some info about the version you are currently using please

@jerson jerson reopened this Feb 6, 2025
@jerson
Copy link
Owner

jerson commented Feb 6, 2025

I have added a branch with some changes for this issue, when you get a chance could you help me to test those please https://github.com/jerson/flutter-rsa/tree/pragma-entrypoint

@dustinkerstein
Copy link

FYI I'm seeing the same issue when using Fast RSA inside a FlutterFlow project and running a debug build locally:

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found

Is there an easy way to test that branch with a package? Thanks!

@jerson
Copy link
Owner

jerson commented Mar 2, 2025

We have just released a new version: https://pub.dev/packages/fast_rsa/versions/3.8.0, which includes two adjustments that may help with this issue:

  • Added a pragma to methods used by Isolate to keep them alive in release mode.
  • Introduced RSASync methods, which do not rely on Isolate and interact directly with the Bridge.

I suggest trying the new version, and if the issue persists, you can replace RSA with the new RSASync methods.

FlutterFlow is something I haven’t used yet, but I’ll check it out soon

@dustinkerstein
Copy link

Hey @jerson, I just gave the new package a try and I'm running into the same issues even when trying the new RSASync methods:

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'RSABridgeCall': dlsym(RTLD_DEFAULT, RSABridgeCall): symbol not found
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33:70)
#1      new Binding._internal (package:fast_rsa/bridge/binding.dart)
#2      Binding._instance (package:fast_rsa/bridge/binding.dart:18:44)
#3      Binding._instance (package:fast_rsa/bridge/binding.dart)
#4      new Binding (package:fast_rsa/bridge/binding.dart:25:12)
#5      RSABridge.bindingEnabled (package:fast_rsa/fast_rsa_bridge.dart:10:38)
#6      RSABridge.bindingEnabled (package:fast_rsa/fast_rsa_bridge.dart)
#7      RSABridge.callSync (package:fast_rsa/fast_rsa_bridge.dart:21:10)
#8      RSASync.encryptPKCS1v15 (package:fast_rsa/fast_rsa_sync.dart:217:19)
#9      encryptText (package:prompts/custom_code/actions/encrypt_text.dart:22:15)
#10     _RecordButtonsWidgetState.build.<anonymous closure> (package:prompts/misc/record_buttons/record_buttons_widget.dart:396:68)
<asynchronous suspension>
#11     _RecorderState._stop (package:prompts/custom_code/widgets/recorder.dart:217:7)
<asynchronous suspension>

Let me know if there's something specific you'd like me to try. Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants