Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Renci.SshNet/PrivateKeyFile.PuTTY.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public Key Parse()
var curve = publicKeyReader.ReadString(Encoding.ASCII);
var pub = publicKeyReader.ReadBinary();
var prv = privateKeyReader.ReadBinary();
parsedKey = new EcdsaKey(curve, pub, prv);
parsedKey = new EcdsaKey(curve, pub, prv.TrimLeadingZeros());
break;
case "ssh-rsa":
var exponent = publicKeyReader.ReadBigInt();
Expand Down
10 changes: 10 additions & 0 deletions test/Data/Key.PuTTY3.ECDSA.LeadingZero.ppk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PuTTY-User-Key-File-3: ecdsa-sha2-nistp256
Encryption: none
Comment: imported-openssh-key
Public-Lines: 3
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNhE4rS0CTev
/VEC6BJ/142eE3dU88t1rpzrSJ3iEcyp+3itM0+182eXSswmunZo/TNyvFE1sXKK
1x0COQJl6hU=
Private-Lines: 1
AAAAIQDTj7+GAKceovRR6/NV8TFi+Mc5cHl555sVVokgFkofYA==
Private-MAC: 71bc2b8cbe9f209ff693afb9b217f060f5dc4d4ae73e136e28fa1034b0fdd982
1 change: 1 addition & 0 deletions test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public void ConstructorWithFileNameAndPassPhraseShouldBeAbleToReadFileThatIsShar
[DataRow("Key.PuTTY2.RSA.Encrypted.12345.ppk", "12345", typeof(RsaKey))]
[DataRow("Key.PuTTY2.RSA.ppk", null, typeof(RsaKey))]
[DataRow("Key.PuTTY3.ECDSA.Encrypted.Argon2id.12345.ppk", "12345", typeof(EcdsaKey))]
[DataRow("Key.PuTTY3.ECDSA.LeadingZero.ppk", null, typeof(EcdsaKey))]
[DataRow("Key.PuTTY3.ECDSA.ppk", null, typeof(EcdsaKey))]
[DataRow("Key.PuTTY3.Ed25519.Encrypted.Argon2i.12345.ppk", "12345", typeof(ED25519Key))]
[DataRow("Key.PuTTY3.Ed25519.Encrypted.Argon2d.12345.ppk", "12345", typeof(ED25519Key))]
Expand Down