@blamejs/pki 0.7.30 → 0.7.31
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 +17 -0
- package/README.md +1 -1
- package/lib/hpke.js +192 -72
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ 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.7.31 — 2026-09-12
|
|
8
|
+
|
|
9
|
+
HPKE encrypts to an ML-KEM public key.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- pki.hpke.suites.KEM.ML_KEM_512, ML_KEM_768 and ML_KEM_1024 (0x0040, 0x0041, 0x0042). The HPKE binding is FIPS 203 encapsulation and decapsulation with the 32-byte ML-KEM shared secret as the HPKE shared secret and the 64-byte seed as the private key. setupS and seal take the recipient's encapsulation key as raw bytes, as { pkm }, or as a node:crypto KeyObject; setupR and open take { skm } holding the seed, with pkm optional, or a KeyObject. The base and psk modes and every KDF and AEAD apply; the auth and auth-psk modes, which the ML-KEM KEMs do not define (draft-ietf-hpke-pq sec. 7.2), are refused with hpke/auth-unsupported at both ends. An encapsulation key that fails the FIPS 203 sec. 7.2 check (length or a coefficient at or above q) is refused at import, and an encapsulated key of the wrong length is refused before decapsulation, each as hpke/bad-key. The recipient side of the draft's A.1, A.2 and A.3 vectors (ML-KEM-512 and -768 with HKDF-SHA256, ML-KEM-1024 with HKDF-SHA384) is a full known answer: the vector's encapsulated key decapsulated under its seed, all ten decryptions and all five exports. The sender side is proven by round trip: node:crypto takes no encapsulation randomness, so a fixed ephemeral (opts.eph) is refused on an ML-KEM suite with hpke/bad-input rather than ignored.
|
|
14
|
+
- pki.hpke.suites.KDF.HKDF_SHA384 (0x0002), for any KEM. The draft-ietf-hpke-pq A.3 vector proves it in the key schedule. DHKEM(P-384) stays unoffered: no known-answer vector pairs it with an HKDF key schedule.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- A serialized HPKE private key, { skm, pkm } on setupR, open, opts.eph and opts.senderKey, passes one door for every suite. skm must be a Buffer of exactly the suite's private-key length, an EC scalar additionally in [1, n-1]; the public key is derived from it; and pkm, now optional, must equal that derivation when given. Before this a DHKEM recipient given { skm } alone escaped as a raw TypeError, and a pkm of the wrong length or of another key was fed into the KEM context unchecked, producing a context that could open nothing. A node:crypto KeyObject is checked against the suite's curve or ML-KEM parameter set, and a public KeyObject where a private one is due is refused rather than tried; each refusal is hpke/bad-key naming what was checked.
|
|
19
|
+
- opts.senderKey on setupS and opts.senderPublicKey on setupR are refused with hpke/bad-input in the base and psk modes, where they were previously left unused: a caller who supplied one without mode auth or auth-psk was not authenticating the exchange. A value of undefined or null is still absent. opts.eph is { skm, pkm } or absent (undefined or null); another value, such as 0 or an empty string, is refused with hpke/bad-input instead of being read as absent.
|
|
20
|
+
- pki.hpke.setupS and setupR read each option once, at entry, into a snapshot. mode was read at the default and again at the use, so an option supplied through an accessor could answer auth to the first read and base to the second and get an unauthenticated setup; senderKey was read at its presence check and again at import.
|
|
21
|
+
- The HKDF expand step wipes every block it computed when a later block's HMAC fails, as it already did on the succeeding path. A private KeyObject handed where a public key is due (the recipient key on setupS and seal, senderPublicKey on setupR) now has its public half taken before export, so no JWK carrying the private scalar is produced.
|
|
22
|
+
- The fuzz target for the HPKE recipient path decapsulates under an ML-KEM-768 seed as well as an X25519 key, and selects HKDF-SHA384 among the KDFs.
|
|
23
|
+
|
|
7
24
|
## v0.7.30 — 2026-09-12
|
|
8
25
|
|
|
9
26
|
The Sigstore bundle verifier decides with operations bound when the module loads.
|
package/README.md
CHANGED
|
@@ -247,7 +247,7 @@ comment blocks, is at [pkijs.com](https://pkijs.com).
|
|
|
247
247
|
| `pki.merkle` | Merkle-tree proof verification (RFC 6962 / RFC 9162). `leafHash`, `nodeHash`, and `emptyRootHash` build the domain-separated (0x00 leaf, 0x01 node) SHA-256 tree hashes. `verifyInclusion` folds an audit proof back to a root, and `verifyConsistency` reconstructs both the old and new root, which is the append-only guarantee; each is constant-time-compared to a trusted checkpoint root. Fail-closed on bad geometry, sync hashing, transport-free — `leafHash`, `nodeHash`, `emptyRootHash`, `verifyInclusion`, `verifyConsistency` |
|
|
248
248
|
| `pki.trust` | Mozilla and CCADB trust-store ingestion. `parseCertdata` reads the NSS `certdata.txt` object stream and `parseCcadbCsv` the CCADB CSV export, both into one constraint-carrying anchor shape: the per-purpose trust bits, where only `CKT_NSS_TRUSTED_DELEGATOR` grants, and the per-purpose distrust-after dates the bare root list omits. Certificate and trust objects pair by byte-exact issuer and serial rather than adjacency and are cross-checked against the parsed DER, so metadata cannot attach to the wrong root. `anchor()` hands an entry to `pki.path.validate({ trustAnchors, checkPurpose })`, and `anchor(entry, { nameConstraints })` attaches the namespace a root program trusts a root for when that is narrower than the root certificate states, a `{ permitted, excluded }` pair of `{ tag, base }` subtrees that `validate` seeds as the RFC 5280 §6.1.1(h)(i) initial value, intersecting with each certificate's own constraints. Offline, fail-closed, bounded — `parseCertdata`, `parseCcadbCsv`, `anchor` |
|
|
249
249
|
| `pki.shbs` | Stateful hash-based signature verification: HSS/LMS (RFC 8554), carried in X.509 by RFC 9802 and in CMS by RFC 9708, profiled by NIST SP 800-208 for CNSA 2.0 firmware signing. `verify` checks an HSS signature, where every level must pass, and `verifyLms` a single-tree LMS, over the raw public-key and signature blobs the parsers already surface. Pure public-input SHA-256 and SHAKE256 hashing, a data-driven typecode registry, and bounds-before-slice reads; a malformed blob throws a typed `ShbsError` while a well-formed but wrong signature returns `false`. Verification only by design, since stateful signing needs atomic one-time-key state that belongs in an HSM. `pki.path.validate` verifies an HSS-signed certificate on its own, so a chain reaching one needs no separate call: the signature covers the whole tbsCertificate rather than a digest of it (RFC 9802 §7.1), and a CertificateList naming the algorithm takes the same route. It is proven against the self-signed certificate RFC 9802 Appendix A publishes — `verify`, `verifyLms` |
|
|
250
|
-
| `pki.hpke` | Hybrid Public Key Encryption (RFC 9180), the encrypt-to-a-public-key primitive behind TLS ECH, MLS, and OHTTP. `setupS` and `setupR` establish a sender or recipient context (KEM encapsulation plus the HKDF key schedule); the context's `seal` and `open` AEAD-encrypt with a sequence-counter nonce, and `export` derives further secrets; the module-level `seal` and `open` are single-shot wrappers. DHKEM (P-256, P-521, X25519, X448)
|
|
250
|
+
| `pki.hpke` | Hybrid Public Key Encryption (RFC 9180), the encrypt-to-a-public-key primitive behind TLS ECH, MLS, and OHTTP. `setupS` and `setupR` establish a sender or recipient context (KEM encapsulation plus the HKDF key schedule); the context's `seal` and `open` AEAD-encrypt with a sequence-counter nonce, and `export` derives further secrets; the module-level `seal` and `open` are single-shot wrappers. DHKEM (P-256, P-521, X25519, X448) in all four modes, proven against the RFC 9180 Appendix A vectors, and the post-quantum ML-KEM-512/768/1024 KEMs (IANA 0x0040 to 0x0042) in the base and psk modes, proven against the draft-ietf-hpke-pq Appendix A vectors; HKDF-SHA256/SHA384/SHA512 by AES-GCM / ChaCha20Poly1305 / export-only. DHKEM(P-384) has no vector under an HKDF key schedule and fails closed. Pure composition over `node:crypto`; the PQ/T hybrid KEMs are a registry data-row extension once the CFRG combiner draft stabilizes — `suites`, `setupS`, `setupR`, `seal`, `open` |
|
|
251
251
|
| `pki.kem` | Composite ML-KEM key establishment (draft-ietf-lamps-pq-composite-kem), a post-quantum ML-KEM hybridized with a traditional RSA-OAEP, ECDH, X25519, or X448 so the established secret holds if either component is later broken. `encapsulate` turns a recipient's composite `SubjectPublicKeyInfo` into a 256-bit shared secret and a ciphertext; `decapsulate` recovers the same secret from the ciphertext and the composite PKCS#8 private key. Each component KEM runs independently and the two secrets are mixed through a SHA3-256 combiner that binds the traditional ciphertext, the traditional public key, and a per-algorithm label. The twelve algorithms pair ML-KEM-768 and ML-KEM-1024 with RSA-OAEP 2048/3072/4096, ECDH over P-256/P-384/P-521 and brainpoolP256r1/P384r1, X25519, and X448, each verified against the draft Appendix G known-answer vectors; a malformed key or ciphertext, an unsupported algorithm, or a component decapsulation failure throws a typed `KemError` — `encapsulate`, `decapsulate` |
|
|
252
252
|
| `pki.sigstore` | Offline verifier for a Sigstore bundle, the artifact `npm publish --provenance` produces and the registry serves. `verifyBundle` composes five fail-closed legs against caller-pinned trust (Fulcio CA roots and Rekor log keys, never trusted from the bundle): the DSSE signature over its PAE preimage under the Fulcio leaf key, the ephemeral Fulcio certificate chain validated as of the Rekor log time, the RFC 9162 inclusion proof folded to a Rekor-signed tree root, the log entry bound to this exact signature, and the in-toto SLSA subject digest the caller confirms against the published artifact. It reuses the X.509 parser, the RFC 5280 path validator, and the Merkle verifier; the net-new codecs are the DSSE PAE byte-builder and a fail-closed JSON reader. `verified: true` says the artifact was signed and logged, not that a party you trust signed it — Fulcio issues to anyone who completes an OIDC flow, so who signed is decided only by `opts.identity`, and `identityChecked` reports which of its fields were compared. An identity policy naming no field, or a field name that is not one of the three, is refused rather than satisfied — either would accept every signer while reading as a policy in force. A sixth leg is opt-in: pinning the certificate-transparency logs in `opts.ctLogs` checks the receipt Fulcio embeds in the certificate it issues (RFC 6962 §3.2), verified over the certificate as it stood before the receipt was added and under the key of the log that issued it, so the verdict says the signing certificate was public when it was issued rather than handed out quietly. At least one receipt must verify against a pinned log, the verdict reports `sctChecked` and `validScts`, and an empty log set is refused rather than read as a policy that checks nothing. Both content arms are read: a DSSE-wrapped in-toto attestation, and a message signature over an artifact's own bytes, which `cosign sign-blob` produces. For that arm `opts.artifact` supplies the bytes, and they are held to the hash the Rekor `hashedrekord` entry records before the signature is checked over them; the `messageDigest` the bundle carries is covered by no signature, so it is compared against the computed digest and never used in its place. `contentType` names the arm and the verdict has one shape for both — `pae`, `parseBundle`, `verifyBundle` |
|
|
253
253
|
| `pki.inspect` | Human-readable inspection, the pure-JS equivalent of `openssl x509/crl/req/cms -text`. `certificate(pem \| der \| parsed)` renders an OpenSSL-style report: version, serial, signature algorithm, issuer and subject distinguished names, validity, public-key details (curve or modulus size plus the raw point or modulus), every decoded extension with its critical flag, and the signature. `crl`, `csr`, and `cms` render the other formats the same way — a CRL like `openssl crl -text`, a CSR like `openssl req -text`, and a CMS message like `openssl cms -cmsout -print`, with a stable summary for a non-SignedData ContentInfo — and `any(input)` detects the format and routes to the right report. Built over the strict parsers and the two-way OID registry with one set of field renderers, it names extension and algorithm OIDs an OpenSSL build shows only as raw bytes. No OpenSSL dependency, and the format is stable and OpenSSL-familiar rather than pinned to one OpenSSL version. A certificate policy's user notice renders as text, both its explicit text and a notice reference with the notice numbers that identify it, rather than hex, and a malformed part falls back to a hex dump rather than throwing — `certificate`, `crl`, `csr`, `cms`, `any` |
|
package/lib/hpke.js
CHANGED
|
@@ -8,16 +8,18 @@
|
|
|
8
8
|
* @fullname HPKE (Hybrid Public Key Encryption, RFC 9180)
|
|
9
9
|
* @intro Hybrid Public Key Encryption (RFC 9180): the standard construction
|
|
10
10
|
* behind TLS Encrypted Client Hello, MLS, and OHTTP that turns a recipient KEM
|
|
11
|
-
* public key into an encapsulated key plus an AEAD-encrypting context.
|
|
12
|
-
* the RFC 9180
|
|
13
|
-
* X448
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
11
|
+
* public key into an encapsulated key plus an AEAD-encrypting context. Two KEM
|
|
12
|
+
* families run the RFC 9180 key schedule: the DHKEM suites P-256, P-521, X25519,
|
|
13
|
+
* and X448 in all four modes (base / psk / auth / auth-psk), proven against the
|
|
14
|
+
* RFC 9180 Appendix A known-answer vectors, and the post-quantum ML-KEM-512 /
|
|
15
|
+
* -768 / -1024 KEMs (IANA code points 0x0040 to 0x0042, draft-ietf-hpke-pq) in
|
|
16
|
+
* the base and psk modes, proven against that draft's Appendix A vectors. The
|
|
17
|
+
* KDFs are HKDF-SHA256 / HKDF-SHA384 / HKDF-SHA512; the AEADs are AES-128-GCM,
|
|
18
|
+
* AES-256-GCM, ChaCha20Poly1305, and export-only. DHKEM(P-384) is RFC-registered
|
|
19
|
+
* but no known-answer vector pairs it with an HKDF key schedule, so a request
|
|
20
|
+
* for it fails closed. The PQ/T hybrid KEMs and the SHAKE-based KDFs of the HPKE
|
|
21
|
+
* revision are a data-row extension once their specifications stabilize. Pure
|
|
22
|
+
* composition over node:crypto: no ASN.1, no schema engine.
|
|
21
23
|
* The RFC 9180 sec. 7 registry code points live in pki.hpke.suites
|
|
22
24
|
* (KEM / KDF / AEAD / MODE), passed to the setup functions to select a suite.
|
|
23
25
|
* @spec RFC 9180
|
|
@@ -28,7 +30,11 @@ var nodeCrypto = require("crypto");
|
|
|
28
30
|
var frameworkError = require("./framework-error");
|
|
29
31
|
var guard = require("./guard-all");
|
|
30
32
|
var intrinsic = require("./guard-intrinsic");
|
|
33
|
+
var oid = require("./oid");
|
|
31
34
|
var _hasOwn = intrinsic.hasOwn;
|
|
35
|
+
var _isBuffer = intrinsic.isBuffer, _bufferFrom = intrinsic.bufferFrom, _bufferAlloc = intrinsic.bufferAlloc;
|
|
36
|
+
var _bufferConcat = intrinsic.bufferConcat, _bufferEquals = intrinsic.bufferEquals, _compare = intrinsic.compare;
|
|
37
|
+
var _subarray = intrinsic.subarray;
|
|
32
38
|
|
|
33
39
|
var HpkeError = frameworkError.HpkeError;
|
|
34
40
|
function _err(code, message, cause) { return new HpkeError(code, message, cause); }
|
|
@@ -49,6 +55,7 @@ function L(s) { return Buffer.from(s, "ascii"); }
|
|
|
49
55
|
|
|
50
56
|
var KDFS = intrinsic.assign(intrinsic.create(null), {
|
|
51
57
|
0x0001: { hash: "sha256", Nh: 32 },
|
|
58
|
+
0x0002: { hash: "sha384", Nh: 48 },
|
|
52
59
|
0x0003: { hash: "sha512", Nh: 64 },
|
|
53
60
|
});
|
|
54
61
|
var AEADS = intrinsic.assign(intrinsic.create(null), {
|
|
@@ -57,11 +64,18 @@ var AEADS = intrinsic.assign(intrinsic.create(null), {
|
|
|
57
64
|
0x0003: { cipher: "chacha20-poly1305", Nk: 32, Nn: 12, Nt: 16 },
|
|
58
65
|
0xFFFF: { exportOnly: true, Nn: 12 },
|
|
59
66
|
});
|
|
67
|
+
function _mlKemRow(name, oidName, node) {
|
|
68
|
+
var p = oid.kemParams(oidName);
|
|
69
|
+
return { kind: "mlkem", name: name, node: node, Nsecret: p.ss, Npub: p.ek, Nenc: p.ct, Nsk: 64 };
|
|
70
|
+
}
|
|
60
71
|
var KEMS = intrinsic.assign(intrinsic.create(null), {
|
|
61
|
-
0x0010: { kind: "ec", curve: "P-256", nodeCurve: "prime256v1", kdf: 0x0001, Nsecret: 32, Npub: 65 },
|
|
62
|
-
0x0012: { kind: "ec", curve: "P-521", nodeCurve: "secp521r1", kdf: 0x0003, Nsecret: 64, Npub: 133 },
|
|
63
|
-
0x0020: { kind: "okp",
|
|
64
|
-
0x0021: { kind: "okp",
|
|
72
|
+
0x0010: { kind: "ec", name: "P-256", curve: "P-256", nodeCurve: "prime256v1", kdf: 0x0001, Nsecret: 32, Npub: 65, Nsk: 32 },
|
|
73
|
+
0x0012: { kind: "ec", name: "P-521", curve: "P-521", nodeCurve: "secp521r1", kdf: 0x0003, Nsecret: 64, Npub: 133, Nsk: 66 },
|
|
74
|
+
0x0020: { kind: "okp", name: "X25519", curve: "X25519", kdf: 0x0001, Nsecret: 32, Npub: 32, Nsk: 32 },
|
|
75
|
+
0x0021: { kind: "okp", name: "X448", curve: "X448", kdf: 0x0003, Nsecret: 64, Npub: 56, Nsk: 56 },
|
|
76
|
+
0x0040: _mlKemRow("ML-KEM-512", "id-ml-kem-512", "ml-kem-512"),
|
|
77
|
+
0x0041: _mlKemRow("ML-KEM-768", "id-ml-kem-768", "ml-kem-768"),
|
|
78
|
+
0x0042: _mlKemRow("ML-KEM-1024", "id-ml-kem-1024", "ml-kem-1024"),
|
|
65
79
|
});
|
|
66
80
|
|
|
67
81
|
var MODE_BASE = 0x00, MODE_PSK = 0x01, MODE_AUTH = 0x02, MODE_AUTH_PSK = 0x03;
|
|
@@ -78,19 +92,24 @@ function _extract(hash, Nh, salt, ikm) {
|
|
|
78
92
|
}
|
|
79
93
|
function _expand(hash, Nh, prk, info, len) {
|
|
80
94
|
if (len > 255 * Nh) throw _err("hpke/export-length", "requested length " + len + " exceeds 255*Nh");
|
|
81
|
-
var out = [], t = Buffer.alloc(0), n = Math.ceil(len / Nh);
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
|
|
95
|
+
var out = [], t = Buffer.alloc(0), n = Math.ceil(len / Nh), fed = null, joined = null;
|
|
96
|
+
try {
|
|
97
|
+
for (var i = 1; i <= n; i++) {
|
|
98
|
+
fed = concat([t, info, Buffer.from([i])]);
|
|
99
|
+
t = nodeCrypto.createHmac(hash, prk).update(fed).digest();
|
|
100
|
+
guard.secret.zeroize(fed, HpkeError, "hpke/bad-input", "an expand feedback input");
|
|
101
|
+
fed = null;
|
|
102
|
+
out.push(t);
|
|
103
|
+
}
|
|
104
|
+
joined = concat(out);
|
|
105
|
+
var exact = Buffer.alloc(len);
|
|
106
|
+
joined.copy(exact, 0, 0, len);
|
|
107
|
+
return exact;
|
|
108
|
+
} finally {
|
|
85
109
|
guard.secret.zeroize(fed, HpkeError, "hpke/bad-input", "an expand feedback input");
|
|
86
|
-
|
|
110
|
+
guard.secret.zeroize(joined, HpkeError, "hpke/bad-input", "the KDF accumulator");
|
|
111
|
+
for (var oi = 0; oi < out.length; oi++) guard.secret.zeroize(out[oi], HpkeError, "hpke/bad-input", "a KDF block");
|
|
87
112
|
}
|
|
88
|
-
var joined = concat(out);
|
|
89
|
-
var exact = Buffer.alloc(len);
|
|
90
|
-
joined.copy(exact, 0, 0, len);
|
|
91
|
-
guard.secret.zeroize(joined, HpkeError, "hpke/bad-input", "the KDF accumulator");
|
|
92
|
-
for (var oi = 0; oi < out.length; oi++) guard.secret.zeroize(out[oi], HpkeError, "hpke/bad-input", "a KDF block");
|
|
93
|
-
return exact;
|
|
94
113
|
}
|
|
95
114
|
function _labeledExtract(kdf, suiteId, salt, label, ikm) {
|
|
96
115
|
var labeled = concat([HPKE_V1, suiteId, L(label), ikm]);
|
|
@@ -104,10 +123,27 @@ function _labeledExpand(kdf, suiteId, prk, label, info, len) {
|
|
|
104
123
|
|
|
105
124
|
var OKP_SPKI = intrinsic.assign(intrinsic.create(null), { X25519: "302a300506032b656e032100", X448: "3042300506032b656f033900" });
|
|
106
125
|
var OKP_PKCS8 = intrinsic.assign(intrinsic.create(null), { X25519: "302e020100300506032b656e04220420", X448: "3046020100300506032b656f043a0438" });
|
|
126
|
+
var EC_SEC1 = intrinsic.assign(intrinsic.create(null), {
|
|
127
|
+
"P-256": { head: "30310201010420", tail: "a00a06082a8648ce3d030107",
|
|
128
|
+
order: "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551" },
|
|
129
|
+
"P-521": { head: "30500201010442", tail: "a00706052b81040023",
|
|
130
|
+
order: "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409" },
|
|
131
|
+
});
|
|
132
|
+
var ML_KEM_SPKI = intrinsic.assign(intrinsic.create(null), {
|
|
133
|
+
"ML-KEM-512": "30820332300b06096086480165030404010382032100",
|
|
134
|
+
"ML-KEM-768": "308204b2300b0609608648016503040402038204a100",
|
|
135
|
+
"ML-KEM-1024": "30820632300b06096086480165030404030382062100",
|
|
136
|
+
});
|
|
137
|
+
var ML_KEM_PKCS8 = intrinsic.assign(intrinsic.create(null), {
|
|
138
|
+
"ML-KEM-512": "3054020100300b060960864801650304040104428040",
|
|
139
|
+
"ML-KEM-768": "3054020100300b060960864801650304040204428040",
|
|
140
|
+
"ML-KEM-1024": "3054020100300b060960864801650304040304428040",
|
|
141
|
+
});
|
|
142
|
+
function _hex(h) { return _bufferFrom(h, "hex"); }
|
|
107
143
|
|
|
108
144
|
function _importPublic(kem, raw) {
|
|
109
|
-
if (!
|
|
110
|
-
throw _err("hpke/bad-key", kem.
|
|
145
|
+
if (!_isBuffer(raw) || raw.length !== kem.Npub) {
|
|
146
|
+
throw _err("hpke/bad-key", kem.name + " public key must be " + kem.Npub + " bytes");
|
|
111
147
|
}
|
|
112
148
|
try {
|
|
113
149
|
if (kem.kind === "ec") {
|
|
@@ -116,31 +152,62 @@ function _importPublic(kem, raw) {
|
|
|
116
152
|
var jwk = { kty: "EC", crv: kem.curve, x: raw.subarray(1, 1 + half).toString("base64url"), y: raw.subarray(1 + half).toString("base64url") };
|
|
117
153
|
return nodeCrypto.createPublicKey({ key: jwk, format: "jwk" });
|
|
118
154
|
}
|
|
119
|
-
|
|
155
|
+
var prefix = kem.kind === "mlkem" ? ML_KEM_SPKI[kem.name] : OKP_SPKI[kem.curve];
|
|
156
|
+
return nodeCrypto.createPublicKey({ key: _bufferConcat([_hex(prefix), raw]), format: "der", type: "spki" });
|
|
120
157
|
} catch (e) {
|
|
121
158
|
if (e instanceof HpkeError) throw e;
|
|
122
|
-
throw _err("hpke/bad-key", "invalid " + kem.
|
|
159
|
+
throw _err("hpke/bad-key", "invalid " + kem.name + " public key" +
|
|
160
|
+
(kem.kind === "mlkem" ? " (FIPS 203 sec. 7.2 encapsulation key check)" : ""), e);
|
|
123
161
|
}
|
|
124
162
|
}
|
|
125
163
|
function _exportPublic(kem, keyObject) {
|
|
126
|
-
var
|
|
164
|
+
var pub = keyObject.type === "public" ? keyObject : nodeCrypto.createPublicKey(keyObject);
|
|
165
|
+
if (kem.kind === "mlkem") {
|
|
166
|
+
var der = pub.export({ format: "der", type: "spki" }), prefix = _hex(ML_KEM_SPKI[kem.name]);
|
|
167
|
+
if (der.length !== prefix.length + kem.Npub || !_bufferEquals(_subarray(der, 0, prefix.length), prefix)) {
|
|
168
|
+
throw _err("hpke/bad-key", "the KeyObject is not an " + kem.name + " key");
|
|
169
|
+
}
|
|
170
|
+
return _subarray(der, prefix.length);
|
|
171
|
+
}
|
|
172
|
+
var jwk = pub.export({ format: "jwk" });
|
|
173
|
+
if (jwk.crv !== kem.curve) throw _err("hpke/bad-key", "the KeyObject is not a " + kem.name + " key");
|
|
127
174
|
if (kem.kind === "ec") return concat([Buffer.from([0x04]), _b64u(jwk.x), _b64u(jwk.y)]);
|
|
128
175
|
return _b64u(jwk.x);
|
|
129
176
|
}
|
|
130
177
|
function _b64u(s) { return guard.encoding.base64url(s, null, _err, "hpke/bad-key", "JWK coordinate"); }
|
|
131
178
|
|
|
132
|
-
function
|
|
179
|
+
function _scalarInRange(d, order) {
|
|
180
|
+
return _compare(d, _bufferAlloc(d.length)) > 0 && _compare(d, order) < 0;
|
|
181
|
+
}
|
|
182
|
+
function _importPrivate(kem, rawSk) {
|
|
183
|
+
if (!_isBuffer(rawSk) || rawSk.length !== kem.Nsk) {
|
|
184
|
+
throw _err("hpke/bad-key", kem.name + " private key must be " +
|
|
185
|
+
(kem.kind === "mlkem" ? "the 64-byte seed" : "the " + kem.Nsk + "-byte scalar") + " as a Buffer");
|
|
186
|
+
}
|
|
187
|
+
var der;
|
|
188
|
+
if (kem.kind === "ec") {
|
|
189
|
+
var sec1 = EC_SEC1[kem.curve];
|
|
190
|
+
if (!_scalarInRange(rawSk, _hex(sec1.order))) throw _err("hpke/bad-key", kem.name + " private scalar is outside [1, n-1]");
|
|
191
|
+
der = _bufferConcat([_hex(sec1.head), rawSk, _hex(sec1.tail)]);
|
|
192
|
+
} else {
|
|
193
|
+
der = _bufferConcat([_hex(kem.kind === "mlkem" ? ML_KEM_PKCS8[kem.name] : OKP_PKCS8[kem.curve]), rawSk]);
|
|
194
|
+
}
|
|
133
195
|
try {
|
|
134
|
-
|
|
135
|
-
var jwk = { kty: "EC", crv: kem.curve, d: rawSk.toString("base64url") };
|
|
136
|
-
if (rawPk) { jwk.x = rawPk.subarray(1, 1 + (rawPk.length - 1) / 2).toString("base64url"); jwk.y = rawPk.subarray(1 + (rawPk.length - 1) / 2).toString("base64url"); }
|
|
137
|
-
return nodeCrypto.createPrivateKey({ key: jwk, format: "jwk" });
|
|
138
|
-
}
|
|
139
|
-
return nodeCrypto.createPrivateKey({ key: Buffer.from(OKP_PKCS8[kem.curve] + rawSk.toString("hex"), "hex"), format: "der", type: "pkcs8" });
|
|
196
|
+
return nodeCrypto.createPrivateKey({ key: der, format: "der", type: kem.kind === "ec" ? "sec1" : "pkcs8" });
|
|
140
197
|
} catch (e) {
|
|
141
|
-
throw _err("hpke/bad-key", "invalid " + kem.
|
|
198
|
+
throw _err("hpke/bad-key", "invalid " + kem.name + " private key", e);
|
|
199
|
+
} finally {
|
|
200
|
+
guard.secret.zeroize(der, HpkeError, "hpke/bad-input", "the private key envelope");
|
|
142
201
|
}
|
|
143
202
|
}
|
|
203
|
+
function _boundPublic(kem, privateKey, pkm) {
|
|
204
|
+
var derived = _exportPublic(kem, nodeCrypto.createPublicKey(privateKey));
|
|
205
|
+
if (pkm === undefined) return derived;
|
|
206
|
+
if (!_isBuffer(pkm) || !_bufferEquals(derived, pkm)) {
|
|
207
|
+
throw _err("hpke/bad-key", "pkm is not the " + kem.name + " public key derived from skm");
|
|
208
|
+
}
|
|
209
|
+
return derived;
|
|
210
|
+
}
|
|
144
211
|
function _dh(privateKey, publicKey) {
|
|
145
212
|
try {
|
|
146
213
|
return nodeCrypto.diffieHellman({ privateKey: privateKey, publicKey: publicKey });
|
|
@@ -164,12 +231,33 @@ function _extractAndExpand(kem, dh, kemContext) {
|
|
|
164
231
|
function _kemId(kem) { for (var k in KEMS) if (KEMS[k] === kem) return Number(k); return 0; }
|
|
165
232
|
|
|
166
233
|
function _ephemeral(kem, eph) {
|
|
167
|
-
if (eph
|
|
234
|
+
if (eph != null) {
|
|
235
|
+
if (typeof eph !== "object") throw _err("hpke/bad-input", "eph must be { skm, pkm } (a fixed ephemeral key pair), got " + guard.text.showValue(eph));
|
|
236
|
+
var skE = _importPrivate(kem, eph.skm);
|
|
237
|
+
return { skE: skE, enc: _boundPublic(kem, skE, eph.pkm) };
|
|
238
|
+
}
|
|
168
239
|
var kp = _generate(kem);
|
|
169
240
|
return { skE: kp.privateKey, enc: _exportPublic(kem, kp.publicKey) };
|
|
170
241
|
}
|
|
171
242
|
function _wipeDh(dh) { guard.secret.zeroize(dh, HpkeError, "hpke/bad-input", "the KEM shared secret"); }
|
|
243
|
+
function _mlKemEncap(kem, pkR, eph) {
|
|
244
|
+
if (eph != null) {
|
|
245
|
+
throw _err("hpke/bad-input", "eph (a fixed ephemeral key pair) applies to a DHKEM suite; " + kem.name + " encapsulation takes its randomness from the runtime");
|
|
246
|
+
}
|
|
247
|
+
var r;
|
|
248
|
+
try { r = nodeCrypto.encapsulate(pkR); }
|
|
249
|
+
catch (e) { throw _err("hpke/bad-key", kem.name + " encapsulation failed", e); }
|
|
250
|
+
return { sharedSecret: r.sharedKey, enc: r.ciphertext };
|
|
251
|
+
}
|
|
252
|
+
function _mlKemDecap(kem, enc, skR) {
|
|
253
|
+
if (enc.length !== kem.Nenc) {
|
|
254
|
+
throw _err("hpke/bad-key", kem.name + " encapsulated key must be " + kem.Nenc + " bytes (FIPS 203 sec. 7.3 ciphertext check)");
|
|
255
|
+
}
|
|
256
|
+
try { return nodeCrypto.decapsulate(skR, enc); }
|
|
257
|
+
catch (e) { throw _err("hpke/bad-key", kem.name + " decapsulation failed", e); }
|
|
258
|
+
}
|
|
172
259
|
function _encap(kem, pkR, pkRm, eph) {
|
|
260
|
+
if (kem.kind === "mlkem") return _mlKemEncap(kem, pkR, eph);
|
|
173
261
|
var e = _ephemeral(kem, eph);
|
|
174
262
|
var dh = null;
|
|
175
263
|
try {
|
|
@@ -178,6 +266,7 @@ function _encap(kem, pkR, pkRm, eph) {
|
|
|
178
266
|
} finally { _wipeDh(dh); }
|
|
179
267
|
}
|
|
180
268
|
function _decap(kem, enc, skR, pkRm) {
|
|
269
|
+
if (kem.kind === "mlkem") return _mlKemDecap(kem, enc, skR);
|
|
181
270
|
var pkE = _importPublic(kem, enc);
|
|
182
271
|
var dh = null;
|
|
183
272
|
try {
|
|
@@ -307,14 +396,32 @@ function _recipPublic(suite, pk) {
|
|
|
307
396
|
}
|
|
308
397
|
}
|
|
309
398
|
function _recipPrivate(suite, sk) {
|
|
310
|
-
|
|
311
|
-
if (
|
|
399
|
+
var kem = suite.kem;
|
|
400
|
+
if (sk && sk.skm != null) {
|
|
401
|
+
var key = _importPrivate(kem, sk.skm);
|
|
402
|
+
return { key: key, pkm: _boundPublic(kem, key, sk.pkm) };
|
|
403
|
+
}
|
|
404
|
+
if (_isBuffer(sk)) {
|
|
405
|
+
throw _err("hpke/bad-key", "a serialized " + kem.name + " private key must be provided as { skm" +
|
|
406
|
+
(kem.kind === "mlkem" ? " } holding the 64-byte seed" : ", pkm } (the raw scalar, and optionally its public key)") + ", not a bare buffer");
|
|
407
|
+
}
|
|
312
408
|
try {
|
|
313
|
-
|
|
409
|
+
if (sk.type !== "private") throw _err("hpke/bad-key", "the private key must be a private KeyObject or { skm, pkm }, got a " + guard.text.showValue(sk.type) + " KeyObject");
|
|
410
|
+
var pkm = _exportPublic(kem, nodeCrypto.createPublicKey(sk));
|
|
314
411
|
return { key: sk, pkm: pkm };
|
|
315
412
|
} catch (e) {
|
|
316
413
|
if (e instanceof HpkeError) throw e;
|
|
317
|
-
throw _err("hpke/bad-key", "invalid
|
|
414
|
+
throw _err("hpke/bad-key", "invalid private key (expected a node KeyObject or { skm, pkm })", e);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function _requireAuthCapable(kem) {
|
|
418
|
+
if (kem.kind === "mlkem") {
|
|
419
|
+
throw _err("hpke/auth-unsupported", kem.name + " defines no AuthEncap / AuthDecap (draft-ietf-hpke-pq sec. 7.2); use the psk mode or a signature");
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function _refuseUnusedAuthKey(value, name, mode) {
|
|
423
|
+
if (value != null) {
|
|
424
|
+
throw _err("hpke/bad-input", name + " applies to the auth and auth-psk modes; mode " + mode + " would leave it unused, so the exchange it was meant to authenticate would not be");
|
|
318
425
|
}
|
|
319
426
|
}
|
|
320
427
|
|
|
@@ -332,7 +439,7 @@ var _SETUP_S_KEYS = _withCommon({
|
|
|
332
439
|
var _SETUP_R_KEYS = _withCommon({
|
|
333
440
|
senderPublicKey: 1,
|
|
334
441
|
});
|
|
335
|
-
function
|
|
442
|
+
function _options(opts, keys, who) {
|
|
336
443
|
guard.identifier.assertKnownKeys(opts, keys, _err, "hpke/bad-input", function (k) {
|
|
337
444
|
var other = (keys === _SETUP_S_KEYS ? _SETUP_R_KEYS : _SETUP_S_KEYS);
|
|
338
445
|
return "unknown HPKE " + who + " option " + JSON.stringify(k) +
|
|
@@ -340,17 +447,21 @@ function _mode(opts, keys, who) {
|
|
|
340
447
|
? " -- that option belongs to the other end of the exchange, where it would authenticate or seed; here it would do nothing"
|
|
341
448
|
: "") + " -- accepted: " + Object.keys(keys).sort().join(", ");
|
|
342
449
|
});
|
|
343
|
-
var
|
|
344
|
-
if (mode
|
|
345
|
-
|
|
450
|
+
var o = guard.identifier.snapshotOptions(opts, keys);
|
|
451
|
+
if (o.mode == null) o.mode = MODE_BASE;
|
|
452
|
+
if (o.mode !== MODE_BASE && o.mode !== MODE_PSK && o.mode !== MODE_AUTH && o.mode !== MODE_AUTH_PSK) {
|
|
453
|
+
throw _err("hpke/unknown-mode", "unsupported HPKE mode " + guard.text.showValue(o.mode) + " (RFC 9180 sec. 5.1 defines base / psk / auth / auth-psk)");
|
|
346
454
|
}
|
|
347
|
-
return
|
|
455
|
+
return o;
|
|
348
456
|
}
|
|
349
457
|
|
|
350
458
|
// @module @intro; a data registry, not a callable primitive).
|
|
351
459
|
var suites = intrinsic.assign(intrinsic.create(null), {
|
|
352
|
-
KEM: intrinsic.assign(intrinsic.create(null), {
|
|
353
|
-
|
|
460
|
+
KEM: intrinsic.assign(intrinsic.create(null), {
|
|
461
|
+
DHKEM_P256_HKDF_SHA256: 0x0010, DHKEM_P521_HKDF_SHA512: 0x0012, DHKEM_X25519_HKDF_SHA256: 0x0020, DHKEM_X448_HKDF_SHA512: 0x0021,
|
|
462
|
+
ML_KEM_512: 0x0040, ML_KEM_768: 0x0041, ML_KEM_1024: 0x0042,
|
|
463
|
+
}),
|
|
464
|
+
KDF: intrinsic.assign(intrinsic.create(null), { HKDF_SHA256: 0x0001, HKDF_SHA384: 0x0002, HKDF_SHA512: 0x0003 }),
|
|
354
465
|
AEAD: intrinsic.assign(intrinsic.create(null), { AES_128_GCM: 0x0001, AES_256_GCM: 0x0002, CHACHA20_POLY1305: 0x0003, EXPORT_ONLY: 0xFFFF }),
|
|
355
466
|
MODE: intrinsic.assign(intrinsic.create(null), { BASE: MODE_BASE, PSK: MODE_PSK, AUTH: MODE_AUTH, AUTH_PSK: MODE_AUTH_PSK }),
|
|
356
467
|
});
|
|
@@ -369,9 +480,13 @@ var suites = intrinsic.assign(intrinsic.create(null), {
|
|
|
369
480
|
* (send it to the recipient) and a `context` whose `.seal(aad, pt)` /
|
|
370
481
|
* `.export(ctx, L)` encrypt and derive further secrets. `suiteIds` is
|
|
371
482
|
* `{ kem, kdf, aead }` from `pki.hpke.suites`; `recipientPublicKey` is a node
|
|
372
|
-
* KeyObject or the serialized public key bytes
|
|
373
|
-
*
|
|
374
|
-
*
|
|
483
|
+
* KeyObject or the serialized public key bytes (the uncompressed point, the raw
|
|
484
|
+
* Montgomery coordinate, or the ML-KEM encapsulation key). `opts.mode` selects
|
|
485
|
+
* base / psk / auth / auth-psk (default base); `opts.info`, `opts.psk`/`opts.pskId`,
|
|
486
|
+
* and `opts.senderKey` (auth modes) supply the corresponding inputs; an option that
|
|
487
|
+
* belongs to another mode, such as `senderKey` in base mode, is refused with
|
|
488
|
+
* `hpke/bad-input` rather than left unused. The auth modes exist for the DHKEM
|
|
489
|
+
* suites only: an ML-KEM suite throws `hpke/auth-unsupported`.
|
|
375
490
|
*
|
|
376
491
|
* @example
|
|
377
492
|
* var s = pki.hpke.suites, ids = { kem: s.KEM.DHKEM_X25519_HKDF_SHA256, kdf: s.KDF.HKDF_SHA256, aead: s.AEAD.AES_128_GCM };
|
|
@@ -380,17 +495,18 @@ var suites = intrinsic.assign(intrinsic.create(null), {
|
|
|
380
495
|
* var ct = sender.context.seal(Buffer.from("aad"), Buffer.from("secret"));
|
|
381
496
|
*/
|
|
382
497
|
function _setupS(ids, pkR, opts) {
|
|
383
|
-
opts = opts || {};
|
|
384
498
|
var suite = _suite(ids);
|
|
385
|
-
|
|
499
|
+
opts = _options(opts || {}, _SETUP_S_KEYS, "sender setup");
|
|
500
|
+
var mode = opts.mode;
|
|
386
501
|
var r = _recipPublic(suite, pkR);
|
|
387
502
|
var kem = suite.kem, k;
|
|
388
503
|
if (mode === MODE_AUTH || mode === MODE_AUTH_PSK) {
|
|
389
|
-
|
|
504
|
+
_requireAuthCapable(kem);
|
|
390
505
|
if (opts.senderKey == null) throw _err("hpke/auth-key-required", "an authenticated mode requires opts.senderKey (the sender's KEM private key, RFC 9180 sec. 5.1.3)");
|
|
391
506
|
var s = _recipPrivate(suite, opts.senderKey);
|
|
392
507
|
k = _authEncap(kem, r.key, r.pkm, s.key, s.pkm, opts.eph);
|
|
393
508
|
} else {
|
|
509
|
+
_refuseUnusedAuthKey(opts.senderKey, "senderKey", mode);
|
|
394
510
|
k = _encap(kem, r.key, r.pkm, opts.eph);
|
|
395
511
|
}
|
|
396
512
|
var ctx = _keySchedule(suite, mode, k.sharedSecret, _buf(opts.info), _buf(opts.psk), _buf(opts.pskId), "S");
|
|
@@ -405,12 +521,14 @@ function _setupS(ids, pkR, opts) {
|
|
|
405
521
|
* @related pki.hpke.setupS, pki.hpke.open
|
|
406
522
|
*
|
|
407
523
|
* Establish the recipient HPKE context from the sender's encapsulated key `enc`
|
|
408
|
-
* and the recipient KEM private key
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
524
|
+
* and the recipient KEM private key, recovering the same shared secret and key
|
|
525
|
+
* schedule. The private key is a node KeyObject, or `{ skm, pkm }` where `skm` is
|
|
526
|
+
* the raw private scalar of a DHKEM suite or the 64-byte seed of an ML-KEM suite;
|
|
527
|
+
* `pkm` is optional, and when given it must be the public key derived from `skm`
|
|
528
|
+
* or the call throws `hpke/bad-key`. The returned `context` `.open(aad, ct)`
|
|
529
|
+
* decrypts and `.export(ctx, L)` derives secrets. `opts` mirrors `setupS` (mode /
|
|
530
|
+
* info / psk / pskId), with `opts.senderPublicKey` for the auth modes (DHKEM
|
|
531
|
+
* suites only). A ciphertext whose tag does not verify throws `hpke/open-failed`.
|
|
414
532
|
*
|
|
415
533
|
* @example
|
|
416
534
|
* var s = pki.hpke.suites, ids = { kem: s.KEM.DHKEM_X25519_HKDF_SHA256, kdf: s.KDF.HKDF_SHA256, aead: s.AEAD.AES_128_GCM };
|
|
@@ -421,16 +539,18 @@ function _setupS(ids, pkR, opts) {
|
|
|
421
539
|
* var pt = recipient.open(Buffer.alloc(0), sender.context.seal(Buffer.alloc(0), Buffer.from("hi")));
|
|
422
540
|
*/
|
|
423
541
|
function _setupR(ids, enc, skR, opts) {
|
|
424
|
-
opts = opts || {};
|
|
425
542
|
var suite = _suite(ids);
|
|
426
|
-
|
|
543
|
+
opts = _options(opts || {}, _SETUP_R_KEYS, "recipient setup");
|
|
544
|
+
var mode = opts.mode;
|
|
427
545
|
var r = _recipPrivate(suite, skR);
|
|
428
546
|
var kem = suite.kem, ss;
|
|
429
547
|
if (mode === MODE_AUTH || mode === MODE_AUTH_PSK) {
|
|
548
|
+
_requireAuthCapable(kem);
|
|
430
549
|
if (opts.senderPublicKey == null) throw _err("hpke/auth-key-required", "an authenticated mode requires opts.senderPublicKey (the sender's KEM public key, RFC 9180 sec. 5.1.3)");
|
|
431
550
|
var pkS = _recipPublic(suite, opts.senderPublicKey);
|
|
432
551
|
ss = _authDecap(kem, _buf(enc), r.key, r.pkm, pkS.key, pkS.pkm);
|
|
433
552
|
} else {
|
|
553
|
+
_refuseUnusedAuthKey(opts.senderPublicKey, "senderPublicKey", mode);
|
|
434
554
|
ss = _decap(kem, _buf(enc), r.key, r.pkm);
|
|
435
555
|
}
|
|
436
556
|
try { return _keySchedule(suite, mode, ss, _buf(opts.info), _buf(opts.psk), _buf(opts.pskId), "R"); }
|
|
@@ -451,9 +571,9 @@ function _setupR(ids, enc, skR, opts) {
|
|
|
451
571
|
* `setupS` options object (mode / info / psk / senderKey).
|
|
452
572
|
*
|
|
453
573
|
* @example
|
|
454
|
-
*
|
|
455
|
-
* var
|
|
456
|
-
* var out = pki.hpke.seal(ids,
|
|
574
|
+
* // requires: mlKemPkR -- the recipient's ML-KEM-768 encapsulation key (1184 bytes)
|
|
575
|
+
* var s = pki.hpke.suites, ids = { kem: s.KEM.ML_KEM_768, kdf: s.KDF.HKDF_SHA256, aead: s.AEAD.AES_256_GCM };
|
|
576
|
+
* var out = pki.hpke.seal(ids, mlKemPkR, {}, Buffer.from("aad"), Buffer.from("msg"));
|
|
457
577
|
*/
|
|
458
578
|
function seal(ids, pkR, opts, aad, pt) {
|
|
459
579
|
var s = null;
|
|
@@ -481,11 +601,11 @@ function seal(ids, pkR, opts, aad, pt) {
|
|
|
481
601
|
* verify throws `hpke/open-failed` and returns no plaintext.
|
|
482
602
|
*
|
|
483
603
|
* @example
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
* var
|
|
487
|
-
* var o = pki.hpke.seal(ids,
|
|
488
|
-
* var pt = pki.hpke.open(ids, o.enc,
|
|
604
|
+
* // requires: mlKemPkR -- the recipient's ML-KEM-768 encapsulation key (1184 bytes)
|
|
605
|
+
* // requires: mlKemSkR -- { skm } holding the recipient's 64-byte ML-KEM-768 seed
|
|
606
|
+
* var s = pki.hpke.suites, ids = { kem: s.KEM.ML_KEM_768, kdf: s.KDF.HKDF_SHA256, aead: s.AEAD.AES_256_GCM };
|
|
607
|
+
* var o = pki.hpke.seal(ids, mlKemPkR, {}, Buffer.alloc(0), Buffer.from("m"));
|
|
608
|
+
* var pt = pki.hpke.open(ids, o.enc, mlKemSkR, {}, Buffer.alloc(0), o.ct);
|
|
489
609
|
*/
|
|
490
610
|
function open(ids, enc, skR, opts, aad, ct) {
|
|
491
611
|
var ctx = _setupR(ids, enc, skR, opts);
|
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:12c7bd5e-a715-426d-b609-24c3b76f11be",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-09-
|
|
8
|
+
"timestamp": "2026-09-12T07:21:39.704Z",
|
|
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.7.
|
|
22
|
+
"bom-ref": "@blamejs/pki@0.7.31",
|
|
23
23
|
"type": "application",
|
|
24
24
|
"name": "pki",
|
|
25
|
-
"version": "0.7.
|
|
25
|
+
"version": "0.7.31",
|
|
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.7.
|
|
29
|
+
"purl": "pkg:npm/%40blamejs/pki@0.7.31",
|
|
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.7.
|
|
57
|
+
"ref": "@blamejs/pki@0.7.31",
|
|
58
58
|
"dependsOn": []
|
|
59
59
|
}
|
|
60
60
|
]
|