scitt-cose 0.0.1__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.
Files changed (33) hide show
  1. scitt_cose-0.0.1/LICENSE +202 -0
  2. scitt_cose-0.0.1/NOTICE +6 -0
  3. scitt_cose-0.0.1/PKG-INFO +394 -0
  4. scitt_cose-0.0.1/README.md +367 -0
  5. scitt_cose-0.0.1/pyproject.toml +52 -0
  6. scitt_cose-0.0.1/scitt_cose/__init__.py +69 -0
  7. scitt_cose-0.0.1/scitt_cose/_status.py +54 -0
  8. scitt_cose-0.0.1/scitt_cose/cli.py +158 -0
  9. scitt_cose-0.0.1/scitt_cose/cose_sign1.py +299 -0
  10. scitt_cose-0.0.1/scitt_cose/hosted.py +599 -0
  11. scitt_cose-0.0.1/scitt_cose/merkle.py +253 -0
  12. scitt_cose-0.0.1/scitt_cose/receipt.py +247 -0
  13. scitt_cose-0.0.1/scitt_cose/statement.py +243 -0
  14. scitt_cose-0.0.1/scitt_cose.egg-info/PKG-INFO +394 -0
  15. scitt_cose-0.0.1/scitt_cose.egg-info/SOURCES.txt +31 -0
  16. scitt_cose-0.0.1/scitt_cose.egg-info/dependency_links.txt +1 -0
  17. scitt_cose-0.0.1/scitt_cose.egg-info/entry_points.txt +3 -0
  18. scitt_cose-0.0.1/scitt_cose.egg-info/requires.txt +10 -0
  19. scitt_cose-0.0.1/scitt_cose.egg-info/top_level.txt +1 -0
  20. scitt_cose-0.0.1/setup.cfg +4 -0
  21. scitt_cose-0.0.1/tests/test_cli_and_status.py +136 -0
  22. scitt_cose-0.0.1/tests/test_cose_sign1.py +106 -0
  23. scitt_cose-0.0.1/tests/test_cose_wg_vectors.py +91 -0
  24. scitt_cose-0.0.1/tests/test_crosslang_go.py +227 -0
  25. scitt_cose-0.0.1/tests/test_hosted_page.py +222 -0
  26. scitt_cose-0.0.1/tests/test_hosted_parity.py +245 -0
  27. scitt_cose-0.0.1/tests/test_iana_codepoints.py +110 -0
  28. scitt_cose-0.0.1/tests/test_merkle.py +134 -0
  29. scitt_cose-0.0.1/tests/test_negative_conformance.py +325 -0
  30. scitt_cose-0.0.1/tests/test_receipt.py +197 -0
  31. scitt_cose-0.0.1/tests/test_rfc9162_vectors.py +100 -0
  32. scitt_cose-0.0.1/tests/test_statement.py +124 -0
  33. scitt_cose-0.0.1/tests/test_thirdparty_cose.py +159 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ scitt-cose
