-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add support for ECDSA and ED #48
Conversation
needs-review |
also added @lgheorghiu to needs-review for Windows testing |
I've only tested the first scenario. Some things work, but I've already had some issues with deciphering private keys with non-empty passwords, no matter the format. To decipher private ECDSA keys with non-empty passwords, I've tried both OpenSSH and Putty, for both I get: The commands to generate using the easy password interactively (also, the length is not an issue, I've also tried with a length of 256):
The commands to decipher:
The same for private ED25519 keys, generated with either OpenSSH or Putty. For the latter, I've also tried
If you don't specify the type for a private ED25519 key, it just works for both OpenSSH and Putty keys (with all its variants). needs-changes |
I don't think that OpenSSH supports ED25519 using the old format. I have updated the CLI to allow loading password protected keys. |
needs-review |
This specific case is related to using Putty's Maybe it doesn't make a difference in this case?
Could be read as forcing new format where there's an option otherwise. |
I've tried to automate scenario 1 this is what I've got so far. It tests public and private keys in all formats supported by
|
Updated the above script to also test public keys. |
Updated the above script to also test private and public keys generated by OpenSSH's For the record, there is one combination that fails: private ECDSA keys in
The error is:
|
…ater on Key instance initialization
Thanks @dumol for the review and tests :) I will try to convert your tests into python test and include them in our GitHub ubuntu automated test run. In theory we don't need python. we can just create separate "integration" workflow yaml file that will run your script with code from current branch. needs-review |
Thanks for the fix, can confirm last commit fixes the above issue with private ECDSA keys in PKCS8 format using non-empty passwords. However, at most I can say I've covered step 1 in the PR's testing scenario… (Haven't looked yet at testing OpenSSL X509 PEM public keys). |
Have cleaned-up my script a bit and added comments for the generated keys with both For now, have also commented out generating RSA and DSA keys to keep the execution time under 1 minute. Committed to Next, I would add testing keys generated with Tectia's |
As discussed on #chevah today, there's an issue handling Commands to reproduce:
Current output:
|
Added support for testing with Tectia's However, lots of private keys generated by the Tectia tools are not loaded by the keycert demo. So far, I've seen two types of errors. Here's how to reproduces them (use the CentOS 8 VM at 172.20.4.137):
|
…cert into use-cryptography-take2
Thanks for the review. I have created #50 and #51 for unicode support. The IOError for path not found, is for the helper code from the demo. And that error is expected. Searching for errors is not easy with current script. This is already a big PR, needs-review |
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.
The IOError for path not found, is for the helper code from the demo. And that error is expected.
I have updated the demo script to be explicit about the raised errors.
OK, thanks. Have also updated the interop test script for loading keys to handle all current error codes.
Searching for errors is not easy with current script.
I see thatputty_ecdsa_256_public
is listed twice as failing, but if I don't know where to look for that error.
It was listed twice because public keys were generated for both private formats supported by Putty for Ed25519 keys: private
and private-openssh
.
As there was no point in testing both scenarios, I've updated the script to only generate and test public keys for Putty's own private keys. More so, only when the complex password is used to generate the private key, as the password type is not relevant here.
On top of that, I've added testing different comment types independently of the type of password.
Current failing results for Ed25519 keys would be:
Combinations with expected errors: 3
putty_ed25519_256_private_emptypass_complexcomm
putty_ed25519_256_private_simplepass_complexcomm
putty_ed25519_256_private_complexpass_complexcomm
Combinations with unexpected errors: 1
putty_ed25519_256_public_complexpass_unicodecomm
Is this clear enough? If not, there's always the option to use bash -x
for quick debugging… ;-]
However, in my last commit I've disabled tests that fail for known issues and added relevant comments.
Therefore, all interop tests should be now green. :-]
changes-approved
Thanks. Looks good :) When migrating to Py3 I hope we can also migrate these tests to Python3. The the current tests are excellent. Many thanks for your work. We also need something like this for chevah/server to test with all Host Key, KEX, CIphers, HMAC combinations :) There is still more work here, but I think we got a good start with ED and ECDSA. I will merge this and we will improve the test during the Py3 migration. I have to clean the current Python test so that they will also be green. |
Scope
Fixes #42
Fixes #39
Fixes #38
This adds support for ECDSA and ED private keys.
It support OpenSSH and PuttyFormat.
Old OpenSSH format and SSH.COM format only support RSA and DSA.
This also removes the usage of pycrypto.
Changes
Use the code from upstream Twisted, revision 38a1ed6f9
As a side effect, this stops using pycrypto and uses crypography instead.
I have updated the keycert-demo.py command to allow re-encoding a file after loading and encrypting the re-encoded file.
The demo also has support for signing and validating the signature.
How to try and test the changes
reviewers: @dumol @lgheorghiu
There is a lot to test here :)
Version 2.0.0 was released on our private PyPI to help with chevah/server testing and Laura will test the server integration.
1.Load EC and ED keys
Try to generate ECDSA and ED keys using OpenSSH and PuttyGen and check that you can load them... with and without password. This is for public and private keys.
There is also support for loading ECDSA and ED keys from OpenSSL X509 PEM public keys.
Then there is also the
PKCS#8
(public and private) and publicPKCS#1
:)2.Generate EC and ED keys
Check key generation help CLI as this also goes to chevah/server
Generate the key in OpenSSH format and then check that you can load them / convert them with OpenSSH or Putty.
Generate key in putty format with password protection
3.Sign and verify data