-
-
Notifications
You must be signed in to change notification settings - Fork 939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Private Key] Add support for PuTTY private key file format (V3 and V2) #1543
Conversation
switch (keyType) | ||
{ | ||
case "ssh-ed25519": | ||
parsedKey = new ED25519Key(privateKeyReader.ReadBignum2()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ED25519Key
class does not have a constructor with both publicKeyData
and privateKeyData
. The current implementation is to generate public key from private key. Should we add a new constructor?
SSH.NET/src/Renci.SshNet/Security/Cryptography/ED25519Key.cs
Lines 98 to 104 in 3ec45e1
public ED25519Key(byte[] privateKeyData) | |
{ | |
PrivateKey = new byte[Ed25519.SecretKeySize]; | |
PublicKey = new byte[Ed25519.PublicKeySize]; | |
Buffer.BlockCopy(privateKeyData, 0, PrivateKey, 0, Ed25519.SecretKeySize); | |
Ed25519.GeneratePublicKey(privateKeyData, 0, PublicKey, 0); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems ok as it is, but I don't mind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, will wait for a stable BC release
switch (keyType) | ||
{ | ||
case "ssh-ed25519": | ||
parsedKey = new ED25519Key(privateKeyReader.ReadBignum2()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems ok as it is, but I don't mind
7e5d67f
to
05547da
Compare
ooh a flaky test |
This PR adds support for PuTTY private key file format (V3 and V2) described in https://tartarus.org/~simon/putty-snapshots/htmldoc/AppendixC.html
Close #341
Close #431
Close #434
Close #510
Notes:
It may subject to change, then we need to change accordingly. (Hope not). Also hope BouncyCastle makes a formal release before SSH.NET next release.Update: BouncyCastle 2.5.0 is released.