2
+ Copyright 2026 Action State Group, Inc.
3
+
4
+ This product includes software developed by Action State Group, Inc.
5
+ (https://actionstate.ai), published as neutral, profile-agnostic SCITT/COSE
6
+ substrate for the community.
@@ -0,0 +1,394 @@
1
+ Metadata-Version: 2.4
2
+ Name: scitt-cose
3
+ Version: 0.0.1
4
+ Summary: Generic, profile-agnostic IETF SCITT + COSE Receipts substrate for Python.
5
+ Author: Action State Group
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/action-state-group/scitt-cose
8
+ Project-URL: Source, https://github.com/action-state-group/scitt-cose
9
+ Project-URL: Issues, https://github.com/action-state-group/scitt-cose/issues
10
+ Keywords: scitt,cose,cose-sign1,receipts,merkle,rfc9162,transparency
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Security :: Cryptography
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: NOTICE
18
+ Requires-Dist: cbor2>=5.5
19
+ Requires-Dist: cryptography>=42.0
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=7.0; extra == "dev"
22
+ Requires-Dist: ruff>=0.4; extra == "dev"
23
+ Requires-Dist: pycose>=1.1; extra == "dev"
24
+ Provides-Extra: serve
25
+ Requires-Dist: uvicorn[standard]>=0.27; extra == "serve"
26
+ Dynamic: license-file
27
+
28
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
29
+ # scitt-cose
30
+
31
+ A generic, profile-agnostic IETF **SCITT + COSE Receipts** substrate for Python:
32
+ build/verify COSE_Sign1 **Signed Statements**, verify **Receipts** and RFC 9162
33
+ **inclusion / consistency proofs**, with the **Merkle + receipt-signing
34
+ primitives**.
35
+
36
+ It is **NOT a transparency service** (operating a log — a hosted registration
37
+ endpoint — is a separate concern), and it carries **NO application profile** —
38
+ bring your own statement semantics. The only third-party dependencies anywhere
39
+ in the package are [`cbor2`](https://pypi.org/project/cbor2/) and
40
+ [`cryptography`](https://pypi.org/project/cryptography/), plus the standard
41
+ library. COSE_Sign1 (RFC 9052) is implemented here from scratch — it does **not**
42
+ use `python-cwt` or any other COSE library.
43
+
44
+ > **Name note.** `scitt-cose` is the finalized package name, claimed on PyPI
45
+ > and GitHub (`action-state-group/scitt-cose`) in the same pass.
46
+
47
+ ## What this does / does not do
48
+
49
+ **Does:**
50
+
51
+ - Verify a SCITT **Signed Statement** (`COSE_Sign1`) signature against a supplied
52
+ key — EdDSA and ES256 — and report its issuer / subject / content-type / alg.
53
+ - Verify a **COSE Receipt** whose verifiable data structure is
54
+ **`RFC9162_SHA256`** (vds = 1, the tree algorithm registered by
55
+ draft-ietf-cose-merkle-tree-proofs): the RFC 9162 SHA-256 inclusion proof
56
+ *and* the log's signature over the reconstructed root — i.e. *"this statement
57
+ is provably in the log"* — **without trusting the log operator**. The vds value
58
+ is read from the protected header only and anything other than
59
+ `RFC9162_SHA256` is rejected, not silently accepted.
60
+ - Provide the RFC 9162 **Merkle primitives** (root, inclusion, consistency) and a
61
+ `build_receipt` primitive.
62
+
63
+ **Does NOT:**
64
+
65
+ - **Operate a Transparency Service.** It never registers statements, issues
66
+ receipts, anchors, or stores anything. Running a log is a separate concern with
67
+ its own operational trust obligations.
68
+ - **Validate any application profile's payload semantics.** The statement payload
69
+ is treated as **opaque bytes**. There is no agent-action-profile awareness —
70
+ that neutrality is deliberate, and is what makes this reusable by *anyone* in the
71
+ SCITT ecosystem.
72
+ - **Depend on a COSE library for wire values.** `COSE_Sign1` is implemented from
73
+ scratch over `cbor2` + `cryptography`; code points are pinned to the IANA
74
+ registries, not to a library's enum.
75
+
76
+ ## Why this exists
77
+
78
+ This is a **standalone, profile-opaque, cross-validated** generic SCITT/COSE
79
+ verifier: it verifies *anyone's* SCITT Signed Statements and COSE Receipts, treats
80
+ the payload as opaque bytes, and its conformance is checked against independent,
81
+ external references (the published RFC 6962/9162 Merkle vectors, a third-party
82
+ COSE library, and a separate Go implementation — see
83
+ [Correctness & cross-implementation evidence](#correctness--cross-implementation-evidence)).
84
+
85
+ It is intended to be useful as **neutral substrate**: the parts that exist today
86
+ don't fit that gap cleanly — `python-cwt` is COSE-only (no SCITT/Receipts), and a
87
+ transparency-service emulator is a server, not a verification library you depend
88
+ on. So this is the small building block — a second, independent implementation
89
+ you can verify against, with no profile baked in. (No primacy is claimed; the
90
+ value is neutrality + verifiable conformance, not being "first".)
91
+
92
+ An agent-action profile is **one** example consumer that builds its
93
+ statement/claim semantics *on top of* this substrate — but nothing
94
+ profile-specific lives here.
95
+
96
+ ## Provenance, neutrality & governance
97
+
98
+ Three things an adopter should know up front:
99
+
100
+ 1. **Built by [Action State Group](https://actionstate.ai).** We built this for
101
+ our own SCITT use and publish it as community substrate under Apache-2.0.
102
+ 2. **Neutral by design.** No application profile, no vendor coupling,
103
+ payload-opaque. The package imports only `cbor2`, `cryptography`, and the
104
+ standard library — it does not import any Action State code, and a test
105
+ gate (`tests/test_iana_codepoints.py`) enforces that this stays true.
106
+ 3. **Foundation intent.** We intend to contribute this project to a neutral
107
+ open-source foundation so its governance does not rest with any single
108
+ vendor. Which foundation is deliberately not yet decided; until then it is
109
+ governed in the open under DCO + Apache-2.0 (see
110
+ [CONTRIBUTING.md](CONTRIBUTING.md)).
111
+
112
+ ## Scope
113
+
114
+ In scope (library plumbing):
115
+
116
+ - Build / parse / verify **Signed Statements** and **Transparent Statements**.
117
+ - Verify **Receipts** + RFC 9162 **inclusion** and **consistency** proofs.
118
+ - RFC 9162 SHA-256 **Merkle primitives** and the **receipt-signing** primitive
119
+ (`build_receipt`) — so you *can* mint receipts as a building block.
120
+
121
+ Out of scope (documented, deliberately not built):
122
+
123
+ - **Operating a transparency log / service.** A hosted registration endpoint,
124
+ log storage, monitoring, witnessing, gossip — none of that is here. The
125
+ primitives needed to build one (Merkle tree, receipt signing) **are** included.
126
+
127
+ ## Install
128
+
129
+ ```bash
130
+ pip install cbor2 cryptography # runtime deps
131
+ # from a checkout (package root):
132
+ pip install -e .
133
+ ```
134
+
135
+ ## Quick start
136
+
137
+ ```python
138
+ from cryptography.hazmat.primitives.asymmetric import ed25519
139
+ from cryptography.hazmat.primitives import serialization
140
+ from scitt_cose import (
141
+ build_signed_statement, parse_signed_statement,
142
+ merkle_root, inclusion_proof, verify_inclusion,
143
+ consistency_proof, verify_consistency,
144
+ build_receipt, verify_receipt,
145
+ attach_receipts, extract_receipts,
146
+ )
147
+
148
+ # --- a key (caller supplies everything) ---
149
+ sk = ed25519.Ed25519PrivateKey.generate()
150
+ priv = sk.private_bytes(serialization.Encoding.PEM,
151
+ serialization.PrivateFormat.PKCS8,
152
+ serialization.NoEncryption())
153
+ pub = sk.public_key().public_bytes(serialization.Encoding.PEM,
154
+ serialization.PublicFormat.SubjectPublicKeyInfo)
155
+
156
+ # --- Signed Statement (generic; no profile) ---
157
+ stmt = build_signed_statement(
158
+ b'{"hello":"world"}',
159
+ alg="EdDSA", private_key_pem=priv,
160
+ issuer="https://issuer.example",
161
+ subject="my-artifact",
162
+ content_type="application/json",
163
+ extra_cwt_claims={"my_claim": "x", 99: 1}, # str- or int-keyed
164
+ )
165
+ parsed = parse_signed_statement(stmt, public_key_pem=pub)
166
+ assert parsed["signature_verified"] is True
167
+ assert parsed["issuer"] == "https://issuer.example"
168
+
169
+ # --- Merkle (RFC 9162 SHA-256; hex in/out) ---
170
+ entries = [b"a".hex(), b"b".hex(), b"c".hex(), b"d".hex()]
171
+ root = merkle_root(entries)
172
+ path = inclusion_proof(entries, 2)
173
+ assert verify_inclusion(entries[2], 2, len(entries), path, root)
174
+
175
+ cproof = consistency_proof(entries, 2, 4)
176
+ assert verify_consistency(merkle_root(entries[:2]), root, 2, 4, cproof)
177
+
178
+ # --- Receipt (primitive) + verify ---
179
+ receipt = build_receipt(
180
+ leaf_entry_hex=entries[2], leaf_index=2, tree_entries_hex=entries,
181
+ alg="EdDSA", log_private_key_pem=priv, # here the "log" key is our key
182
+ )
183
+ res = verify_receipt(receipt, leaf_entry_hex=entries[2], log_public_key_pem=pub)
184
+ assert res.ok and res.root == root
185
+
186
+ # --- Transparent Statement = Signed Statement + Receipts ---
187
+ transparent = attach_receipts(stmt, [receipt])
188
+ assert extract_receipts(transparent) == [receipt]
189
+ ```
190
+
191
+ ## CLI
192
+
193
+ ```bash
194
+ scitt-cose --statement stmt.cose --statement-pubkey issuer.pem
195
+ scitt-cose --receipt receipt.cose --receipt-log-pubkey log.pem --leaf-entry-hex 61
196
+ scitt-cose --statement stmt.cose --receipt receipt.cose \
197
+ --receipt-log-pubkey log.pem --leaf-entry-hex 61 --json
198
+ ```
199
+
200
+ ## Public API
201
+
202
+ | Area | Functions / types |
203
+ |---|---|
204
+ | COSE_Sign1 | `sign_sign1`, `verify_sign1`, `Sign1`, `CoseError` |
205
+ | Statements | `build_signed_statement`, `parse_signed_statement`, `attach_receipts`, `extract_receipts` |
206
+ | Merkle | `leaf_hash`, `merkle_root`, `inclusion_proof`, `verify_inclusion`, `consistency_proof`, `verify_consistency` |
207
+ | Receipts | `build_receipt`, `verify_receipt`, `ReceiptResult` |
208
+ | Status | `DRAFT_TRACKING_NOTICE`, `DRAFT_SCITT_ARCHITECTURE`, `DRAFT_COSE_MERKLE_TREE_PROOFS`, `SUBSTRATE_RFCS` |
209
+
210
+ ### Algorithms
211
+
212
+ `sign_sign1` / statements support `"EdDSA"` (code point −8) and `"ES256"`
213
+ (−7). For ES256, COSE carries the signature as **raw `r || s`** (64 bytes), not
214
+ DER; the conversion happens at the `cryptography` boundary. ML-DSA code points
215
+ (RFC 9964) are *recognized* in the status notice but signing is **not**
216
+ implemented here.
217
+
218
+ ### Why CWT Claims at label 15 (not 13)
219
+
220
+ Signed-Statement CWT Claims are placed in the protected header at **label 15**,
221
+ the "CWT Claims" header parameter registered by **RFC 9597 §2**. Label **13** is
222
+ a different parameter (`kcwt`, RFC 9528) and is sometimes mistakenly used for the
223
+ claims map; this library always reads and writes the claims at **15**.
224
+
225
+ ### Receipt vdp encoding (honest caveat)
226
+
227
+ The Receipt's verifiable-data-proof shape tracks
228
+ **draft-ietf-cose-merkle-tree-proofs-18**:
229
+
230
+ - protected `1` = alg, protected `395` = vds (`1` = `RFC9162_SHA256`);
231
+ - unprotected `396` = vdp map with key `-1` → array of inclusion-proof bstrs;
232
+ - each inclusion-proof bstr = `cbor([tree_size, leaf_index, [audit_path bstrs]])`;
233
+ - payload = the Merkle root (detached by default).
234
+
235
+ `verify_receipt` reads **vds from the protected header only** (it is
236
+ security-relevant and must be integrity-protected), reconstructs the root from
237
+ the proof, and verifies the COSE_Sign1 over that root with the log key. Because
238
+ the underlying documents are **drafts, not RFCs**, this exact CBOR shape is
239
+ **validated by round-trip in this library's own tests**, not against a frozen
240
+ RFC. Treat the wire shape as draft-tracking.
241
+
242
+ ## Draft-tracking / standards honesty
243
+
244
+ This library tracks two IETF documents that are **Active Internet-Drafts (Work in
245
+ Progress)** — they have been approved and are in the **RFC Editor Queue**, but are
246
+ **NOT yet published RFCs** (status audited against the IETF Datatracker at ship
247
+ date; re-verify at publish time, since RFC-Ed-Queue documents can be published at
248
+ any point):
249
+
250
+ - `draft-ietf-scitt-architecture-22` — *SCITT Architecture* (Datatracker:
251
+ Active Internet-Draft, RFC Ed Queue)
252
+ - `draft-ietf-cose-merkle-tree-proofs-18` — *COSE Receipts / COSE Merkle Tree
253
+ Proofs* (Datatracker: Active Internet-Draft, RFC Ed Queue)
254
+
255
+ **There is no RFC 9942.** No positive "RFC 9942" claim is made anywhere (enforced
256
+ by a test that scans shipped source + docs).
257
+
258
+ Published RFCs whose mechanisms this library implements / relies on (titles
259
+ verified against the RFC Editor / IANA registries):
260
+
261
+ - **RFC 9052** — *CBOR Object Signing and Encryption (COSE): Structures and
262
+ Process* (COSE_Sign1, Sig_structure).
263
+ - **RFC 9053** — *COSE: Initial Algorithms* (EdDSA −8, ES256 −7).
264
+ - **RFC 9162** — *Certificate Transparency Version 2* (SHA-256 Merkle tree;
265
+ inclusion and consistency proofs; reuses the RFC 6962 tree hash).
266
+ - **RFC 9597** — *CBOR Web Token (CWT) Claims in COSE Headers* — the **CWT Claims**
267
+ header parameter at **label 15** (IANA COSE Header Parameters registry). Label
268
+ **13** is `kcwt` and **14** is `kccs`, both from **RFC 9528** (EDHOC) — *not* the
269
+ CWT Claims map; using 13 for claims is the python-cwt bug this library avoids.
270
+ - **RFC 9964** — *ML-DSA for JOSE and COSE* (code points recognized; ML-DSA
271
+ signing not implemented here).
272
+
273
+ ## Independence
274
+
275
+ `scitt_cose/` imports **only** `cbor2`, `cryptography`, and the standard library.
276
+ It does **not** import `cwt` / `python-cwt`, `pycose`, or any consuming
277
+ product/profile package. Verify:
278
+
279
+ ```bash
280
+ grep -rnE 'import (cwt|pycose)\b' scitt_cose/ # → nothing
281
+ ```
282
+
283
+ Two tests keep this true: the COSE-library import guard and the
284
+ no-downstream-code neutrality gate (both in `tests/test_iana_codepoints.py`).
285
+
286
+ ## Correctness & cross-implementation evidence
287
+
288
+ For a *community* verifier, "trust me, it's conformant" is worthless. The
289
+ correctness story rests on agreement with things **outside this library**, not on
290
+ self-consistency:
291
+
292
+ - **Cross-language agreement (in CI).** An independent Go verifier
293
+ (the `scitt-cose-go-verify` directory, built on `veraison/go-cose` + `fxamacker/cbor`,
294
+ with a clean-room Merkle fold) verifies the statements *and receipts* this
295
+ library emits, agrees on the reconstructed Merkle root, and rejects tampered
296
+ inputs. CI runs it with `SCITT_REQUIRE_GO=1`, so the cross-check can never
297
+ silently skip. (`tests/test_crosslang_go.py`)
298
+ - **The standard's own test vectors.** The Merkle code is checked against the
299
+ published RFC 6962 / RFC 9162 reference vectors (8-leaf root `5dc9da79…`, the
300
+ canonical inclusion/consistency proofs) — external values, not ours.
301
+ (`tests/test_rfc9162_vectors.py`)
302
+ - **A third-party COSE library.** `pycose` (independent of us, and *not*
303
+ `python-cwt`) both verifies our statements and emits statements *we* verify —
304
+ so the round-trip isn't self-referential. (`tests/test_thirdparty_cose.py`)
305
+ - **The COSE standard's own reference-signed vector.** We verify the canonical
306
+ COSE_Sign1 the COSE WG published (RFC 9052 §C.2.1, ES256, from the
307
+ `cose-wg/Examples` corpus) — anchoring the *signature* layer to the spec's
308
+ reference output, just as the RFC 6962 vectors anchor the Merkle layer.
309
+ (`tests/test_cose_wg_vectors.py`)
310
+ - **A real Transparency-Service verifier.** A downstream consumer (the Action
311
+ State Authority verifier, built on a *different* COSE stack —
312
+ `python-cwt`) cross-verifies the same Signed Statements and the same
313
+ TS-issued Receipts and agrees on the reconstructed Merkle root. This exercises
314
+ the real register→issue→verify shape; the integration test lives in the
315
+ consuming repo (so this package stays standalone).
316
+ - **IANA values, not library enums.** Every wire code point is asserted against
317
+ its registry/RFC number (CWT Claims **15**, not python-cwt's `13`).
318
+ (`tests/test_iana_codepoints.py`)
319
+ - **Spec-driven negative suite.** The MUST-reject conditions — alg confusion,
320
+ critical-header (`crit`) handling, `vds` downgrade, wrong-leaf/wrong-log
321
+ receipts, Merkle edge cases, malformed CBOR — each have a test.
322
+ (`tests/test_negative_conformance.py`)
323
+
324
+ > **Evaluated and not used: the SCITT API emulator.** The `scitt-community/`
325
+ > `scitt-api-emulator` was considered as an ecosystem oracle and rejected: it is
326
+ > archived/unmaintained (final "pre-archive" tag, Nov 2024) and emits the
327
+ > *obsolete* pre-standard receipt format (`draft-birkholz-scitt-receipts` —
328
+ > string labels `service_id`/`tree_alg`, not a COSE_Sign1 receipt, not the
329
+ > `vds`=395 / `vdp`=396 RFC 9162 structure this library verifies); its statements
330
+ > use `pycose`, already covered above. Pinning a non-conformant, drift-prone
331
+ > implementation would be a *misleading* oracle, so the COSE WG spec vector is
332
+ > used in its place.
333
+
334
+ ## Hosted verification — a standalone SCITT-only verifier
335
+
336
+ `scitt_cose.hosted` is a **stateless, read-only** wrapper over the *same* verify
337
+ functions, so you can offer verification without anyone installing anything — and
338
+ without the submitter having to trust the operator with their data (nothing
339
+ stored, nothing logged, payload-opaque; the receipt path needs only the leaf
340
+ *digest*, never the payload). `tests/test_hosted_parity.py` asserts the hosted
341
+ verdict equals the local verdict on a fixture set, including the ASGI path.
342
+
343
+ **This is a SCITT-*only* verifier, and it is NOT a Transparency Service.** It
344
+ verifies statements and receipts; it never registers, issues receipts, or
345
+ anchors. Running a Transparency Service is a **separate** offering with its own
346
+ operational trust obligations — deliberately out of scope here.
347
+
348
+ Run it standalone (no other service involved):
349
+
350
+ ```bash
351
+ # Zero extra deps — stdlib HTTP server:
352
+ scitt-cose-serve # 127.0.0.1:8080
353
+
354
+ # Or under a production ASGI server (pip install "scitt-cose[serve]"):
355
+ uvicorn scitt_cose.hosted:make_asgi_app --factory --host 0.0.0.0 --port 8080
356
+
357
+ # Or containerized (Dockerfile ships with the package):
358
+ docker build -t scitt-verifier . && docker run -p 8080:8080 scitt-verifier
359
+ ```
360
+
361
+ ```
362
+ GET / -> capabilities (what it does / does not do)
363
+ POST /verify -> {valid, statement, receipt, reasons} # JSON body, see below
364
+ ```
365
+
366
+ `GET /` is content-negotiated: browsers (`Accept: text/html`) get a static
367
+ landing **page that renders the verifier-vs-Transparency-Service boundary table
368
+ on the page itself** — not buried in docs — while API clients get the same data
369
+ as JSON (including a `boundary` field). Both are generated from the same
370
+ constants (`scitt_cose.hosted.BOUNDARY_TABLE`), so page and API can't drift;
371
+ `tests/test_hosted_page.py` pins the table's presence on both.
372
+
373
+ It can also **ride along** inside an existing ASGI app via
374
+ `app.mount("/scitt-verify", scitt_cose.hosted.make_asgi_app())` — same logic,
375
+ shared deployment, still standalone code. The full design, submitter-safety
376
+ constraints, and proposed deployment shape are in
377
+ [`docs/hosted-verifier-design.md`](docs/hosted-verifier-design.md). The package
378
+ is ready to run privately today; a **public** endpoint is a coordinated launch,
379
+ not shipped reflexively.
380
+
381
+ ## Tests
382
+
383
+ ```bash
384
+ python3 -m pytest -q # unit + conformance suite (package root)
385
+ SCITT_REQUIRE_GO=1 python3 -m pytest -q # also forces the Go cross-check
386
+ python3 -m ruff check .
387
+ ```
388
+
389
+ ## License & contributing
390
+
391
+ Apache-2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE). Contributions are
392
+ accepted under the Developer Certificate of Origin (sign your commits with
393
+ `git commit -s`); scope rules and the standards-honesty gates are in
394
+ [CONTRIBUTING.md](CONTRIBUTING.md).