cryptography icon indicating copy to clipboard operation
cryptography copied to clipboard

UnimplementedError: Ecdh.p256(length: 32).newKeyPair() on on Android

Open joshuajylin opened this issue 2 years ago • 2 comments

Does cryptography or cryptography_flutter support ECDH p256 on Android?

joshuajylin avatar Dec 14 '23 14:12 joshuajylin

I have the same issue.

It seems that the CryptographyFlutterPlugin.kt should support ECDH algorithms:

https://github.com/dint-dev/cryptography/blob/4ba46dcdd8db97b9c42a2429078c6a75e7c5ab73/cryptography_flutter/android/src/main/kotlin/dev/dint/cryptography_flutter/CryptographyFlutterPlugin.kt#L56

After some debugging, I found that the the isSupportedPlatform in flutter_ecdh.dart returns false if the current platform is not a Cupertino device.

  @override
  bool get isSupportedPlatform =>
      FlutterCryptography.isPluginPresent && isCupertino;

Maybe an easy fix would be to remove the && isCupertino statement? 🤷

phillippbertram avatar May 07 '24 12:05 phillippbertram

This bug also happens on windows build, it seems it is forced to ios and android, leaving out all other platforms although they should be supported

joaquingrech avatar Aug 06 '25 04:08 joaquingrech