Skip to content
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

WIP: Add Support for ECDSA Host- and Private-Keys #489

Closed
wants to merge 1 commit into from

Conversation

darinkes
Copy link
Collaborator

Also known as:

  • ecdsa-sha2-nistp256
  • ecdsa-sha2-nistp384
  • ecdsa-sha2-nistp521

Works but needs some more testing and tests, but already opening an PR so it can be discussed.

Basically it translate between SSH-Data and Microsoft Crypto API.

Tested with ECDSA-{256,384,521} Hostkeys and ECDSA-{256,384,521}-Pub/Private-Keys
against OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016.
Keys generated with:

  • ssh-keygen -t ecdsa
  • ssh-keygen -t ecdsa -b 384
  • ssh-keygen -t ecdsa -b 521

@darinkes
Copy link
Collaborator Author

According to https://docs.microsoft.com/de-de/dotnet/api/system.security.cryptography.cngkey .NET Core should be also possible. But in my setup it keeps complaining it cannot find System.Security.Cryptography. Any hints?

@darkoperator
Copy link

darkoperator commented Nov 27, 2018 via email

@darinkes
Copy link
Collaborator Author

.NET 3.5 Tests fail with:

Keys used with the ECDsaCng algorithm must have an algorithm group of ECDsa.

https://stackoverflow.com/questions/43980660/keys-used-with-the-ecdsacng-algorithm-must-have-an-algorithm-group-of-ecdsa

@darinkes
Copy link
Collaborator Author

.NET 3.5 Tests fail with:

Keys used with the ECDsaCng algorithm must have an algorithm group of ECDsa.

https://stackoverflow.com/questions/43980660/keys-used-with-the-ecdsacng-algorithm-must-have-an-algorithm-group-of-ecdsa

Added an own version of the Workaround mentioned in the stackoverflow-Post.

@bhalbright
Copy link

bhalbright commented Nov 27, 2018

This is great that some additional private key support is being added. For what its worth, I'm currently working on adding ed25519 support though I'm a ways off as I don't a lot of time to work on it (currently have working code to parse openssh v1 key and decrypt it if protected with a passphrase but that's it so far).

@darinkes
Copy link
Collaborator Author

This is great that some additional private key support is being added. For what its worth, I'm currently working on adding ed25519 support though I'm a ways off as I don't a lot of time to work on it (currently have working code to parse openssh v1 key and decrypt it if protected with a passphrase but that's it so far).

Cool! I'm also on it. Can you share your result so far?
Right now working on including CodesInChaos/Chaos.NaCl in SSH.NET and use it.

@bhalbright
Copy link

Cool! I'm also on it. Can you share your result so far?
Right now working on including CodesInChaos/Chaos.NaCl in SSH.NET and use it.

@darinkes sure, please give me a little time to clean up my code and I'll be happy to share it (It is pretty messy at the moment, I was in trial and error mode expecting to clean it up when I had it basically working). I saw your PR for ed25519, I'm going to add a comment there too

Also known as:
- ecdsa-sha2-nistp256
- ecdsa-sha2-nistp384
- ecdsa-sha2-nistp521

Works for .NET 3.5 and 4.0 but needs some more testing and tests.

Basically it translate between SSH-Data and Microsoft Crypto API.

Tested with ECDSA-{256,384,521} Hostkeys and ECDSA-{256,384,521}-Pub/Private-Keys
against OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g  1 Mar 2016.
Keys generated with:
- ssh-keygen -t ecdsa
- ssh-keygen -t ecdsa -b 384
- ssh-keygen -t ecdsa -b 521
@darinkes
Copy link
Collaborator Author

darinkes commented Dec 2, 2018

Closing in favor of: #496

@darinkes darinkes closed this Dec 2, 2018
@darinkes darinkes deleted the ecdsa branch December 9, 2018 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants