Skip to content

Commit

Permalink
Fix ED25519 Support with SSH.NET 2024.2.0
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
darinkes committed Dec 3, 2024
1 parent ce992ff commit 193efa3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions SshNet.Keygen/Extensions/KeyExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ private static string OpensshPrivateKeyData(this Key key, ISshKeyEncryption encr
case "ssh-ed25519":
var ed25519 = (ED25519Key)key;
privWriter.EncodeBinary(ed25519.PublicKey);
privWriter.EncodeBinary(ed25519.PrivateKey);
var privateKey = new byte[ed25519.PrivateKey.Length + ed25519.PublicKey.Length];
Buffer.BlockCopy(ed25519.PrivateKey, 0, privateKey, 0, ed25519.PrivateKey.Length);
Buffer.BlockCopy(ed25519.PublicKey, 0, privateKey, ed25519.PrivateKey.Length, ed25519.PublicKey.Length);
privWriter.EncodeBinary(privateKey);
break;
case "ssh-rsa":
var rsa = (RsaKey)key;
Expand Down Expand Up @@ -200,7 +203,10 @@ internal static string ToPuttyFormat(this Key key, ISshKeyEncryption encryption,
{
case "ssh-ed25519":
var ed25519 = (ED25519Key)key;
privWriter.EncodeBinary(ed25519.PrivateKey);
var privateKey = new byte[ed25519.PrivateKey.Length + ed25519.PublicKey.Length];
Buffer.BlockCopy(ed25519.PrivateKey, 0, privateKey, 0, ed25519.PrivateKey.Length);
Buffer.BlockCopy(ed25519.PublicKey, 0, privateKey, ed25519.PrivateKey.Length, ed25519.PublicKey.Length);
privWriter.EncodeBinary(privateKey);
break;
case "ssh-rsa":
var rsa = (RsaKey)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 @@ -5,7 +5,7 @@
<LangVersion>9</LangVersion>
<Nullable>enable</Nullable>
<PackageId>SshNet.Keygen</PackageId>
<Version>2024.2.0.0</Version>
<Version>2024.2.0.1</Version>
<PackageVersion>$(Version)</PackageVersion>
<PackageTags>ssh;scp;sftp</PackageTags>
<Description>SSH.NET Extension to generate and export Authentication Keys in OpenSSH and PuTTY Format.</Description>
Expand Down

0 comments on commit 193efa3

Please sign in to comment.