nomosprotocol 0.3.0__tar.gz → 0.5.0__tar.gz
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.
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/PKG-INFO +3 -3
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/README.md +1 -1
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/__init__.py +5 -4
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/act.py +18 -6
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/chain.py +135 -35
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/statements.py +87 -27
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/suites.py +88 -22
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol.egg-info/PKG-INFO +3 -3
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol.egg-info/requires.txt +1 -1
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/pyproject.toml +2 -2
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/LICENSE +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/accept.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/bindings.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/budgets.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/carrier.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/issuer.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/jcs.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/registrar.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol/witness.py +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol.egg-info/SOURCES.txt +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol.egg-info/dependency_links.txt +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/nomosprotocol.egg-info/top_level.txt +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/setup.cfg +0 -0
- {nomosprotocol-0.3.0 → nomosprotocol-0.5.0}/tests/test_sdk.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nomosprotocol
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: NOMOS for Python: the reference verifiers for NOMOS-SPEC-007 (rev. 1.11), -008 and -010, NOMOS-SPEC-014 registrar logs, and accept(), act() and witness() for NOMOS-SPEC-009. Verify an Act, commit it exactly once, carry one, or sign the facts it needs.
|
|
5
5
|
Author-email: NOMOS Protocol <hello@nomosprotocol.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -14,7 +14,7 @@ Classifier: Topic :: Security :: Cryptography
|
|
|
14
14
|
Requires-Python: >=3.9
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: cryptography>=
|
|
17
|
+
Requires-Dist: cryptography>=48
|
|
18
18
|
Provides-Extra: postgres
|
|
19
19
|
Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
|
|
20
20
|
Requires-Dist: psycopg-pool>=3.2; extra == "postgres"
|
|
@@ -112,7 +112,7 @@ chain.verify_revocation_list(lst, ROOT, now) # NOMOS-SPEC-007 rev. 1.10
|
|
|
112
112
|
|
|
113
113
|
This package is checked against:
|
|
114
114
|
- every vector of NOMOS-SPEC-007 (1.7.0, rev. 1.11, rev. 1.10 revocation sources), NOMOS-SPEC-008
|
|
115
|
-
0.7.0 with rev. 0.8.0 (several laws) and rev. 0.9.0 (intake questions), NOMOS-SPEC-010 0.
|
|
115
|
+
0.7.0 with rev. 0.8.0 (several laws) and rev. 0.9.0 (intake questions), NOMOS-SPEC-010 0.3.0 and
|
|
116
116
|
NOMOS-SPEC-016 0.1.0 (budgets: 200 of 200, `budget-vectors/check.py`);
|
|
117
117
|
- the NOMOS-SPEC-009 selection vectors;
|
|
118
118
|
- the NOMOS-SPEC-009 HTTP runner, 17 of 17, with `accept()` behind it
|
|
@@ -90,7 +90,7 @@ chain.verify_revocation_list(lst, ROOT, now) # NOMOS-SPEC-007 rev. 1.10
|
|
|
90
90
|
|
|
91
91
|
This package is checked against:
|
|
92
92
|
- every vector of NOMOS-SPEC-007 (1.7.0, rev. 1.11, rev. 1.10 revocation sources), NOMOS-SPEC-008
|
|
93
|
-
0.7.0 with rev. 0.8.0 (several laws) and rev. 0.9.0 (intake questions), NOMOS-SPEC-010 0.
|
|
93
|
+
0.7.0 with rev. 0.8.0 (several laws) and rev. 0.9.0 (intake questions), NOMOS-SPEC-010 0.3.0 and
|
|
94
94
|
NOMOS-SPEC-016 0.1.0 (budgets: 200 of 200, `budget-vectors/check.py`);
|
|
95
95
|
- the NOMOS-SPEC-009 selection vectors;
|
|
96
96
|
- the NOMOS-SPEC-009 HTTP runner, 17 of 17, with `accept()` behind it
|
|
@@ -34,10 +34,11 @@ from .issuer import issuer, Issuer
|
|
|
34
34
|
from . import registrar
|
|
35
35
|
from .registrar import verify_registrar_log, fold_registrar_log, load_registrar_world, discover as discover_registrar_log
|
|
36
36
|
|
|
37
|
-
__version__ = "0.
|
|
37
|
+
__version__ = "0.5.0"
|
|
38
38
|
SPECIFICATIONS = {
|
|
39
|
-
"NOMOS-SPEC-001": "2.2.0 + amendments 2.3.0, 2.6.0 (budgets)
|
|
40
|
-
"NOMOS-SPEC-
|
|
41
|
-
"NOMOS-SPEC-
|
|
39
|
+
"NOMOS-SPEC-001": "2.2.0 + amendments 2.3.0, 2.6.0 (budgets), 2.7.0 (seal suites, dual seals)",
|
|
40
|
+
"NOMOS-SPEC-007": "rev. 1.12.0 (dual keys)",
|
|
41
|
+
"NOMOS-SPEC-008": "0.7.0 + rev. 0.8.0 (several laws), rev. 0.9.0 (intake questions), rev. 0.10.0 (dual keys)",
|
|
42
|
+
"NOMOS-SPEC-009": "0.4.0", "NOMOS-SPEC-010": "0.3.0", "NOMOS-SPEC-014": "0.4.0 (registrar logs)",
|
|
42
43
|
"NOMOS-SPEC-016": "0.1.0",
|
|
43
44
|
}
|
|
@@ -60,8 +60,8 @@ def type_ok(value: Any, spec: dict) -> bool:
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
# §6.3 (0.6.0): the suites each statement may be signed under (NOMOS-SPEC-010)
|
|
63
|
-
TESTIMONY_SUITES = ("Ed25519", "ES256") # testimony and in-force statements
|
|
64
|
-
CONSENT_SUITES = ("Ed25519", "ES256", "WebAuthn-ES256")
|
|
63
|
+
TESTIMONY_SUITES = ("Ed25519", "ES256", "ES384", "ES512") # testimony and in-force statements (rev. 0.10.0 §1)
|
|
64
|
+
CONSENT_SUITES = ("Ed25519", "ES256", "ES384", "ES512", "WebAuthn-ES256")
|
|
65
65
|
CURRENCY_POLICIES = ("record", "record_or_statement")
|
|
66
66
|
WEBAUTHN_FIELDS = ("authenticator_data", "client_data_json", "signature")
|
|
67
67
|
|
|
@@ -405,7 +405,7 @@ def verify_act(act: Any, *, relying_party_id: str, root_pem: str, now: datetime,
|
|
|
405
405
|
meta = art.get("meta", {})
|
|
406
406
|
r = chain.resolve(seal["kid"], pool, root_pem, now, chain.for_artifact(meta, seal["signature_algorithm"]), revoked_kids, revoked_certs)
|
|
407
407
|
if r["decision"] != "RESOLVED": return r
|
|
408
|
-
failure = chain.seal_failure(art, r
|
|
408
|
+
failure = chain.seal_failure(art, r) # rev. 0.10.0 §2: the resolution says whether the key is dual
|
|
409
409
|
if failure: return failure
|
|
410
410
|
# 5a. the authority in force at `now` (§5.4): genuine is not enough, it must also be current.
|
|
411
411
|
# A superseded version stays valid for verifying past decisions; it cannot authorize new ones.
|
|
@@ -432,6 +432,8 @@ def verify_act(act: Any, *, relying_party_id: str, root_pem: str, now: datetime,
|
|
|
432
432
|
if st["kid"] != seal["kid"] or not chain.suite_permitted(r["effective"], st["algorithm"]) \
|
|
433
433
|
or not statement_sig(r["key"], st, in_force_payload(st))[0]:
|
|
434
434
|
return unverified("bad_signature")
|
|
435
|
+
dual = chain.dual_failure(r, st, jcs(in_force_payload(st)), strong=True) # rev. 0.10.0 §2
|
|
436
|
+
if dual: return unverified(dual)
|
|
435
437
|
try:
|
|
436
438
|
sa, su = ts(st["as_of"]), ts(st["valid_until"])
|
|
437
439
|
except (ValueError, TypeError):
|
|
@@ -458,6 +460,8 @@ def verify_act(act: Any, *, relying_party_id: str, root_pem: str, now: datetime,
|
|
|
458
460
|
return statement_failure(w, "TESTIMONY_INVALID", "TESTIMONY_OUT_OF_SCOPE", claim=t["claim"])
|
|
459
461
|
ok, why = statement_sig(w["key"], t, testimony_payload(t))
|
|
460
462
|
if not ok: return {"decision": "TESTIMONY_INVALID", "claim": t["claim"], "reason_code": why}
|
|
463
|
+
why = chain.dual_failure(w, t, jcs(testimony_payload(t)), strong=False) # rev. 0.10.0 §2
|
|
464
|
+
if why: return {"decision": "TESTIMONY_INVALID", "claim": t["claim"], "reason_code": why}
|
|
461
465
|
try:
|
|
462
466
|
fresh = ts(t["as_of"]) <= now <= ts(t["valid_until"])
|
|
463
467
|
except (ValueError, TypeError, AttributeError):
|
|
@@ -526,6 +530,8 @@ def verify_act(act: Any, *, relying_party_id: str, root_pem: str, now: datetime,
|
|
|
526
530
|
if len({e["approver"] for e in k["admitted"]}) > 1: return {"decision": "CONSENT_INVALID", "reason_code": "approver_ambiguous"}
|
|
527
531
|
ok, why = statement_sig(k["key"], c, consent_payload(c))
|
|
528
532
|
if not ok: return {"decision": "CONSENT_INVALID", "reason_code": why}
|
|
533
|
+
why = chain.dual_failure(k, c, jcs(consent_payload(c)), strong=False) # rev. 0.10.0 §2
|
|
534
|
+
if why: return {"decision": "CONSENT_INVALID", "reason_code": why}
|
|
529
535
|
if c["binding_digest"] != digest: return {"decision": "CONSENT_INVALID", "reason_code": "binding_mismatch"}
|
|
530
536
|
if c["decision"] == "approve" and c["role"] == role: approvers.add(k["effective"]["approver"])
|
|
531
537
|
# §4.4: n consents means n distinct people, never n keys
|
|
@@ -543,7 +549,7 @@ def _check_authority(entry: dict, pool: list, root_pem: str, now: datetime, curr
|
|
|
543
549
|
art = entry["artifact"]; seal = art["seal"]; meta = art.get("meta", {}); art_id = meta.get("artifact_id")
|
|
544
550
|
r = chain.resolve(seal["kid"], pool, root_pem, now, chain.for_artifact(meta, seal["signature_algorithm"]), revoked_kids, revoked_certs)
|
|
545
551
|
if r["decision"] != "RESOLVED": return {**r, "artifact_id": art_id}, None
|
|
546
|
-
failure = chain.seal_failure(art, r
|
|
552
|
+
failure = chain.seal_failure(art, r) # rev. 0.10.0 §2: the resolution says whether the key is dual
|
|
547
553
|
if failure: return {**failure, "artifact_id": art_id}, None
|
|
548
554
|
if seal["hash"] in revoked_artifacts: return {"decision": "ARTIFACT_REVOKED", "artifact_id": art_id}, None
|
|
549
555
|
def unverified(reason): return {"decision": "VERSION_UNVERIFIED", "artifact_id": art_id, "reason_code": reason}, None
|
|
@@ -564,6 +570,8 @@ def _check_authority(entry: dict, pool: list, root_pem: str, now: datetime, curr
|
|
|
564
570
|
if st["kid"] != seal["kid"] or not chain.suite_permitted(r["effective"], st["algorithm"]) \
|
|
565
571
|
or not statement_sig(r["key"], st, in_force_payload(st))[0]:
|
|
566
572
|
return unverified("bad_signature")
|
|
573
|
+
dual = chain.dual_failure(r, st, jcs(in_force_payload(st)), strong=True) # rev. 0.10.0 §2
|
|
574
|
+
if dual: return unverified(dual)
|
|
567
575
|
try:
|
|
568
576
|
sa, su = ts(st["as_of"]), ts(st["valid_until"])
|
|
569
577
|
except (ValueError, TypeError):
|
|
@@ -654,14 +662,16 @@ def verify_act_multi(act: Any, *, relying_party_id: str, root_pem: str, now: dat
|
|
|
654
662
|
or t.get("algorithm") not in TESTIMONY_SUITES:
|
|
655
663
|
return {"decision": "MALFORMED", "reason_code": "bad_testimony"}
|
|
656
664
|
if only_ignored(t["claim"]): continue
|
|
657
|
-
key_pem = None
|
|
665
|
+
key_pem, resolved = None, None
|
|
658
666
|
for l in (declaring(t["claim"]) or laws[:1]):
|
|
659
667
|
w = resolve_statement_key("claim", t["claim"], t, pool, root_pem, now, l["meta"], revoked_kids, revoked_certs)
|
|
660
668
|
if w["decision"] != "RESOLVED":
|
|
661
669
|
return {**statement_failure(w, "TESTIMONY_INVALID", "TESTIMONY_OUT_OF_SCOPE", claim=t["claim"]), "artifact_id": l["artifact_id"]}
|
|
662
|
-
key_pem = w["key"]
|
|
670
|
+
key_pem, resolved = w["key"], w
|
|
663
671
|
ok, why = statement_sig(key_pem, t, testimony_payload(t))
|
|
664
672
|
if not ok: return {"decision": "TESTIMONY_INVALID", "claim": t["claim"], "reason_code": why}
|
|
673
|
+
why = chain.dual_failure(resolved, t, jcs(testimony_payload(t)), strong=False) # rev. 0.10.0 §2
|
|
674
|
+
if why: return {"decision": "TESTIMONY_INVALID", "claim": t["claim"], "reason_code": why}
|
|
665
675
|
try:
|
|
666
676
|
fresh = ts(t["as_of"]) <= now <= ts(t["valid_until"])
|
|
667
677
|
except (ValueError, TypeError, AttributeError):
|
|
@@ -729,6 +739,8 @@ def verify_act_multi(act: Any, *, relying_party_id: str, root_pem: str, now: dat
|
|
|
729
739
|
if len({e["approver"] for e in k["admitted"]}) > 1: return {"decision": "CONSENT_INVALID", "reason_code": "approver_ambiguous"}
|
|
730
740
|
ok, why = statement_sig(k["key"], c, consent_payload(c))
|
|
731
741
|
if not ok: return {"decision": "CONSENT_INVALID", "reason_code": why}
|
|
742
|
+
why = chain.dual_failure(k, c, jcs(consent_payload(c)), strong=False) # rev. 0.10.0 §2
|
|
743
|
+
if why: return {"decision": "CONSENT_INVALID", "reason_code": why}
|
|
732
744
|
if c["binding_digest"] != digest: return {"decision": "CONSENT_INVALID", "reason_code": "binding_mismatch"}
|
|
733
745
|
e = esc_of.get(l["artifact_id"])
|
|
734
746
|
if e and c["decision"] == "approve" and c["role"] == e.get("role_required"): approvers[l["artifact_id"]].add(k["effective"]["approver"])
|
|
@@ -20,8 +20,10 @@ from . import suites
|
|
|
20
20
|
from .jcs import jcs, sha256_hex
|
|
21
21
|
|
|
22
22
|
MAX_CHAIN = 20 # §4.5
|
|
23
|
-
CERT_SUITES = ("Ed25519", "ES256")
|
|
24
|
-
SEAL_SUITES = ("Ed25519", "ES256")
|
|
23
|
+
CERT_SUITES = ("Ed25519", "ES256", "ES384", "ES512") # §3.1 (rev. 1.12): never WebAuthn-signed
|
|
24
|
+
SEAL_SUITES = ("Ed25519", "ES256", "ES384", "ES512") # NOMOS-SPEC-001 amendment 2.7.0 §8.3
|
|
25
|
+
PQ_SUITES = ("ML-DSA-65", "ML-DSA-87") # rev. 1.12 §3.0: the ML-DSA half of a dual key
|
|
26
|
+
PQ_FIELDS = ("child_pq_public_key_pem", "pq_algorithm", "pq_signature")
|
|
25
27
|
ARTIFACT_DIMS = ("artifact", "industry", "jurisdiction")
|
|
26
28
|
STATEMENT_DIMS = ("claim", "consent")
|
|
27
29
|
SET_DIMS = ("claim", "consent", "suite")
|
|
@@ -41,8 +43,53 @@ def ts(s: str) -> datetime:
|
|
|
41
43
|
|
|
42
44
|
# ── certificates (§3) ────────────────────────────────────────────────────────────────────────
|
|
43
45
|
def cert_payload(c: dict) -> dict:
|
|
44
|
-
"""§3.2: the signed payload. `algorithm` and `
|
|
45
|
-
|
|
46
|
+
"""§3.2: the signed payload. `algorithm`, `signature`, `pq_algorithm` and `pq_signature` are not
|
|
47
|
+
signed; `scope` is null when absent. Rev. 1.12: a certificate that carries
|
|
48
|
+
`child_pq_public_key_pem` (a dual parent's) signs it too, so whether the child is dual is a fact
|
|
49
|
+
the parent signed with both keys."""
|
|
50
|
+
p = {k: c.get(k) for k in ("parent_kid", "child_kid", "child_public_key_pem", "issued_at", "expires_at")} | {"scope": c.get("scope")}
|
|
51
|
+
if "child_pq_public_key_pem" in c:
|
|
52
|
+
p["child_pq_public_key_pem"] = c["child_pq_public_key_pem"]
|
|
53
|
+
return p
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# ── dual keys (rev. 1.12) ────────────────────────────────────────────────────────────────────
|
|
57
|
+
def root_keys(root: Any) -> Tuple[Optional[str], Optional[str], Optional[str]]:
|
|
58
|
+
"""A pinned root: its PEM, or {"public_key_pem", "pq_public_key_pem"} (§4.1). Returns
|
|
59
|
+
(classical PEM, ML-DSA PEM or None, reason or None). A dual root's ML-DSA key is ML-DSA-87."""
|
|
60
|
+
if isinstance(root, dict):
|
|
61
|
+
pem, pq = root.get("public_key_pem"), root.get("pq_public_key_pem")
|
|
62
|
+
if pq is not None:
|
|
63
|
+
ktype, _, reason = suites.load_key(pq)
|
|
64
|
+
if reason or ktype != "ML-DSA-87": return None, None, "bad_root"
|
|
65
|
+
else:
|
|
66
|
+
pem, pq = root, None
|
|
67
|
+
_, _, reason = suites.load_key(pem)
|
|
68
|
+
if reason or not isinstance(pem, str): return None, None, "bad_root"
|
|
69
|
+
if suites.load_key(pem)[0] in PQ_SUITES: return None, None, "bad_root"
|
|
70
|
+
return pem, pq, None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def dual_failure(resolved: Verdict, obj: dict, payload: bytes, *, strong: bool,
|
|
74
|
+
alg_field: str = "pq_algorithm", sig_field: str = "pq_signature",
|
|
75
|
+
kid_field: Optional[str] = None) -> Optional[str]:
|
|
76
|
+
"""NOMOS-SPEC-008 rev. 0.10.0 §2 and rev. 1.12 §5, after the classical signature has verified:
|
|
77
|
+
None when the object's ML-DSA half is exactly what its signer requires, else the reason.
|
|
78
|
+
`strong` marks objects whose signer must be dual under a dual root and ML-DSA-87 (seals,
|
|
79
|
+
in-force statements, certificates, staples, revocations)."""
|
|
80
|
+
pq = resolved.get("pq_key")
|
|
81
|
+
fields = [f for f in (alg_field, sig_field, kid_field) if f]
|
|
82
|
+
present = [f for f in fields if f in obj]
|
|
83
|
+
if pq is None:
|
|
84
|
+
if present: return "unexpected_pq_signature"
|
|
85
|
+
if strong and resolved.get("root_dual"): return "dual_required"
|
|
86
|
+
return None
|
|
87
|
+
if len(present) != len(fields) or not all(isinstance(obj.get(f), str) and obj.get(f) for f in fields):
|
|
88
|
+
return "dual_signature_required"
|
|
89
|
+
if kid_field and obj[kid_field] != suites.compute_kid(pq): return "kid_mismatch"
|
|
90
|
+
if obj[alg_field] not in (("ML-DSA-87",) if strong else PQ_SUITES): return "pq_level"
|
|
91
|
+
ok, why = suites.verify(obj[alg_field], pq, payload, {"signature": obj[sig_field]})
|
|
92
|
+
return None if ok else why
|
|
46
93
|
|
|
47
94
|
|
|
48
95
|
def fingerprint(c: dict) -> str:
|
|
@@ -63,9 +110,17 @@ def check_pool(pool: Any) -> Optional[str]:
|
|
|
63
110
|
return "bad_certificate"
|
|
64
111
|
if c["algorithm"] not in CERT_SUITES: return "bad_certificate"
|
|
65
112
|
if c.get("scope") is not None and not isinstance(c.get("scope"), str): return "bad_certificate"
|
|
113
|
+
if _bad_pq_fields(c): return "bad_certificate"
|
|
66
114
|
return None
|
|
67
115
|
|
|
68
116
|
|
|
117
|
+
def _bad_pq_fields(c: dict) -> bool:
|
|
118
|
+
"""Shape only: a present dual field has its type. Presence is judged against the parent (§3.3)."""
|
|
119
|
+
if "child_pq_public_key_pem" in c and c["child_pq_public_key_pem"] is not None and not isinstance(c["child_pq_public_key_pem"], str):
|
|
120
|
+
return True
|
|
121
|
+
return any(f in c and not (isinstance(c[f], str) and c[f]) for f in ("pq_algorithm", "pq_signature"))
|
|
122
|
+
|
|
123
|
+
|
|
69
124
|
def check_staples(staples: Any) -> Optional[str]:
|
|
70
125
|
if staples is None: return None
|
|
71
126
|
if not isinstance(staples, list) or len(staples) > MAX_CHAIN: return "bad_staples"
|
|
@@ -73,6 +128,7 @@ def check_staples(staples: Any) -> Optional[str]:
|
|
|
73
128
|
if not isinstance(s, dict) or not all(isinstance(s.get(k), str) and s.get(k) for k in STAPLE_FIELDS):
|
|
74
129
|
return "bad_staple"
|
|
75
130
|
if s["algorithm"] not in CERT_SUITES: return "bad_staple"
|
|
131
|
+
if any(f in s and not (isinstance(s[f], str) and s[f]) for f in ("pq_algorithm", "pq_signature")): return "bad_staple"
|
|
76
132
|
return None
|
|
77
133
|
|
|
78
134
|
|
|
@@ -204,8 +260,9 @@ def _sig_ok(cert: dict, parent_pem: str, memo: Optional[dict]) -> Tuple[bool, Op
|
|
|
204
260
|
|
|
205
261
|
|
|
206
262
|
def _validate(path: list, root_pem: str, now: datetime, admit: Admit,
|
|
207
|
-
revoked_kids: Set[str], revoked_certs: Set[str], memo: Optional[dict] = None
|
|
208
|
-
|
|
263
|
+
revoked_kids: Set[str], revoked_certs: Set[str], memo: Optional[dict] = None,
|
|
264
|
+
root_pq: Optional[str] = None) -> Verdict:
|
|
265
|
+
cur_pem, cur_pq, effective = root_pem, root_pq, {}
|
|
209
266
|
hops = []
|
|
210
267
|
for index, cert in enumerate(path):
|
|
211
268
|
ktype, _, reason = suites.load_key(cert["child_public_key_pem"])
|
|
@@ -214,8 +271,22 @@ def _validate(path: list, root_pem: str, now: datetime, admit: Admit,
|
|
|
214
271
|
return _fail("ISSUER_NOT_RECOGNIZED", reason_code="kid_mismatch")
|
|
215
272
|
if not suite_permitted(effective, cert["algorithm"]):
|
|
216
273
|
return _fail("OUT_OF_SCOPE", dimension="suite", reason_code="suite_not_permitted")
|
|
274
|
+
# rev. 1.12 §3.3, §3.9: the parent decides whether the certificate is dual
|
|
275
|
+
if cur_pq is None:
|
|
276
|
+
if any(f in cert for f in PQ_FIELDS): return _fail("ISSUER_NOT_RECOGNIZED", reason_code="pq_without_dual_parent")
|
|
277
|
+
if root_pq is not None: return _fail("ISSUER_NOT_RECOGNIZED", reason_code="dual_required")
|
|
278
|
+
else:
|
|
279
|
+
if not all(f in cert for f in PQ_FIELDS): return _fail("ISSUER_NOT_RECOGNIZED", reason_code="dual_signature_required")
|
|
280
|
+
child_pq = cert["child_pq_public_key_pem"]
|
|
281
|
+
if child_pq is not None:
|
|
282
|
+
ptype, _, preason = suites.load_key(child_pq)
|
|
283
|
+
if preason or ptype not in PQ_SUITES: return _fail("ISSUER_NOT_RECOGNIZED", reason_code="invalid_key")
|
|
217
284
|
ok, why = _sig_ok(cert, cur_pem, memo)
|
|
218
285
|
if not ok: return _fail("ISSUER_NOT_RECOGNIZED", reason_code=why)
|
|
286
|
+
if cur_pq is not None:
|
|
287
|
+
ok, why = suites.verify(cert["pq_algorithm"], cur_pq, jcs(cert_payload(cert)), {"signature": cert["pq_signature"]})
|
|
288
|
+
if not ok: return _fail("ISSUER_NOT_RECOGNIZED", reason_code=why)
|
|
289
|
+
if cert["pq_algorithm"] != "ML-DSA-87": return _fail("ISSUER_NOT_RECOGNIZED", reason_code="pq_level")
|
|
219
290
|
try:
|
|
220
291
|
issued, expires = ts(cert["issued_at"]), ts(cert["expires_at"])
|
|
221
292
|
except (ValueError, TypeError):
|
|
@@ -225,6 +296,9 @@ def _validate(path: list, root_pem: str, now: datetime, admit: Admit,
|
|
|
225
296
|
fp = fingerprint(cert)
|
|
226
297
|
if fp in revoked_certs: return _fail("CERTIFICATE_REVOKED", revoked_fingerprint=fp)
|
|
227
298
|
if cert["child_kid"] in revoked_kids: return _fail("KEY_REVOKED", revoked_kid=cert["child_kid"])
|
|
299
|
+
child_pq = cert.get("child_pq_public_key_pem")
|
|
300
|
+
if child_pq and suites.compute_kid(child_pq) in revoked_kids:
|
|
301
|
+
return _fail("KEY_REVOKED", revoked_kid=suites.compute_kid(child_pq))
|
|
228
302
|
try:
|
|
229
303
|
terms = parse_scope(cert.get("scope"))
|
|
230
304
|
except ScopeError:
|
|
@@ -239,14 +313,15 @@ def _validate(path: list, root_pem: str, now: datetime, admit: Admit,
|
|
|
239
313
|
if d in effective and not contains(d, effective[d], v):
|
|
240
314
|
return _fail("OUT_OF_SCOPE", dimension=d, reason_code="widening")
|
|
241
315
|
narrowed[d] = v
|
|
242
|
-
hops.append({"cert": cert, "parent_pem": cur_pem, "parent_effective": effective})
|
|
243
|
-
cur_pem, effective = cert["child_public_key_pem"], narrowed
|
|
316
|
+
hops.append({"cert": cert, "parent_pem": cur_pem, "parent_pq": cur_pq, "parent_effective": effective})
|
|
317
|
+
cur_pem, cur_pq, effective = cert["child_public_key_pem"], cert.get("child_pq_public_key_pem"), narrowed
|
|
244
318
|
dim = admit(effective)
|
|
245
319
|
if dim is not None: return _fail("OUT_OF_SCOPE", dimension=dim)
|
|
246
|
-
return {"decision": "RESOLVED", "key": cur_pem, "
|
|
320
|
+
return {"decision": "RESOLVED", "key": cur_pem, "pq_key": cur_pq, "root_dual": root_pq is not None,
|
|
321
|
+
"effective": effective, "hops": hops}
|
|
247
322
|
|
|
248
323
|
|
|
249
|
-
def resolve(target_kid: str, pool: list, root_pem:
|
|
324
|
+
def resolve(target_kid: str, pool: list, root_pem: Any, now: datetime, admit: Admit,
|
|
250
325
|
revoked_kids: Optional[Set[str]] = None, revoked_certs: Optional[Set[str]] = None,
|
|
251
326
|
all_paths: bool = False) -> Verdict:
|
|
252
327
|
"""§4.2a. `pool` must already have passed check_pool. On success the verdict carries the
|
|
@@ -256,14 +331,16 @@ def resolve(target_kid: str, pool: list, root_pem: str, now: datetime, admit: Ad
|
|
|
256
331
|
the first, in fingerprint order, is still the one reported."""
|
|
257
332
|
revoked_kids = revoked_kids or set()
|
|
258
333
|
revoked_certs = revoked_certs or set()
|
|
259
|
-
|
|
260
|
-
if reason: return _fail("MALFORMED", reason_code=
|
|
334
|
+
root_pem, root_pq, reason = root_keys(root_pem) # rev. 1.12 §4.1: a pinned root may be dual
|
|
335
|
+
if reason: return _fail("MALFORMED", reason_code=reason)
|
|
261
336
|
root_kid = suites.compute_kid(root_pem)
|
|
262
337
|
if root_kid in revoked_kids: return _fail("KEY_REVOKED", revoked_kid=root_kid)
|
|
338
|
+
if root_pq is not None and suites.compute_kid(root_pq) in revoked_kids:
|
|
339
|
+
return _fail("KEY_REVOKED", revoked_kid=suites.compute_kid(root_pq))
|
|
263
340
|
first_failure, first_resolved, admitted = None, None, []
|
|
264
341
|
memo: dict = {}
|
|
265
342
|
for path in _candidates(target_kid, root_kid, pool, frozenset()):
|
|
266
|
-
r = _validate(path, root_pem, now, admit, revoked_kids, revoked_certs, memo)
|
|
343
|
+
r = _validate(path, root_pem, now, admit, revoked_kids, revoked_certs, memo, root_pq)
|
|
267
344
|
if r["decision"] == "RESOLVED":
|
|
268
345
|
r["path"] = [root_kid] + [c["child_kid"] for c in path]
|
|
269
346
|
if not all_paths: return r
|
|
@@ -286,17 +363,25 @@ def check_seal_shape(artifact: Any) -> Optional[str]:
|
|
|
286
363
|
if not isinstance(seal, dict) or seal.get("status") != "sealed" or not all(isinstance(seal.get(k), str) for k in ("hash", "signature", "kid")):
|
|
287
364
|
return "unsealed_artifact"
|
|
288
365
|
if seal.get("signature_algorithm") not in SEAL_SUITES: return "seal_algorithm"
|
|
366
|
+
if any(f in seal and not (isinstance(seal[f], str) and seal[f]) for f in ("pq_kid", "pq_signature_algorithm", "pq_signature")):
|
|
367
|
+
return "unsealed_artifact"
|
|
289
368
|
return None
|
|
290
369
|
|
|
291
370
|
|
|
292
|
-
def seal_failure(artifact: dict, key_pem:
|
|
293
|
-
"""None if the seal verifies under the resolved key; otherwise the SEAL_INVALID verdict.
|
|
371
|
+
def seal_failure(artifact: dict, key_pem: Any) -> Optional[Verdict]:
|
|
372
|
+
"""None if the seal verifies under the resolved key; otherwise the SEAL_INVALID verdict.
|
|
373
|
+
`key_pem` is the classical PEM, or the resolution verdict itself, which also says whether the
|
|
374
|
+
key is dual (NOMOS-SPEC-001 amendment 2.7.0 §8.3a)."""
|
|
375
|
+
resolved = key_pem if isinstance(key_pem, dict) else {"key": key_pem}
|
|
294
376
|
seal = artifact["seal"]
|
|
295
377
|
body = {k: v for k, v in artifact.items() if k not in ("seal", "attestations")}
|
|
296
378
|
if sha256_hex(jcs(body)) != seal["hash"]: return _fail("SEAL_INVALID", reason_code="hash_mismatch")
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
379
|
+
payload = jcs({"hash": seal["hash"], "signed_by": seal.get("signed_by")})
|
|
380
|
+
ok, why = suites.verify(seal["signature_algorithm"], resolved["key"], payload, {"signature": seal["signature"]})
|
|
381
|
+
if not ok: return _fail("SEAL_INVALID", reason_code=why)
|
|
382
|
+
why = dual_failure(resolved, seal, payload, strong=True, alg_field="pq_signature_algorithm",
|
|
383
|
+
sig_field="pq_signature", kid_field="pq_kid")
|
|
384
|
+
return None if why is None else _fail("SEAL_INVALID", reason_code=why)
|
|
300
385
|
|
|
301
386
|
|
|
302
387
|
# ── freshness staples (§5.5) ─────────────────────────────────────────────────────────────────
|
|
@@ -314,7 +399,8 @@ def staple_confidence(resolved: Verdict, staples: Optional[list], now: datetime)
|
|
|
314
399
|
if not ts(s["as_of"]) <= now <= ts(s["valid_until"]): continue
|
|
315
400
|
except (ValueError, TypeError):
|
|
316
401
|
continue
|
|
317
|
-
if suites.verify(s["algorithm"], hop["parent_pem"], jcs(staple_payload(s)), {"signature": s["signature"]})[0]
|
|
402
|
+
if (suites.verify(s["algorithm"], hop["parent_pem"], jcs(staple_payload(s)), {"signature": s["signature"]})[0]
|
|
403
|
+
and dual_failure({"pq_key": hop.get("parent_pq")}, s, jcs(staple_payload(s)), strong=True) is None):
|
|
318
404
|
covered = True
|
|
319
405
|
break
|
|
320
406
|
levels.append("staple" if covered else "unchecked")
|
|
@@ -322,7 +408,7 @@ def staple_confidence(resolved: Verdict, staples: Optional[list], now: datetime)
|
|
|
322
408
|
|
|
323
409
|
|
|
324
410
|
# ── revocation sources (rev. 1.10 §5.1, §5.1a, §5.3, §5.3a) ──────────────────────────────────
|
|
325
|
-
REVOCATION_SUITES = ("Ed25519", "ES256")
|
|
411
|
+
REVOCATION_SUITES = ("Ed25519", "ES256", "ES384", "ES512")
|
|
326
412
|
MAX_LIST_CERTS = 1000
|
|
327
413
|
_FP = re.compile(r"^[0-9a-f]{64}$")
|
|
328
414
|
|
|
@@ -354,14 +440,22 @@ def _unique(certs: list) -> list:
|
|
|
354
440
|
return out
|
|
355
441
|
|
|
356
442
|
|
|
357
|
-
def
|
|
358
|
-
|
|
359
|
-
"""The signer's
|
|
443
|
+
def _signer(kid: str, pool: list, root_pem: Any, at: datetime, suite: str,
|
|
444
|
+
revoked_kids: Set[str], revoked_certs: Set[str]) -> Optional[Verdict]:
|
|
445
|
+
"""The signer's resolution if it is the root or resolves to it (§4.2a) at `at`, else None."""
|
|
360
446
|
r = resolve(kid, pool, root_pem, at, for_signing(suite), revoked_kids, revoked_certs)
|
|
361
|
-
return r
|
|
447
|
+
return r if r["decision"] == "RESOLVED" else None
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
def _cert_signed_by(c: dict, parent: Verdict) -> bool:
|
|
451
|
+
"""rev. 1.10 §5.1a rule 4, as amended by rev. 1.12 §5: every signature §3.3 requires of `c`."""
|
|
452
|
+
if not suites.verify(c["algorithm"], parent["key"], jcs(cert_payload(c)), {"signature": c["signature"]})[0]: return False
|
|
453
|
+
if parent.get("pq_key") is None: return not any(f in c for f in PQ_FIELDS)
|
|
454
|
+
return (all(f in c for f in PQ_FIELDS) and c["pq_algorithm"] == "ML-DSA-87"
|
|
455
|
+
and suites.verify(c["pq_algorithm"], parent["pq_key"], jcs(cert_payload(c)), {"signature": c["pq_signature"]})[0])
|
|
362
456
|
|
|
363
457
|
|
|
364
|
-
def evaluate_statement(st: Any, pool: list, root_pem:
|
|
458
|
+
def evaluate_statement(st: Any, pool: list, root_pem: Any, now: datetime) -> Optional[str]:
|
|
365
459
|
"""§5.1a. None if the statement counts, else the first rule it fails."""
|
|
366
460
|
if not isinstance(st, dict): return "bad_statement"
|
|
367
461
|
has_kid, has_fp = "revoked_kid" in st, "revoked_fingerprint" in st
|
|
@@ -379,20 +473,23 @@ def evaluate_statement(st: Any, pool: list, root_pem: str, now: datetime) -> Opt
|
|
|
379
473
|
if issued > now: return "bad_statement"
|
|
380
474
|
# rule 2: the revoked object, certified by this parent
|
|
381
475
|
certs = [c for c in pool if c.get("parent_kid") == st["kid"] and
|
|
382
|
-
(c.get("child_kid") == target
|
|
476
|
+
((c.get("child_kid") == target or (bool(c.get("child_pq_public_key_pem")) and suites.compute_kid(c["child_pq_public_key_pem"]) == target))
|
|
477
|
+
if has_kid else fingerprint(c) == target)]
|
|
383
478
|
if not certs: return "no_certificate"
|
|
384
479
|
# rule 3: the parent is recognized from the root, at issued_at, revocation not consulted
|
|
385
|
-
parent =
|
|
480
|
+
parent = _signer(st["kid"], pool, root_pem, issued, st["algorithm"], set(), set())
|
|
386
481
|
if parent is None: return "signer_not_recognized"
|
|
387
|
-
# rule 4: the parent made the certificate
|
|
388
|
-
if not any(
|
|
482
|
+
# rule 4: the parent made the certificate (both halves when the parent is dual)
|
|
483
|
+
if not any(_cert_signed_by(c, parent) for c in certs):
|
|
389
484
|
return "bad_certificate_signature"
|
|
390
|
-
# rule 5: the parent signed the statement
|
|
391
|
-
|
|
392
|
-
|
|
485
|
+
# rule 5: the parent signed the statement (both halves when the parent is dual)
|
|
486
|
+
payload = jcs(revocation_payload(st))
|
|
487
|
+
ok, _ = suites.verify(st["algorithm"], parent["key"], payload, {"signature": st["signature"]})
|
|
488
|
+
if not ok: return "bad_signature"
|
|
489
|
+
return dual_failure(parent, st, payload, strong=True)
|
|
393
490
|
|
|
394
491
|
|
|
395
|
-
def verify_revocation_list(lst: Any, root_pem:
|
|
492
|
+
def verify_revocation_list(lst: Any, root_pem: Any, now: datetime, own_certs: Optional[list] = None) -> dict:
|
|
396
493
|
"""§5.3a. Returns {decision, revoked_kids, revoked_certs, as_of?, ignored} with sorted lists."""
|
|
397
494
|
if (not isinstance(lst, dict) or not all(isinstance(lst.get(f), str) for f in ("generated_at", "kid", "algorithm", "signature"))
|
|
398
495
|
or not isinstance(lst.get("statements"), list)):
|
|
@@ -412,8 +509,10 @@ def verify_revocation_list(lst: Any, root_pem: str, now: datetime, own_certs: Op
|
|
|
412
509
|
except (ValueError, TypeError):
|
|
413
510
|
return out
|
|
414
511
|
if generated > now or lst["algorithm"] not in REVOCATION_SUITES: return out
|
|
415
|
-
signer =
|
|
416
|
-
|
|
512
|
+
signer = _signer(lst["kid"], pool, root_pem, generated, lst["algorithm"], kids, fps)
|
|
513
|
+
payload = jcs(revocation_list_payload(lst))
|
|
514
|
+
if (signer and suites.verify(lst["algorithm"], signer["key"], payload, {"signature": lst["signature"]})[0]
|
|
515
|
+
and dual_failure(signer, lst, payload, strong=True) is None):
|
|
417
516
|
out["as_of"] = lst["generated_at"]
|
|
418
517
|
return out
|
|
419
518
|
|
|
@@ -425,4 +524,5 @@ def check_pool_unbounded(pool: list) -> Optional[str]:
|
|
|
425
524
|
if not isinstance(c, dict) or not all(isinstance(c.get(f), str) and c.get(f) for f in CERT_FIELDS) or c.get("algorithm") not in CERT_SUITES:
|
|
426
525
|
return "bad_certificate"
|
|
427
526
|
if c.get("scope") is not None and not isinstance(c.get("scope"), str): return "bad_certificate"
|
|
527
|
+
if _bad_pq_fields(c): return "bad_certificate"
|
|
428
528
|
return None
|
|
@@ -5,9 +5,12 @@ Every payload is exactly the one the specification names, canonicalized with RFC
|
|
|
5
5
|
and signed under a NOMOS-SPEC-010 suite (suites.py). The same functions the reference vector
|
|
6
6
|
generators use.
|
|
7
7
|
|
|
8
|
-
A `Signer` is anything with `kid`, `public_key_pem`, `algorithm` ("Ed25519"
|
|
9
|
-
`sign(payload: bytes) -> str` (base64, the suite's encoding). `local_signer()` wraps a
|
|
10
|
-
held in this process; in production, pass one backed by your KMS or HSM.
|
|
8
|
+
A `Signer` is anything with `kid`, `public_key_pem`, `algorithm` ("Ed25519", "ES256", "ES384" or
|
|
9
|
+
"ES512") and `sign(payload: bytes) -> str` (base64, the suite's encoding). `local_signer()` wraps a
|
|
10
|
+
private key held in this process; in production, pass one backed by your KMS or HSM.
|
|
11
|
+
|
|
12
|
+
A dual key (NOMOS-SPEC-007 rev. 1.12.0) is a Signer whose `pq` attribute is a second Signer with an
|
|
13
|
+
ML-DSA `algorithm`. Every producer below then adds the ML-DSA signature over the same bytes.
|
|
11
14
|
"""
|
|
12
15
|
from __future__ import annotations
|
|
13
16
|
|
|
@@ -19,7 +22,7 @@ from datetime import datetime, timedelta, timezone
|
|
|
19
22
|
from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol
|
|
20
23
|
|
|
21
24
|
from cryptography.hazmat.primitives import serialization
|
|
22
|
-
from cryptography.hazmat.primitives.asymmetric import ec, ed25519
|
|
25
|
+
from cryptography.hazmat.primitives.asymmetric import ec, ed25519, mldsa
|
|
23
26
|
|
|
24
27
|
from . import suites
|
|
25
28
|
from .act import binding_digest, consent_payload, in_force_payload, testimony_payload
|
|
@@ -38,24 +41,34 @@ class Signer(Protocol):
|
|
|
38
41
|
|
|
39
42
|
@dataclass
|
|
40
43
|
class LocalSigner:
|
|
41
|
-
"""A Signer over a private key in this process: for development, tests and offline roots.
|
|
44
|
+
"""A Signer over a private key in this process: for development, tests and offline roots.
|
|
45
|
+
`pq`, when set, is the ML-DSA half of a dual key (NOMOS-SPEC-007 rev. 1.12.0 §3.0)."""
|
|
42
46
|
kid: str
|
|
43
47
|
public_key_pem: str
|
|
44
48
|
algorithm: str
|
|
45
49
|
_key: Any
|
|
50
|
+
pq: Optional["LocalSigner"] = None
|
|
46
51
|
|
|
47
52
|
def sign(self, payload: bytes) -> str:
|
|
48
|
-
# Ed25519 signs the payload;
|
|
49
|
-
|
|
53
|
+
# Ed25519 signs the payload; ECDSA the suite's hash of it, P1363 r‖s, low-S, deterministic
|
|
54
|
+
# nonces; ML-DSA the payload itself, pure, empty context, hedged (NOMOS-SPEC-010 §4, §6).
|
|
55
|
+
if self.algorithm == "Ed25519": return suites.sign_ed25519(self._key, payload)
|
|
56
|
+
if self.algorithm in ("ML-DSA-65", "ML-DSA-87"): return suites.sign_mldsa(self._key, payload)
|
|
57
|
+
return suites.sign_ecdsa(self.algorithm, self._key, payload)
|
|
50
58
|
|
|
51
59
|
def private_key_pem(self) -> str:
|
|
52
60
|
return self._key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, serialization.NoEncryption()).decode()
|
|
53
61
|
|
|
54
62
|
|
|
63
|
+
_CURVE_SUITE = {"secp256r1": "ES256", "secp384r1": "ES384", "secp521r1": "ES512"}
|
|
64
|
+
|
|
65
|
+
|
|
55
66
|
def _wrap(key) -> LocalSigner:
|
|
56
67
|
if isinstance(key, ed25519.Ed25519PrivateKey): alg = "Ed25519"
|
|
57
|
-
elif isinstance(key, ec.EllipticCurvePrivateKey) and
|
|
58
|
-
|
|
68
|
+
elif isinstance(key, ec.EllipticCurvePrivateKey) and key.curve.name in _CURVE_SUITE: alg = _CURVE_SUITE[key.curve.name]
|
|
69
|
+
elif isinstance(key, mldsa.MLDSA65PrivateKey): alg = "ML-DSA-65"
|
|
70
|
+
elif isinstance(key, mldsa.MLDSA87PrivateKey): alg = "ML-DSA-87"
|
|
71
|
+
else: raise ValueError("not a NOMOS-SPEC-010 key: Ed25519, P-256, P-384, P-521, ML-DSA-65 or ML-DSA-87")
|
|
59
72
|
pem = suites.public_pem(key)
|
|
60
73
|
return LocalSigner(kid=suites.compute_kid(pem), public_key_pem=pem, algorithm=alg, _key=key)
|
|
61
74
|
|
|
@@ -68,8 +81,35 @@ def local_signer(private_key_pem: str) -> LocalSigner:
|
|
|
68
81
|
def generate_signer(algorithm: str = "Ed25519") -> LocalSigner:
|
|
69
82
|
"""A fresh in-memory key. For development and tests."""
|
|
70
83
|
if algorithm == "Ed25519": return _wrap(ed25519.Ed25519PrivateKey.generate())
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
curve = {"ES256": ec.SECP256R1, "ES384": ec.SECP384R1, "ES512": ec.SECP521R1}.get(algorithm)
|
|
85
|
+
if curve: return _wrap(ec.generate_private_key(curve()))
|
|
86
|
+
if algorithm == "ML-DSA-65": return _wrap(mldsa.MLDSA65PrivateKey.generate())
|
|
87
|
+
if algorithm == "ML-DSA-87": return _wrap(mldsa.MLDSA87PrivateKey.generate())
|
|
88
|
+
raise ValueError("algorithm must be a NOMOS-SPEC-010 suite other than WebAuthn-ES256")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def dual_signer(classical: LocalSigner, pq: LocalSigner) -> LocalSigner:
|
|
92
|
+
"""A dual key (NOMOS-SPEC-007 rev. 1.12.0 §3.0): `classical` named by its kid, carrying `pq`.
|
|
93
|
+
The classical key must never have signed alone (§3.0); make both fresh."""
|
|
94
|
+
if classical.algorithm not in ("Ed25519", "ES256", "ES384", "ES512"): raise ValueError("the classical half must be Ed25519 or ECDSA")
|
|
95
|
+
if pq.algorithm not in ("ML-DSA-65", "ML-DSA-87"): raise ValueError("the second half must be ML-DSA-65 or ML-DSA-87")
|
|
96
|
+
return LocalSigner(kid=classical.kid, public_key_pem=classical.public_key_pem, algorithm=classical.algorithm, _key=classical._key, pq=pq)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def generate_dual_signer(algorithm: str = "Ed25519", pq_algorithm: str = "ML-DSA-87") -> LocalSigner:
|
|
100
|
+
"""A fresh dual key. For development and tests."""
|
|
101
|
+
return dual_signer(generate_signer(algorithm), generate_signer(pq_algorithm))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _with_pq(obj: Dict[str, Any], signer: Any, payload: bytes, alg_field: str = "pq_algorithm",
|
|
105
|
+
sig_field: str = "pq_signature", kid_field: Optional[str] = None) -> Dict[str, Any]:
|
|
106
|
+
"""NOMOS-SPEC-008 rev. 0.10.0 §2: a dual signer's ML-DSA signature over the same bytes."""
|
|
107
|
+
pq = getattr(signer, "pq", None)
|
|
108
|
+
if pq is None: return obj
|
|
109
|
+
if kid_field: obj[kid_field] = pq.kid
|
|
110
|
+
obj[alg_field] = pq.algorithm
|
|
111
|
+
obj[sig_field] = pq.sign(payload)
|
|
112
|
+
return obj
|
|
73
113
|
|
|
74
114
|
|
|
75
115
|
def seeded_signer(seed: str) -> LocalSigner:
|
|
@@ -90,14 +130,27 @@ def now_utc() -> datetime:
|
|
|
90
130
|
|
|
91
131
|
# ── NOMOS-SPEC-007 ─────────────────────────────────────────────────────────────────────────
|
|
92
132
|
def certify(parent: Signer, child_kid: str, child_public_key_pem: str, *, expires_at: datetime,
|
|
93
|
-
scope: Optional[str] = None, issued_at: Optional[datetime] = None
|
|
94
|
-
|
|
133
|
+
scope: Optional[str] = None, issued_at: Optional[datetime] = None,
|
|
134
|
+
child_pq_public_key_pem: Optional[str] = None) -> dict:
|
|
135
|
+
"""§3: `parent` certifies the child key within `scope` until `expires_at`. A dual parent
|
|
136
|
+
(rev. 1.12.0) also states the child's ML-DSA key, or that it has none, and signs with both keys."""
|
|
137
|
+
dual = getattr(parent, "pq", None) is not None
|
|
138
|
+
if child_pq_public_key_pem is not None and not dual:
|
|
139
|
+
raise ValueError("only a dual parent can certify a dual key (NOMOS-SPEC-007 rev. 1.12.0 §3.3)")
|
|
95
140
|
c: Dict[str, Any] = {"parent_kid": parent.kid, "child_kid": child_kid, "child_public_key_pem": child_public_key_pem}
|
|
141
|
+
if dual: c["child_pq_public_key_pem"] = child_pq_public_key_pem
|
|
96
142
|
if scope: c["scope"] = scope
|
|
97
143
|
c["issued_at"] = iso(issued_at or now_utc()); c["expires_at"] = iso(expires_at)
|
|
98
144
|
c["algorithm"] = parent.algorithm
|
|
99
|
-
|
|
100
|
-
|
|
145
|
+
payload = jcs(cert_payload(c))
|
|
146
|
+
c["signature"] = parent.sign(payload)
|
|
147
|
+
return _with_pq(c, parent, payload)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def certify_signer(parent: Signer, child: Any, **kw) -> dict:
|
|
151
|
+
"""certify() for a Signer: its key, and its ML-DSA half when it is dual."""
|
|
152
|
+
pq = getattr(child, "pq", None)
|
|
153
|
+
return certify(parent, child.kid, child.public_key_pem, child_pq_public_key_pem=pq.public_key_pem if pq else None, **kw)
|
|
101
154
|
|
|
102
155
|
|
|
103
156
|
def sign_revocation(parent: Signer, *, kid: Optional[str] = None, certificate: Optional[dict] = None,
|
|
@@ -108,7 +161,8 @@ def sign_revocation(parent: Signer, *, kid: Optional[str] = None, certificate: O
|
|
|
108
161
|
raise ValueError("only the parent that issued a certificate can revoke it")
|
|
109
162
|
st: Dict[str, Any] = {"revoked_kid": kid} if kid else {"revoked_fingerprint": fingerprint(certificate)}
|
|
110
163
|
st.update({"reason": reason, "issued_at": iso(issued_at or now_utc())})
|
|
111
|
-
|
|
164
|
+
payload = jcs(revocation_payload(st))
|
|
165
|
+
return _with_pq({**st, "kid": parent.kid, "algorithm": parent.algorithm, "signature": parent.sign(payload)}, parent, payload)
|
|
112
166
|
|
|
113
167
|
|
|
114
168
|
def sign_revocation_list(signer: Signer, statements: List[dict], key_certs: Iterable[dict] = (), generated_at: Optional[datetime] = None) -> dict:
|
|
@@ -116,37 +170,43 @@ def sign_revocation_list(signer: Signer, statements: List[dict], key_certs: Iter
|
|
|
116
170
|
lst: Dict[str, Any] = {"generated_at": iso(generated_at or now_utc()), "kid": signer.kid, "algorithm": signer.algorithm, "statements": statements}
|
|
117
171
|
kc = list(key_certs)
|
|
118
172
|
if kc: lst["key_certs"] = kc
|
|
119
|
-
|
|
120
|
-
|
|
173
|
+
payload = jcs(revocation_list_payload(lst))
|
|
174
|
+
lst["signature"] = signer.sign(payload)
|
|
175
|
+
return _with_pq(lst, signer, payload)
|
|
121
176
|
|
|
122
177
|
|
|
123
178
|
# ── NOMOS-SPEC-001 §8 ──────────────────────────────────────────────────────────────────────
|
|
124
179
|
def seal(body: dict, issuer: Signer, signed_by: Any) -> dict:
|
|
125
180
|
content = {k: v for k, v in body.items() if k not in ("seal", "attestations")}
|
|
126
181
|
h = sha256_hex(jcs(content))
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
182
|
+
payload = jcs({"hash": h, "signed_by": signed_by})
|
|
183
|
+
s = {"status": "sealed", "hash": h, "canonicalization": "JCS", "signature_algorithm": issuer.algorithm,
|
|
184
|
+
"kid": issuer.kid, "signed_by": signed_by, "signature": issuer.sign(payload)}
|
|
185
|
+
# NOMOS-SPEC-001 amendment 2.7.0 §8.3a: a dual sealing key adds its ML-DSA signature
|
|
186
|
+
return {**content, "seal": _with_pq(s, issuer, payload, "pq_signature_algorithm", "pq_signature", "pq_kid")}
|
|
130
187
|
|
|
131
188
|
|
|
132
189
|
# ── NOMOS-SPEC-008 ─────────────────────────────────────────────────────────────────────────
|
|
133
190
|
def sign_testimony(witness: Signer, *, claim: str, value: Any, about: Optional[str], valid_until: datetime, as_of: Optional[datetime] = None) -> dict:
|
|
134
191
|
st = {"claim": claim, "value": value, "about": about, "as_of": iso(as_of or now_utc()), "valid_until": iso(valid_until), "kid": witness.kid, "algorithm": witness.algorithm}
|
|
135
|
-
|
|
136
|
-
|
|
192
|
+
payload = jcs(testimony_payload(st))
|
|
193
|
+
st["signature"] = witness.sign(payload)
|
|
194
|
+
return _with_pq(st, witness, payload)
|
|
137
195
|
|
|
138
196
|
|
|
139
197
|
def sign_consent(approver: Signer, act: dict, role: str, decision: str = "approve") -> dict:
|
|
140
198
|
c = {"binding_digest": binding_digest(act), "role": role, "decision": decision, "signed_at": iso(now_utc()), "kid": approver.kid, "algorithm": approver.algorithm}
|
|
141
|
-
|
|
142
|
-
|
|
199
|
+
payload = jcs(consent_payload(c))
|
|
200
|
+
c["signature"] = approver.sign(payload)
|
|
201
|
+
return _with_pq(c, approver, payload)
|
|
143
202
|
|
|
144
203
|
|
|
145
204
|
def sign_in_force(issuer: Signer, artifact: dict, *, valid_until: datetime, as_of: Optional[datetime] = None) -> dict:
|
|
146
205
|
st = {"artifact_id": artifact["meta"]["artifact_id"], "version": artifact["meta"]["version"], "seal_hash": artifact["seal"]["hash"],
|
|
147
206
|
"as_of": iso(as_of or now_utc()), "valid_until": iso(valid_until), "kid": artifact["seal"]["kid"], "algorithm": issuer.algorithm}
|
|
148
|
-
|
|
149
|
-
|
|
207
|
+
payload = jcs(in_force_payload(st))
|
|
208
|
+
st["signature"] = issuer.sign(payload)
|
|
209
|
+
return _with_pq(st, issuer, payload)
|
|
150
210
|
|
|
151
211
|
|
|
152
212
|
def build_act(*, relying_party: str, action: dict, artifact: dict, key_certs: List[dict], testimony: Optional[List[dict]] = None,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
verify(suite, public_key_pem, payload, proof) -> (ok, reason)
|
|
4
4
|
|
|
5
|
-
suite "Ed25519" | "ES256" | "WebAuthn-ES256"
|
|
5
|
+
suite "Ed25519" | "ES256" | "ES384" | "ES512" | "ML-DSA-65" | "ML-DSA-87" | "WebAuthn-ES256"
|
|
6
6
|
public_key_pem the signing key, as PEM SubjectPublicKeyInfo
|
|
7
7
|
payload the exact JCS bytes the calling specification says are signed
|
|
8
|
-
proof {"signature": ...} for
|
|
8
|
+
proof {"signature": ...} for every suite but WebAuthn-ES256;
|
|
9
9
|
{"authenticator_data", "client_data_json", "signature"} for WebAuthn-ES256
|
|
10
10
|
|
|
11
11
|
reason is one of the §7 reasons, or None when ok.
|
|
@@ -20,11 +20,18 @@ from typing import Any, Dict, Optional, Tuple
|
|
|
20
20
|
|
|
21
21
|
from cryptography.exceptions import InvalidSignature
|
|
22
22
|
from cryptography.hazmat.primitives import hashes, serialization
|
|
23
|
-
from cryptography.hazmat.primitives.asymmetric import ec, ed25519
|
|
23
|
+
from cryptography.hazmat.primitives.asymmetric import ec, ed25519, mldsa
|
|
24
24
|
from cryptography.hazmat.primitives.asymmetric.utils import decode_dss_signature, encode_dss_signature
|
|
25
25
|
|
|
26
|
-
SUITES = ("Ed25519", "ES256", "WebAuthn-ES256")
|
|
26
|
+
SUITES = ("Ed25519", "ES256", "ES384", "ES512", "ML-DSA-65", "ML-DSA-87", "WebAuthn-ES256")
|
|
27
27
|
P256_N = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551
|
|
28
|
+
P384_N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973
|
|
29
|
+
P521_N = 0x01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409
|
|
30
|
+
|
|
31
|
+
# §4.1: suite -> (signature length, group order, hash)
|
|
32
|
+
_ECDSA = {"ES256": (64, P256_N, hashes.SHA256), "ES384": (96, P384_N, hashes.SHA384), "ES512": (132, P521_N, hashes.SHA512)}
|
|
33
|
+
# §4.2: suite -> signature length
|
|
34
|
+
_MLDSA = {"ML-DSA-65": 3309, "ML-DSA-87": 4627}
|
|
28
35
|
|
|
29
36
|
_B64 = re.compile(r"^[A-Za-z0-9+/]*={0,2}$")
|
|
30
37
|
_B64URL = re.compile(r"^[A-Za-z0-9_-]*$")
|
|
@@ -70,6 +77,14 @@ def _pem_der(pem: Any) -> Optional[bytes]:
|
|
|
70
77
|
ED25519_SPKI_PREFIX = bytes.fromhex("302a300506032b6570032100")
|
|
71
78
|
P256_SPKI_PREFIX = bytes.fromhex("3059301306072a8648ce3d020106082a8648ce3d03010703420004")
|
|
72
79
|
|
|
80
|
+
# §3.1, 0.3.0: (key type, SPKI prefix, total DER length)
|
|
81
|
+
_SPKI_FORMS = (
|
|
82
|
+
("P-384", bytes.fromhex("3076301006072a8648ce3d020106052b81040022036200") + b"\x04", 120),
|
|
83
|
+
("P-521", bytes.fromhex("30819b301006072a8648ce3d020106052b8104002303818600") + b"\x04", 158),
|
|
84
|
+
("ML-DSA-65", bytes.fromhex("308207b2300b0609608648016503040312038207a100"), 1974),
|
|
85
|
+
("ML-DSA-87", bytes.fromhex("30820a32300b060960864801650304031303820a2100"), 2614),
|
|
86
|
+
)
|
|
87
|
+
|
|
73
88
|
|
|
74
89
|
_ED_P = 2**255 - 19
|
|
75
90
|
_ED_D = (-121665 * pow(121666, _ED_P - 2, _ED_P)) % _ED_P
|
|
@@ -102,7 +117,7 @@ def ed25519_point_valid(a: bytes) -> bool:
|
|
|
102
117
|
|
|
103
118
|
|
|
104
119
|
def load_key(pem: Any) -> Tuple[Optional[str], Any, Optional[str]]:
|
|
105
|
-
"""Returns (key_type, key, reason). key_type is
|
|
120
|
+
"""Returns (key_type, key, reason). key_type is one of the key types of §3.1.
|
|
106
121
|
|
|
107
122
|
Canonical form is checked against the exact bytes of §3.1, never by re-encoding through a
|
|
108
123
|
library, whose output format is not part of the specification.
|
|
@@ -117,9 +132,12 @@ def load_key(pem: Any) -> Tuple[Optional[str], Any, Optional[str]]:
|
|
|
117
132
|
elif len(der) == 91 and der.startswith(P256_SPKI_PREFIX):
|
|
118
133
|
ktype = "P-256"
|
|
119
134
|
else:
|
|
120
|
-
|
|
135
|
+
ktype = next((name for name, prefix, length in _SPKI_FORMS
|
|
136
|
+
if len(der) == length and der.startswith(prefix)), None)
|
|
137
|
+
if ktype is None:
|
|
138
|
+
return None, None, "invalid_key"
|
|
121
139
|
try:
|
|
122
|
-
key = serialization.load_der_public_key(der) # also rejects
|
|
140
|
+
key = serialization.load_der_public_key(der) # also rejects an EC point not on the curve
|
|
123
141
|
except (ValueError, TypeError):
|
|
124
142
|
return None, None, "invalid_key"
|
|
125
143
|
return ktype, key, None
|
|
@@ -130,7 +148,8 @@ def compute_kid(pem: str) -> str:
|
|
|
130
148
|
return base64.urlsafe_b64encode(hashlib.sha256(der).digest()).decode().rstrip("=")[:16]
|
|
131
149
|
|
|
132
150
|
|
|
133
|
-
_SUITES_FOR_TYPE = {"Ed25519": ("Ed25519",), "P-256": ("ES256", "WebAuthn-ES256")
|
|
151
|
+
_SUITES_FOR_TYPE = {"Ed25519": ("Ed25519",), "P-256": ("ES256", "WebAuthn-ES256"), "P-384": ("ES384",),
|
|
152
|
+
"P-521": ("ES512",), "ML-DSA-65": ("ML-DSA-65",), "ML-DSA-87": ("ML-DSA-87",)}
|
|
134
153
|
|
|
135
154
|
|
|
136
155
|
# ── verification ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -146,8 +165,10 @@ def verify(suite: Any, public_key_pem: Any, payload: bytes, proof: Dict[str, Any
|
|
|
146
165
|
return False, "bad_encoding"
|
|
147
166
|
if suite == "Ed25519":
|
|
148
167
|
return _verify_ed25519(key, payload, proof.get("signature"))
|
|
149
|
-
if suite
|
|
150
|
-
return
|
|
168
|
+
if suite in _ECDSA:
|
|
169
|
+
return _verify_ecdsa(suite, key, payload, proof.get("signature"))
|
|
170
|
+
if suite in _MLDSA:
|
|
171
|
+
return _verify_mldsa(suite, key, payload, proof.get("signature"))
|
|
151
172
|
return _verify_webauthn(key, payload, proof)
|
|
152
173
|
|
|
153
174
|
|
|
@@ -162,17 +183,36 @@ def _verify_ed25519(key, payload: bytes, sig_b64: Any):
|
|
|
162
183
|
return True, None
|
|
163
184
|
|
|
164
185
|
|
|
165
|
-
def
|
|
186
|
+
def _verify_ecdsa(suite: str, key, payload: bytes, sig_b64: Any):
|
|
187
|
+
"""§4.1: P1363 r||s of the suite's length, each in [1, n-1], low-S, over the suite's hash."""
|
|
188
|
+
length, n, hash_ = _ECDSA[suite]
|
|
166
189
|
sig = b64decode_canonical(sig_b64)
|
|
167
|
-
if sig is None or len(sig) !=
|
|
190
|
+
if sig is None or len(sig) != length:
|
|
168
191
|
return False, "bad_encoding"
|
|
169
|
-
|
|
170
|
-
|
|
192
|
+
half = length // 2
|
|
193
|
+
r, s = int.from_bytes(sig[:half], "big"), int.from_bytes(sig[half:], "big")
|
|
194
|
+
if not (1 <= r < n and 1 <= s < n):
|
|
171
195
|
return False, "bad_encoding"
|
|
172
|
-
if s >
|
|
196
|
+
if s > n // 2:
|
|
173
197
|
return False, "high_s"
|
|
174
198
|
try:
|
|
175
|
-
key.verify(encode_dss_signature(r, s), payload, ec.ECDSA(
|
|
199
|
+
key.verify(encode_dss_signature(r, s), payload, ec.ECDSA(hash_()))
|
|
200
|
+
except InvalidSignature:
|
|
201
|
+
return False, "bad_signature"
|
|
202
|
+
return True, None
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _verify_es256(key, payload: bytes, sig_b64: Any):
|
|
206
|
+
return _verify_ecdsa("ES256", key, payload, sig_b64)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def _verify_mldsa(suite: str, key, payload: bytes, sig_b64: Any):
|
|
210
|
+
"""§4.2: pure ML-DSA (FIPS 204 ML-DSA.Verify) over the payload, empty context."""
|
|
211
|
+
sig = b64decode_canonical(sig_b64)
|
|
212
|
+
if sig is None or len(sig) != _MLDSA[suite]:
|
|
213
|
+
return False, "bad_encoding"
|
|
214
|
+
try:
|
|
215
|
+
key.verify(sig, payload)
|
|
176
216
|
except InvalidSignature:
|
|
177
217
|
return False, "bad_signature"
|
|
178
218
|
return True, None
|
|
@@ -228,13 +268,39 @@ def sign_ed25519(private_key, payload: bytes) -> str:
|
|
|
228
268
|
|
|
229
269
|
|
|
230
270
|
def sign_es256(private_key, payload: bytes, *, low_s: bool = True) -> str:
|
|
231
|
-
|
|
271
|
+
return sign_ecdsa("ES256", private_key, payload, low_s=low_s)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def sign_ecdsa(suite: str, private_key, payload: bytes, *, low_s: bool = True) -> str:
|
|
275
|
+
"""P1363 r||s with RFC 6979 nonces (§6). low_s=False makes the high-S twin a verifier must refuse."""
|
|
276
|
+
length, n, hash_ = _ECDSA[suite]
|
|
277
|
+
der = private_key.sign(payload, ec.ECDSA(hash_(), deterministic_signing=True))
|
|
232
278
|
r, s = decode_dss_signature(der)
|
|
233
|
-
if low_s and s >
|
|
234
|
-
s =
|
|
235
|
-
if not low_s and s <=
|
|
236
|
-
s =
|
|
237
|
-
|
|
279
|
+
if low_s and s > n // 2:
|
|
280
|
+
s = n - s
|
|
281
|
+
if not low_s and s <= n // 2:
|
|
282
|
+
s = n - s # deliberately high-S, for the vector that must be refused
|
|
283
|
+
half = length // 2
|
|
284
|
+
return base64.b64encode(r.to_bytes(half, "big") + s.to_bytes(half, "big")).decode()
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def ec_key_from_seed(seed: bytes, curve: str) -> ec.EllipticCurvePrivateKey:
|
|
288
|
+
"""A P-256, P-384 or P-521 test key derived from a published seed."""
|
|
289
|
+
n, crv, h = {"P-256": (P256_N, ec.SECP256R1(), hashlib.sha256),
|
|
290
|
+
"P-384": (P384_N, ec.SECP384R1(), hashlib.sha384),
|
|
291
|
+
"P-521": (P521_N, ec.SECP521R1(), hashlib.sha512)}[curve]
|
|
292
|
+
return ec.derive_private_key(int.from_bytes(h(seed).digest(), "big") % (n - 1) + 1, crv)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def mldsa_key_from_seed(seed: bytes, suite: str):
|
|
296
|
+
"""An ML-DSA test key from FIPS 204 KeyGen on the 32-byte xi = SHA-256(seed)."""
|
|
297
|
+
cls = {"ML-DSA-65": mldsa.MLDSA65PrivateKey, "ML-DSA-87": mldsa.MLDSA87PrivateKey}[suite]
|
|
298
|
+
return cls.from_seed_bytes(hashlib.sha256(seed).digest())
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def sign_mldsa(private_key, payload: bytes) -> str:
|
|
302
|
+
"""Pure ML-DSA, empty context (§6). Hedged: two calls give different, equally valid signatures."""
|
|
303
|
+
return base64.b64encode(private_key.sign(payload)).decode()
|
|
238
304
|
|
|
239
305
|
|
|
240
306
|
def webauthn_assert(private_key, payload: bytes, *, rp_id: str = "approve.example",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nomosprotocol
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: NOMOS for Python: the reference verifiers for NOMOS-SPEC-007 (rev. 1.11), -008 and -010, NOMOS-SPEC-014 registrar logs, and accept(), act() and witness() for NOMOS-SPEC-009. Verify an Act, commit it exactly once, carry one, or sign the facts it needs.
|
|
5
5
|
Author-email: NOMOS Protocol <hello@nomosprotocol.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -14,7 +14,7 @@ Classifier: Topic :: Security :: Cryptography
|
|
|
14
14
|
Requires-Python: >=3.9
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: cryptography>=
|
|
17
|
+
Requires-Dist: cryptography>=48
|
|
18
18
|
Provides-Extra: postgres
|
|
19
19
|
Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
|
|
20
20
|
Requires-Dist: psycopg-pool>=3.2; extra == "postgres"
|
|
@@ -112,7 +112,7 @@ chain.verify_revocation_list(lst, ROOT, now) # NOMOS-SPEC-007 rev. 1.10
|
|
|
112
112
|
|
|
113
113
|
This package is checked against:
|
|
114
114
|
- every vector of NOMOS-SPEC-007 (1.7.0, rev. 1.11, rev. 1.10 revocation sources), NOMOS-SPEC-008
|
|
115
|
-
0.7.0 with rev. 0.8.0 (several laws) and rev. 0.9.0 (intake questions), NOMOS-SPEC-010 0.
|
|
115
|
+
0.7.0 with rev. 0.8.0 (several laws) and rev. 0.9.0 (intake questions), NOMOS-SPEC-010 0.3.0 and
|
|
116
116
|
NOMOS-SPEC-016 0.1.0 (budgets: 200 of 200, `budget-vectors/check.py`);
|
|
117
117
|
- the NOMOS-SPEC-009 selection vectors;
|
|
118
118
|
- the NOMOS-SPEC-009 HTTP runner, 17 of 17, with `accept()` behind it
|
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nomosprotocol"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.0"
|
|
8
8
|
description = "NOMOS for Python: the reference verifiers for NOMOS-SPEC-007 (rev. 1.11), -008 and -010, NOMOS-SPEC-014 registrar logs, and accept(), act() and witness() for NOMOS-SPEC-009. Verify an Act, commit it exactly once, carry one, or sign the facts it needs."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
11
|
license = { text = "Apache-2.0" }
|
|
12
12
|
authors = [{ name = "NOMOS Protocol", email = "hello@nomosprotocol.com" }]
|
|
13
|
-
dependencies = ["cryptography>=
|
|
13
|
+
dependencies = ["cryptography>=48"] # 43 added deterministic (RFC 6979) ECDSA; 48 brought ML-DSA (FIPS 204) to the standard wheels
|
|
14
14
|
keywords = ["nomos", "computable-authority", "agents", "authorization", "verifier", "ed25519", "es256", "webauthn"]
|
|
15
15
|
classifiers = ["Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Topic :: Security :: Cryptography"]
|
|
16
16
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|