Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

System.Formats.Asn1.AsnContentException: 'The encoded length exceeds the maximum supported by this library (Int32.MaxValue).'

Abierto
#1,630 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
32/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
csharp

Línea de trabajo

Comienza en Renci.SshNet.Security.RsaKey..ctor y en la ruta de PrivateKeyFile.Open mostrada en el stack trace. Reproduce el fallo con la clave privada generada por PuTTY y compara su codificación con los formatos que esperan estos puntos de entrada. Se considera terminado cuando el formato de clave compatible se carga correctamente, o cuando su estado de no compatible queda claramente establecido y cubierto por una prueba de regresión adecuada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

System.Formats.Asn1.AsnContentException occurs when loading a private key file generated by PuTTY key generator.

PrivateKeyFile[] keyFiles = new[] { new PrivateKeyFile(PrivateKeyFilePath, PrivateKeyFilePassword) };

System.Formats.Asn1.AsnContentException
  HResult=0x80131500
  Message=The encoded length exceeds the maximum supported by this library (Int32.MaxValue).
  Source=System.Formats.Asn1
  StackTrace:
   at System.Formats.Asn1.AsnDecoder.ReadLength(ReadOnlySpan`1 source, AsnEncodingRules ruleSet, Int32& bytesConsumed)
   at System.Formats.Asn1.AsnDecoder.ReadTagAndLength(ReadOnlySpan`1 source, AsnEncodingRules ruleSet, Nullable`1& contentsLength, Int32& bytesRead)
   at System.Formats.Asn1.AsnDecoder.ReadSequence(ReadOnlySpan`1 source, AsnEncodingRules ruleSet, Int32& contentOffset, Int32& contentLength, Int32& bytesConsumed, Nullable`1 expectedTag)
   at System.Formats.Asn1.AsnReader.ReadSequence(Nullable`1 expectedTag)
   at Renci.SshNet.Security.RsaKey..ctor(Byte[] privateKeyData)
   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, String passPhrase)

Changing the key produces a new error:

System.Formats.Asn1.AsnContentException: 'The provided data is tagged with 'ContextSpecific' class value '14', but it should have been 'Universal' class value '16'.'

   at System.Formats.Asn1.AsnDecoder.CheckExpectedTag(Asn1Tag tag, Asn1Tag expectedTag, UniversalTagNumber tagNumber)
   at System.Formats.Asn1.AsnDecoder.ReadSequence(ReadOnlySpan`1 source, AsnEncodingRules ruleSet, Int32& contentOffset, Int32& contentLength, Int32& bytesConsumed, Nullable`1 expectedTag)
   at System.Formats.Asn1.AsnReader.ReadSequence(Nullable`1 expectedTag)
   at Renci.SshNet.Security.RsaKey..ctor(Byte[] privateKeyData)
   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, String passPhrase)
   

Lenguaje dominante
C#
Estrellas
4.4k
Forks
993
Merge medio
9 d 21 h
PR fusionados (30 d)
1

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sshnet/SSH.NET

Todos los issues de sshnet/SSH.NET

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.