@blamejs/pki 0.4.14 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/MIGRATING.md +2 -2
  3. package/README.md +142 -137
  4. package/index.js +4 -0
  5. package/lib/acme.js +73 -1
  6. package/lib/asn1-der.js +2 -0
  7. package/lib/attrcert-sign.js +4 -0
  8. package/lib/cbor-det.js +32 -16
  9. package/lib/cmc-build.js +880 -0
  10. package/lib/cmc-verify.js +657 -0
  11. package/lib/cmp-build.js +8 -7
  12. package/lib/cmp-verify.js +11 -1
  13. package/lib/cms-sign.js +170 -8
  14. package/lib/cms-verify.js +80 -14
  15. package/lib/crl-sign.js +22 -0
  16. package/lib/crmf-sign.js +5 -2
  17. package/lib/csr-sign.js +3 -0
  18. package/lib/ct.js +72 -0
  19. package/lib/est.js +828 -32
  20. package/lib/framework-error.js +13 -0
  21. package/lib/guard-bytes.js +37 -1
  22. package/lib/guard-range.js +23 -1
  23. package/lib/http-transport.js +9 -3
  24. package/lib/inspect.js +28 -5
  25. package/lib/jose.js +15 -0
  26. package/lib/lint.js +4 -0
  27. package/lib/merkle.js +5 -5
  28. package/lib/ocsp.js +139 -11
  29. package/lib/oid.js +69 -1
  30. package/lib/path-validate.js +438 -100
  31. package/lib/pkcs12-build.js +12 -0
  32. package/lib/schema-all.js +19 -1
  33. package/lib/schema-attrcert.js +27 -0
  34. package/lib/schema-c509.js +6 -0
  35. package/lib/schema-cmc.js +791 -0
  36. package/lib/schema-cmp.js +25 -0
  37. package/lib/schema-cms.js +17 -1
  38. package/lib/schema-crl.js +23 -1
  39. package/lib/schema-crmf.js +13 -0
  40. package/lib/schema-csr.js +11 -0
  41. package/lib/schema-csrattrs.js +6 -0
  42. package/lib/schema-engine.js +6 -2
  43. package/lib/schema-ocsp.js +41 -0
  44. package/lib/schema-pkcs12.js +16 -0
  45. package/lib/schema-pkcs8.js +8 -0
  46. package/lib/schema-pkix.js +6 -0
  47. package/lib/schema-smime.js +4 -4
  48. package/lib/schema-tsp.js +32 -1
  49. package/lib/schema-x509.js +14 -1
  50. package/lib/shbs.js +12 -4
  51. package/lib/sigstore.js +4 -0
  52. package/lib/smime.js +28 -7
  53. package/lib/tls-cert-compress.js +15 -3
  54. package/lib/trust.js +27 -4
  55. package/lib/tsp-sign.js +41 -6
  56. package/lib/vendor/README.md +19 -19
  57. package/lib/webauthn.js +895 -26
  58. package/lib/x509-sign.js +3 -0
  59. package/package.json +1 -1
  60. package/sbom.cdx.json +6 -6
