Skip to content

Commit 6e79603

Browse files
committed
Fix ED25519 PubKey-auth
LeadingZeros of BigInteger-Conversion have to be removed before sending the Key.
1 parent c6813d5 commit 6e79603

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Renci.SshNet/Security/Cryptography/ED25519Key.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public override BigInteger[] Public
3333
{
3434
get
3535
{
36-
return new BigInteger[] { publicKey.ToBigInteger() };
36+
return new BigInteger[] { publicKey.ToBigInteger2() };
3737
}
3838
set
3939
{

src/Renci.SshNet/Security/KeyHostAlgorithm.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using Renci.SshNet.Common;
3+
using Renci.SshNet.Security.Chaos.NaCl;
34

45
namespace Renci.SshNet.Security
56
{
@@ -101,7 +102,11 @@ private set
101102
_keys = new List<byte[]>(value.Length);
102103
foreach (var key in value)
103104
{
104-
_keys.Add(key.ToByteArray().Reverse());
105+
var keyData = key.ToByteArray().Reverse();
106+
if (Name == "ssh-ed25519")
107+
keyData = keyData.TrimLeadingZeros().Pad(Ed25519.PublicKeySizeInBytes);
108+
109+
_keys.Add(keyData);
105110
}
106111
}
107112
}

0 commit comments

Comments
 (0)