Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
tniessen
left a comment
There was a problem hiding this comment.
Code itself LGTM, but I don't really trust my understanding of JWK enough to judge whether this is opening a new can of worms. (And yes, I've read most of the WebCrypto and JWK specs multiple times.)
commented
Jan 26, 2021
@tniessen Anything I can do to help you disperse this particular trust issue? |
This comment has been minimized.
This comment has been minimized.
commented
Jan 27, 2021
left a comment
•
There was a problem hiding this comment.
The errors in errors.md are in alphabetical order so before this lands, the names need to be determined and then they need to be moved to the right place in the file. Once that's happened, feel free to clear this request for changes. No need to ping me on it or anything. Just leaving this here to make sure it happens before the code lands.
commented
Jan 31, 2021
|
I also wonder if we want to avoid creating additional error codes and use something fairly generic like the existing |
I've kept the specific errors here since i couldn't come up with a generic one. As far as future import feature comes in, these two will be re-used. I will keep the amount of specific error codes to the minimum based on this feedback though. |
This comment has been minimized.
This comment has been minimized.
feedback applied, @Trott said "feel free to clear this request for changes"
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
left a comment
There was a problem hiding this comment.
I still have my doubts about the integration of WebCrypto/JWK into the crypto module, but that might just be because I spent far too much time on core crypto and not enough time on web crypto standards. It's an incredibly complicated topic.
KeyObjects ignore some JWK properties, e.g., key usages. And that's by design, that's not what KeyObjects are for. But it also means that importing and then exporting a JWK means it loses those additional JWK properties.
ASN.1 remains the most relevant and popular format for public and private keys. I designed the KeyObject class and many other crypto APIs in core, but I cannot fully estimate the impact of the addition of web crypto standards on them. I am fine with these additions as long as they don't get in the way of ASN.1 import and export capabilities, or the mapping of asymmetricKeyType to EVP_PKEY_* in OpenSSL. If JWK key types and EVP_PKEY_* key types ever start diverging, we might be in serious trouble.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Adds [JWK](https://tools.ietf.org/html/rfc7517) keyObject.export format option. Supported key types: `ec`, `rsa`, `ed25519`, `ed448`, `x25519`, `x448`, and symmetric keys, resulting in JWK `kty` (Key Type) values `EC`, `RSA`, `OKP`, and `oct`. `rsa-pss` is not supported since the JWK format does not support PSS Parameters. `EC` JWK curves supported are `P-256`, `secp256k1`, `P-384`, and `P-521`
Co-authored-by: James M Snell <jasnell@gmail.com>
641de23 to
a6d1e96
Compare
This comment has been minimized.
This comment has been minimized.
commented
Feb 2, 2021
commented
Feb 2, 2021
|
Landed in a8d7de1 |
Adds JWK keyObject.export format option.
ec,rsa,ed25519,ed448,x25519,x448, and symmetric keys, resulting in JWKkty(Key Type) valuesEC,RSA,OKP, andoct.rsa-pssis not supported since the JWK format does not support PSS Parameters.ECJWK curves supported areP-256,secp256k1,P-384, andP-521cc @nodejs/crypto