Skip to content

Commit 49aed6f

Browse files
authored
Relax the RSA/DSA decision for SSH2 keys (#1190)
1 parent 452c1a2 commit 49aed6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Renci.SshNet/PrivateKeyFile.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ private void Open(Stream privateKey, string passPhrase)
333333
throw new SshException("Invalid passphrase.");
334334
}
335335

336-
if (keyType == "if-modn{sign{rsa-pkcs1-sha1},encrypt{rsa-pkcs1v2-oaep}}")
336+
if (keyType.Contains("rsa"))
337337
{
338338
var exponent = reader.ReadBigIntWithBits(); // e
339339
var d = reader.ReadBigIntWithBits(); // d
@@ -349,7 +349,7 @@ private void Open(Stream privateKey, string passPhrase)
349349
_hostAlgorithms.Add(new KeyHostAlgorithm("rsa-sha2-256", _key, new RsaDigitalSignature(decryptedRsaKey, HashAlgorithmName.SHA256)));
350350
#pragma warning restore CA2000 // Dispose objects before losing scope
351351
}
352-
else if (keyType == "dl-modp{sign{dsa-nist-sha1},dh{plain}}")
352+
else if (keyType.Contains("dsa"))
353353
{
354354
var zero = reader.ReadUInt32();
355355
if (zero != 0)

0 commit comments

Comments
 (0)