System.Security.Cryptography.ECDsa.Create (System.Security.Cryptography.ECParameters parameters exception

Sk 61 Reputation points
2024-05-20T07:15:52.04+00:00

We have integrated SSH.Net 2024.0.0 from Nuget for Xamarin UWP, Xamarin. IOS and Mono Android. UWP works fine. BUT iOS and Android are throwing exceptions. Any ideas or suggestions would be helpful. Visual Studio 2022 C#

          using (SftpClient sftp = new SftpClient(host, port, user, pass))
            {
                sftp.Connect();

                if (!sftp.Exists(path))
                    ok = false;
                sftp.Disconnect();
            }

Throws an Exception on sftp.Connect().

iOS Exception {System.NotImplementedException: The method or operation is not implemented. at System.Security.Cryptography.ECDsa.Create (System.Security.Cryptography.ECParameters parameters) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamari…} 

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,311 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 59,016 Reputation points
    2024-05-20T21:17:05.68+00:00

    the System.Security.Cryptography.ECDsa methods are not supported on IOS or Android. a replacement cryptography library is required. I don't believe SSH.Net supports external encryption libraries. you will need to use a different SSH library or fork it and change the Cryptography to a supported one.

    https://github.com/sshnet/SSH.NET