VOOZH about

URL: https://www.nuget.org/packages/SshKeyGenerator/

⇱ NuGet Gallery | SshKeyGenerator 1.1.51




SshKeyGenerator 1.1.51

dotnet add package SshKeyGenerator --version 1.1.51
 
 
NuGet\Install-Package SshKeyGenerator -Version 1.1.51
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SshKeyGenerator" Version="1.1.51" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SshKeyGenerator" Version="1.1.51" />
 
Directory.Packages.props
<PackageReference Include="SshKeyGenerator" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SshKeyGenerator --version 1.1.51
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SshKeyGenerator, 1.1.51"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SshKeyGenerator@1.1.51
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SshKeyGenerator&version=1.1.51
 
Install as a Cake Addin
#tool nuget:?package=SshKeyGenerator&version=1.1.51
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

DotNet Core SSH KeyGen

👁 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.

Supported Platforms

  • .NET 4.5 (Desktop / Server)
  • .NET Standard 2.0
  • .NET Standard 2.1
  • .NET 5.0
  • .NET 6.0

Installation

SshKeyGenerator is a library for .NET and is available on NuGet:

Install-Package SshKeyGenerator

or

dotnet add package SshKeyGenerator

Usage Example

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);

Sample Output

keygen.ToPrivateKey()
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAs1O/9F2XlZVaVWEUYfflxx0wDG9FE09hQF2wngA6EemHpe6I
hvdwvQ7obrZ85jSYdBxBRjNAYF3T9+wU+8w6m4qZCVYvqqRjszN8j3VwUBLzWilt
...
wDGzJIkmbhANi+252pH6PAuWjZPfz8COGA6QPPH0/khpHPj1LY4mi5Ubi3YT1uRo
dOGttjtkj9fLX5IQ81G9HR0MdT1Gd4fPenYPOUCgCPB5adpT1BB+
-----END RSA PRIVATE KEY-----
keygen.ToRfcPublicKey()
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzU7/0XZeVlVpVYRRh9
...
+ohFsbcbAMcfLWGUdouyHvLvF21G0z50z2i2CrU7WW4WdrGGfxhU3TeRTXd7Skwk/K7iBBn3oc/xct generated-key
keygen.ToRfcPublicKey("user@domain.com")
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzU7/0XZeVlVpVYRRh9
...
+ohFsbcbAMcfLWGUdouyHvLvF21G0z50z2i2CrU7WW4WdrGGfxhU3TeRTXd7Skwk/K7iBBn3oc/xct user@domain.com

Export Methods

There are three methods which can be used to export SSH key data for use by other libraries such as FxSsh:

  1. byte[] ToBlobs : Export as Blobs
  2. string ToB64Blob : Export blobs as base64 string
  3. string ToXml : Export as XML string

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);

References

Contributors

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SshKeyGenerator:

Package Downloads
Slithin.Core

Package Description

GitHub repositories (1)

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
Loading failed