ECDiffieHellman Class RRS feed

  • Question

  • User228975 posted

    Hi, I would like to know if the cryptography class above is ever going to be supported in Xamarin for Android and IOS ? I am asking this because it is supported by .Net Standard 2.1 and dotnet Core 2.1. I am hitting error thrown saying that the feature is not implemented.


    Thursday, February 6, 2020 11:01 AM

All replies

  • User382871 posted

    Cryptographic functions was introduced since .NET Standard target1.3. To use the library, add using System.Security.Cryptography above the class. ECDiffieHellman is an abstract class, you can use ECDiffieHellman.Create() method to get the instance. ``` using System.Security.Cryptography;

    ... ECDiffieHellman cDiffieHellman = ECDiffieHellman.Create(); ```

    Check the links: https://xamarinhelp.com/cryptography-in-xamarin-forms/ https://stackoverflow.com/questions/41303777/use-ecdiffiehellman-with-or-without-cryptography-next-generation-cng

    Friday, February 7, 2020 2:42 AM
  • User228975 posted

    I have the exact same code and it is deployed in Android 5 - API 21 physical hardware and I am getting the error below. The target framework is .net Standard 2.1. Can you or someone try on their end to see if you are getting the same error ?

    Xamarin (d16-4@1d551f9) Xamarin Designer (remotes/origin/d16-4@ac250f5aa) Xamarin.Android SDK (d16-4/d66aed0)

    Saturday, February 8, 2020 2:33 AM
  • User382871 posted

    ECDiffieHellman is an abstract class try to create a custom class and make it inherit from ECDiffieHellman class to use the method. The PublicKey should be specified a value which will be used by this ECDiffieHellman instance. public class CustomClass : ECDiffieHellman { public override ECDiffieHellmanPublicKey PublicKey => throw new NotImplementedException(); }

    Tutorial: https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.ecdiffiehellman.publickey?view=netcore-3.1

    Monday, February 10, 2020 11:05 AM