Repository navigation
Commit 813d128
committed
ports/webcrypto: complete the polymorph:webcrypto@0.1.0 surface (#3)
19 interfaces ported from the consumer's own jco host module
(js/jco/webcrypto.js, cited by file:line throughout): cipher +
aes-cbc/aes-ctr, key-wrap + aes-kw, pbkdf2 (+sha1/sha2), ecdh,
ecdsa-verify/-sign, rsassa-pkcs1-v15-verify/-sign,
rsa-pss-verify/-sign, public-encryption + rsa-oaep-encrypt/-decrypt,
and sha1-checked (fail-closed: no platform WebCrypto carries sha1dc).
Existing families upgraded where the real suites proved them
non-conformant: signature.ts rebuilt around mint-bound algorithm
records shared by Ed25519/ECDSA/RSA (the strict-point and
S-canonicality predicates kept), keyAgreement.ts generalized
(algorithm-agnostic agree with the contributory-behavior probe),
mac/aead JWK paths moved onto the shared jwkMaterial admission, and a
new host-side EC admission layer (curve-equation + JWK crv/alg
checks): Deno admits off-curve public keys and ignores JWK crv, so
Wycheproof InvalidCurveAttack vectors now refuse with
error.invalid-key as the WIT requires.
Two interpretation calls, marked // CONTRACT: in the files:
- errors.ts platformCall maps platform-originated TypeError ->
error.unsupported and Error -> error.other instead of trapping: Deno
reports capability limits as plain TypeErrors, and the guest must
receive a refusal it can handle, not a trap.
- The RSA private-key posture (rsa-pss-sign, rsassa-pkcs1-v15-sign,
rsa-oaep-decrypt) defaults to serve — Deno is a server runtime, the
reference's Node posture; setRsaPrivateKeyPolicy("decline") gives
the browser posture.
Against the consumer's REAL suites (conformance/run.ts, targets
deltic + deltic-signing): shared 18757 pass / 332 fail / 1 n/a,
signing 686 / 84 / 2. Every residual failure is an adversarially
verified Deno platform gap (pure crypto.subtle probes, no port code
in the loop):
1. rsassa 8192-bit IMPORTED keys: verify throws "SPKI cryptographic
key data malformed" (ring; Deno-minted 8192 keys verify fine) —
299 cases
2. rsa-oaep at odd modulus sizes (3104-bit etc.) with label:
OperationError on valid vectors — 84 cases (signing suite)
3. aes-gcm: IV window limited to 12/16 bytes, decrypt refuses
non-128-bit tags — 32 cases
4. aes-ctr: counter width limited to 32/64/128 bits — 1 case
None is a port defect; the consumer-side migration declares them as
gated capability features (their features mechanism, the sha1-checked
precedent), NOT expected-fail entries. Runner output under
conformance/ is gitignored.
Tests: families_test.ts (17 KATs, vectors named by file+tcId,
positive + negative per family), import_surface_test.ts (both suites
resolve with ZERO unresolved leaves). Gates: deno task check; port
tests 50/50 under seeds unset/1/4242; consumer tree verified clean
before/after. iroh exam not run on this host (no iroh-relay on PATH);
the exec-model integration test runs against the real iroh guest and
passes.
Closes #3.1 parent b396d6a commit 813d128
23 files changed
Lines changed: 3245 additions & 172 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
248 | 262 | | |
249 | 263 | | |
250 | 264 | | |
| |||
0 commit comments