package/lib/oid.js CHANGED
@@ -132,7 +132,65 @@ var FAMILIES = {
132
132
  // name->OID reverse stays unambiguous next to the id-kp "timeStamping" purpose (a distinct arc).
133
133
  adAccess: { base: [1, 3, 6, 1, 5, 5, 7, 48], of: { ocsp: 1, caIssuers: 2,
134
134
  "id-ad-timeStamping": 3, "id-ad-caRepository": 5, "id-ad-rpkiManifest": 10,
135
- "id-ad-signedObject": 11, "id-ad-rpkiNotify": 13 } },
135
+ "id-ad-signedObject": 11, "id-ad-rpkiNotify": 13, "id-ad-cmc": 12 } },
136
+
137
+ // CMC control attributes -- id-cmc ::= {id-pkix 7} (RFC 5272 sec. 6, extended by RFC 6402
138
+ // sec. 2.2/2.8). The whole registry is declared, not just the controls used today: a control
139
+ // this side does not act on must still be RECOGNIZED to be reported by name, and a decoder that
140
+ // meets an unknown OID cannot tell "control this build ignores" from "attacker-supplied filler".
141
+ //
142
+ // The gaps are the specification's own: 12/13/14 (identityProof/popLinkRandom/popLinkWitness's
143
+ // superseded siblings are retained below where RFC 6402 kept them) and 20 are unassigned in
144
+ // RFC 5272 Appendix A. V2 forms exist because RFC 6402 replaced the originals to fix a hash
145
+ // agility gap -- BOTH are registered, since a v1 message is still legal to receive.
146
+ idCmc: { base: [1, 3, 6, 1, 5, 5, 7, 7], of: {
147
+ "id-cmc-statusInfo": 1, "id-cmc-identification": 2, "id-cmc-identityProof": 3,
148
+ "id-cmc-dataReturn": 4, "id-cmc-transactionId": 5, "id-cmc-senderNonce": 6,
149
+ "id-cmc-recipientNonce": 7, "id-cmc-addExtensions": 8, "id-cmc-encryptedPOP": 9,
150
+ "id-cmc-decryptedPOP": 10, "id-cmc-lraPOPWitness": 11,
151
+ "id-cmc-getCert": 15, "id-cmc-getCRL": 16, "id-cmc-revokeRequest": 17,
152
+ "id-cmc-regInfo": 18, "id-cmc-responseInfo": 19,
153
+ "id-cmc-queryPending": 21, "id-cmc-popLinkRandom": 22, "id-cmc-popLinkWitness": 23,
154
+ "id-cmc-confirmCertAcceptance": 24, "id-cmc-statusInfoV2": 25, "id-cmc-trustedAnchors": 26,
155
+ "id-cmc-authData": 27, "id-cmc-batchRequests": 28, "id-cmc-batchResponses": 29,
156
+ "id-cmc-publishCert": 30, "id-cmc-modCertTemplate": 31, "id-cmc-controlProcessed": 32,
157
+ // ---------------------------------------------------------------------
158
+ // 33 / 34 -- the specification assigns these two OIDs BOTH ways, and no
159
+ // erratum resolves it. Counted across every place either document states an
160
+ // assignment, it is not an even split:
161
+ //
162
+ // identityProofV2 = 34, popLinkWitnessV2 = 33
163
+ // rfc5272.txt:1494 / :1504 the sec. 6 control summary table
164
+ // rfc5272.txt:1846 sec. 6.2.1 body
165
+ // rfc5272.txt:2037 sec. 6.3.1.1 body
166
+ // rfc5272.txt:4041 / :4049 RFC 5272's own ASN.1 module
167
+ // rfc6402.txt:1228 / :1245 RFC 6402 Appendix A.1 (1988 module)
168
+ //
169
+ // identityProofV2 = 33, popLinkWitnessV2 = 34
170
+ // rfc6402.txt:1938 / :1949 RFC 6402 Appendix A.2 (2008 module) ONLY
171
+ //
172
+ // The rows below therefore follow the base specification's normative body
173
+ // text and its module, which RFC 6402's own 1988 module agrees with. The
174
+ // 2008 module is the lone outlier and is treated as its typo.
175
+ //
176
+ // This binds what the toolkit EMITS, and it is load-bearing because the two
177
+ // controls cannot be told apart by SHAPE: both are SEQUENCE {
178
+ // AlgorithmIdentifier, AlgorithmIdentifier, OCTET STRING } (rfc6402.txt:1238,
179
+ // :1246), so the OID is the only discriminator. Emitting the A.2 reading
180
+ // would hand a peer built on RFC 5272 an Identity Proof it reads as a POP
181
+ // Link Witness. A CONSUMER must still not infer meaning from these names
182
+ // alone -- a peer built against A.2 means the other one, and nothing on the
183
+ // wire says which module it read.
184
+ "id-cmc-identityProofV2": 34, "id-cmc-popLinkWitnessV2": 33,
185
+ "id-cmc-raIdentityWitness": 35, "id-cmc-changeSubjectName": 36, "id-cmc-responseBody": 37,
186
+ } },
187
+
188
+ // CMC content types -- id-cct ::= {id-pkix 12} (RFC 5272 Appendix A). The eContentType a CMC
189
+ // message rides under inside its CMS SignedData wrapper. RFC 5272 Appendix B repeatedly writes
190
+ // "id-ct-PKIData"; that is erratum 4775 (Verified) and the correct prefix is id-cct-.
191
+ idCct: { base: [1, 3, 6, 1, 5, 5, 7, 12], of: {
192
+ "id-cct-PKIData": 2, "id-cct-PKIResponse": 3,
193
+ } },
136
194
 
137
195
  // id-on -- RFC 5280 sec. 4.2.1.6 otherName type-ids the C509 sec. 8.13 registry gives their own
138
196
  // negative ints: id-on-hardwareModuleName (RFC 4108), id-on-SmtpUTF8Mailbox (RFC 9598),
@@ -312,6 +370,11 @@ var FAMILIES = {
312
370
  // identifiers (RFC 9802 sec. 4). HSS/LMS additionally has the SMIME
313
371
  // id-alg-hss-lms-hashsig OID above (RFC 9708 / RFC 9802 share it).
314
372
  pkixAlg: { base: [1, 3, 6, 1, 5, 5, 7, 6], of: {
373
+ // id-alg-noSignature (RFC 6402 sec. 2.4, {id-pkix id-alg(6) 2}): the CMC
374
+ // "signature" algorithm for a request whose signer has no key yet -- the
375
+ // SignerInfo carries a MAC-based proof instead. Registered so a decoder can
376
+ // NAME it and refuse it deliberately, rather than meeting an unknown OID.
377
+ "id-alg-noSignature": 2,
315
378
  "id-alg-xmss-hashsig": 34, "id-alg-xmssmt-hashsig": 35,
316
379
  // Composite ML-DSA signature algorithms (draft-ietf-lamps-pq-composite-sigs
317
380
  // sec. 6): a PQ ML-DSA paired with a traditional RSA / ECDSA / EdDSA so the
@@ -348,6 +411,11 @@ var FAMILIES = {
348
411
  receiptRequest: 1, eSSSecurityLabel: 2, mlExpansionHistory: 3, contentHints: 4,
349
412
  msgSigDigest: 5, contentIdentifier: 7, equivalentLabels: 9, contentReference: 10,
350
413
  signingCertificate: 12, timeStampToken: 14, decryptKeyID: 37, signingCertificateV2: 47,
414
+ // id-aa-cmc-unsignedData (RFC 6402 sec. 2.7, {id-aa 34}): the CMC unsigned
415
+ // attribute that carries body parts too large to sit inside the signed
416
+ // PKIData -- unsigned by design, so a consumer must treat its contents as
417
+ // untrusted data rather than as part of the authenticated message.
418
+ cmcUnsignedData: 34,
351
419
  asymmDecryptKeyID: 54, certificationRequestInfoTemplate: 61, extensionReqTemplate: 62 } },
352
420
 
353
421
  // ANSI X9.62 EC public key, named curve, and ECDSA signatures.