Skip to content

Commit

Permalink
Add sample for encryption export
Browse files Browse the repository at this point in the history
- Fix NuGet Description
- Fix Typo in Sample
  • Loading branch information
darinkes committed Mar 17, 2024
1 parent 1f1c4ad commit 65b7f1e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,16 @@ var publicKey = keyFile.ToPublic();
Console.WriteLine("Private Key: {0}", privateKey);
Console.WriteLine("Public Key: {0}", publicKey);
```

### Export an existing Key from SSH.NET with Encryption
```cs
var keyFile = new PrivateKeyFile("test.key");

var privateKey = keyFile.ToOpenSshFormat(new SshKeyEncryptionAes256("12345"));
var puttyKey = keyFile.ToPuttyFormat(new SshKeyEncryptionAes256("12345"));
var publicKey = keyFile.ToPublic();

Console.WriteLine("Private Key: {0}", privateKey);
Console.WriteLine("Putty Private Key: {0}", puttyKey);
Console.WriteLine("Public Key: {0}", publicKey);
```
2 changes: 1 addition & 1 deletion SshNet.Keygen.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void Main(string[] args)
var fingerprint = key.Fingerprint();

Console.WriteLine("Fingerprint: {0}", fingerprint);
Console.WriteLine("Add this to your .ssh/authorized_keys of the SSH Server: {0}", publicKey);
Console.WriteLine("Add this to your .ssh/authorized_keys on the SSH Server: {0}", publicKey);
Console.ReadLine();

using var client = new SshClient("localhost", Environment.GetEnvironmentVariable("USER") ?? Environment.GetEnvironmentVariable("USERNAME"), key);
Expand Down
2 changes: 1 addition & 1 deletion SshNet.Keygen/SshNet.Keygen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Version>2024.0.0-beta</Version>
<PackageVersion>$(Version)</PackageVersion>
<PackageTags>ssh;scp;sftp</PackageTags>
<Description>SSH.NET Extension to generate and export Authentication Keys in OPENSSH-Format</Description>
<Description>SSH.NET Extension to generate and export Authentication Keys in OpenSSH and PuTTY Format.</Description>
<PackageReleaseNotes>https://github.com/darinkes/SshNet.Keygen/releases/tag/$(PackageVersion)</PackageReleaseNotes>
<Copyright>Copyright (c) 2021 - 2024 Stefan Rinkes</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down

0 comments on commit 65b7f1e

Please sign in to comment.