Repository navigation
feat: add Hybrid KEMs - #67
Conversation
|
JWK import question: There is a note that says: (a) where are the hybrid KEM algorithm registrations defined? https://www.ietf.org/archive/id/draft-irtf-cfrg-concrete-hybrid-kems-03.html#name-iana-considerations doesn't seem to match, and I don't see it in https://datatracker.ietf.org/doc/draft-ietf-lamps-pq-composite-kem/ either (or in https://www.iana.org/assignments/jose/jose.xhtml) (b) is this saying that there may be more than one name for the same Hybrid KEM? |
|
@hubertchao happy to explain the "alg" values come from the proposal's own IANA registration section where we'll register the exact names that correspond for use with JWK only, i.e. in JOSE there isn't actually going to be a JWE "alg" for MLKEM768-X25519. What https://datatracker.ietf.org/doc/draft-skokan-jose-hpke-pq-pqt/ (pending confirmation of adoption, only positive signals on the JOSE WG mailing list) will register are JWE "alg" values that will end up using these hybrid KEMs, due to reasons? the convention set out by https://datatracker.ietf.org/doc/draft-ietf-jose-hpke-encrypt/ the HPKE specific alg names are non-descriptive e.g. So, the modern algorithms draft (or webcrypto-actual after merge) will register JWK use
This was my way of attempting to let implementers know that e.g. To be honest because the https://datatracker.ietf.org/doc/draft-skokan-jose-hpke-pq-pqt/ defines the JWK serialization for its keys as just direct callouts to HPKE's SerializePublicKey and SerializePrivateKey which correspond with raw-public and raw-seed I don't necessarily believe we need JWK for these hybrids. But then I recall a conversation with @twiss about the usefulness of JWK/pkcs8/spki in wrapKey/unwrapKey because the wrapped key in a jwk/pkcs8/spki format cannot be unwrapped to another algorithm (due to either "alg" binding or an X509 OID). I have yet to see actual use of wrapKey/unwrapKey ever but will leave this to @twiss to chime in on. For now based on the feedback from @davidben that also happens to align with my view i'm removing spki from the PR. I've gathered the spki/pkcs8 discovery i did in a collapsible section in the PR description. |
Implements importKey and exportKey using the JWK format, based on spec PR in WICG/webcrypto-modern-algos#67. Add unit tests for now, which can be deleted once the PR is merged in and WPTs are added web-platform-tests/wpt#59947 Change-Id: I856ae991432c99612cf7b5d9198dba81fccf1e7b Bug: 510170714 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7887900 Reviewed-by: David Benjamin <davidben@chromium.org> Commit-Queue: Hubert Chao <hchao@chromium.org> Cr-Commit-Position: refs/heads/main@{#1645466}
|
This is part of the Chrome 151 to 154 Origin Trials. |
Refs: WICG/webcrypto-modern-algos#67 Refs: https://developer.chrome.com/origintrials/#/view_trial/1379790335835635713 Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Refs: WICG/webcrypto-modern-algos#67 Refs: https://developer.chrome.com/origintrials/#/view_trial/1379790335835635713 Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Add MLKEM768-P256, MLKEM768-X25519, and MLKEM1024-P384 with key generation, raw and JWK import/export, and encapsulation and decapsulation support. Refs: WICG/webcrypto-modern-algos#67 Refs: https://developer.chrome.com/origintrials/#/view_trial/1379790335835635713 Refs: https://chromestatus.com/feature/5198951632470016
SHA: 2ff1a92 Reason: push, by twiss Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
I had this lying around since March, gave it a rebase and updated references. I'm opening this as a draft PR to accomodate a discussion (and to get a preview link).
Proposes to add 3 Hybrid KEMs (per https://www.ietf.org/archive/id/draft-irtf-cfrg-concrete-hybrid-kems-03.html) as Web Cryptography algorithms. These three KEMs are exactly what HPKE-PQ uses.
Yanked SPKI / PKCS#8 discovery
SPKI import/export is specified using the Composite ML-KEM OIDs from draft-ietf-lamps-pq-composite-kem:
MLKEM768-X25519->id-MLKEM768-X25519-SHA3-256(1.3.6.1.5.5.7.6.58)MLKEM768-P256->id-MLKEM768-ECDH-P256-SHA3-256(1.3.6.1.5.5.7.6.59)MLKEM1024-P384->id-MLKEM1024-ECDH-P384-SHA3-256(1.3.6.1.5.5.7.6.63)PKCS#8 is kept as an issue in the proposal for now. LAMPS encodes
OneAsymmetricKey.privateKeyasmlkemSeed || tradSK, while this draft'sraw-seedand JWK private-key forms use the 32-byte seed from the CFRG Hybrid KEMDeriveKeyPairflow. Seed-backed keys should be able to export PKCS#8 if the implementation can derive and serialize the component private keys. PKCS#8-imported keys can be usable for decapsulation and PKCS#8 re-export, but cannot be exported asraw-seedor JWK unless the original 32-byte seed is also available. The proposal calls out whetherpkcs8import should requireextractableto befalse, or whether seed-based export formats should fail for non-seed-backed keys.Additionaly,
raw-privateexport/import in the LAMPSmlkemSeed || tradSKdefinition might be an option to support in addition toraw-seed.raw-seedmust remain as-is to support HPKE-PQ.I'm not married to either pkcs8, spki, or raw-private. But i at least did the due diligence for the proposal. Happy to adjust based on feedback.
WPTs: web-platform-tests/wpt#59947
Preview | Diff