-
Notifications
You must be signed in to change notification settings - Fork 421
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
ECDSA Keys and Certificates #291
Comments
|
@carlskii: By my reading of the code it is not currently possible. @reaperhulk: What are the blockers to adding ECDSA support? I'd like to add ECDSA support to Certbot, but I think it's blocked on support in pyOpenSSL. cc @bmw @ohemorange for confirmation. |
|
It's not possible currently using the PyOpenSSL API directly, but it is possible to generate an ECDSA private key and load it into a PyOpenSSL PKey using lower-level crypto APIs: From there you can generate a CSR, see https://github.com/plinss/acmebot/ for more code examples. (There are more curves you can use, I only used those three in my bot.) |
|
pyOpenSSL has direct support for loading cryptography PKeys as of 16.1. Certificates will follow hopefully soon. Therefore I’m closing this issue. Our mid-term plan is to get rid of code duplication between cryptography and pyOpensSSL. Specifically x509 is the first to go. |
|
@hynek FWIW, loading a cryptography key directly into a PKey currently fails for ECDSA keys (as of 16.2.0), results in "TypeError: Unsupported key type", the PEM workaround I posted above does work. |
|
Ah right...is there a reason why we don't allow EC keys @reaperhulk? Or was that just for parity? |
|
That was because pyOpenSSL doesn't officially support EC keys so I figured I should just have it error on that. We could lift that restriction but I wouldn't guarantee that an EC PKey object would behave properly in all cases. |
|
Do you have a hunch what might go wrong or is it just a general bad feeling? |
|
A general bad feeling. Looking at the public methods In the specific case of certbot it's probably worth revisiting what all they use pyOpenSSL for since it's possible cryptography covers the complete set now. |
|
I know better than to argue against your bad feeling. :) I’m thinking about removing the exception but leave it experimental for now? |
|
As a data point, I'm using the following PyOpenSSL (16.2) methods in acmebot with ECDSA private keys, public keys, and certificates, and all seems fine (in that I am able to issue functioning ECDSA certificates from Let's Encrypt): |
|
If that's the only part of pyOpenSSL you're using in acmebot then you could actually directly depend on cryptography (you have it as a transitive dependency via pyOpenSSL right now). CSRBuilder, Certificate, and CertificateSigningRequest contain what you need. |
|
I'm using Let's Encrypt's acme client which uses PyOpenSSL X509Reqs and returns X509 certificates. If I ever switch to my own acme client code then yeah, I can most likely go directly to cryptography. |
|
Just as a warning: the acme client doesn't require pyOpenSSL 16.2 (just |
|
Thanks for the heads-up, I'll update my requirements file. |
Talked about this with @bmw today. It seems likely (haven't verified 100%) that we could use |
|
Chopping a dependency would be the primary reason -- the secondary is that as hynek noted we're slowly moving pyOpenSSL to maintenance mode as cryptography takes over its capabilities. That's a long term project though (the primary use case for pyOpenSSL is making TLS connections and cryptography has no interface for that at the present time), so it's entirely reasonable to keep using pyOpenSSL if you'd like. Just be aware that things like EC keys may need some contributions to get working on the pyOpenSSL side (and even if we do add them you'll be forced to upgrade your pyOpenSSL dep to get that feature). |
|
Good to know, thanks. @bmw pointed out that we already take the PyOpenSSL dependency because we depend on |
|
Right. To clarify a bit, we currently unconditionally depend on requests security extras to provide reasonable SSL support for ancient versions of Python. The security extras include PyOpenSSL in newer versions of As more of |
Hi,
Could you please provide an example of using PyOpenssl to create an ECDSA key pair and associated self signed x.509 certificate.
Best Regards,
The text was updated successfully, but these errors were encountered: