ECDSA support #2
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'd like to help out making Acme v2 support not only RSA compatible but also ECDSA.
As per coolaj86/greenlock.js#4
You will find that quit a few places are hard-coded to use RS256:
https://git.coolaj86.com/coolaj86/acme-v2.js/src/branch/master/node.js#L142
Instead they could be handled like this:
And before the
accountKeypair
(ordomainKeypair
) is passed in, this could be done:Then you could start experimenting using ECDSA (ES256), probably using elliptic:
https://github.com/indutny/elliptic (or sepc256k1-node)
Next would be to create an alternate tests/index.js that passes in an object with the same function signatures as the RSA object (don't bother changing the name of it yet), but that is actually doing ECDSA functions.
Then would be to abstract the use of the ECDSA or RSA module based on the user input.
The spec uses 'RS256' and 'ES256', but normal implementations would simply specify the algorithm and then the bitlength of the algo as separate arguments.
So really it should probably look like this at the end:
Hopefully that's enough to get you started. Ask me questions.
Essentially:
First simply copy the interface of the RSA module and "hard code" its substitution.
Then once that's working begin abstracting and the object so that by
type
a simple if statement can pass it into the correct library under-the-hood.It may require more than one library to be able to transition between
jwk
andpem
.I've managed to create the equivalent of your genkeypair.js using ecdsa, including writing it to the system.
I also have the basic structure of a function that returns a JWK in ECDSA format based on params you pass in, still needs a bit of work though. Doing this work in a practice repository for the time being, until I have it working.
https://github.com/travislavery/ecdsa-acme-practice
Going to work on cleaning up the code a bit more tomorrow.
@travislavery We have all of the pieces except for one: signing a CSR. Let's get that done and then I'll spend some more time defining the abstraction for ECDSA and we can wrap it al up.
Here's four examples that I want you to create:
Think you can do that?
Yeah for sure, I'll work on that today.
Hi,
First, i would like to thank you for developing this great lib.
Any update on that? is ECDSA gone be supported in the near future?
Thanks!
The first 90% of the work for ECDSA support is done: https://www.npmjs.com/package/eckles
What remains:
ecCurve
analogous torsaKeySize
in Greenlock / ACME.jsecCurve
is specifiedRSA.*
withEckles.*
@coolaj86 I was able to create a certificate with ECDSA key by manipulating the code and inject a method to the options which create the CSR (base64) as Acme-v2.js do.
Anyway it will be great if you will enable it in the lib (to inject a CSR create function to the options) In that way it's not limiting the usage of the lib and the user can sign the CSR by himself.
Another thing to keep in mind is that letsencrypt still not support signing the certificate with ECDSA. which meeans that the certificate private key will be ECDSA but it will signed with rsa certificate.
This made it into v3.