Table of Contents

Method FromRsa

Namespace
SshSharp
Assembly
SshSharp.dll

FromRsa(RSA, string?)

A key that .NET's RSA holds, used without exporting it: a software key, or a non-exportable one in Windows CNG (a TPM through the Microsoft Platform Crypto Provider, Windows Hello) or in any provider that implements RSA. Only the public key is read. Signs with rsa-sha2-512 or rsa-sha2-256.

public static SshPrivateKey FromRsa(RSA rsa, string? comment = null)

Parameters

rsa RSA

The key. It stays the caller's: disposing the returned key does not dispose it.

comment string

A comment for the key, often user@host.

Returns

SshPrivateKey

Remarks

The returned key cannot be exported or added to an agent.

Exceptions

ArgumentException

The key is under 2048 bits.