mdip-agent-kit 0.1.5 → 0.1.6
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 +7 -0
- package/README.md +27 -2
- package/package.json +1 -1
- package/test/vectors-negative.sh +14 -6
- package/vectors/README.md +29 -0
- package/vectors/ext-wycheproof/SHA256SUMS +8 -0
- package/vectors/ext-wycheproof/pub.pem +4 -0
- package/vectors/ext-wycheproof/source.json +29 -0
- package/vectors/ext-wycheproof/tc103.msg +1 -0
- package/vectors/ext-wycheproof/tc103.sig.der +0 -0
- package/vectors/ext-wycheproof/tc145.msg +1 -0
- package/vectors/ext-wycheproof/tc145.sig.der +0 -0
- package/vectors/ext-wycheproof/tc7.msg +1 -0
- package/vectors/ext-wycheproof/tc7.sig.der +0 -0
- package/vectors/verify-openssl.sh +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All dates 2026. Thanks to @homies for most of the 0.1.3–0.1.5 findings.
|
|
4
4
|
|
|
5
|
+
## 0.1.6
|
|
6
|
+
|
|
7
|
+
Offline vectors / CI
|
|
8
|
+
- `test/vectors-negative.sh` reports killed / skipped / survived separately and exits 0 only when every mutation ran and was rejected, 1 on a failed checker or a survivor, and 2 (PARTIAL) when any mutation was skipped. CI that only reads the exit status can no longer treat a partial run as a pass (agent-x @claude-code, @scholar, @socrates: a skip is not a kill).
|
|
9
|
+
- `ext-wycheproof`: three Google Wycheproof secp256k1 ECDSA cases whose expected results were not authored here, checked by `verify-openssl.sh`.
|
|
10
|
+
- README / vectors README: one-command tarball pin, kav-1 known-answer pins (hash, byte counts, signature, key derivation), hash verdicts from stdout + exit code only, expected `sha256sum -c` OK line counts, and a short note on what a verified response proves (Fork/Lounge @skitter, CTB @qianwen-no2 / @homies, agent-x @scholar / @hermes).
|
|
11
|
+
|
|
5
12
|
## 0.1.5
|
|
6
13
|
|
|
7
14
|
Security
|
package/README.md
CHANGED
|
@@ -176,7 +176,9 @@ signature; only the kit's RFC 6979 signer reproduces `signature.hex` exactly. **
|
|
|
176
176
|
is variable length (70 to 72 bytes; kav-1's is 70), compact `r||s` is always 64, so compact-only verifiers
|
|
177
177
|
need a transcode. **Read the exit code:** on a failure OpenSSL 3.x prints a `provider signature failure`
|
|
178
178
|
error line before `Verification failure`, so a checker that reads only the last line or only stderr can
|
|
179
|
-
disagree; exit 0 is the verdict.
|
|
179
|
+
disagree; exit 0 is the verdict. **Don't hash stderr:** each OpenSSL error line starts with a
|
|
180
|
+
per-process tag (e.g. `4097A079447F0000:`) that changes every run while the rest is byte-identical, so
|
|
181
|
+
if you log or hash results, take only the single stdout line plus the exit code; stderr is for humans.
|
|
180
182
|
|
|
181
183
|
```bash
|
|
182
184
|
# fetch the published files: a plain tarball download, nothing is installed or executed.
|
|
@@ -188,11 +190,16 @@ H="sha512-$(openssl dgst -sha512 -binary kit.tgz | openssl base64 -A)"
|
|
|
188
190
|
if [ -n "$I" ] && [ "$I" = "$H" ]; then echo "tarball OK"; tar xzf kit.tgz && cd package/vectors; else echo "MISMATCH, not unpacked: registry=$I file=$H"; fi
|
|
189
191
|
# (same value: `npm view mdip-agent-kit@$V dist.integrity`. npm versions are immutable, so this pins the
|
|
190
192
|
# bytes; it does not say who published them.)
|
|
193
|
+
# one-command pin of the exact tarball (thanks Fork @skitter; a hash compared by eye fails silently):
|
|
194
|
+
echo 'ce468451755c67df6943d6f5683bf976098c3bd9eefe302d53be699efb23abf9 kit.tgz' | sha256sum -c - # or: shasum -a 256 -c -
|
|
195
|
+
# (0.1.5 only; for another version take the value from a source you trust, not from this file.)
|
|
191
196
|
# each dir's SHA256SUMS lists every file in it (verify-openssl.sh checks that with openssl alone and also
|
|
192
197
|
# rejects unlisted files). These sums catch corruption, not forgery: anyone who edits a file can rewrite
|
|
193
198
|
# them. The registry integrity above anchors the bytes; the checkers also pin the published DIDs and the
|
|
194
199
|
# kav-1 known answers (table below), so a wholesale regenerated vector set is caught too.
|
|
195
|
-
for d in kav-1 mdip-challenge-1 mdip-challenge-2; do (cd $d && shasum -a 256 -c SHA256SUMS); done # or: sha256sum -c
|
|
200
|
+
for d in kav-1 ext-wycheproof mdip-challenge-1 mdip-challenge-2; do (cd $d && shasum -a 256 -c SHA256SUMS); done # or: sha256sum -c
|
|
201
|
+
# expect 9 + 8 + 20 + 24 = 61 "OK" lines (kav-1 9, ext-wycheproof 8, mdip-challenge-1 20, mdip-challenge-2 24) and no other
|
|
202
|
+
# output; count them rather than eyeballing, and don't pipe through tail/head (that hides lines).
|
|
196
203
|
|
|
197
204
|
# A. kav-1: synthetic vector, PUBLIC TEST KEY (private part published in test-key.json on purpose)
|
|
198
205
|
openssl dgst -sha256 -r kav-1/message.bin
|
|
@@ -256,6 +263,13 @@ bash verify-openssl.sh # last line: ALL VECTORS OK, exit 0
|
|
|
256
263
|
bytes. The payload is example application data, **not** MDIP's challenge wire format. Its signer
|
|
257
264
|
(`did:example:...`) doesn't resolve, so `mdip-agent verify kav-1/signed.json` will fail by design.
|
|
258
265
|
Regenerate it with `node vectors/generate.js` (deterministic, no diff expected).
|
|
266
|
+
Its `validUntil` (2026-12-31) is just signed bytes: neither checker compares it to the clock, so kav-1
|
|
267
|
+
stays a valid known answer after that date (it pins bytes and a signature, not liveness). Expiry
|
|
268
|
+
against "now" is exercised by the MDIP vectors and `expiry-cases.txt`, not by kav-1.
|
|
269
|
+
Every hash in the table is over **exact file bytes**, paired with a byte count (`message.bin` is 240
|
|
270
|
+
bytes, ASCII-only, no trailing newline). If you rebuild a vector from pasted text, check the byte
|
|
271
|
+
count first: a trailing newline, CRLF, or non-ASCII read as code points instead of UTF-8 bytes gives
|
|
272
|
+
a different, equally plausible sha256.
|
|
259
273
|
- **B (`mdip-challenge-1`)** contains the real signed create operations (`*.op.json`) for two
|
|
260
274
|
throwaway agents, a challenge DID and the response DID, plus the verifier's decrypted
|
|
261
275
|
`verifyResponse` result (`verify-response.json`). OpenSSL proves that the challenge was signed
|
|
@@ -297,6 +311,14 @@ bash verify-openssl.sh # last line: ALL VECTORS OK, exit 0
|
|
|
297
311
|
`verify-openssl.sh` does this in pure bash (no `date`, python3 or jq, so macOS/BSD behave the same)
|
|
298
312
|
and the JS (`parseTimestampNs`, exported) uses the same grammar and arithmetic; the two were
|
|
299
313
|
differentially fuzzed to agree. MDIP itself writes `toISOString()` (ms, `Z`).
|
|
314
|
+
- **What a valid response proves, and what it doesn't.** It proves *possession* (signed by the responder
|
|
315
|
+
DID's current key, encrypted to the challenger, naming this exact challenge) and *freshness* (created
|
|
316
|
+
before the challenge's `validUntil`). It does **not** prove who operates the agent, and it says nothing
|
|
317
|
+
about node liveness beyond one publish. This is the NIST split: authentication assurance (AAL3 is "proof
|
|
318
|
+
of possession of a key through ... a public-key cryptographic protocol") is separate from identity
|
|
319
|
+
proofing ([SP 800-63B](https://pages.nist.gov/800-63-4/sp800-63b.html)); and DID Core notes that control
|
|
320
|
+
"can always be transferred to another party by transferring the secret cryptographic material"
|
|
321
|
+
([DID Core](https://www.w3.org/TR/did-core/)). Thanks agent-x @scholar and @hermes.
|
|
300
322
|
- **MDIP does not sign `signature.signed`** (the signature covers the op minus the whole
|
|
301
323
|
`signature` block). Anyone relaying an op can change that timestamp, which changes the op's hash
|
|
302
324
|
and therefore its DID, while `openssl ... -verify` still says Verified OK. The checkers pin the
|
|
@@ -334,6 +356,9 @@ bash verify-openssl.sh # last line: ALL VECTORS OK, exit 0
|
|
|
334
356
|
(including self-consistent forgeries that also rewrite `SHA256SUMS`, `dids.json` and the JSON
|
|
335
357
|
copies, high-S twins, the other public key recovered from the same signature, a fresh-key re-sign,
|
|
336
358
|
dotfiles, symlinks, and runs with jq hidden) and checks both checkers reject every one.
|
|
359
|
+
Its exit status matches its last line: `0` ALL MUTATIONS REJECTED, `1` MUTATION TEST FAILED (a
|
|
360
|
+
mutation was accepted), `2` PARTIAL (none survived but some were skipped, e.g. no-install runs
|
|
361
|
+
without the kit). Wire CI on the exit status; only `0` is a full pass.
|
|
337
362
|
|
|
338
363
|
## Backup & restore
|
|
339
364
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdip-agent-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Give any AI agent its own MDIP (did:mdip) identity on the SELF (https://selfid.com) / Keychain hyperswarm network: keymaster wallet, DID, SELF Public Profile molecule, backups, challenges and delegated-authority credentials.",
|
|
5
5
|
"homepage": "https://selfid.com",
|
|
6
6
|
"type": "module",
|
package/test/vectors-negative.sh
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
set -uo pipefail
|
|
10
10
|
cd "$(dirname "$0")/.."
|
|
11
11
|
root=$(mktemp -d "${TMPDIR:-/tmp}/mdip-neg.XXXXXX"); trap 'rm -rf "$root"' EXIT
|
|
12
|
-
fail=0; n=0
|
|
12
|
+
fail=0; n=0; killed=0; skipped=0; survived=0
|
|
13
13
|
SH=${BASH:-bash} # run the checker under the same bash as this script (e.g. /bin/bash 3.2 on macOS)
|
|
14
14
|
resum() { local d=$1 f; ( cd "$d" && for f in $(ls | LC_ALL=C sort); do [ "$f" = SHA256SUMS ] && continue
|
|
15
15
|
printf '%s %s\n' "$("${OPENSSL:-openssl}" dgst -sha256 -r "$f" | cut -d' ' -f1)" "$f"; done > "$root/sums.tmp" && mv "$root/sums.tmp" SHA256SUMS ); }
|
|
@@ -21,11 +21,11 @@ fresh() { rm -rf "$root/v"; cp -R vectors "$root/v"; }
|
|
|
21
21
|
# expect_fail NAME CHECKER: CHECKER is "sh" (verify-openssl.sh), "shnojq" (same, jq hidden) or "js" (verify-with-kit.js)
|
|
22
22
|
havekit=0; [ -n "$nm" ] && havekit=1 # verify-with-kit.js needs `npm install`
|
|
23
23
|
expect_fail() { n=$((n+1)); local out
|
|
24
|
-
if [ "$2" = js ] && [ $havekit = 0 ]; then echo "skip (no npm install): $1 [js]"; return; fi
|
|
24
|
+
if [ "$2" = js ] && [ $havekit = 0 ]; then skipped=$((skipped+1)); echo "skip (no npm install): $1 [js]"; return; fi
|
|
25
25
|
case $2 in js) out=$(cd "$root/v" && node verify-with-kit.js 2>&1);; shnojq) out=$(cd "$root/v" && PATH="$root/nojq" "$SH" verify-openssl.sh 2>&1);;
|
|
26
26
|
*) out=$("$SH" "$root/v/verify-openssl.sh" 2>&1);; esac
|
|
27
|
-
if [ $? -ne 0 ] && ! printf %s "$out" | grep -q '^ALL VECTORS OK$'; then echo "ok rejected: $1 ($(printf %s "$out" | grep -m1 '^FAIL' | cut -c6-))"
|
|
28
|
-
else echo "FAIL accepted: $1"; fail=1; fi; }
|
|
27
|
+
if [ $? -ne 0 ] && ! printf %s "$out" | grep -q '^ALL VECTORS OK$'; then killed=$((killed+1)); echo "ok rejected: $1 ($(printf %s "$out" | grep -m1 '^FAIL' | cut -c6-))"
|
|
28
|
+
else survived=$((survived+1)); echo "FAIL accepted: $1"; fail=1; fi; }
|
|
29
29
|
did_of() { node -e 'const c=require("crypto"),b=Buffer.concat([Buffer.from("0180041220","hex"),c.createHash("sha256").update(require("fs").readFileSync(process.argv[1])).digest()]);const A="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let n=BigInt("0x"+b.toString("hex")),s="";while(n>0n){s=A[Number(n%58n)]+s;n/=58n}console.log("did:mdip:z"+s)' "$1"; }
|
|
30
30
|
# forge DIR OP JS: edit OP's signed op with JS (on `o`), rewrite signed-op.bin (JCS) + op.json (pretty) consistently,
|
|
31
31
|
# recompute OP's DID into dids.json and resum: a fully self-consistent forgery that keeps the original signature
|
|
@@ -228,5 +228,13 @@ fresh; : > "$C2/.hidden"; expect_fail "unlisted dotfile [js accepted by 29b81bb]
|
|
|
228
228
|
fresh; printf 'x' >> "$C1/challenge.message.bin"; expect_fail "file changed, SHA256SUMS not updated" js
|
|
229
229
|
fresh; sed -i.bak '$d' "$K/SHA256SUMS"; rm -f "$K/SHA256SUMS.bak"; expect_fail "SHA256SUMS missing an entry [js accepted by 29b81bb]" js
|
|
230
230
|
fresh; tail -1 "$K/SHA256SUMS" >> "$K/SHA256SUMS"; expect_fail "SHA256SUMS duplicate entry [js accepted by 29b81bb]" js
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
# count outcomes separately: a skipped mutant never ran, so it is not a rejection
|
|
232
|
+
echo "$n mutations: $killed killed (ran and rejected), $skipped skipped (not run), $survived survived (accepted)"
|
|
233
|
+
[ $((killed+skipped+survived)) = $n ] || { echo "MUTATION TEST FAILED: counts do not add up"; exit 1; }
|
|
234
|
+
if [ $fail != 0 ]; then echo "MUTATION TEST FAILED"; exit 1; fi
|
|
235
|
+
# Exit status carries the same three outcomes as the summary line:
|
|
236
|
+
# 0 = ALL MUTATIONS REJECTED (every mutation ran and was rejected)
|
|
237
|
+
# 1 = MUTATION TEST FAILED (a mutation was accepted, or counts do not add up)
|
|
238
|
+
# 2 = PARTIAL (nothing survived, but some mutations were skipped and not run)
|
|
239
|
+
if [ $skipped = 0 ]; then echo "ALL MUTATIONS REJECTED"; exit 0
|
|
240
|
+
else echo "PARTIAL: $killed of $n mutations ran and were rejected; $skipped skipped need npm install (verify-with-kit.js). Not ALL MUTATIONS REJECTED. (exit 2)"; exit 2; fi
|
package/vectors/README.md
CHANGED
|
@@ -18,6 +18,35 @@ main README under "Known-answer vectors (verify with stock OpenSSL, no install)"
|
|
|
18
18
|
| `make-mdip-fixture.js` | Re-captures `mdip-challenge-1/` against a gatekeeper (publishes throwaway DIDs) |
|
|
19
19
|
| `make-mdip-fixture-2.js` | Re-captures `mdip-challenge-2/` (publishes throwaway DIDs; verifier from the published label mnemonic) |
|
|
20
20
|
|
|
21
|
+
## ext-wycheproof: expected results not authored by this kit
|
|
22
|
+
|
|
23
|
+
kav-1 and the mdip-challenge fixtures were generated by this kit, so "ALL OK" on them shows the checker
|
|
24
|
+
agrees with its own author (thanks Agent Lounge / Fork @skitter). `ext-wycheproof/` adds three cases copied
|
|
25
|
+
byte-for-byte from [C2SP/wycheproof](https://github.com/C2SP/wycheproof)
|
|
26
|
+
`testvectors_v1/ecdsa_secp256k1_sha256_test.json` (file sha256
|
|
27
|
+
`43db761c0a2eae71fb0755d355d5130e28ce64a5b07846cf27e7072082597a81`), test group 1, whose public key is
|
|
28
|
+
`04b838ff…b21832e9`: tcId 7 (valid), tcId 103 (last byte of r modified, invalid) and tcId 145 (last
|
|
29
|
+
byte of s modified, invalid), all over the message `123400` (hex `313233343030`). `source.json` records the
|
|
30
|
+
upstream hex. To check independently, fetch the upstream file yourself and compare `tcId`/`msg`/`sig`/`result`
|
|
31
|
+
against these files. `verify-openssl.sh` runs them with stock OpenSSL.
|
|
32
|
+
|
|
33
|
+
## kav-1 known answers (pinned here too, so this page alone is checkable)
|
|
34
|
+
|
|
35
|
+
| File | Bytes | Value |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `kav-1/message.bin` (JCS of `payload.json`, ASCII, no trailing newline) | 240 | sha256 `4d4523d99bebdd70689f67a80e865349848f520d19ab9537403e56a280dcf64b` |
|
|
38
|
+
| `kav-1/signature.hex` (compact r‖s, low-S) | 64 (128 hex) | `2b61bc63136caf5dbbdfee80d6717d57df09555be0f6c1b0158adc70feb0363c` `2067a7017b2b52fd92fd0e980650118bf5d4e07bc88ee8527f04f6404a37b4d1` |
|
|
39
|
+
| `kav-1/signature.der` | 70 | sha256 `fdc8e19ec10ced978a9dbd5ae599c35fa715d561dd1635bb5cf0360e3acd4508` |
|
|
40
|
+
| `kav-1/pub.pem` | | sha256 `43d15804c3379b189d1d1fbfb391d3c42abf739587297bdb9987eab382bcd131` |
|
|
41
|
+
| private key | 32 | `sha256("mdip-agent-kit kav-1 PUBLIC TEST KEY - never use for anything real")` = `c1433ed3bcadb796140c3bdbe694698f70ba1cf1f57f4e4e5ab789c22a2e3732` |
|
|
42
|
+
|
|
43
|
+
What is independent of the maintainer: you can derive the private key from the label yourself,
|
|
44
|
+
derive the public key from it with stock OpenSSL, rebuild `message.bin` from `payload.json` by JCS,
|
|
45
|
+
and check the signature with that key. The only maintainer-supplied value in that chain is the
|
|
46
|
+
signature, which is the thing under test. "ALL VECTORS OK" alone is the package agreeing with
|
|
47
|
+
itself; compare the values above, and run the tampered negative case (`message-tampered.bin` must
|
|
48
|
+
fail). Suggested by skitter (Agent Lounge).
|
|
49
|
+
|
|
21
50
|
`test/vectors-negative.sh` (shipped in the package) checks that tampered copies of these vectors are rejected.
|
|
22
51
|
|
|
23
52
|
Both checkers pin the known answers (kav-1 hash, signature and key label; every DID in both
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
2bd03647fd7c7771556ae3d9717382a1804ddfc93a76dd9f13dc7d4147a71fc3 pub.pem
|
|
2
|
+
303505fb7a759fc16454e7281f99d847d7d4dc322a675c67a8a173c1e42da73b source.json
|
|
3
|
+
bb5a52f42f9c9261ed4361f59422a1e30036e7c32b270c8807a419feca605023 tc103.msg
|
|
4
|
+
072cbb03270400acc4139b97c655eebdf56f5e831e7ff02eb676f15e1463569f tc103.sig.der
|
|
5
|
+
bb5a52f42f9c9261ed4361f59422a1e30036e7c32b270c8807a419feca605023 tc145.msg
|
|
6
|
+
15709a020a66757730f2fc927a349a74ea32de8705cc7e4bdc3716fb0f70e729 tc145.sig.der
|
|
7
|
+
bb5a52f42f9c9261ed4361f59422a1e30036e7c32b270c8807a419feca605023 tc7.msg
|
|
8
|
+
ff6b0b6277eaf12ed33266ecd9654e3ef7c0d09be0685c41ebde5875aff97326 tc7.sig.der
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cases": [
|
|
3
|
+
{
|
|
4
|
+
"comment": "valid",
|
|
5
|
+
"msg": "313233343030",
|
|
6
|
+
"result": "valid",
|
|
7
|
+
"sig": "3045022100813ef79ccefa9a56f7ba805f0e478584fe5f0dd5f567bc09b5123ccbc983236502206ff18a52dcc0336f7af62400a6dd9b810732baf1ff758000d6f613a556eb31ba",
|
|
8
|
+
"tcId": 7
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"comment": "modifying last byte of r",
|
|
12
|
+
"msg": "313233343030",
|
|
13
|
+
"result": "invalid",
|
|
14
|
+
"sig": "3045022100813ef79ccefa9a56f7ba805f0e478584fe5f0dd5f567bc09b5123ccbc98323e502206ff18a52dcc0336f7af62400a6dd9b810732baf1ff758000d6f613a556eb31ba",
|
|
15
|
+
"tcId": 103
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"comment": "modifying last byte of s",
|
|
19
|
+
"msg": "313233343030",
|
|
20
|
+
"result": "invalid",
|
|
21
|
+
"sig": "3045022100813ef79ccefa9a56f7ba805f0e478584fe5f0dd5f567bc09b5123ccbc983236502206ff18a52dcc0336f7af62400a6dd9b810732baf1ff758000d6f613a556eb313a",
|
|
22
|
+
"tcId": 145
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"publicKeyUncompressed": "04b838ff44e5bc177bf21189d0766082fc9d843226887fc9760371100b7ee20a6ff0c9d75bfba7b31a6bca1974496eeb56de357071955d83c4b1badaa0b21832e9",
|
|
26
|
+
"source": "https://raw.githubusercontent.com/C2SP/wycheproof/main/testvectors_v1/ecdsa_secp256k1_sha256_test.json",
|
|
27
|
+
"sourceSha256": "43db761c0a2eae71fb0755d355d5130e28ce64a5b07846cf27e7072082597a81",
|
|
28
|
+
"testGroup": 1
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
123400
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
123400
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
123400
|
|
Binary file
|
|
@@ -187,6 +187,17 @@ vr_check() { local d=$1 nonce=$2 extra=$3
|
|
|
187
187
|
[ "$(norm $d/verify-response.json)" = "{\"challenge\":\"$(did $d challenge)\",\"credentials\":[],$extra\"fulfilled\":0,\"match\":true,\"requested\":0,\"responder\":\"$(did $d responder-agent)\",\"responseNonce\":\"$nonce\",\"vps\":[]}" ] \
|
|
188
188
|
&& ok "$d verify-response.json == challenge/responder DIDs, match=true, nonce" || bad "$d verify-response.json"; }
|
|
189
189
|
|
|
190
|
+
echo "== ext-wycheproof: externally sourced secp256k1/sha256 vectors (expected results authored by Wycheproof, not this kit)"
|
|
191
|
+
# Copied byte-for-byte from C2SP/wycheproof testvectors_v1/ecdsa_secp256k1_sha256_test.json, test group 1
|
|
192
|
+
# (file sha256 in ext-wycheproof/source.json). Re-derive them yourself from that upstream file; nothing here is ours.
|
|
193
|
+
WP_PUB=04b838ff44e5bc177bf21189d0766082fc9d843226887fc9760371100b7ee20a6ff0c9d75bfba7b31a6bca1974496eeb56de357071955d83c4b1badaa0b21832e9
|
|
194
|
+
sumcheck ext-wycheproof && ok "ext-wycheproof SHA256SUMS (complete)" || bad "ext-wycheproof SHA256SUMS"
|
|
195
|
+
[ "$(openssl pkey -pubin -in ext-wycheproof/pub.pem -outform DER 2>/dev/null | od -An -v -tx1 | tr -d ' \n' | tail -c 130)" = $WP_PUB ] && ok "PINNED: Wycheproof group 1 public key" || bad "ext-wycheproof pub.pem is not the Wycheproof group 1 key"
|
|
196
|
+
[ "$(od -An -v -tx1 ext-wycheproof/tc7.msg | tr -d ' \n')" = 313233343030 ] && ok "PINNED: Wycheproof message bytes \"123400\"" || bad "ext-wycheproof message changed"
|
|
197
|
+
v ext-wycheproof/pub.pem ext-wycheproof/tc7.sig.der ext-wycheproof/tc7.msg && ok "Wycheproof tcId 7 (valid) verifies" || bad "Wycheproof tcId 7 (valid) rejected"
|
|
198
|
+
v ext-wycheproof/pub.pem ext-wycheproof/tc103.sig.der ext-wycheproof/tc103.msg && bad "Wycheproof tcId 103 (last byte of r modified) verified (must not)" || ok "Wycheproof tcId 103 (last byte of r modified) rejected"
|
|
199
|
+
v ext-wycheproof/pub.pem ext-wycheproof/tc145.sig.der ext-wycheproof/tc145.msg && bad "Wycheproof tcId 145 (last byte of s modified) verified (must not)" || ok "Wycheproof tcId 145 (last byte of s modified) rejected"
|
|
200
|
+
|
|
190
201
|
echo "== mdip-challenge-1: real MDIP create operations (challenge -> response)"
|
|
191
202
|
d=mdip-challenge-1
|
|
192
203
|
sumcheck $d && ok "$d SHA256SUMS (complete)" || bad "$d SHA256SUMS"
|