Failure parsing private key with PEM format generated by OpenSSH 9.9p1 (macOS 15.4)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- csharp
- Área
- cryptography, security
Línea de trabajo
Reproduce el fallo con el comando de macOS 15.4 OpenSSH 9.9p1 e inspecciona el PEM generado comparándolo con una clave de macOS 14.6.1. Comienza en Renci.SshNet.Security.EcdsaKey y sigue PrivateKeyFile.Open; el trabajo estará terminado cuando la clave generada más recientemente se cargue mediante PrivateKeyFile sin la excepción de análisis ASN.1.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The OpenSSH version that macOS 15.4 ships (9.9p1) generates PEM private keys including some extra metadata that makes SSH.NET fail to parse it.
Steps to reproduce it:
- Generate a private key on macOS 15.4 using the following command:
ssh-keygen -t ecdsa -b 521 -m PEM -f ./pkey.pem -q
- Add the following code to a .NET app:
var pkey = new PrivateKeyFile("<path to pkey.pem>");
- Run the app and you will get the following exception:
Exception has occurred: CLR/System.Formats.Asn1.AsnContentException
An unhandled exception of type 'System.Formats.Asn1.AsnContentException' occurred in System.Formats.Asn1.dll: 'The provided data is tagged with 'Universal' class value '16', but it should have been 'Universal' class value '6'.'
at System.Formats.Asn1.AsnDecoder.CheckExpectedTag(Asn1Tag tag, Asn1Tag expectedTag, UniversalTagNumber tagNumber)
at System.Formats.Asn1.AsnDecoder.GetPrimitiveContentSpan(ReadOnlySpan`1 source, AsnEncodingRules ruleSet, Asn1Tag expectedTag, UniversalTagNumber tagNumber, Int32& bytesConsumed)
at System.Formats.Asn1.AsnDecoder.ReadObjectIdentifier(ReadOnlySpan`1 source, AsnEncodingRules ruleSet, Int32& bytesConsumed, Nullable`1 expectedTag)
at System.Formats.Asn1.AsnReader.ReadObjectIdentifier(Nullable`1 expectedTag)
at Renci.SshNet.Security.EcdsaKey..ctor(Byte[] data)
at Renci.SshNet.PrivateKeyFile.Open(Stream privateKey, String passPhrase)
at Renci.SshNet.PrivateKeyFile..ctor(String fileName, String passPhrase, String certificateFileName)
at Renci.SshNet.PrivateKeyFile..ctor(String fileName)
at Program.<Main>$(String[] args) in
If you compare the result of running the same ssh-keygen command in macOS 15.4 (OpenSSH 9.9p1) and macOS 14.6.1 (OpenSHH 9.7p1), you'll see the newer version generates a lot of extra content that seems to be the culprit of the parsing content exception.
- Lenguaje dominante
- C#
- Estrellas
- 4.4k
- Forks
- 993
- Merge medio
- 9 d 21 h
- PR fusionados (30 d)
- 1
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 3/5 1-2 días Aptitud para principiantes 68/100
-
Using SshClient on Linux under Wine throws System.Security.Cryptography.CryptographicException Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Todos los issues de sshnet/SSH.NET
Issues similares
-
effort:S P3 refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
C#/.NET Roslyn LSP Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Suspicious code fragments Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
DotNetNext/SqlSugar#1458 ·