Repository navigation
fix(crypto): generate P-384 operator keys so CryptOS and external CAs accept them - #139
Merged
Merged
Conversation
… accept them The browser minted ECDSA P-256 keys and signed the CSR with ECDSA-SHA256. A CryptOS node certifies ECDSA subject keys on P-384 only, so the operator credential dialog and browser-generated leaf requests were refused, and the external CAs used for operator credentials expect P-384 as well. Generate P-384 keys and sign the CSR with ECDSA-SHA384. Add a test that the generated key and CSR are P-384 / ECDSA-SHA384, and one that a P-384 key survives the PKCS#12 shrouded key bag intact. Closes #138 Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
Contributor
Author
|
Merging for the v0.1.0 test run: CI green and mergeable at merge time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The browser minted ECDSA P-256 keys and signed the CSR with ECDSA-SHA256 (
src/lib/crypto/leaf-key.ts). A CryptOS node certifies ECDSA subject keys on P-384 only (ValidateSubjectKeyin CryptOS-PKI/cryptosinternal/ca/profile.go), so the "Issue operator" dialog was refused, and so was a leaf issued from the certificate form with "Generate a key here". The external CAs the operator-credential design is moving to expect P-384 as well.This PR generates P-384 keys and signs the CSR with ECDSA-SHA384. The
keyAlghint ongenerateLeafKeyAndCSRnow readsECDSA-P384; no caller passes it. The PKCS#12 and encrypted-PKCS#8 envelopes don't depend on the curve (PBES2 over the PKCS#8 bytes), so they're unchanged.Closes #138
No docs change: the docs site never names the curve of browser-generated keys. Its P-256 mentions describe the
cryptosctl bootstrapidentity and the TPM SRK, which this PR doesn't touch. The pages about issuing already say the node certifies P-384 only.Verification
How this was verified
mints a P-384 key and signs the CSR with ECDSA-SHA384inleaf-key.test.tschecks the private key's curve, the CSR's public-key curve, and that the CSR signature algorithm is ECDSA with SHA-384 and verifies. It failed onmain(expected 'P-256' to be 'P-384').round-trips a P-384 key through the shrouded key baginpkcs12.test.tswalks the PFX, decrypts the PBES2 shrouded key bag, checks the PKCS#8 matches the original key byte for byte, and imports it as ECDSA P-384. It failed onmainthe same way. The existing PKCS#12 tests pass unchanged with the P-384 key.npm ci --ignore-scripts && npm run lint && npm test && npm run build: lint and Prettier clean, 79 files and 375 tests pass, build succeeds.