Details on RSA encryption used by SshPrivateKey.Generate

0 votes
asked Aug 11, 2020 by mdahlke (150 points)


Are there more details available on the algorithm used to generate an SSH private key with RSA?

ie. when calling:


What isthe algorithm (like diffie-hellman-group-exchange-sha256), mac list (like hmac-sha2-256), and cipher list (like aes128-cbc, aes128-ctr, etc...) that is used?

Thank you

1 Answer

0 votes
answered Aug 12, 2020 by Lukas Pokorny (128,290 points)
selected Aug 12, 2020 by mdahlke
Best answer


SshPrivateKey.Generate(SshHostKeyAlgorithm.RSA) just generates an RSA private/public key pair using either .NET's RSACryptoServiceProvider class or using Widows CNG API. The key can be saved using the Save(...) method or exported using the GetRSAParameters() method.

SSH ciphers for key exchange (such as diffie-hellman-group-exchange-sha256), MAC (such as hmac-sha2-256) or symmetric encryption (such as aes128-cbc or aes128-ctr) are used during SSH negotiation and/or for encrypting and integrity checking transmitted data once SSH negotiation has finished. However, these are not part of the RSA key and not not involved in its generation. The same RSA key can be used with any allowed combination of other ciphers.

commented Aug 12, 2020 by mdahlke (150 points)
Thank you for the detailed reply