![]() |
VOOZH | about |
dotnet add package SshKeyGenerator --version 1.1.51
NuGet\Install-Package SshKeyGenerator -Version 1.1.51
<PackageReference Include="SshKeyGenerator" Version="1.1.51" />
<PackageVersion Include="SshKeyGenerator" Version="1.1.51" />Directory.Packages.props
<PackageReference Include="SshKeyGenerator" />Project file
paket add SshKeyGenerator --version 1.1.51
#r "nuget: SshKeyGenerator, 1.1.51"
#:package SshKeyGenerator@1.1.51
#addin nuget:?package=SshKeyGenerator&version=1.1.51Install as a Cake Addin
#tool nuget:?package=SshKeyGenerator&version=1.1.51Install as a Cake Tool
👁 Build status
👁 NuGet version (SshKeyGenerator)
After searching around for a solution to creating SSH keys using C# and dotnet core I came across the following stackoverflow posts which explain how to convert from RSACryptoServiceProvider to values suitable for use with ssh.
SshKeyGenerator is a library for .NET and is available on NuGet:
Install-Package SshKeyGenerator
or
dotnet add package SshKeyGenerator
var keygen = new SshKeyGenerator.SshKeyGenerator(2048);
var privateKey = keygen.ToPrivateKey();
Console.WriteLine(privateKey);
var publicSshKey = keygen.ToRfcPublicKey();
Console.WriteLine(publicSshKey);
var publicSshKeyWithComment = keygen.ToRfcPublicKey("user@domain.com");
Console.WriteLine(publicSshKeyWithComment);
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAs1O/9F2XlZVaVWEUYfflxx0wDG9FE09hQF2wngA6EemHpe6I
hvdwvQ7obrZ85jSYdBxBRjNAYF3T9+wU+8w6m4qZCVYvqqRjszN8j3VwUBLzWilt
...
wDGzJIkmbhANi+252pH6PAuWjZPfz8COGA6QPPH0/khpHPj1LY4mi5Ubi3YT1uRo
dOGttjtkj9fLX5IQ81G9HR0MdT1Gd4fPenYPOUCgCPB5adpT1BB+
-----END RSA PRIVATE KEY-----
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzU7/0XZeVlVpVYRRh9
...
+ohFsbcbAMcfLWGUdouyHvLvF21G0z50z2i2CrU7WW4WdrGGfxhU3TeRTXd7Skwk/K7iBBn3oc/xct generated-key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzU7/0XZeVlVpVYRRh9
...
+ohFsbcbAMcfLWGUdouyHvLvF21G0z50z2i2CrU7WW4WdrGGfxhU3TeRTXd7Skwk/K7iBBn3oc/xct user@domain.com
There are three methods which can be used to export SSH key data for use by other libraries such as FxSsh:
Export methods usage:
// Create a new instance
var keygen = new SshKeyGenerator.SshKeyGenerator(4096);
// Get Base64 encoded keys with private key
var base64Keys = keygen.ToB64Blob(true);
// Use in a SSH server. e.g. FxSsh
var server = new SshServer();
server.AddHostKey("ssh-rsa", base64Keys);
Thanks to the following contributors for their assistance with this library.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net452 net452 is compatible. net46 net46 was computed. net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on SshKeyGenerator:
| Package | Downloads |
|---|---|
|
Slithin.Core
Package Description |
Showing the top 1 popular GitHub repositories that depend on SshKeyGenerator:
| Repository | Stars |
|---|---|
|
furesoft/Slithin
A management application for the remarkable tablet
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.51 | 807,557 | 1/29/2023 |
| 1.1.50 | 110,800 | 3/18/2022 |
| 1.1.49 | 1,552 | 3/18/2022 |
| 1.1.48 | 1,459 | 3/18/2022 |
| 1.1.47 | 1,537 | 3/18/2022 |
| 1.1.46 | 1,459 | 3/18/2022 |
| 1.1.45 | 3,795 | 2/5/2022 |
| 1.1.44 | 1,610 | 2/3/2022 |
| 1.1.43 | 1,591 | 2/3/2022 |
| 1.1.42 | 1,513 | 2/3/2022 |
| 1.1.40 | 182,510 | 3/25/2021 |
| 1.1.39 | 1,472 | 3/25/2021 |
| 1.1.38 | 6,774 | 1/16/2021 |
| 1.1.33 | 35,894 | 3/5/2020 |
| 1.1.32 | 1,681 | 3/5/2020 |
| 1.1.31 | 15,767 | 10/30/2019 |
| 1.1.19 | 5,516 | 7/21/2018 |
| 1.1.18 | 2,282 | 7/21/2018 |
| 1.1.17 | 2,264 | 7/21/2018 |
| 1.1.16 | 2,447 | 7/18/2018 |