device-identity: what a machine is, as a chain of signed statements checked offline (manufacturer credential, owners, firmware attestation, anchored on 28001; 175/175 with the AIP-23 verifier); conformance: the device-bundle vectors and the rules that cover them; control-plane console; README
This commit is contained in:
1 parent
5fb38c5d0b
commit
54028e07f4
215 files changed
+77436
-56
No files matched your search
@@ -10,7 +10,8 @@
|
||||
// and its classical impostor (Ed25519), a random envelope nobody notarized, a small dataset
|
||||
// (random salts), the presentations of one identity credential with their forged siblings
|
||||
// (six hybrid key pairs), and the transaction of the recorded receipt READ from testnet 28001 (two
|
||||
// eth_ calls; nothing is sent). With --tot everything is made anew
|
||||
// eth_ calls; nothing is sent). With --tot everything is made anew; with --refa <name>
|
||||
// ONE source is made anew (its vectors change, the others stay byte for byte)
|
||||
//
|
||||
// A vector is { artifact, input, expected: { verdict, failed, levels } }. An INVALID vector names its `base` (a vector that is not
|
||||
// INVALID) and its `mutation`: ONE operation (set, remove, add at one JSON path) applied to the base input, so that it differs from the
|
||||
@@ -31,6 +32,7 @@ import * as BAZA from '../verifiable-data/baza.mjs';
|
||||
import { newAgentIdentity, openLedger, agentIdFromKey, sessionId, canonical as canonicLedger } from '../agents/agent-ledger.mjs';
|
||||
import { construieste as lantAI } from '../ai-trust/lant-de-incredere.mjs';
|
||||
import * as ID from '../identity/identity.mjs';
|
||||
import * as DV from '../device-identity/device.mjs';
|
||||
import { hartaPublica, LEVELS } from './reguli.mjs';
|
||||
|
||||
const AICI = path.dirname(fileURLToPath(import.meta.url));
|
||||
@@ -75,10 +77,12 @@ function invalid(id, title, bazaId, op, failed, { levels = {}, exercises = null,
|
||||
}
|
||||
|
||||
// ---------- the fresh sources: a key, randomness, the chain ----------
|
||||
async function proaspat(tot) {
|
||||
async function proaspat(tot, refa = []) {
|
||||
// what is already in surse-proaspete.json STAYS (the vectors derived from it stay byte for byte); only what is missing is made.
|
||||
// --tot remakes everything (other keys, other salts: every vector derived from the fresh sources changes).
|
||||
// --refa <name> remakes ONE source (its producers changed): the vectors derived from it change, every other vector stays.
|
||||
const P = !tot && fs.existsSync(PROASPETE) ? JSON.parse(fs.readFileSync(PROASPETE, 'utf8')) : { v: 1, kind: 'aere-conformance-fresh-sources', at: new Date().toISOString() };
|
||||
for (const n of refa) { if (!(n in PROASPETE_IN_PLUS)) throw new Error('--refa: no fresh source named ' + n + ' (one of: ' + Object.keys(PROASPETE_IN_PLUS).join(', ') + ')'); delete P[n]; }
|
||||
const AT = new Date().toISOString(); const facute = []; const INT = intrariKinds();
|
||||
if (!P.signedHead) { // a signed tree head: three envelopes in a hash-chained log, the head signed with an ML-DSA-65 key that exists only in this call
|
||||
let prev = '0x' + '00'.repeat(32);
|
||||
@@ -252,6 +256,150 @@ const PROASPETE_IN_PLUS = {
|
||||
linkOtherClaims: prezD([una({ scope: ingust })], phone, { reveal: ['age_over_18', 'name'] }),
|
||||
linkOtherAudience: prezD([una({ scope: { ...scop, audiences: ['https://other.example'] } })], phone) } };
|
||||
},
|
||||
// a device (roadmap 31): one manufacturer, two owners, a second identity the first owner sells to, a stranger, another manufacturer,
|
||||
// a device key and a clone's key (six hybrid key pairs and two ML-DSA-65 keys that exist only in this call), every link made by the
|
||||
// producers of the device module at a fixed time; and the forged siblings only a key holder can make, signed again with the
|
||||
// published formulas (signLink, signAttestation)
|
||||
device: async () => {
|
||||
const T0 = Math.floor(Date.now() / 1000) * 1000 - 3600000, zi = 86400; const at = (s) => new Date(T0 + s * 1000).toISOString(), la = (s) => new Date(T0 + s * 1000);
|
||||
const [mfr, op, buyer, strain, imp, second] = Array.from({ length: 6 }, () => ID.generateKeys()); const dev = DV.generateDeviceKey(), clone = DV.generateDeviceKey();
|
||||
const AUD = 'https://gateway.example', NONCE = 'n-' + crypto.randomBytes(8).toString('hex'), LID = 'https://manufacturer.example/status/1', MODEL = 'AX-200';
|
||||
// the firmware image and its Proof of Software attestation are the fixtures of the device module (the attestation was written by the Proof of Software tool)
|
||||
const IMG1 = Buffer.from('conformance firmware 1.0.0', 'utf8'), IMG2 = fs.readFileSync(fileURLToPath(new URL('../device-identity/fixturi/firmware-2.0.0.bin', import.meta.url))), POS = citeste(new URL('../device-identity/fixturi/atestare-firmware.json', import.meta.url));
|
||||
const face = (o = {}) => DV.manufacture({ manufacturer: mfr, deviceKey: dev.publicKey, model: MODEL, serial: 'SN-0001', validFrom: at(-30 * zi), validUntil: at(3650 * zi), status: { list: LID, index: 7 }, now: la(-30 * zi), ...o });
|
||||
const cred = face(); const lista = (o = {}) => ID.createStatusList({ issuer: mfr, id: LID, validFrom: at(-3600), validUntil: at(zi), now: la(-3600), ...o });
|
||||
const rel = (o = {}) => DV.releaseFirmware({ signer: mfr, model: MODEL, version: '2.0.0', sequence: 2, image: IMG2, now: la(-5 * zi), ...o });
|
||||
const fw2 = rel(), fw1 = rel({ version: '1.0.0', sequence: 1, image: IMG1, now: la(-20 * zi) });
|
||||
const pol = (o = {}) => DV.firmwarePolicy({ manufacturer: mfr, model: MODEL, minSequence: 1, validFrom: at(-3600), validUntil: at(zi), now: la(-3600), ...o });
|
||||
const t1 = DV.transferOwnership({ from: mfr, to: op.public, manufacture: cred, now: la(-10 * zi) }), t2 = DV.transferOwnership({ from: op, to: buyer.public, manufacture: cred, transfers: [t1], now: la(-2 * zi) });
|
||||
const cap0 = DV.ownershipHead(cred), cap1 = DV.ownershipHead(cred, [t1]);
|
||||
const aut = (owner, cap, o = {}) => DV.authorize({ owner, deviceId: dev.deviceId, ownership: cap, actions: ['door.unlock', 'telemetry.publish'], notBefore: at(-zi), notAfter: at(zi), now: la(-zi), ...o });
|
||||
// a status record: the manufacturer signs as the manufacturer of the credential (no ownership head), anybody else under the head given
|
||||
const stare = (by, state, seq, cap, o = {}) => DV.statusRecord({ by, state, seq, validUntil: at(zi), now: la(-600), ...(by === mfr ? { manufacture: cred } : { deviceId: dev.deviceId, ownership: cap }), ...o });
|
||||
const atest = (o = {}) => DV.attest({ device: dev, nonce: NONCE, audience: AUD, firmware: fw2, ownership: cap1, action: 'telemetry.publish', now: la(60), ...o });
|
||||
const A1 = aut(op, cap1), X1 = atest(); const plic = DV.proofOfDevice(X1, buildProof);
|
||||
const reSemn = (scop, link, k, f) => { const st = clona(link.statement); f(st); return { statement: st, signature: DV.signLink(scop, st, k) }; };
|
||||
const reCred = (c, k, f) => { const st = clona(c.statement); f(st); return { statement: st, signature: ID.signText('credential', ID.canonical(st), k) }; };
|
||||
const reAtest = (x, f) => { const st = clona(x.statement); f(st); return { statement: st, signature: DV.signAttestation(st, dev) }; };
|
||||
const fals = 'aere-id:' + '11'.repeat(20);
|
||||
// sold on: the first owner transfers the device to a second identity (a buyer, or another key of its own: the chain cannot tell)
|
||||
const tx = DV.transferOwnership({ from: op, to: second.public, manufacture: cred, transfers: [t1], now: la(-300) }), capx = DV.ownershipHead(cred, [t1, tx]);
|
||||
// sold, and bought back: the first owner owns the device again, under a third head
|
||||
const t3 = DV.transferOwnership({ from: buyer, to: op.public, manufacture: cred, transfers: [t1, t2], now: la(-zi) }), cap3 = DV.ownershipHead(cred, [t1, t2, t3]);
|
||||
const credAlt = face({ deviceKey: clone.publicKey, serial: 'SN-0002', status: { list: LID, index: 8 } }); // ANOTHER device of the same manufacturer
|
||||
const clasic = (() => { const ed = crypto.generateKeyPairSync('ed25519'); const spki = ed.publicKey.export({ type: 'spki', format: 'der' }).toString('base64'); const id = 'aere-device:' + crypto.createHash('sha256').update(Buffer.from(spki, 'base64')).digest('hex').slice(0, 40);
|
||||
const st = clona(X1.statement); st.key = spki; st.deviceId = id;
|
||||
return { credential: reCred(cred, mfr, (s) => { s.claims.deviceKey = spki; s.claims.deviceId = id; }), attestation: { statement: st, signature: { alg: 'ml-dsa-65', value: crypto.sign(null, Buffer.from('aere-device/v1/attestation\n' + ID.canonical(st), 'utf8'), ed.privateKey).toString('base64') } } }; })();
|
||||
const lung = (() => { const l = []; let de = mfr; const chei = [op, buyer]; for (let i = 0; i < 65; i++) { const catre = chei[i % 2]; l.push(DV.transferOwnership({ from: de, to: catre.public, manufacture: cred, transfers: l, now: la(-10 * zi + i) })); de = catre; } return l; })();
|
||||
// ---- (2026-10-06, after a second adversarial review) one input for each condition that had none: the order of a list, an ending
|
||||
// 30 s past, a form the producers refuse to write (signed by hand with the published formulas), a device id written otherwise
|
||||
const r2 = (() => {
|
||||
const LID2 = 'https://manufacturer.example/status/2';
|
||||
const rehash = (o) => { o.statementHash = sha256(Buffer.from(JSON.stringify(o.statement), 'utf8')); return o; };
|
||||
const notPoS = (() => { const a = clona(POS); a.statement.kind = 'aere-proof-of-something-else'; return rehash(a); })();
|
||||
const idMare = 'aere-device:' + dev.deviceId.slice('aere-device:'.length).toUpperCase();
|
||||
// the same device key certified by ANOTHER manufacturer, which then says the device is retired
|
||||
const credImp = DV.manufacture({ manufacturer: imp, deviceKey: dev.publicKey, model: MODEL, serial: 'SN-0001', validFrom: at(-zi), validUntil: at(3650 * zi), now: la(-zi) });
|
||||
return {
|
||||
trustedBoth: [mfr.id, imp.id],
|
||||
records: { suspendedFive: stare(op, 'suspended', 5, cap1), activeThree: stare(op, 'active', 3, cap1), activeFive: stare(op, 'active', 5, cap1), activeSix: stare(op, 'active', 6, cap1),
|
||||
activeNumberNotWhole: reSemn('status', stare(op, 'active', 1, cap1), op, (s) => { s.seq = 1.5; }), suspendedNumberAsText: reSemn('status', stare(op, 'suspended', 7, cap1), op, (s) => { s.seq = '7'; }),
|
||||
activeExpired30s: stare(op, 'active', 1, cap1, { now: la(-3600), validUntil: at(35) }),
|
||||
activeValidityWithOffset: reSemn('status', stare(op, 'active', 1, cap1), op, (s) => { s.validUntil = s.validUntil.slice(0, -1) + '+03:00'; }),
|
||||
retiredByManufacturerUpperCaseId: reSemn('status', stare(mfr, 'retired', 1, null), mfr, (s) => { s.deviceId = idMare; }),
|
||||
activeUpperCaseId: reSemn('status', stare(op, 'active', 1, cap1), op, (s) => { s.deviceId = idMare; }),
|
||||
retiredByOwnerIdWithSpace: reSemn('status', stare(op, 'retired', 3, cap1), op, (s) => { s.deviceId = dev.deviceId + ' '; }),
|
||||
retiredByOtherManufacturer: DV.statusRecord({ by: imp, manufacture: credImp, state: 'retired', seq: 1, validUntil: at(zi), now: la(-600) }) },
|
||||
lists: { otherId: ID.createStatusList({ issuer: mfr, id: LID2, validFrom: at(-3600), validUntil: at(zi), now: la(-3600) }),
|
||||
otherIdRevoked: ID.createStatusList({ issuer: mfr, id: LID2, revoked: [7], validFrom: at(-3600), validUntil: at(zi), now: la(-3600) }), expired30s: lista({ validFrom: at(-3 * zi), validUntil: at(35), now: la(-3 * zi) }) },
|
||||
policies: { floorNegative: reSemn('firmware-policy', pol(), mfr, (s) => { s.minSequence = -1; }), expired30s: pol({ validFrom: at(-7200), validUntil: at(35), now: la(-7200) }) },
|
||||
manufactureExpired30s: face({ validUntil: at(35) }), manufactureBeginsInTolerance: face({ validFrom: at(95) }),
|
||||
manufactureSelectiveDisclosure: reCred(cred, mfr, (s) => { s.sd = ['x']; }),
|
||||
firmwareNamesNotProofOfSoftware: reSemn('firmware', rel(), mfr, (s) => { s.softwareAttestationHash = notPoS.statementHash; }), notProofOfSoftware: notPoS,
|
||||
authorizationEndWithoutZone: reSemn('authorization', A1, op, (s) => { s.notAfter = s.notAfter.slice(0, -1); }),
|
||||
attestationOld330s: atest({ now: la(-265) }), attestationOld300s: atest({ now: la(-235) }),
|
||||
envelopeStatementOtherKind: (() => { const e = clona(plic); e.statement.kind = 'aere-proof-of-something-else'; return rehash(e); })(),
|
||||
chainOf64: lung.slice(0, 64) };
|
||||
})();
|
||||
return { r2, at: at(0), now: at(65), later: at(3665), audience: AUD, nonce: NONCE, trusted: [mfr.id], strangerId: strain.id,
|
||||
manufacture: cred, firmware: fw2, firmwareWithSoftware: rel({ softwareAttestation: POS }), software: POS, transfers: [t1, t2], authorization: A1, attestation: X1, envelope: plic,
|
||||
reading: { statementHash: plic.statementHash, at: Math.floor((T0 + 100000) / 1000), chainId: 28001 }, readingEarlier: Math.floor((T0 - 600000) / 1000),
|
||||
lists: { clean: lista(), revoked: lista({ revoked: [7] }), unreadable: (() => { const st = clona(lista().statement); st.encodedList = Buffer.from('not gzip', 'utf8').toString('base64url'); return { statement: st, signature: ID.signText('status-list', ID.canonical(st), mfr) }; })(),
|
||||
// a list with the same id signed by ANOTHER manufacturer (it recalls the device), and the manufacturer's own list, expired
|
||||
byAnotherManufacturer: ID.createStatusList({ issuer: imp, id: LID, revoked: [7], validFrom: at(-3600), validUntil: at(zi), now: la(-3600) }), expired: lista({ validFrom: at(-3 * zi), validUntil: at(-zi), now: la(-3 * zi) }),
|
||||
// the manufacturer's list, recalling the device, with a validity that is not a time (signed by hand)
|
||||
validityNotATime: (() => { const st = clona(lista({ revoked: [7] }).statement); st.validUntil = 'next year'; return { statement: st, signature: ID.signText('status-list', ID.canonical(st), mfr) }; })() },
|
||||
policies: { current: pol(), floorThree: pol({ minSequence: 3 }), retracts: pol({ retracted: [fw2.statement.digest] }),
|
||||
// a policy of the manufacturer for ANOTHER model; one that expired; and one signed by hand whose retracted entry is the 64 hex digits of this release without 0x (the producer refuses to write it)
|
||||
otherModel: pol({ model: 'BX-1', minSequence: 0 }), expired: pol({ validFrom: at(-7200), validUntil: at(-10), now: la(-7200) }),
|
||||
retractedNotADigest: reSemn('firmware-policy', pol(), mfr, (s) => { s.retracted = [fw2.statement.digest.slice(2)]; }),
|
||||
// one not in force yet; two more that cannot be read (signed by hand); and one whose tooling wrote the retracted digest in upper case
|
||||
notYet: pol({ validFrom: at(zi), validUntil: at(2 * zi) }), floorNotANumber: reSemn('firmware-policy', pol(), mfr, (s) => { s.minSequence = '1'; }), validityNotATime: reSemn('firmware-policy', pol(), mfr, (s) => { s.validUntil = 'next week'; }),
|
||||
retractsUpperCase: reSemn('firmware-policy', pol(), mfr, (s) => { s.retracted = ['0x' + fw2.statement.digest.slice(2).toUpperCase()]; }),
|
||||
// a policy of a version this verifier does not read (it retracts the release), signed by hand
|
||||
otherVersion: reSemn('firmware-policy', pol({ retracted: [fw2.statement.digest] }), mfr, (s) => { s.v = 2; }) },
|
||||
records: { active: stare(op, 'active', 1, cap1), retiredByManufacturer: stare(mfr, 'retired', 1, null), suspendedByOwner: stare(op, 'suspended', 2, cap1), retiredByStranger: stare(strain, 'retired', 9, cap1), activeLaterByOwner: stare(op, 'active', 9, cap1),
|
||||
retiredByOwner: stare(op, 'retired', 3, cap1),
|
||||
// the owner's retirement in a record that names NO ownership head: signed by hand with the published formula (the producer refuses to write one)
|
||||
retiredByOwnerNoHead: reSemn('status', stare(op, 'retired', 3, cap1), op, (s) => { s.ownership = null; }),
|
||||
// the owner's keys under an id they do not derive; the manufacturer's retirement of ANOTHER device; a retirement the manufacturer dated 120 s after the verifier's clock
|
||||
retiredOwnerKeysOtherId: reSemn('status', stare(op, 'retired', 9, cap1), op, (s) => { s.by.id = fals; }),
|
||||
retiredOtherDevice: DV.statusRecord({ by: mfr, manufacture: credAlt, state: 'retired', seq: 1, validUntil: at(zi), now: la(-600) }),
|
||||
retiredByManufacturerAhead: stare(mfr, 'retired', 1, null, { now: la(185) }),
|
||||
// after the sale to the second identity: its own "active"; and what the FIRST owner signed (before the sale, under its own head; and under the new head)
|
||||
activeBySecond: stare(second, 'active', 1, capx, { now: la(-100) }), retiredByFirstOwner: stare(op, 'retired', 1, cap1, { now: la(-900) }), suspendedByFirstOwner: stare(op, 'suspended', 1, cap1, { now: la(-900) }),
|
||||
retiredByFirstOwnerUnderNewHead: stare(op, 'retired', 2, capx, { now: la(-50) }),
|
||||
// bought back: the owner's "active" under its third head
|
||||
activeUnderThirdHead: stare(op, 'active', 1, cap3),
|
||||
// suspension and time: a suspension by the manufacturer; one of the owner whose record has expired; an "active" that has expired; a
|
||||
// second record of the owner with the number of its "active" that says suspended; a retirement whose date is not a time (signed by
|
||||
// hand); a retirement the manufacturer dated 30 s after the verifier's clock (inside the tolerance)
|
||||
suspendedByManufacturer: stare(mfr, 'suspended', 1, null), suspendedByOwnerExpired: stare(op, 'suspended', 2, cap1, { now: la(-3 * zi), validUntil: at(-zi) }), activeExpired: stare(op, 'active', 1, cap1, { now: la(-3 * zi), validUntil: at(-zi) }),
|
||||
suspendedSameNumber: stare(op, 'suspended', 1, cap1), retiredByManufacturerNoDate: reSemn('status', stare(mfr, 'retired', 1, null), mfr, (s) => { s.at = 'yesterday'; }), retiredByManufacturerJustAhead: stare(mfr, 'retired', 1, null, { now: la(95) }),
|
||||
// a record of the manufacturer in a version this verifier does not read (it says retired), signed by hand
|
||||
retiredByManufacturerOtherVersion: reSemn('status', stare(mfr, 'retired', 1, null), mfr, (s) => { s.v = 2; }) },
|
||||
resold: { transfers: [t1, tx], authorization: aut(second, capx, { now: la(-200), notBefore: at(-200) }), attestation: atest({ ownership: capx }) },
|
||||
boughtBack: { transfers: [t1, t2, t3], authorization: aut(op, cap3, { now: la(-3600), notBefore: at(-3600) }), attestation: atest({ ownership: cap3 }) },
|
||||
attestationJustAhead: atest({ now: la(95) }),
|
||||
forged: {
|
||||
manufactureNotYet: face({ validFrom: at(zi) }),
|
||||
manufactureHolderOtherId: reCred(cred, mfr, (s) => { s.holder = { id: fals, keys: mfr.public }; }), manufactureHolderOtherKeys: reCred(cred, mfr, (s) => { s.holder = { id: mfr.id, keys: op.public }; }),
|
||||
deviceKeyNotCanonical: reCred(cred, mfr, (s) => { s.claims.deviceKey = dev.publicKey + '='; }), attestationKeyNotCanonical: reAtest(X1, (s) => { s.key = dev.publicKey + '='; }),
|
||||
transferGiverId: reSemn('transfer', t1, mfr, (s) => { s.from.id = fals; }), transferPosition: reSemn('transfer', t2, op, (s) => { s.seq = 7; }),
|
||||
authorizationNotYet: aut(op, cap1, { notBefore: at(3600) }), authorizationAfterAttestation: aut(op, cap1, { notBefore: at(123) }), authorizationEndedBetween: aut(op, cap1, { notAfter: at(62) }),
|
||||
attestationOtherSequence: atest({ firmware: { digest: fw2.statement.digest, sequence: 9 } }), attestationOtherDigest: atest({ firmware: { digest: fw1.statement.digest, sequence: 2 } }),
|
||||
attestationAhead: atest({ now: la(185) }),
|
||||
// an attestation dated 35 s ahead (inside the tolerance), for the two conditions of the authorization window that need one
|
||||
attestationAheadInTolerance: atest({ now: la(100) }), authorizationBeginsAfterTolerance: aut(op, cap1, { notBefore: at(135) }), authorizationEndsBeforeAttestation: aut(op, cap1, { notAfter: at(66) }),
|
||||
transferFuture: reSemn('transfer', t2, op, (s) => { s.at = at(30 * zi); }),
|
||||
manufactureHardwareRoot: reCred(cred, mfr, (s) => { s.claims.hardwareRoot = { type: 'ek-certificate', evidence: 'AAAA' }; }),
|
||||
firmwareSignerId: reSemn('firmware', fw2, mfr, (s) => { s.signer.id = fals; }), authorizationOwnerId: reSemn('authorization', A1, op, (s) => { s.owner.id = fals; }),
|
||||
manufacturerImpostor: reCred(DV.manufacture({ manufacturer: imp, deviceKey: dev.publicKey, model: MODEL, serial: 'SN-0001', validFrom: at(-30 * zi), validUntil: at(3650 * zi), status: { list: LID, index: 7 }, now: la(-30 * zi) }), imp, (s) => { s.issuer.id = mfr.id; s.holder.id = mfr.id; }),
|
||||
manufactureHolder: reCred(cred, mfr, (s) => { s.holder = { id: op.id, keys: op.public }; }),
|
||||
manufactureExpired: face({ validFrom: at(-30 * zi), validUntil: at(-zi) }),
|
||||
deviceKeyClassical: clasic.credential, attestationClassical: clasic.attestation,
|
||||
deviceId: reCred(cred, mfr, (s) => { s.claims.deviceId = clone.deviceId; }),
|
||||
manufactureTime: reCred(cred, mfr, (s) => { s.validUntil = 'next year'; }),
|
||||
firmwareByStranger: DV.releaseFirmware({ signer: strain, model: MODEL, version: '2.0.0', sequence: 2, image: IMG2, now: la(-5 * zi) }),
|
||||
firmwareOtherModel: rel({ model: 'BX-1' }),
|
||||
firmwareOld: fw1, attestationOfOld: atest({ firmware: fw1 }),
|
||||
transferFromFormerOwner: reSemn('transfer', t2, mfr, (s) => { s.from = { id: mfr.id, keys: mfr.public }; }),
|
||||
transferPrev: reSemn('transfer', t2, op, (s) => { s.prev = cap0; }),
|
||||
transferBackdated: reSemn('transfer', t2, op, (s) => { s.at = at(-20 * zi); }),
|
||||
transferOtherDevice: reSemn('transfer', t2, op, (s) => { s.deviceId = clone.deviceId; }),
|
||||
transferIds: reSemn('transfer', t2, op, (s) => { s.to.id = fals; }),
|
||||
transferByStranger: { statement: t2.statement, signature: DV.signLink('transfer', t2.statement, strain) },
|
||||
chainLong: lung,
|
||||
authorizationByFormerOwner: aut(mfr, cap1), authorizationOldHead: aut(op, cap0), authorizationExpired: aut(op, cap1, { notBefore: at(-2 * zi), notAfter: at(-3600) }),
|
||||
authorizationOtherAction: aut(op, cap1, { actions: ['door.unlock'] }), authorizationOtherDevice: DV.authorize({ owner: op, deviceId: clone.deviceId, ownership: cap1, actions: ['door.unlock', 'telemetry.publish'], notBefore: at(-zi), notAfter: at(zi), now: la(-zi) }),
|
||||
authorizationPurpose: { statement: A1.statement, signature: DV.signLink('status', A1.statement, op) },
|
||||
cloneOwnId: DV.attest({ device: clone, nonce: NONCE, audience: AUD, firmware: fw2, ownership: cap1, action: 'telemetry.publish', now: la(60) }),
|
||||
cloneClaimsId: (() => { const st = clona(X1.statement); st.key = clone.publicKey; return { statement: st, signature: DV.signAttestation(st, clone) }; })(),
|
||||
cloneSigns: { statement: X1.statement, signature: DV.signAttestation(X1.statement, clone) },
|
||||
attestationOldHead: atest({ ownership: cap0 }),
|
||||
hardwareRoot: (() => { const st = clona(X1.statement); st.hardwareRoot = { type: 'tpm2-quote', evidence: 'AAAA' }; return { statement: st, signature: DV.signAttestation(st, dev) }; })(),
|
||||
envelopeOfAnother: DV.proofOfDevice(atest({ now: la(61) }), buildProof) } };
|
||||
},
|
||||
};
|
||||
|
||||
// ---------- fixed inputs of the AIP-23 kinds (the inputs of the published AIP-23 kind vectors) ----------
|
||||
@@ -591,6 +739,265 @@ function construieste() {
|
||||
pl('delegation-credential', 'the link is for another credential', F.linkOtherCredential, ['identity.delegation-credential'], 'the holder gave a link scoped to another credential id');
|
||||
pl('delegation-claims', 'the phone shows a claim outside the scope of its link', F.linkOtherClaims, ['identity.delegation-claims'], 'the holder gave a link for one claim; the phone disclosed two');
|
||||
pl('delegation-audience', 'the link is for another verifier', F.linkOtherAudience, ['identity.delegation-audience'], 'the holder gave a link scoped to another audience'); }
|
||||
// (J) a device bundle (device identity): the manufacturer's credential for the device key, a firmware release, the ownership chain,
|
||||
// the owner's authorization, the device's fresh attestation, judged with what the verifier brings (clock, nonce, audience, trusted
|
||||
// manufacturers, the recall list, the firmware policy, the status records, its reading of the notarized envelope)
|
||||
{ const DK = Object.keys(HARTA).filter((r) => r.startsWith('device.')); const X = P.device; const A = 'device-bundle'; const F = X.forged; const T1 = [X.transfers[0]];
|
||||
const pachet = (o = {}) => DV.bundle({ manufacture: X.manufacture, firmware: X.firmware, transfers: T1, authorization: X.authorization, attestation: X.attestation, ...o });
|
||||
const intrare = (b, o = {}) => ({ bundle: b, now: X.now, nonce: X.nonce, audience: X.audience, trustedManufacturers: X.trusted, statusLists: [X.lists.clean], firmwarePolicies: [X.policies.current], statusRecords: [X.records.active], ...o });
|
||||
const AP = { authenticity: 'PASSED' }, OPRIT = { authenticity: 'NOT_MEASURED' }, NI = { integrity: 'NOT_MEASURED' }, NA = { authenticity: 'NOT_MEASURED' }; const schimba = (c) => (c[0] === 'A' ? 'B' : 'A') + c.slice(1);
|
||||
const src = 'producers (device identity: manufacture, releaseFirmware, firmwarePolicy, transferOwnership, authorize, statusRecord, attest, proofOfDevice), five hybrid key pairs and two ML-DSA-65 device keys made and discarded at generation';
|
||||
const bd = 'device-bundle/sold-once.valid', bs = 'device-bundle/with-software.valid', bw = 'device-bundle/witnessed.valid', bm = 'device-bundle/manufacture-only.partial', bc = 'device-bundle/chain-only.partial', ba = 'device-bundle/attestation-only.partial';
|
||||
valid(bd, A, 'a device made by a manufacturer the verifier trusts, sold once, authorized by its owner, attesting to the verifier\'s nonce; the recall list, the firmware policy and the status registry were read', src, intrare(pachet()), { exercises: DK, levels: AP });
|
||||
valid(bs, A, 'the same device, the release names a Proof of Software attestation of its image and the verifier is handed it', src, intrare(pachet({ firmware: X.firmwareWithSoftware }), { softwareAttestation: X.software }), { exercises: DK, levels: AP });
|
||||
valid(bw, A, 'the same device with the AIP-23 envelope of its attestation and the verifier\'s own reading of when that envelope was on the chain', src, intrare(pachet({ anchor: { ...X.envelope, notarization: { chainId: X.reading.chainId, note: 'a claim written for this vector: nothing was notarized' } } }), { anchors: [X.reading] }), { exercises: DK, levels: AP });
|
||||
// what was not brought or not read: nothing fails, and the verdict is not VALID
|
||||
const fara = (id, titlu, baza, op, levels, o = {}) => valid(id, A, titlu, src, aplica(V.find((x) => x.id === baza).input, op), { exercises: DK, verdict: 'PARTIAL', levels: { ...AP, ...levels }, base: baza, mutation: op, ...o });
|
||||
const dinProd = (id, titlu, input, levels) => valid(id, A, titlu, src, input, { exercises: DK, verdict: 'PARTIAL', levels: { ...AP, ...levels } });
|
||||
fara('device-bundle/no-nonce.partial', 'the verifier gives no nonce: an old attestation could be replayed', bd, { op: 'remove', path: ['nonce'] }, NI);
|
||||
fara('device-bundle/no-audience.partial', 'the verifier gives no audience: an attestation made for another verifier would be accepted', bd, { op: 'remove', path: ['audience'] }, NI);
|
||||
fara('device-bundle/no-trusted-manufacturers.partial', 'the verifier names no manufacturer it trusts: anyone can sign a manufacture credential', bd, { op: 'remove', path: ['trustedManufacturers'] }, NA);
|
||||
fara('device-bundle/recall-list-not-read.partial', 'the manufacturer\'s recall list was not handed to the verifier', bd, { op: 'remove', path: ['statusLists', 0] }, NI);
|
||||
fara('device-bundle/firmware-policy-not-read.partial', 'no firmware policy was handed: a retracted or outdated firmware cannot be seen', bd, { op: 'remove', path: ['firmwarePolicies', 0] }, NI);
|
||||
fara('device-bundle/status-not-read.partial', 'the status registry was not read: a suspension or a retirement cannot be seen, so the verdict is not VALID', bd, { op: 'remove', path: ['statusRecords', 0] }, NI);
|
||||
fara('device-bundle/status-of-a-stranger.partial', 'the only status record handed is a stranger\'s: it is ignored, and the registry counts as not read', bd, { op: 'set', path: ['statusRecords', 0], value: X.records.retiredByStranger }, NI);
|
||||
fara('device-bundle/no-attestation.partial', 'the bundle brings no attestation: nothing was said by the device now', bd, { op: 'remove', path: ['bundle', 'attestation'] }, NI);
|
||||
fara('device-bundle/no-authorization.partial', 'the bundle brings no authorization: nothing says what the device may do', bd, { op: 'remove', path: ['bundle', 'authorization'] }, NI);
|
||||
fara('device-bundle/no-firmware.partial', 'the bundle brings no firmware release: the digest the device attests names nothing a manufacturer signed', bd, { op: 'remove', path: ['bundle', 'firmware'] }, NI);
|
||||
fara('device-bundle/software-not-read.partial', 'the release names a Proof of Software attestation that was not handed', bs, { op: 'remove', path: ['softwareAttestation'] }, NI);
|
||||
fara('device-bundle/notarization-not-read.partial', 'the envelope claims a notarization and the verifier read nothing on the chain: a claim is not a reading', bw, { op: 'remove', path: ['anchors'] }, { anchoring: 'NOT_MEASURED' });
|
||||
dinProd(bm, 'the manufacture credential alone: who made the device and which key is its key, nothing more', intrare(DV.bundle({ manufacture: X.manufacture }), { statusRecords: [] }), NI);
|
||||
dinProd(bc, 'the manufacture credential and two transfers: the device was sold twice', intrare(DV.bundle({ manufacture: X.manufacture, transfers: X.transfers }), { statusRecords: [] }), NI);
|
||||
dinProd(ba, 'an attestation alone: a key speaking for itself', intrare(DV.bundle({ attestation: X.attestation }), { statusRecords: [] }), NI);
|
||||
dinProd('device-bundle/hardware-root.partial', 'an attestation that carries a hardware root: this verifier does not judge one, and the verdict says so', intrare(pachet({ attestation: F.hardwareRoot })), NA);
|
||||
// revocations that have no effect: VALID stays VALID
|
||||
valid('device-bundle/suspension-lifted.valid', A, 'the owner suspended the device and later said active again: the later record of the same signer holds', src, aplica(aplica(V.find((x) => x.id === bd).input, { op: 'set', path: ['statusRecords', 0], value: X.records.suspendedByOwner }), { op: 'add', path: ['statusRecords', 1], value: X.records.activeLaterByOwner }), { exercises: DK, levels: AP });
|
||||
{ const op = { op: 'add', path: ['statusRecords', 1], value: X.records.retiredByStranger }; valid('device-bundle/retired-by-a-stranger.valid', A, 'a "retired" record signed by a stranger is ignored', src, aplica(V.find((x) => x.id === bd).input, op), { exercises: DK, levels: AP, base: bd, mutation: op }); }
|
||||
// one operation on what the verifier brings, or on a field nobody hashed
|
||||
const d = (nume, titlu, op, r, o = {}) => invalid('device-bundle/sold-once.' + nume, titlu, bd, op, r, o);
|
||||
d('form', 'the file is of another kind', { op: 'set', path: ['bundle', 'kind'], value: 'aere-presentation' }, ['device.form'], { levels: OPRIT });
|
||||
d('form-null', 'the bundle is the JSON value null', { op: 'set', path: ['bundle'], value: null }, ['device.form'], { levels: OPRIT });
|
||||
d('manufacture-form', 'the credential inside is of another type', { op: 'set', path: ['bundle', 'manufacture', 'statement', 'type'], value: 'ExampleMembership' }, ['device.manufacture-form'], { levels: { ...OPRIT, ...NI } });
|
||||
d('manufacturer-trusted', 'the verifier trusts another manufacturer', { op: 'set', path: ['trustedManufacturers'], value: [X.strangerId] }, ['device.manufacturer-trusted']);
|
||||
// the hash of the signed credential is what the first transfer names: on a sold device a changed signature also unhooks the chain
|
||||
d('manufacture-signature-and-chain', 'the ML-DSA-65 half of the manufacturer\'s signature has one character changed on a device that was sold: the signature fails, and the first transfer no longer names this credential', { op: 'set', path: ['bundle', 'manufacture', 'signature', 'mldsa65'], value: schimba(X.manufacture.signature.mldsa65) }, ['device.manufacture-signature', 'device.transfer-prev']);
|
||||
d('manufacture-revoked', 'the manufacturer\'s current recall list has the bit of this device set', { op: 'set', path: ['statusLists', 0], value: X.lists.revoked }, ['device.manufacture-revoked']);
|
||||
d('manufacture-revoked-second-list', 'two current lists of the manufacturer, one of them recalls: a recall is not lifted by another list', { op: 'add', path: ['statusLists', 1], value: X.lists.revoked }, ['device.manufacture-revoked']);
|
||||
d('manufacture-status-list', 'the manufacturer signed a recall list that does not decompress', { op: 'set', path: ['statusLists', 0], value: X.lists.unreadable }, ['device.manufacture-status-list']);
|
||||
d('firmware-form', 'the sequence number of the release is a string', { op: 'set', path: ['bundle', 'firmware', 'statement', 'sequence'], value: '2' }, ['device.firmware-form'], { levels: OPRIT });
|
||||
d('firmware-signature', 'the ML-DSA-65 half of the release signature has one character changed', { op: 'set', path: ['bundle', 'firmware', 'signature', 'mldsa65'], value: schimba(X.firmware.signature.mldsa65) }, ['device.firmware-signature']);
|
||||
d('firmware-signature-version', 'the version label edited after the release was signed', { op: 'set', path: ['bundle', 'firmware', 'statement', 'version'], value: '9.9.9' }, ['device.firmware-signature']);
|
||||
d('firmware-retracted', 'the manufacturer retracted this release: its digest is in the current policy', { op: 'set', path: ['firmwarePolicies', 0], value: X.policies.retracts }, ['device.firmware-retracted']);
|
||||
d('firmware-retracted-second-policy', 'two current policies, one retracts the release: a retraction is not lifted by another policy', { op: 'add', path: ['firmwarePolicies', 1], value: X.policies.retracts }, ['device.firmware-retracted']);
|
||||
d('firmware-rollback', 'the manufacturer raised the floor above this release (sequence 2, floor 3): the firmware is outdated', { op: 'set', path: ['firmwarePolicies', 0], value: X.policies.floorThree }, ['device.firmware-rollback']);
|
||||
d('firmware-rollback-second-policy', 'two current policies, a loose one and a strict one: the strict floor holds', { op: 'add', path: ['firmwarePolicies', 1], value: X.policies.floorThree }, ['device.firmware-rollback']);
|
||||
d('transfer-form', 'the transfer is of another kind', { op: 'set', path: ['bundle', 'transfers', 0, 'statement', 'kind'], value: 'aere-device-transfer-v0' }, ['device.transfer-form'], { levels: { ...OPRIT, ...NI } });
|
||||
d('authorization-form', 'the authorization is of another kind', { op: 'set', path: ['bundle', 'authorization', 'statement', 'kind'], value: 'aere-delegation' }, ['device.authorization-form'], { levels: OPRIT });
|
||||
d('authorization-signature', 'the granted actions widened after the owner signed', { op: 'add', path: ['bundle', 'authorization', 'statement', 'actions', 2], value: 'zz.everything' }, ['device.authorization-signature']);
|
||||
d('status-retired', 'the manufacturer retired the device, and the registry was read', { op: 'add', path: ['statusRecords', 1], value: X.records.retiredByManufacturer }, ['device.status-retired']);
|
||||
d('status-suspended', 'the owner\'s latest record suspends the device', { op: 'add', path: ['statusRecords', 1], value: X.records.suspendedByOwner }, ['device.status-suspended']);
|
||||
d('attestation-form', 'the attestation is of another kind', { op: 'set', path: ['bundle', 'attestation', 'statement', 'kind'], value: 'aere-device-status' }, ['device.attestation-form'], { levels: OPRIT });
|
||||
d('attestation-signature', 'the action edited after the device signed', { op: 'set', path: ['bundle', 'attestation', 'statement', 'action'], value: 'door.unlock' }, ['device.attestation-signature']);
|
||||
d('attestation-signature-scheme', 'the attestation signature declares another scheme', { op: 'set', path: ['bundle', 'attestation', 'signature', 'alg'], value: 'ed25519' }, ['device.attestation-signature']);
|
||||
d('audience', 'the attestation was made for this verifier and is shown to another', { op: 'set', path: ['audience'], value: 'https://another-gateway.example' }, ['device.audience']);
|
||||
d('nonce', 'the verifier gave another nonce: the attestation is a replay', { op: 'set', path: ['nonce'], value: 'n-another' }, ['device.nonce']);
|
||||
d('freshness', 'the verifier\'s clock is an hour after the attestation was made', { op: 'set', path: ['now'], value: X.later }, ['device.freshness']);
|
||||
invalid('device-bundle/retired-then-active.status-retired', 'the manufacturer retired the device and the owner later said active: the manufacturer\'s retirement is never lifted', 'device-bundle/suspension-lifted.valid', { op: 'add', path: ['statusRecords', 2], value: X.records.retiredByManufacturer }, ['device.status-retired']);
|
||||
invalid('device-bundle/with-software.firmware-software', 'the Proof of Software attestation handed was edited: it no longer hashes to what the release names', bs, { op: 'set', path: ['softwareAttestation', 'statement', 'subject', 'version'], value: '2.0.1' }, ['device.firmware-software']);
|
||||
invalid('device-bundle/witnessed.witness-time', 'the verifier read the envelope on the chain ten minutes BEFORE the time the device wrote in its attestation', bw, { op: 'set', path: ['anchors', 0, 'at'], value: X.readingEarlier }, ['device.witness-time']);
|
||||
invalid('device-bundle/witnessed.witness-envelope', 'the envelope edited after its hash', bw, { op: 'set', path: ['bundle', 'anchor', 'statement', 'posture'], value: 'firmware-sequence-9' }, ['device.witness-envelope']);
|
||||
{ const m = (nume, titlu, op) => invalid('device-bundle/manufacture-only.' + nume, titlu, bm, op, ['device.manufacture-signature']);
|
||||
m('manufacture-signature', 'the ML-DSA-65 half of the manufacturer\'s signature has one character changed', { op: 'set', path: ['bundle', 'manufacture', 'signature', 'mldsa65'], value: schimba(X.manufacture.signature.mldsa65) });
|
||||
m('manufacture-signature-ed25519', 'the Ed25519 half of the manufacturer\'s signature has one character changed', { op: 'set', path: ['bundle', 'manufacture', 'signature', 'ed25519'], value: schimba(X.manufacture.signature.ed25519) });
|
||||
m('manufacture-signature-no-ml-dsa', 'the ML-DSA-65 half of the manufacturer\'s signature removed: the classical half alone is not a signature here', { op: 'remove', path: ['bundle', 'manufacture', 'signature', 'mldsa65'] });
|
||||
m('manufacture-signature-model', 'the model edited after the manufacturer signed', { op: 'set', path: ['bundle', 'manufacture', 'statement', 'claims', 'model'], value: 'AX-900' }); }
|
||||
// one change at the producer: a link signed again by its key holder, the paths that moved declared
|
||||
const prod = (baza, nume, titlu, input, changed, r, nota, o = {}) => invalid(baza.replace(/\.[a-z]+$/, '.') + nume, titlu, baza, null, r, { producer: { note: nota, input, changed }, ...o });
|
||||
const cuM = (m) => intrare(DV.bundle({ manufacture: m }), { statusRecords: [] }), M_ = [['bundle', 'manufacture']];
|
||||
prod(bm, 'manufacturer-id', 'an impostor writes the trusted manufacturer\'s id beside its own keys and signs', cuM(F.manufacturerImpostor), M_, ['device.manufacturer-id'], 'another manufacturer wrote the trusted one\'s id beside its own keys and signed with its own keys');
|
||||
prod(bm, 'manufacture-holder', 'the manufacturer names somebody else as the holder of the credential (ownership without a signed transfer)', cuM(F.manufactureHolder), M_, ['device.manufacture-holder'], 'the manufacturer signed the credential with another identity as its holder');
|
||||
prod(bm, 'manufacture-window', 'the manufacture credential expired the day before', cuM(F.manufactureExpired), M_, ['device.manufacture-window'], 'the manufacturer issued the same credential valid until the day before');
|
||||
prod(bm, 'device-key', 'the manufacturer certifies an Ed25519 key as the device key: a classical key is not a post-quantum one because of the field it sits in', cuM(F.deviceKeyClassical), M_, ['device.device-key'], 'the manufacturer signed an Ed25519 public key as the device key, with the id of that key');
|
||||
prod(bm, 'device-id', 'the manufacturer signs a device id that the device key does not derive', cuM(F.deviceId), M_, ['device.device-id'], 'the manufacturer signed another device id beside the device key');
|
||||
prod(bm, 'unreadable', 'the manufacturer signed a validity that is not a time', cuM(F.manufactureTime), M_, ['device.unreadable'], 'the manufacturer signed validUntil "next year"', { levels: OPRIT });
|
||||
const cuL = (t) => intrare(DV.bundle({ manufacture: X.manufacture, transfers: t }), { statusRecords: [] }), L2 = [['bundle', 'transfers', 1]]; const cuT2 = (t) => cuL([X.transfers[0], t]);
|
||||
prod(bc, 'transfer-from', 'THE FORMER OWNER SELLS AGAIN: the second transfer is given by the manufacturer, who had already sold the device', cuT2(F.transferFromFormerOwner), L2, ['device.transfer-from'], 'the manufacturer, no longer the owner, signed the second transfer');
|
||||
prod(bc, 'transfer-prev', 'the second transfer names the manufacture credential instead of the first transfer', cuT2(F.transferPrev), L2, ['device.transfer-prev'], 'the owner signed a second transfer whose prev is not the first transfer');
|
||||
prod(bc, 'transfer-time', 'the second transfer is dated before the first', cuT2(F.transferBackdated), L2, ['device.transfer-time'], 'the owner signed a second transfer dated twenty days before');
|
||||
prod(bc, 'transfer-device', 'the second transfer is a transfer of another device', cuT2(F.transferOtherDevice), L2, ['device.transfer-device'], 'the owner signed a second transfer that names another device id');
|
||||
prod(bc, 'transfer-ids', 'the recipient id of the second transfer is not derived from the recipient keys', cuT2(F.transferIds), L2, ['device.transfer-ids'], 'the owner signed another recipient id beside the recipient keys');
|
||||
prod(bc, 'transfer-signature', 'the second transfer is signed by a stranger in the owner\'s name', cuT2(F.transferByStranger), L2, ['device.transfer-signature'], 'a stranger signed the owner\'s transfer statement');
|
||||
prod(bc, 'chain-length', 'a chain of sixty-five transfers', cuL(F.chainLong), [['bundle', 'transfers']], ['device.chain-length'], 'the two owners transferred the device to one another sixty-five times', { levels: OPRIT });
|
||||
const cuF = (f, x = X.attestation) => intrare(pachet({ firmware: f, attestation: x })), cuA = (a) => intrare(pachet({ authorization: a })), cuX = (x) => intrare(pachet({ attestation: x }));
|
||||
const BF = [['bundle', 'firmware']], BA = [['bundle', 'authorization']], BX = [['bundle', 'attestation']];
|
||||
prod(bd, 'firmware-signer', 'a release signed by somebody who is not the manufacturer of the device', cuF(F.firmwareByStranger), BF, ['device.firmware-signer'], 'a stranger released the same image for the same model and signed with its own keys', { levels: NI });
|
||||
prod(bd, 'firmware-model', 'a genuine release of the manufacturer for another model', cuF(F.firmwareOtherModel), BF, ['device.firmware-model'], 'the manufacturer released the same image for model BX-1');
|
||||
prod(bd, 'firmware-rollback-old-release', 'FIRMWARE ROLLED BACK: the device runs a genuine older release (sequence 1) and the manufacturer\'s floor is 3', intrare(pachet({ firmware: F.firmwareOld, attestation: F.attestationOfOld }), { firmwarePolicies: [X.policies.floorThree] }), [...BF, ...BX, ['firmwarePolicies', 0]], ['device.firmware-rollback'], 'the device attests the older release of the manufacturer, and the verifier read the policy with floor 3');
|
||||
prod(bd, 'attestation-firmware', 'the bundle shows the new release and the device says it runs the old digest', cuX(F.attestationOfOld), BX, ['device.attestation-firmware'], 'the device attested the digest and the sequence of the older release');
|
||||
prod(bd, 'authorization-owner', 'THE FORMER OWNER STILL SIGNS: the manufacturer, having sold the device, grants an authorization under the current head', cuA(F.authorizationByFormerOwner), BA, ['device.authorization-owner'], 'the previous owner signed an authorization under the current ownership head');
|
||||
prod(bd, 'authorization-ownership', 'the owner\'s authorization is given under the head of before the sale', cuA(F.authorizationOldHead), BA, ['device.authorization-ownership'], 'the owner signed an authorization that names the manufacture credential as the ownership head');
|
||||
prod(bd, 'authorization-window', 'the authorization expired an hour before', cuA(F.authorizationExpired), BA, ['device.authorization-window'], 'the owner granted the same actions from two days to one hour before');
|
||||
prod(bd, 'authorization-action', 'the device asks for an action its owner did not grant', cuA(F.authorizationOtherAction), BA, ['device.authorization-action'], 'the owner granted door.unlock only');
|
||||
prod(bd, 'authorization-device', 'an authorization of another device by the same owner', cuA(F.authorizationOtherDevice), BA, ['device.authorization-device'], 'the owner signed the same grant for another device id');
|
||||
prod(bd, 'authorization-signature-purpose', 'the owner\'s signature made for another purpose (status) shown as the signature of the authorization', cuA(F.authorizationPurpose), [['bundle', 'authorization', 'signature']], ['device.authorization-signature'], 'the owner signed the authorization statement with the purpose "status"');
|
||||
prod(bd, 'attestation-device', 'A CLONE WITH ANOTHER KEY: its own key and the id of that key, behind the real device\'s manufacture credential', cuX(F.cloneOwnId), BX, ['device.attestation-device'], 'another device key attested the same nonce, firmware, head and action');
|
||||
prod(bd, 'attestation-device-claimed-id', 'a clone with another key that claims the real device\'s id', cuX(F.cloneClaimsId), BX, ['device.attestation-device', 'device.attestation-key'], 'another device key signed the statement with its own key under the real device id');
|
||||
prod(bd, 'attestation-signature-clone', 'a clone keeps the real key in the statement and signs with its own', cuX(F.cloneSigns), [['bundle', 'attestation', 'signature']], ['device.attestation-signature'], 'another device key signed the real device\'s statement');
|
||||
prod(bd, 'attestation-ownership', 'the device names the ownership head of before the sale', cuX(F.attestationOldHead), BX, ['device.attestation-ownership'], 'the device attested under the manufacture credential as the ownership head');
|
||||
prod(ba, 'attestation-key', 'an attestation whose "ML-DSA-65" key is an Ed25519 key, signed with it, the signature declared ml-dsa-65', intrare(DV.bundle({ attestation: F.attestationClassical }), { statusRecords: [] }), BX, ['device.attestation-key'], 'an Ed25519 key attested under the ML-DSA-65 name, with the id of that key');
|
||||
prod(bw, 'witness-envelope-of-another', 'the envelope of another attestation attached to this one', intrare(pachet({ anchor: F.envelopeOfAnother }), { anchors: [X.reading] }), [['bundle', 'anchor']], ['device.witness-envelope'], 'the envelope of an attestation made one second later was attached');
|
||||
|
||||
// ---- (2026-10-05, after an adversarial review) whose status record counts, and each half of the compound checks
|
||||
const REC = X.records, baza = (id) => V.find((x) => x.id === id).input;
|
||||
const tot = (id, titlu, b, op, levels = AP) => valid(id, A, titlu, src, aplica(baza(b), op), { exercises: DK, verdict: id.endsWith('.partial') ? 'PARTIAL' : 'VALID', levels, base: b, mutation: op }); // not INVALID, one operation from its base
|
||||
const adauga = (k, rec) => ({ op: 'add', path: ['statusRecords', k], value: rec });
|
||||
// the owner of NOW: its retirement counts whatever ownership head the record names, and with none
|
||||
d('status-retired-by-owner', 'the owner retired the device (its record names the current ownership head)', adauga(1, REC.retiredByOwner), ['device.status-retired']);
|
||||
d('status-retired-by-owner-no-head', 'THE OWNER OF NOW RETIRES THE DEVICE in a record that names no ownership head, beside its own current "active": it is the owner\'s record all the same', adauga(1, REC.retiredByOwnerNoHead), ['device.status-retired']);
|
||||
// sold on to a second identity: the records of the owner BEFORE do not bind the owner of now; they are named, and the verdict stands
|
||||
const br = 'device-bundle/resold.valid', bb = 'device-bundle/bought-back.valid';
|
||||
const cuLant = (l, o = {}) => intrare(DV.bundle({ manufacture: X.manufacture, firmware: X.firmware, transfers: l.transfers, authorization: l.authorization, attestation: l.attestation }), o);
|
||||
valid(br, A, 'the same device sold on by its first owner to a second identity, which authorizes it and says active under the new ownership head', src, cuLant(X.resold, { statusRecords: [REC.activeBySecond] }), { exercises: DK, levels: AP });
|
||||
tot('device-bundle/resold-after-retirement.valid', 'RETIREMENT, THEN A SALE: the first owner retired the device and then sold it. Its retirement does not bind the owner of now (a seller could date one before the sale after it); the verifier names it and what it says, and the verdict stands', br, adauga(1, REC.retiredByFirstOwner));
|
||||
tot('device-bundle/resold-after-suspension.valid', 'suspension, then a sale: the same, the state the verifier names is "suspended"', br, adauga(1, REC.suspendedByFirstOwner));
|
||||
tot('device-bundle/resold-seller-retires-after.valid', 'the seller signs a retirement under the NEW ownership head, after the sale: it does not bind the owner of now, and is named', br, adauga(1, REC.retiredByFirstOwnerUnderNewHead));
|
||||
invalid('device-bundle/resold.status-retired-by-manufacturer', 'the manufacturer\'s retirement is never lifted: not by a sale either', br, adauga(1, REC.retiredByManufacturer), ['device.status-retired']);
|
||||
// sold, and bought back: what the owner signed under its FIRST ownership holds now that it owns the device again
|
||||
valid(bb, A, 'the same device sold twice and bought back by its first owner, which says active under its third ownership head', src, cuLant(X.boughtBack, { statusRecords: [REC.activeUnderThirdHead] }), { exercises: DK, levels: AP });
|
||||
invalid('device-bundle/bought-back.status-suspended-first-ownership', 'the suspension the owner signed under its FIRST ownership holds now that it owns the device again (it can only harm itself)', bb, adauga(1, REC.suspendedByOwner), ['device.status-suspended']);
|
||||
invalid('device-bundle/bought-back.status-retired-first-ownership', 'the retirement the owner signed under its first ownership holds as well', bb, adauga(1, REC.retiredByOwner), ['device.status-retired']);
|
||||
// records that are named and change nothing
|
||||
tot('device-bundle/retired-under-an-id-not-derived.valid', 'a "retired" record signed with the owner\'s keys under an id those keys do not derive is not the owner\'s record: ignored', bd, adauga(1, REC.retiredOwnerKeysOtherId));
|
||||
tot('device-bundle/retirement-of-another-device.valid', 'the registry also holds the manufacturer\'s retirement of ANOTHER device: it does not concern this one', bd, adauga(1, REC.retiredOtherDevice));
|
||||
tot('device-bundle/retirement-not-yet-in-effect.valid', 'the manufacturer dated a retirement 120 s after the verifier\'s clock (beyond the tolerance of 60 s): it is not in effect yet, and the verifier names it', bd, adauga(1, REC.retiredByManufacturerAhead));
|
||||
// the firmware policy: of another model, expired, or one that cannot be read
|
||||
tot('device-bundle/policy-of-another-model.partial', 'the only firmware policy handed is the manufacturer\'s policy for another model', bd, { op: 'set', path: ['firmwarePolicies', 0], value: X.policies.otherModel }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-expired.partial', 'the only firmware policy handed has expired', bd, { op: 'set', path: ['firmwarePolicies', 0], value: X.policies.expired }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-unreadable.partial', 'A SIGNED POLICY WHOSE RETRACTED ENTRY IS NOT A DIGEST (the 64 hex digits of this release without 0x) is not read as a policy that retracts nothing', bd, { op: 'set', path: ['firmwarePolicies', 0], value: X.policies.retractedNotADigest }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-unreadable-beside-a-clean-one.partial', 'the same policy beside a clean current one: still not read as clean', bd, { op: 'add', path: ['firmwarePolicies', 1], value: X.policies.retractedNotADigest }, { ...AP, ...NI });
|
||||
// the attestation's time: a tolerance for a clock that runs fast, never a date chosen in the future
|
||||
{ const input = cuX(X.attestationJustAhead); valid('device-bundle/attested-just-ahead.valid', A, 'the device dated its attestation 30 s after the verifier\'s clock: inside the tolerance of 60 s', src, input, { exercises: DK, levels: AP }); }
|
||||
prod(bd, 'freshness-ahead', 'AN ATTESTATION DATED 120 s AHEAD of the verifier\'s clock: beyond its tolerance of 60 s, well inside the allowed age', cuX(F.attestationAhead), BX, ['device.freshness'], 'the device dated the same attestation 120 s after the verifier\'s clock');
|
||||
prod(bd, 'attestation-firmware-sequence', 'the device attests the digest of the release shown under another sequence number', cuX(F.attestationOtherSequence), BX, ['device.attestation-firmware'], 'the device attested the digest of the release with sequence 9');
|
||||
prod(bd, 'attestation-firmware-digest', 'the device attests the sequence number of the release shown with another digest', cuX(F.attestationOtherDigest), BX, ['device.attestation-firmware'], 'the device attested the digest of the older release with the sequence of the new one');
|
||||
// the authorization window, judged on the verifier's clock AND at the time the device attested
|
||||
prod(bd, 'authorization-window-not-yet', 'the authorization begins in an hour', cuA(F.authorizationNotYet), BA, ['device.authorization-window'], 'the owner granted the same actions from an hour later');
|
||||
prod(bd, 'authorization-window-after-attestation', 'the authorization was not in force yet when the device attested: it begins 63 s after the attestation (on the verifier\'s clock, with its tolerance, it has begun)', cuA(F.authorizationAfterAttestation), BA, ['device.authorization-window'], 'the owner granted the same actions from 63 s after the attestation');
|
||||
prod(bd, 'authorization-window-ended-between', 'the authorization ended between the attestation and the verification', cuA(F.authorizationEndedBetween), BA, ['device.authorization-window'], 'the owner granted the same actions until 2 s after the attestation, 3 s before the verifier\'s clock');
|
||||
// the manufacture credential: not valid yet; a holder that is the manufacturer in one half only; the device key in another base64 text
|
||||
prod(bm, 'manufacture-window-not-yet', 'the manufacture credential is not valid yet: it starts the day after', cuM(F.manufactureNotYet), M_, ['device.manufacture-window'], 'the manufacturer issued the same credential valid from the day after');
|
||||
prod(bm, 'manufacture-holder-other-id', 'the manufacture credential names as holder another id beside the manufacturer\'s own keys', cuM(F.manufactureHolderOtherId), M_, ['device.manufacture-holder'], 'the manufacturer signed a holder with its own keys under another id');
|
||||
prod(bm, 'manufacture-holder-other-keys', 'the manufacture credential names as holder the manufacturer\'s id beside other keys', cuM(F.manufactureHolderOtherKeys), M_, ['device.manufacture-holder'], 'the manufacturer signed a holder with its own id beside the keys of somebody else');
|
||||
prod(bm, 'device-key-not-canonical', 'the manufacturer certifies the device key written in another base64 text (a padding character added): one key has one text', cuM(F.deviceKeyNotCanonical), M_, ['device.device-key'], 'the manufacturer signed the same device key with a padding character added to its text');
|
||||
prod(ba, 'attestation-key-not-canonical', 'the attestation carries the device key in another base64 text', intrare(DV.bundle({ attestation: F.attestationKeyNotCanonical }), { statusRecords: [] }), BX, ['device.attestation-key'], 'the device signed the same statement with a padding character added to the text of its key');
|
||||
// the ownership chain: the position of a transfer; and, with no manufacture credential beside it, the id of who gives the first one
|
||||
prod(bc, 'transfer-prev-position', 'the second transfer carries position 7 (the hash of the link before it is right)', cuT2(F.transferPosition), L2, ['device.transfer-prev'], 'the owner signed the second transfer with the sequence number 7');
|
||||
const bu = 'device-bundle/chain-unrooted.partial';
|
||||
dinProd(bu, 'one transfer with no manufacture credential beside it: the chain has nothing to start from and is checked only against itself', intrare(DV.bundle({ transfers: T1 }), { statusRecords: [] }), NI);
|
||||
prod(bu, 'transfer-ids-giver', 'with no manufacture credential beside it, the GIVER of the first transfer carries an id its keys do not derive', intrare(DV.bundle({ transfers: [F.transferGiverId] }), { statusRecords: [] }), [['bundle', 'transfers', 0]], ['device.transfer-ids'], 'the giver signed the first transfer under another id beside its own keys');
|
||||
// a signature has ONE text: the same bytes in another base64 text are refused (one operation each, on the text of a signature)
|
||||
const AB = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const altText = (s) => { const p = s.indexOf('='); const t = p < 0 ? s + '=' : s.slice(0, p - 1) + AB[AB.indexOf(s[p - 1]) ^ 1] + s.slice(p); if (t === s || !Buffer.from(t, 'base64').equals(Buffer.from(s, 'base64'))) throw new Error('altText: not the same bytes in another text'); return t; };
|
||||
invalid('device-bundle/chain-only.transfer-signature-not-canonical', 'the Ed25519 half of the second transfer\'s signature is the same bytes in another base64 text (the unused bits of its last character changed)', bc, { op: 'set', path: ['bundle', 'transfers', 1, 'signature', 'ed25519'], value: altText(X.transfers[1].signature.ed25519) }, ['device.transfer-signature']);
|
||||
d('attestation-signature-not-canonical', 'the attestation signature is the same bytes in another base64 text (a padding character added)', { op: 'set', path: ['bundle', 'attestation', 'signature', 'value'], value: altText(X.attestation.signature.value) }, ['device.attestation-signature']);
|
||||
invalid('device-bundle/manufacture-only.manufacture-signature-not-canonical', 'the ML-DSA-65 half of the manufacturer\'s signature is the same bytes in another base64 text', bm, { op: 'set', path: ['bundle', 'manufacture', 'signature', 'mldsa65'], value: altText(X.manufacture.signature.mldsa65) }, ['device.manufacture-signature']);
|
||||
|
||||
// ---- the other conditions of the compound checks (each vector is written for ONE condition; the control of the halves plants each out)
|
||||
// status: who lifts a suspension, what expires, what a date that cannot be read undoes
|
||||
tot('device-bundle/bought-back-active-of-first-ownership.partial', 'bought back: the only record is the owner\'s "active" of its FIRST ownership, which is not believed under another ownership head', bb, { op: 'set', path: ['statusRecords', 0], value: REC.active }, { ...AP, ...NI });
|
||||
invalid('device-bundle/suspension-lifted.status-suspended-by-manufacturer', 'the manufacturer suspended the device: the owner\'s later "active" does not lift a suspension it did not make', 'device-bundle/suspension-lifted.valid', { op: 'set', path: ['statusRecords', 0], value: REC.suspendedByManufacturer }, ['device.status-suspended']);
|
||||
d('status-suspended-record-expired', 'a suspension does not expire with its record: the record is past its validity and still holds', { op: 'set', path: ['statusRecords', 0], value: REC.suspendedByOwnerExpired }, ['device.status-suspended']);
|
||||
tot('device-bundle/active-record-expired.partial', 'the only "active" record has expired: the registry must be read again', bd, { op: 'set', path: ['statusRecords', 0], value: REC.activeExpired }, { ...AP, ...NI });
|
||||
d('status-suspended-same-number', 'two records of the owner with the same number, one says suspended: the stricter holds', adauga(1, REC.suspendedSameNumber), ['device.status-suspended']);
|
||||
d('status-retired-date-not-a-time', 'a retirement of the manufacturer whose date is not a time is applied all the same', adauga(1, REC.retiredByManufacturerNoDate), ['device.status-retired']);
|
||||
d('status-retired-dated-just-ahead', 'a retirement the manufacturer dated 30 s after the verifier\'s clock is inside the tolerance: in effect', adauga(1, REC.retiredByManufacturerJustAhead), ['device.status-retired']);
|
||||
// the recall list and the firmware policy: whose, and when
|
||||
tot('device-bundle/recall-list-of-another-manufacturer.partial', 'the only recall list handed has the right id and is signed by ANOTHER manufacturer (it recalls the device): it is not the manufacturer\'s list', bd, { op: 'set', path: ['statusLists', 0], value: X.lists.byAnotherManufacturer }, { ...AP, ...NI });
|
||||
tot('device-bundle/recall-list-expired.partial', 'the only recall list handed has expired: it is not read as "not recalled"', bd, { op: 'set', path: ['statusLists', 0], value: X.lists.expired }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-not-yet.partial', 'the only firmware policy handed is not in force yet', bd, { op: 'set', path: ['firmwarePolicies', 0], value: X.policies.notYet }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-floor-unreadable-beside-a-clean-one.partial', 'a signed policy whose floor is not a whole number, beside a clean one', bd, { op: 'add', path: ['firmwarePolicies', 1], value: X.policies.floorNotANumber }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-validity-unreadable-beside-a-clean-one.partial', 'a signed policy whose validity is not a time, beside a clean one', bd, { op: 'add', path: ['firmwarePolicies', 1], value: X.policies.validityNotATime }, { ...AP, ...NI });
|
||||
d('firmware-retracted-upper-case', 'the manufacturer\'s tooling wrote the retracted digest in upper case: it is the same digest', { op: 'set', path: ['firmwarePolicies', 0], value: X.policies.retractsUpperCase }, ['device.firmware-retracted']);
|
||||
{ const alta = clona(X.software); alta.statement.subject.version = '2.0.1'; alta.statementHash = sha256(Buffer.from(JSON.stringify(alta.statement), 'utf8'));
|
||||
prod(bs, 'firmware-software-not-the-one-named', 'the Proof of Software attestation handed lists the image and is NOT the one the release names', intrare(pachet({ firmware: X.firmwareWithSoftware }), { softwareAttestation: alta }), [['softwareAttestation']], ['device.firmware-software'], 'another attestation of the same image was handed: its statement differs and its hash was recomputed'); }
|
||||
// ownership and authorization
|
||||
prod(bc, 'transfer-time-future', 'the second transfer is dated a month after the verifier\'s clock', cuT2(F.transferFuture), L2, ['device.transfer-time'], 'the owner signed a second transfer dated thirty days ahead');
|
||||
const cuAX = (a_, x_) => intrare(pachet({ authorization: a_, attestation: x_ }));
|
||||
prod(bd, 'authorization-window-begins-after-tolerance', 'the authorization begins after the verifier\'s clock and its tolerance; the attestation, dated 35 s ahead, is later still', cuAX(F.authorizationBeginsAfterTolerance, F.attestationAheadInTolerance), [...BA, ...BX], ['device.authorization-window'], 'the owner granted the same actions from 70 s after the verifier\'s clock, and the device dated its attestation 35 s ahead');
|
||||
prod(bd, 'authorization-window-ends-before-attestation', 'the authorization ends before the time the device wrote in its attestation (dated 35 s ahead, inside the tolerance)', cuAX(F.authorizationEndsBeforeAttestation, F.attestationAheadInTolerance), [...BA, ...BX], ['device.authorization-window'], 'the owner granted the same actions until 1 s after the verifier\'s clock, and the device dated its attestation 35 s ahead');
|
||||
// with no manufacture credential beside them, the id of who signs a release and of who grants is derived from its keys here alone
|
||||
const brl = 'device-bundle/release-only.partial', bg = 'device-bundle/grant-only.partial';
|
||||
dinProd(brl, 'a firmware release alone: nothing says which device it is for', intrare(DV.bundle({ firmware: X.firmware }), { statusRecords: [] }), NI);
|
||||
prod(brl, 'firmware-signer-id', 'with no manufacture credential beside it, the signer of the release carries an id its keys do not derive', intrare(DV.bundle({ firmware: F.firmwareSignerId }), { statusRecords: [] }), BF, ['device.firmware-signer'], 'the signer signed the release under another id beside its own keys');
|
||||
dinProd(bg, 'an authorization and an attestation with no chain beside them: nothing says whose the device is', intrare(DV.bundle({ authorization: X.authorization, attestation: X.attestation }), { statusRecords: [] }), NI);
|
||||
prod(bg, 'authorization-owner-id', 'with no chain beside it, the owner that grants carries an id its keys do not derive', intrare(DV.bundle({ authorization: F.authorizationOwnerId, attestation: X.attestation }), { statusRecords: [] }), BA, ['device.authorization-owner'], 'the owner signed the authorization under another id beside its own keys');
|
||||
dinProd('device-bundle/manufacture-hardware-root.partial', 'a manufacture credential that carries a hardware root (an endorsement of the device key): this verifier does not judge one, and the verdict says so', cuM(F.manufactureHardwareRoot), { ...NI, ...NA });
|
||||
// the witness, and the form of the bundle
|
||||
{ const fals2 = clona(X.envelope); fals2.statement.deviceId = F.cloneOwnId.statement.deviceId; fals2.statementHash = sha256(Buffer.from(JSON.stringify(fals2.statement), 'utf8'));
|
||||
prod(bw, 'witness-envelope-other-device', 'a forged envelope: the hash of this attestation under ANOTHER device id, its statementHash recomputed', intrare(pachet({ anchor: fals2 }), { anchors: [X.reading] }), [['bundle', 'anchor']], ['device.witness-envelope'], 'the envelope was rewritten with another device id and hashed again'); }
|
||||
tot('device-bundle/reading-of-another-envelope.partial', 'the verifier\'s reading is of ANOTHER envelope: the notarization this one claims was not read', bw, { op: 'set', path: ['anchors', 0, 'statementHash'], value: '0x' + '22'.repeat(32) }, { ...AP, anchoring: 'NOT_MEASURED' });
|
||||
// signed by who may, and not readable by this verifier: never read as clean
|
||||
tot('device-bundle/recall-list-unreadable-beside-a-clean-one.partial', 'a recall list of the manufacturer whose validity is not a time (it recalls the device), beside a clean current one: it is not read as "not recalled"', bd, { op: 'add', path: ['statusLists', 1], value: X.lists.validityNotATime }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-of-another-version-beside-a-clean-one.partial', 'a signed policy of a version this verifier does not read (it retracts the release), beside a clean one', bd, { op: 'add', path: ['firmwarePolicies', 1], value: X.policies.otherVersion }, { ...AP, ...NI });
|
||||
tot('device-bundle/status-record-of-another-version.partial', 'a record signed by the manufacturer in a version this verifier does not read (it says retired), beside the owner\'s current "active": the registry is not read as clean', bd, adauga(1, REC.retiredByManufacturerOtherVersion), { ...AP, ...NI });
|
||||
tot('device-bundle/reading-in-milliseconds.partial', 'the verifier\'s reading of this envelope carries its time in milliseconds: it is not a reading, and the notarization claimed counts as not read', bw, { op: 'set', path: ['anchors', 0, 'at'], value: X.reading.at * 1000 }, { ...AP, anchoring: 'NOT_MEASURED' });
|
||||
d('form-version', 'a bundle of another version', { op: 'set', path: ['bundle', 'v'], value: 2 }, ['device.form'], { levels: OPRIT });
|
||||
d('form-transfers-not-a-list', 'a bundle whose transfers are not a list', { op: 'set', path: ['bundle', 'transfers'], value: 'x' }, ['device.form'], { levels: OPRIT });
|
||||
// ---- (2026-10-06, after a second adversarial review) the conditions that had no vector: the order of a list, an ending 30 s past, a
|
||||
// form the producers refuse to write; then what is handed in another shape, the device id as written, a link with a member more
|
||||
const R2 = X.r2, Q2 = R2.records, cuS = (l) => intrare(pachet(), { statusRecords: l }), SR_ = [['statusRecords']];
|
||||
prod(bd, 'status-suspended-highest-number-listed-first', 'the registry lists [suspended 5, active 3]: the record with the highest number holds, not the last one in the list', cuS([Q2.suspendedFive, Q2.activeThree]), SR_, ['device.status-suspended'], 'the owner signed "suspended" as its record 5 and "active" as its record 3, and the registry lists them in that order');
|
||||
prod(bd, 'status-suspended-same-number-listed-first', 'the registry lists [suspended 5, active 5]: of two records with one number the stricter holds, whichever comes last', cuS([Q2.suspendedFive, Q2.activeFive]), SR_, ['device.status-suspended'], 'the owner signed "suspended" and "active" under the same number 5, and the registry lists the suspension first');
|
||||
valid('device-bundle/suspension-lifted-listed-first.valid', A, 'the registry lists [active 6, suspended 5]: the later record of the signer lifts its suspension, whatever the order of the list', src, cuS([Q2.activeSix, Q2.suspendedFive]), { exercises: DK, levels: AP });
|
||||
tot('device-bundle/active-record-number-not-whole.partial', 'the only record is an "active" of the owner whose number is not whole (1.5): it cannot be placed in order, and is not believed', bd, { op: 'set', path: ['statusRecords', 0], value: Q2.activeNumberNotWhole }, { ...AP, ...NI });
|
||||
tot('device-bundle/suspended-record-number-as-text.partial', 'beside a current "active", a "suspended" of the owner whose number is written as text ("7"): it cannot be placed in order, and is not passed over', bd, adauga(1, Q2.suspendedNumberAsText), { ...AP, ...NI });
|
||||
tot('device-bundle/active-record-expired-30s.partial', 'the only "active" expired 30 s before the verifier\'s clock: an ending has no tolerance', bd, { op: 'set', path: ['statusRecords', 0], value: Q2.activeExpired30s }, { ...AP, ...NI });
|
||||
tot('device-bundle/active-record-validity-with-offset.partial', 'the only record is an "active" whose validity is written with a zone offset (+03:00): not an RFC 3339 UTC time, and not believed', bd, { op: 'set', path: ['statusRecords', 0], value: Q2.activeValidityWithOffset }, { ...AP, ...NI });
|
||||
tot('device-bundle/recall-list-of-another-id.partial', 'the only recall list handed is the manufacturer\'s own, current and clean, under ANOTHER id than the one the credential names', bd, { op: 'set', path: ['statusLists', 0], value: R2.lists.otherId }, { ...AP, ...NI });
|
||||
tot('device-bundle/recall-list-of-another-id-beside.valid', 'beside the list the credential names, another list of the manufacturer whose bit 7 is set: it is the bit of another list, not a recall of this device', bd, { op: 'add', path: ['statusLists', 1], value: R2.lists.otherIdRevoked });
|
||||
tot('device-bundle/recall-list-expired-30s.partial', 'the only recall list expired 30 s before the verifier\'s clock: an ending has no tolerance', bd, { op: 'set', path: ['statusLists', 0], value: R2.lists.expired30s }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-expired-30s.partial', 'the only firmware policy expired 30 s before the verifier\'s clock: an ending has no tolerance', bd, { op: 'set', path: ['firmwarePolicies', 0], value: R2.policies.expired30s }, { ...AP, ...NI });
|
||||
tot('device-bundle/policy-floor-negative.partial', 'a signed policy with a negative floor (-1), the only one handed: not read as a floor', bd, { op: 'set', path: ['firmwarePolicies', 0], value: R2.policies.floorNegative }, { ...AP, ...NI });
|
||||
prod(bm, 'manufacture-window-expired-30s', 'the manufacture credential expired 30 s before the verifier\'s clock: an ending has no tolerance', cuM(R2.manufactureExpired30s), M_, ['device.manufacture-window'], 'the manufacturer issued the same credential valid until 30 s before the verifier\'s clock');
|
||||
dinProd('device-bundle/manufacture-begins-in-tolerance.partial', 'the manufacture credential alone, beginning 30 s after the verifier\'s clock: a beginning has the tolerance of 60 s, and nothing refuses it', cuM(R2.manufactureBeginsInTolerance), NI);
|
||||
prod(bm, 'manufacture-form-selective-disclosure', 'a manufacture credential with a claim under selective disclosure, signed by the manufacturer: every claim of a device is in the clear', cuM(R2.manufactureSelectiveDisclosure), M_, ['device.manufacture-form'], 'the manufacturer signed the same credential with an entry in its list of claims under selective disclosure', { levels: { ...OPRIT, ...NI } });
|
||||
prod(bs, 'firmware-software-not-a-proof-of-software', 'the release names, by its hash, an attestation that is not a Proof of Software attestation, and that one is handed', intrare(pachet({ firmware: R2.firmwareNamesNotProofOfSoftware }), { softwareAttestation: R2.notProofOfSoftware }), [...BF, ['softwareAttestation']], ['device.firmware-software'], 'the manufacturer signed a release that names the hash of a statement of another kind, and that statement was handed to the verifier');
|
||||
d('authorization-signature-scheme', 'the authorization signature (the right bytes) declares another scheme', { op: 'set', path: ['bundle', 'authorization', 'signature', 'alg'], value: 'rsa-pss' }, ['device.authorization-signature']);
|
||||
prod(bd, 'unreadable-time-without-zone', 'an authorization signed by the owner whose end is written without a time zone (a parser would read it as local time): not an RFC 3339 UTC time', cuA(R2.authorizationEndWithoutZone), BA, ['device.unreadable'], 'the owner signed the same authorization with its end written without the Z', { levels: OPRIT });
|
||||
prod(bd, 'freshness-330s', 'an attestation made 330 s before the verifier\'s clock: 30 s past the allowed age of 300 s', cuX(R2.attestationOld330s), BX, ['device.freshness'], 'the device dated the same attestation 330 s before the verifier\'s clock');
|
||||
valid('device-bundle/attested-300s-before.valid', A, 'an attestation made exactly 300 s before the verifier\'s clock: at the edge of the allowed age, inside it', src, cuX(R2.attestationOld300s), { exercises: DK, levels: AP });
|
||||
dinProd('device-bundle/chain-of-64.partial', 'the manufacture credential and a chain of exactly 64 transfers, the most that is read: read', cuL(R2.chainOf64), NI);
|
||||
// the witness: which of two readings, the kind of the envelope and of its statement, a time that is not a number
|
||||
const citire2 = { statementHash: X.reading.statementHash, at: X.readingEarlier, chainId: X.reading.chainId };
|
||||
invalid('device-bundle/witnessed.witness-time-second-reading', 'two readings of the envelope, the second one ten minutes BEFORE the time the device wrote in its attestation: the earliest reading is the bound', bw, { op: 'add', path: ['anchors', 1], value: citire2 }, ['device.witness-time']);
|
||||
prod(bw, 'witness-time-earlier-reading-first', 'the same two readings in the other order', aplica(aplica(baza(bw), { op: 'set', path: ['anchors', 0], value: citire2 }), { op: 'add', path: ['anchors', 1], value: X.reading }), [['anchors']], ['device.witness-time'], 'the verifier made two readings of the envelope, the earlier one listed first');
|
||||
invalid('device-bundle/witnessed.witness-envelope-kind', 'the envelope carries the kind of another envelope, the rest untouched', bw, { op: 'set', path: ['bundle', 'anchor', 'kind'], value: 'aere-proof-of-ai-attestation' }, ['device.witness-envelope']);
|
||||
prod(bw, 'witness-envelope-statement-kind', 'the statement of the envelope is of another kind, its hash recomputed', intrare(pachet({ anchor: R2.envelopeStatementOtherKind }), { anchors: [X.reading] }), [['bundle', 'anchor']], ['device.witness-envelope'], 'the envelope was rewritten with a statement of another kind and hashed again');
|
||||
tot('device-bundle/reading-time-as-text.partial', 'the verifier\'s reading carries its time as text, ten minutes before the date of the attestation: it is not a reading (as a number it would refuse the attestation)', bw, { op: 'set', path: ['anchors', 0, 'at'], value: String(X.readingEarlier) }, { ...AP, anchoring: 'NOT_MEASURED' });
|
||||
// what the verifier is handed in another shape is not read, and the verdict says so
|
||||
tot('device-bundle/registry-with-a-list-inside.partial', 'the registry handed as [active, [retired]] (a list inside the list): the retirement was not read, and the verdict is not VALID', bd, adauga(1, [REC.retiredByManufacturer]), { ...AP, ...NI });
|
||||
tot('device-bundle/registry-with-a-registry-object-inside.partial', 'the registry handed as [active, { records: [retired] }] (a registry object as an element): what is inside was not read', bd, adauga(1, { records: [REC.retiredByManufacturer] }), { ...AP, ...NI });
|
||||
tot('device-bundle/policies-with-a-list-inside.partial', 'the policies handed as [clean, [one that retracts this release]]: what is inside the inner list was not read', bd, { op: 'add', path: ['firmwarePolicies', 1], value: [X.policies.retracts] }, { ...AP, ...NI });
|
||||
tot('device-bundle/recall-lists-with-a-list-inside.partial', 'the recall lists handed as [clean, [one that recalls this device]]: what is inside the inner list was not read', bd, { op: 'add', path: ['statusLists', 1], value: [X.lists.revoked] }, { ...AP, ...NI });
|
||||
tot('device-bundle/readings-with-a-list-inside.partial', 'the readings handed as [[a reading ten minutes before the date of the attestation]]: it was not read', bw, { op: 'set', path: ['anchors', 0], value: [citire2] }, { ...AP, anchoring: 'NOT_MEASURED' });
|
||||
// the device id a status record names is compared like a digest; one that is not a device id is not passed over when its signer may retire the device
|
||||
d('status-retired-device-id-upper-case', 'THE MANUFACTURER\'S RETIREMENT names the device id with its hex in upper case (its tooling writes it so): it is this device', adauga(1, Q2.retiredByManufacturerUpperCaseId), ['device.status-retired']);
|
||||
tot('device-bundle/active-record-device-id-upper-case.valid', 'the only record is the owner\'s "active" with the device id in upper case: it is this device\'s record', bd, { op: 'set', path: ['statusRecords', 0], value: Q2.activeUpperCaseId });
|
||||
tot('device-bundle/status-record-device-id-not-an-id.partial', 'THE OWNER\'S RETIREMENT names the device id with a space after it: not a device id, and it may be meant for this device, so the registry is not read as clean', bd, adauga(1, Q2.retiredByOwnerIdWithSpace), { ...AP, ...NI });
|
||||
// another manufacturer the verifier trusts speaks about this device key: not applied, and not passed over
|
||||
dinProd('device-bundle/status-of-another-trusted-manufacturer.partial', 'ANOTHER manufacturer, which the verifier also trusts, signed a retirement of this device key: it is not applied to another manufacturer\'s device, and the verdict is not VALID', intrare(pachet(), { trustedManufacturers: R2.trustedBoth, statusRecords: [REC.active, Q2.retiredByOtherManufacturer] }), NI);
|
||||
tot('device-bundle/status-of-an-untrusted-manufacturer.valid', 'the same record from a manufacturer the verifier does not trust is a stranger\'s record: ignored', bd, adauga(1, Q2.retiredByOtherManufacturer));
|
||||
// a link is exactly { statement, signature } and a signature exactly its members: one member more is another text of the same signed statement
|
||||
const mm = (id, titlu, b, cale, r) => invalid(id, titlu, b, { op: 'add', path: cale, value: 'x' }, r);
|
||||
mm('device-bundle/chain-only.transfer-signature-member-more', 'the last transfer with a member more in its signature object (the statement and the signature bytes untouched): one link would have two hashes', bc, ['bundle', 'transfers', 1, 'signature', 'note'], ['device.transfer-signature']);
|
||||
mm('device-bundle/chain-only.transfer-member-more', 'the last transfer with a member more beside its statement and its signature', bc, ['bundle', 'transfers', 1, 'note'], ['device.transfer-signature']);
|
||||
mm('device-bundle/manufacture-only.manufacture-member-more', 'the manufacture credential with a member more beside its statement and its signature', bm, ['bundle', 'manufacture', 'note'], ['device.manufacture-signature']);
|
||||
mm('device-bundle/manufacture-only.manufacture-signature-member-more', 'the manufacture credential with a member more in its signature object', bm, ['bundle', 'manufacture', 'signature', 'note'], ['device.manufacture-signature']);
|
||||
mm('device-bundle/release-only.firmware-member-more', 'the firmware release with a member more beside its statement and its signature', brl, ['bundle', 'firmware', 'note'], ['device.firmware-signature']);
|
||||
mm('device-bundle/grant-only.authorization-member-more', 'the authorization with a member more beside its statement and its signature', bg, ['bundle', 'authorization', 'note'], ['device.authorization-signature']);
|
||||
mm('device-bundle/attestation-only.attestation-member-more', 'the attestation with a member more beside its statement and its signature', ba, ['bundle', 'attestation', 'note'], ['device.attestation-signature']);
|
||||
mm('device-bundle/attestation-only.attestation-signature-member-more', 'the attestation with a member more in its signature object', ba, ['bundle', 'attestation', 'signature', 'note'], ['device.attestation-signature']);
|
||||
tot('device-bundle/active-record-signature-member-more.partial', 'a status record with a member more in its signature object is not a signed record: the only "active" is not believed', bd, { op: 'add', path: ['statusRecords', 0, 'signature', 'note'], value: 'x' }, { ...AP, ...NI }); }
|
||||
// (E) a dataset: a record, a range answer, a consistency proof, an availability sample
|
||||
const DS = P.dataset; const REC = ['dataset.form', 'dataset.commitment', 'dataset.field', 'dataset.inclusion']; const src = 'producer (verifiable-data), random salts, generated ' + P.at;
|
||||
valid('dataset-record/r5.valid', 'dataset-record', 'one record against the commitment of version 2, two fields disclosed', src, { record: DS.record, commitment: DS.newer }, { exercises: REC });
|
||||
@@ -648,7 +1055,7 @@ const peDisc = (d, pre = '') => (fs.existsSync(d) ? fs.readdirSync(d, { withFile
|
||||
|
||||
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
||||
const a = process.argv.slice(2);
|
||||
if (a.includes('--proaspat')) await proaspat(a.includes('--tot'));
|
||||
if (a.includes('--proaspat')) await proaspat(a.includes('--tot'), a.flatMap((x, i) => (x === '--refa' && a[i + 1] ? [a[i + 1]] : [])));
|
||||
const out = fisiere(construieste());
|
||||
if (a.includes('--verifica')) {
|
||||
let dif = 0; for (const [f, t] of out) { const p = path.join(DIR, f); if (!fs.existsSync(p) || fs.readFileSync(p, 'utf8').replace(/\r\n/g, '\n') !== t) { dif++; console.log('DIFERIT: ' + f); } }
|
||||
|
||||
Reference in new issue
Block a user