Skip to content

fix(crypto): generate P-384 operator keys so CryptOS and external CAs accept them - #139

Merged
Bugs5382 merged 1 commit into
mainfrom
fix/138-p384-operator-keys
Sep 30, 2026
Merged

Bugs5382 merged 1 commit into
mainfrom
fix/138-p384-operator-keys

Conversation

@Bugs5382

Copy link
Copy Markdown
Contributor

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 (ValidateSubjectKey in CryptOS-PKI/cryptos internal/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 keyAlg hint on generateLeafKeyAndCSR now reads ECDSA-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 bootstrap identity and the TPM SRK, which this PR doesn't touch. The pages about issuing already say the node certifies P-384 only.

Verification

  • Lint clean
  • Tests pass
  • Build succeeds

How this was verified

  • New test mints a P-384 key and signs the CSR with ECDSA-SHA384 in leaf-key.test.ts checks 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 on main (expected 'P-256' to be 'P-384').
  • New test round-trips a P-384 key through the shrouded key bag in pkcs12.test.ts walks 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 on main the 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.

… 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>
@Bugs5382 Bugs5382 added this to the v0.1.0 milestone Sep 30, 2026
@Bugs5382 Bugs5382 added the bug Something isn't working. label Sep 30, 2026
@Bugs5382 Bugs5382 self-assigned this Sep 30, 2026
@Bugs5382
Bugs5382 marked this pull request as ready for review September 30, 2026 16:17
@github-actions github-actions Bot added the fix Bug fix (fix). Patch. label Sep 30, 2026
@Bugs5382

Copy link
Copy Markdown
Contributor Author

Merging for the v0.1.0 test run: CI green and mergeable at merge time.

@Bugs5382
Bugs5382 merged commit ded9b6e into main Sep 30, 2026
18 checks passed
@Bugs5382
Bugs5382 deleted the fix/138-p384-operator-keys branch September 30, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. fix Bug fix (fix). Patch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(crypto): generate P-384 operator keys so CryptOS and external CAs accept them

1 participant