@blamejs/pki 0.4.6 → 0.4.7
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.
- package/CHANGELOG.md +9 -0
- package/lib/schema-c509.js +14 -7
- package/lib/schema-pkix.js +9 -3
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to `@blamejs/pki` are documented here. The format
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## v0.4.7 — 2026-08-08
|
|
8
|
+
|
|
9
|
+
One certificate now renders one distinguished-name string whichever parser read it -- a C509 certificate's subject and issuer strings joined their components without the separating space every other parser in the toolkit uses.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- A C509 certificate's subject and issuer strings now use the same spelling as every other parser in the toolkit -- components separated by a comma and a space, which is what openssl prints for the same certificate. Previously the C509 parser omitted the space, so one certificate had two different rendered names depending on the parser that read it, and code comparing or logging them saw a difference where there was none. The two renderers are now checked against each other on a multi-component name, so the divergence cannot return.
|
|
14
|
+
- Where these strings are built now states what they are: a display form listing the components in the certificate's own order, escaped so that a comma inside a value cannot read as a separator between components. It is not an LDAP distinguished name, which reverses the component order and omits the space, and must not be passed to a directory client as one. Name comparison never used these strings and still does not.
|
|
15
|
+
|
|
7
16
|
## v0.4.6 — 2026-08-08
|
|
8
17
|
|
|
9
18
|
A C509 certificate now has one encoding where the specification defines one -- nine alternative spellings that rebuilt a byte-identical X.509 certificate, so that a single signature covered all of them, are refused, and the encoder emits the spelling it accepts.
|
package/lib/schema-c509.js
CHANGED
|
@@ -365,13 +365,20 @@ function _name509(node, isSubject, isNative) {
|
|
|
365
365
|
if (!isNative && rdns.length === 1 && rdns[0].type === "commonName" && !rdns[0].printable) {
|
|
366
366
|
throw _err("c509/bad-name", "a Name holding a single +1 commonName must be encoded as a bare SpecialText, not an array (draft sec. 3.1.4)");
|
|
367
367
|
}
|
|
368
|
-
return { rdns: rdns, dn: parts.join(",") };
|
|
369
|
-
}
|
|
370
|
-
// The rendered dn
|
|
371
|
-
//
|
|
372
|
-
//
|
|
373
|
-
//
|
|
374
|
-
|
|
368
|
+
return { rdns: rdns, dn: parts.join(", ") };
|
|
369
|
+
}
|
|
370
|
+
// The rendered dn uses the SAME spelling as every other name renderer here (schema-pkix): the RDNs in
|
|
371
|
+
// certificate order joined by ", ", which is what `openssl x509 -subject` prints -- so one certificate
|
|
372
|
+
// has one dn string whichever parser read it, and the interop gate can pin both against openssl. It is
|
|
373
|
+
// deliberately not the RFC 4514 / LDAP distinguishedName (which reverses the RDNs and drops the space).
|
|
374
|
+
// What IS taken from RFC 4514 is sec. 2.4 value escaping, through the shared guard: raw concatenation
|
|
375
|
+
// would let a single attribute whose value contains a comma render identically to a genuine multi-RDN
|
|
376
|
+
// name (a spoofable identity string, and the ONLY name surface a natively signed certificate has, since
|
|
377
|
+
// it never reconstructs DER), and would carry control bytes into logs.
|
|
378
|
+
// The SAME label table schema-pkix renders with (pki.C.NAMES.DN_SHORT), not a local list: a hand-rolled
|
|
379
|
+
// one covers whichever attributes it was written for and silently renders the rest by their long name,
|
|
380
|
+
// so the same certificate would still read differently depending on which parser produced the string.
|
|
381
|
+
function _shortName(n) { return (n && constants.NAMES.DN_SHORT[n]) || n; }
|
|
375
382
|
|
|
376
383
|
// ---- compact per-extension value codec (draft-20 sec. 3.3) -------------------
|
|
377
384
|
// Each registered extension in EXT_COMPACT has a specific CBOR encoding of its value that is invertible
|
package/lib/schema-pkix.js
CHANGED
|
@@ -455,9 +455,15 @@ function name(ns, opts) {
|
|
|
455
455
|
rdns.push(atvs);
|
|
456
456
|
parts.push(atvParts.join("+"));
|
|
457
457
|
});
|
|
458
|
-
// `
|
|
459
|
-
//
|
|
460
|
-
//
|
|
458
|
+
// `dn` is a DISPLAY string, and its spelling is `openssl x509 -subject`: the RDNs in the
|
|
459
|
+
// certificate's own order, joined by ", ". That is deliberately NOT the RFC 4514 / LDAP
|
|
460
|
+
// distinguishedName, which reverses the RDNs and joins them with a bare comma (`openssl -nameopt
|
|
461
|
+
// RFC2253`) -- so this string must never be handed to an LDAP client. What IS taken from RFC 4514
|
|
462
|
+
// is sec. 2.4 value escaping, so an attribute value holding a comma cannot read as two RDNs. The
|
|
463
|
+
// interop gate pins this against openssl's own output. Identity never flows through this string:
|
|
464
|
+
// guard.name.dnEqual compares the DER under RFC 5280 sec. 7.1, and `bytes` below carries the raw
|
|
465
|
+
// Name DER for a consumer that needs the exact octets (the EST re-enroll subject MUST). Every
|
|
466
|
+
// renderer in the toolkit uses this one spelling, so a certificate has one dn whichever parsed it.
|
|
461
467
|
return { rdns: rdns, dn: parts.join(", "), bytes: opts.implicitTag != null ? asn1.sequenceTlv(m.node) : m.node.bytes };
|
|
462
468
|
}
|
|
463
469
|
if (opts.implicitTag != null) {
|
package/package.json
CHANGED
package/sbom.cdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.5",
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:a7694ebc-a9fb-440b-ac11-b024d67aae76",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-08-08T20:12
|
|
8
|
+
"timestamp": "2026-08-08T20:51:12.787Z",
|
|
9
9
|
"lifecycles": [
|
|
10
10
|
{
|
|
11
11
|
"phase": "build"
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"component": {
|
|
22
|
-
"bom-ref": "@blamejs/pki@0.4.
|
|
22
|
+
"bom-ref": "@blamejs/pki@0.4.7",
|
|
23
23
|
"type": "application",
|
|
24
24
|
"name": "pki",
|
|
25
|
-
"version": "0.4.
|
|
25
|
+
"version": "0.4.7",
|
|
26
26
|
"scope": "required",
|
|
27
27
|
"author": "blamejs contributors",
|
|
28
28
|
"description": "Pure-JavaScript PKI toolkit that owns its stack — X.509, ASN.1/DER, CMS, PQC-first.",
|
|
29
|
-
"purl": "pkg:npm/%40blamejs/pki@0.4.
|
|
29
|
+
"purl": "pkg:npm/%40blamejs/pki@0.4.7",
|
|
30
30
|
"properties": [],
|
|
31
31
|
"externalReferences": [
|
|
32
32
|
{
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"components": [],
|
|
55
55
|
"dependencies": [
|
|
56
56
|
{
|
|
57
|
-
"ref": "@blamejs/pki@0.4.
|
|
57
|
+
"ref": "@blamejs/pki@0.4.7",
|
|
58
58
|
"dependsOn": []
|
|
59
59
|
}
|
|
60
60
|
]
|