Skip to content

Commit 5021f6d

Browse files
Use System.Security.Cryptography in AesCipher (#1235)
* Use System.Security.Cryptography in AesCipher * don't set the IV - it is unused by ECB * Dispose ciphers in Session if applicable --------- Co-authored-by: Wojciech Nagórski <[email protected]>
1 parent b4c8291 commit 5021f6d

File tree

4 files changed

+56
-783
lines changed

4 files changed

+56
-783
lines changed

src/Renci.SshNet/PrivateKeyFile.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,14 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase)
531531
throw new SshException("Cipher '" + cipherName + "' is not supported for an OpenSSH key.");
532532
}
533533

534-
privateKeyBytes = cipher.Decrypt(privateKeyBytes);
534+
try
535+
{
536+
privateKeyBytes = cipher.Decrypt(privateKeyBytes);
537+
}
538+
finally
539+
{
540+
cipher.Dispose();
541+
}
535542
}
536543

537544
// validate private key length

0 commit comments

Comments
 (0)