Using SshClient on Linux under Wine throws System.Security.Cryptography.CryptographicException
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- csharp
- Área
- cryptography
Línea de trabajo
Comienza en KeyExchangeECCurve25519 e inspecciona cómo SshClient expone ConnectionInfo.KeyExchangeAlgorithms. Revisa la selección entre BclImpl y BouncyCastleImpl mostrada en el issue y determina después cómo podría un llamador configurar la implementación antes de conectarse. Se considera terminado cuando se pueda seleccionar la ruta BouncyCastle configurada para Wine sin eliminar manualmente los algoritmos de intercambio de claves.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
SSH.NET Version: 2026.0.0
.NET Version: 10.0.11
Wine Version: 11.0
When trying to connect a SshClient from a Windows Application running under Wine, I get the following exception:
System.PlatformNotSupportedException: The specified curve 'Curve25519' or its parameters are not valid for this platform.
---> System.Security.Cryptography.CryptographicException: Unknown error (0x80090029)
at System.Security.Cryptography.CngKey.Create(CngAlgorithm algorithm, String keyName, CngKeyCreationParameters creationParameters)
at System.Security.Cryptography.CngAlgorithmCore.GetOrGenerateKey(Nullable`1 curve)
--- End of inner exception stack trace ---
at System.Security.Cryptography.CngAlgorithmCore.GetOrGenerateKey(Nullable`1 curve)
at System.Security.Cryptography.ECDiffieHellmanCng.GenerateKey(ECCurve curve)
at Renci.SshNet.Security.KeyExchangeECCurve25519.BclImpl.GenerateClientPublicKey()
at Renci.SshNet.Security.KeyExchangeECCurve25519.StartImpl()
at Renci.SshNet.Security.KeyExchangeECCurve25519.Start(Session session, KeyExchangeInitMessage message, Boolean sendClientInitMessage)
at Renci.SshNet.Session.OnKeyExchangeInitReceived(KeyExchangeInitMessage message)
at Renci.SshNet.Messages.Transport.KeyExchangeInitMessage.Process(Session session)
at Renci.SshNet.Session.MessageListener()
--- End of stack trace from previous location ---
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.CreateAndConnectSession()
at Renci.SshNet.BaseClient.Connect()
at <my code>
Code executed:
var sshClient = new Renci.SshNet.SshClient(hostname, port, username, password);
sshClient.Connect();
I understand this is a Wine specific issue, because the bcrypt.dll / ncrypt.dll are heavily stubbed under Wine and Windows CNG (ECDH kex algorithms) is not fully supported as of right now. So not really a SSH.NET bug.
I was able to circumvent the issue by removing ECDH key exchange algorithms before connecting via my SshClient:
foreach (var algo in sshClient.ConnectionInfo.KeyExchangeAlgorithms.Keys.ToList())
{
if (!algo.StartsWith("diffie-hellman-group", StringComparison.Ordinal))
sshClient.ConnectionInfo.KeyExchangeAlgorithms.Remove(algo);
}
Obviously this is not really a good solution.
As a suggestion, it would be nice to have an option to switch to the BouncyCastle implementations via e.g. some config option.
For example in KeyExchangeECCurve25519:
public override void Start(Session session, KeyExchangeInitMessage message, bool sendClientInitMessage)
{
base.Start(session, message, sendClientInitMessage);
#if NET
if (!_forceBouncyCastleImpl && System.OperatingSystem.IsWindowsVersionAtLeast(10))
{
_impl = new BclImpl();
}
else
#endif
{
_impl = new BouncyCastleImpl();
}
StartImpl();
}
where _forceBouncyCastleImpl is just some placeholder to force using the BouncyCastle implementation that can be somehow configured.
(As a side note: This issues did not occur with older SSH.NET versions or on .NET Framework)
- Lenguaje dominante
- C#
- Estrellas
- 4.4k
- Forks
- 994
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de sshnet/SSH.NET
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
-
ShellStream.Expect over-discards on undecodable bytes, driving ArrayBuffer.ActiveLength negativeAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
Todos los issues de sshnet/SSH.NET
Issues similares
-
copilot documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 2 días
-
[Rust][Flaky Test] multiple_deadlines_fire_in_order asserts a wall-clock gap instead of firing orderAbiertoCI/CD ⚒️ Flaky-tests 🐦
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
valkey-io/valkey-glide#7255 ·
Los mantenedores suelen responder en 3 días
-
bug good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
unoplatform/Uno.Core#99 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
aws/aws-dotnet-ai#75 ·