quantbom 0.6.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.
Files changed (50) hide show
  1. quantbom-0.6.0/LICENSE +202 -0
  2. quantbom-0.6.0/PKG-INFO +207 -0
  3. quantbom-0.6.0/README.md +163 -0
  4. quantbom-0.6.0/pyproject.toml +59 -0
  5. quantbom-0.6.0/quantbom/__init__.py +497 -0
  6. quantbom-0.6.0/quantbom/_bitorder.py +121 -0
  7. quantbom-0.6.0/quantbom/_circuit.py +77 -0
  8. quantbom-0.6.0/quantbom/_collect.py +661 -0
  9. quantbom-0.6.0/quantbom/_drift.py +333 -0
  10. quantbom-0.6.0/quantbom/_fidelity.py +280 -0
  11. quantbom-0.6.0/quantbom/_merge.py +187 -0
  12. quantbom-0.6.0/quantbom/_qir.py +224 -0
  13. quantbom-0.6.0/quantbom/_scan.py +118 -0
  14. quantbom-0.6.0/quantbom/_sign.py +284 -0
  15. quantbom-0.6.0/quantbom/_stats.py +125 -0
  16. quantbom-0.6.0/quantbom/_verify.py +530 -0
  17. quantbom-0.6.0/quantbom/actions/__init__.py +27 -0
  18. quantbom-0.6.0/quantbom/actions/base.py +68 -0
  19. quantbom-0.6.0/quantbom/actions/benchmark.py +53 -0
  20. quantbom-0.6.0/quantbom/actions/bind_backend.py +71 -0
  21. quantbom-0.6.0/quantbom/actions/capture.py +106 -0
  22. quantbom-0.6.0/quantbom/actions/check_qir.py +44 -0
  23. quantbom-0.6.0/quantbom/actions/check_results.py +75 -0
  24. quantbom-0.6.0/quantbom/actions/compare_native.py +88 -0
  25. quantbom-0.6.0/quantbom/actions/disclose_error_handling.py +66 -0
  26. quantbom-0.6.0/quantbom/actions/execute.py +85 -0
  27. quantbom-0.6.0/quantbom/actions/inventory.py +24 -0
  28. quantbom-0.6.0/quantbom/actions/layout.py +118 -0
  29. quantbom-0.6.0/quantbom/actions/prove_equivalence.py +225 -0
  30. quantbom-0.6.0/quantbom/actions/record_provenance.py +49 -0
  31. quantbom-0.6.0/quantbom/actions/verify_conversion.py +53 -0
  32. quantbom-0.6.0/quantbom/attest.py +363 -0
  33. quantbom-0.6.0/quantbom/cli.py +378 -0
  34. quantbom-0.6.0/quantbom/frameworks/__init__.py +67 -0
  35. quantbom-0.6.0/quantbom/frameworks/base.py +155 -0
  36. quantbom-0.6.0/quantbom/frameworks/braket.py +132 -0
  37. quantbom-0.6.0/quantbom/frameworks/cirq.py +106 -0
  38. quantbom-0.6.0/quantbom/frameworks/cudaq.py +223 -0
  39. quantbom-0.6.0/quantbom/frameworks/pennylane.py +116 -0
  40. quantbom-0.6.0/quantbom/frameworks/qiskit.py +67 -0
  41. quantbom-0.6.0/quantbom/frameworks/qrisp.py +267 -0
  42. quantbom-0.6.0/quantbom/harness.json +1730 -0
  43. quantbom-0.6.0/quantbom/harness.py +88 -0
  44. quantbom-0.6.0/quantbom.egg-info/PKG-INFO +207 -0
  45. quantbom-0.6.0/quantbom.egg-info/SOURCES.txt +48 -0
  46. quantbom-0.6.0/quantbom.egg-info/dependency_links.txt +1 -0
  47. quantbom-0.6.0/quantbom.egg-info/entry_points.txt +2 -0
  48. quantbom-0.6.0/quantbom.egg-info/requires.txt +36 -0
  49. quantbom-0.6.0/quantbom.egg-info/top_level.txt +1 -0
  50. quantbom-0.6.0/setup.cfg +4 -0
quantbom-0.6.0/LICENSE ADDED
@@ -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,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantbom
3
+ Version: 0.6.0
4
+ Summary: QuantBOM SDK — certify quantum software releases from your Qrisp/Qiskit pipeline (a SecQDevOps MOD-08 service).
5
+ Author: SecQDevOps / QuantBOM
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://certify.zortenet.eu
8
+ Keywords: quantum,qiskit,qrisp,compliance,certification,cra,qbom,sbom
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Security
14
+ Classifier: Topic :: Scientific/Engineering
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Provides-Extra: quantum
19
+ Requires-Dist: qiskit<3,>=2.0; extra == "quantum"
20
+ Requires-Dist: qiskit-qasm3-import>=0.5; extra == "quantum"
21
+ Provides-Extra: qrisp
22
+ Requires-Dist: qrisp<1,>=0.8; extra == "qrisp"
23
+ Provides-Extra: cirq
24
+ Requires-Dist: cirq-core<2,>=1.4; extra == "cirq"
25
+ Provides-Extra: braket
26
+ Requires-Dist: amazon-braket-sdk<2,>=1.80; extra == "braket"
27
+ Provides-Extra: pennylane
28
+ Requires-Dist: pennylane<1,>=0.41; extra == "pennylane"
29
+ Provides-Extra: cudaq
30
+ Requires-Dist: cudaq<1,>=0.9; extra == "cudaq"
31
+ Provides-Extra: ibm
32
+ Requires-Dist: qiskit-ibm-runtime>=0.20; extra == "ibm"
33
+ Provides-Extra: verify
34
+ Requires-Dist: mqt.qcec>=3.10; extra == "verify"
35
+ Provides-Extra: signing
36
+ Requires-Dist: cryptography>=42; extra == "signing"
37
+ Provides-Extra: sim
38
+ Requires-Dist: qiskit-aer>=0.15; extra == "sim"
39
+ Provides-Extra: qir
40
+ Requires-Dist: qdk<2,>=1.30; extra == "qir"
41
+ Requires-Dist: pyqir<1,>=0.10; extra == "qir"
42
+ Requires-Dist: qirrunner<1,>=0.9; extra == "qir"
43
+ Dynamic: license-file
44
+
45
+ # QuantBOM SDK
46
+
47
+ Certify a quantum software release straight from your **Qrisp / Qiskit / Cirq / Braket / PennyLane** pipeline.
48
+ Evidence is collected locally (your source never leaves the machine) and sent to
49
+ the QuantBOM service, which returns a signed, independently-verifiable CRA
50
+ certificate — also mirrored to `./.quantbom/<release>/`.
51
+
52
+ QuantBOM is a [SecQDevOps](https://certify.zortenet.eu) MOD-08 service.
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pip install "quantbom[quantum]" # Qiskit + OpenQASM3 evidence collection
58
+ # pip install "quantbom[quantum,qrisp]" # also collect from Qrisp circuits
59
+ # pip install "quantbom[quantum,cirq]" # Cirq — likewise [braket], [pennylane], [cudaq] (Linux only)
60
+ # pip install "quantbom[quantum,ibm]" # real IBM Runtime execution evidence
61
+ # pip install "quantbom[quantum,qir]" # also emit QIR (QDK) and check it against the program (QNT-07)
62
+ # pip install "quantbom[signing]" # sign your evidence (quantbom keygen / --sign) and verify certificates offline
63
+ # Each frontend extra pins the version range the conformance suite holds for
64
+ # (harness_manifest.json `requires`); `quantbom actions --framework <name>` shows
65
+ # the recorded run, or that conformance is still pending.
66
+ ```
67
+
68
+ The core install is a lightweight, stdlib-only client; the `quantum` extra adds
69
+ the toolchain needed to build the evidence (QBOM).
70
+
71
+ ## Use
72
+
73
+ Set your API key (generate it in the QuantBOM dashboard):
74
+
75
+ ```bash
76
+ export QUANTBOM_API_KEY=qb_live_...
77
+ export QUANTBOM_API_URL=https://certify.zortenet.eu # default
78
+ ```
79
+
80
+ **Post-run call**
81
+
82
+ ```python
83
+ import quantbom
84
+ result = quantbom.certify(my_circuit, release="portfolio-opt@1.2.3")
85
+ print(result["overall_status"], result["certificate"]["certificate_id"])
86
+ ```
87
+
88
+ **Decorator** — certifies the circuit a function returns:
89
+
90
+ ```python
91
+ @quantbom.certified(release="vqe@2.1")
92
+ def build(): ... # returns a qiskit/qrisp circuit
93
+ ```
94
+
95
+ **Qiskit primitive wrapper** — certify transparently on `.run()`:
96
+
97
+ ```python
98
+ sampler = quantbom.wrap(SamplerV2(mode=backend), release="vqe@2.1")
99
+ job = sampler.run([circuit]) # certifies, then runs as normal
100
+ ```
101
+
102
+ **Sign your evidence** — the certificate's authorship claim (CRA-SIGN-01)
103
+ rests on *your* signature, not the service's. One key per organisation:
104
+
105
+ ```bash
106
+ pip install "quantbom[signing]"
107
+ quantbom keygen # ~/.quantbom/signing.key (0600) + signing.pub — back it up
108
+ quantbom certify --qpy circuit.qpy --release my-app@1.0 --sign
109
+ ```
110
+
111
+ In Python: `quantbom.certify(circuit, release=..., sign=True)`. The SDK signs
112
+ the collected evidence (Ed25519, in-toto/DSSE) before upload; the service
113
+ verifies it, countersigns what it received, and the certificate names both
114
+ key ids. Without `--sign` the release is **NON_COMPLIANT**: CRA-SIGN-01 rests
115
+ on the producer's signature, the service's countersignature is a receipt and
116
+ never substitutes, and the certificate says in words that the producer did
117
+ not sign. `--key FILE` or `QUANTBOM_SIGNING_KEY` point at a key elsewhere; in
118
+ CI, store the key as a secret and pass it to the `quantbom-certify` action's
119
+ `signing-key` input.
120
+
121
+ **Verify a certificate without trusting us** — for the auditor, the customer,
122
+ or your future self. Needs only the wheel, never the service code:
123
+
124
+ ```bash
125
+ pip install "quantbom[signing]"
126
+ quantbom keys --pin # fetch the service's signing keys once; pin them
127
+ quantbom verify .quantbom/my-app@1.0 # the mirror, a collect bundle, or a zip of either
128
+ ```
129
+
130
+ It re-hashes every artifact against the QBOM, verifies the producer's
131
+ attestation and the service's receipt, recomputes the CSNAP's and the
132
+ certificate's reproducibility hashes and bindings, and checks the certificate
133
+ signature against a key that is *anchored* (pinned from `/v1/keys`, or given
134
+ with `--keys` / `--service-key`). What it does not do, it says: the 24
135
+ controls are not re-run (that needs the gate, `verify_bundle.py` in the
136
+ repository). Verdicts: `VERIFIED` (exit 0), `FAILED`, or `UNANCHORED` when
137
+ every check passed but nothing was pinned.
138
+
139
+ **CLI / CI**
140
+
141
+ ```bash
142
+ quantbom certify --qpy circuit.qpy --release my-app@1.0 --mode gate --sign
143
+ quantbom certify --qasm3 program.qasm3 --release my-app@1.0
144
+ quantbom certify --demo --release smoke-test # needs the [qrisp] extra
145
+
146
+ # any supported framework, straight from your code (module:attr or file.py:attr;
147
+ # a function is called, an object such as a PennyLane QNode is passed as is)
148
+ quantbom certify --entry my_pkg.circuits:build --release my-app@1.0 --expect 10=1.0
149
+ ```
150
+
151
+ `--mode gate` exits non-zero on a non-compliant release (use it to fail CI);
152
+ `--mode report` (default) never fails your pipeline. `--expect` outcomes are
153
+ read in your framework's own bit order (`--expected-order qiskit` to override).
154
+ For Qrisp that depends on what you hand over: a `QuantumCircuit` reads like
155
+ `run()` (qubit 0 rightmost), a `QuantumSession` like `get_measurement()` and a
156
+ Jasp program like `measure()` (qubit 0 leftmost) — declare what Qrisp shows you.
157
+
158
+ **Adding evidence from other modules** — collect, add, then certify the bundle:
159
+
160
+ ```bash
161
+ quantbom collect --entry my_pkg.circuits:build --release my-app@1.0 --out bundle/
162
+ quantbom attest tests --bundle bundle/ --suite quantum-security-suite --outcome passed --passed 42
163
+ quantbom attest vulns --bundle bundle/ --policy-url https://example.org/security --contact mailto:security@example.org
164
+ quantbom attest constant-time --bundle bundle/ --tool dudect --target kyber_decaps --measurements timings.csv
165
+ quantbom attest crypto --bundle bundle/ --cbom cbom.cdx.json
166
+ quantbom sign --bundle bundle/ # last, so the signature covers it all
167
+ quantbom certify --bundle bundle/ --release my-app@1.0
168
+ ```
169
+
170
+ The four `attest` commands are the partner-module evidence the gate otherwise
171
+ reports as N-A: a MOD-05 security test report (`MOD05-TEST-01`), a VEX/VDR and
172
+ a coordinated-disclosure policy (`CRA-VULN-01`, `CRA-VDP-01`), a constant-time
173
+ proof from dudect / ctgrind / Binsec-Rel (`CRA-ESR-06`), and a CBOM
174
+ PQC-readiness assessment (`CRA-CRYPTO-01`). Each writes a hash-bound document
175
+ into the bundle; the same bytes the repository scripts write.
176
+
177
+ In Python: `quantbom.collect(...)`, then `quantbom.attest.tests(bundle, ...)`,
178
+ `.vulnerability_handling(...)`, `.constant_time(...)`, `.crypto(...)`, then
179
+ `quantbom.certify(bundle="bundle", release=..., sign=True)`.
180
+
181
+ **What can the harness do for me?**
182
+
183
+ ```bash
184
+ quantbom actions --framework cirq # every action, its status for Cirq, how to turn it on
185
+ quantbom actions --requirement CRA-II-3 # which actions produce evidence for this requirement
186
+ ```
187
+
188
+ Answered offline from the index shipped in the package — the same answer the
189
+ service gives at `GET /v1/harness`.
190
+
191
+ ## Behaviour
192
+
193
+ - **Non-intrusive & fail-soft.** If the service is unreachable or credits are
194
+ exhausted, a warning is logged and your quantum run continues. Certifying is
195
+ additive (unless you opt into `gate` mode).
196
+ - **Privacy by design.** Only the QBOM/evidence (hashes, metrics, backend
197
+ binding) is uploaded — not your program source.
198
+ - **Local mirror.** Every result is written to `./.quantbom/<release>/`
199
+ (the QBOM as the gate ran on it, CSNAP, certificate, attestation, the
200
+ service's receipt and public keys, verification) so you keep your own
201
+ audit bundle and can re-verify it offline with `quantbom verify`.
202
+
203
+ | Env var | Purpose |
204
+ |---|---|
205
+ | `QUANTBOM_API_KEY` | your API key (required for actions) |
206
+ | `QUANTBOM_API_URL` | service base URL (default `https://certify.zortenet.eu`) |
207
+ | `QUANTBOM_SIGNING_KEY` | producer signing key for `--sign` (default `~/.quantbom/signing.key`) |
@@ -0,0 +1,163 @@
1
+ # QuantBOM SDK
2
+
3
+ Certify a quantum software release straight from your **Qrisp / Qiskit / Cirq / Braket / PennyLane** pipeline.
4
+ Evidence is collected locally (your source never leaves the machine) and sent to
5
+ the QuantBOM service, which returns a signed, independently-verifiable CRA
6
+ certificate — also mirrored to `./.quantbom/<release>/`.
7
+
8
+ QuantBOM is a [SecQDevOps](https://certify.zortenet.eu) MOD-08 service.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pip install "quantbom[quantum]" # Qiskit + OpenQASM3 evidence collection
14
+ # pip install "quantbom[quantum,qrisp]" # also collect from Qrisp circuits
15
+ # pip install "quantbom[quantum,cirq]" # Cirq — likewise [braket], [pennylane], [cudaq] (Linux only)
16
+ # pip install "quantbom[quantum,ibm]" # real IBM Runtime execution evidence
17
+ # pip install "quantbom[quantum,qir]" # also emit QIR (QDK) and check it against the program (QNT-07)
18
+ # pip install "quantbom[signing]" # sign your evidence (quantbom keygen / --sign) and verify certificates offline
19
+ # Each frontend extra pins the version range the conformance suite holds for
20
+ # (harness_manifest.json `requires`); `quantbom actions --framework <name>` shows
21
+ # the recorded run, or that conformance is still pending.
22
+ ```
23
+
24
+ The core install is a lightweight, stdlib-only client; the `quantum` extra adds
25
+ the toolchain needed to build the evidence (QBOM).
26
+
27
+ ## Use
28
+
29
+ Set your API key (generate it in the QuantBOM dashboard):
30
+
31
+ ```bash
32
+ export QUANTBOM_API_KEY=qb_live_...
33
+ export QUANTBOM_API_URL=https://certify.zortenet.eu # default
34
+ ```
35
+
36
+ **Post-run call**
37
+
38
+ ```python
39
+ import quantbom
40
+ result = quantbom.certify(my_circuit, release="portfolio-opt@1.2.3")
41
+ print(result["overall_status"], result["certificate"]["certificate_id"])
42
+ ```
43
+
44
+ **Decorator** — certifies the circuit a function returns:
45
+
46
+ ```python
47
+ @quantbom.certified(release="vqe@2.1")
48
+ def build(): ... # returns a qiskit/qrisp circuit
49
+ ```
50
+
51
+ **Qiskit primitive wrapper** — certify transparently on `.run()`:
52
+
53
+ ```python
54
+ sampler = quantbom.wrap(SamplerV2(mode=backend), release="vqe@2.1")
55
+ job = sampler.run([circuit]) # certifies, then runs as normal
56
+ ```
57
+
58
+ **Sign your evidence** — the certificate's authorship claim (CRA-SIGN-01)
59
+ rests on *your* signature, not the service's. One key per organisation:
60
+
61
+ ```bash
62
+ pip install "quantbom[signing]"
63
+ quantbom keygen # ~/.quantbom/signing.key (0600) + signing.pub — back it up
64
+ quantbom certify --qpy circuit.qpy --release my-app@1.0 --sign
65
+ ```
66
+
67
+ In Python: `quantbom.certify(circuit, release=..., sign=True)`. The SDK signs
68
+ the collected evidence (Ed25519, in-toto/DSSE) before upload; the service
69
+ verifies it, countersigns what it received, and the certificate names both
70
+ key ids. Without `--sign` the release is **NON_COMPLIANT**: CRA-SIGN-01 rests
71
+ on the producer's signature, the service's countersignature is a receipt and
72
+ never substitutes, and the certificate says in words that the producer did
73
+ not sign. `--key FILE` or `QUANTBOM_SIGNING_KEY` point at a key elsewhere; in
74
+ CI, store the key as a secret and pass it to the `quantbom-certify` action's
75
+ `signing-key` input.
76
+
77
+ **Verify a certificate without trusting us** — for the auditor, the customer,
78
+ or your future self. Needs only the wheel, never the service code:
79
+
80
+ ```bash
81
+ pip install "quantbom[signing]"
82
+ quantbom keys --pin # fetch the service's signing keys once; pin them
83
+ quantbom verify .quantbom/my-app@1.0 # the mirror, a collect bundle, or a zip of either
84
+ ```
85
+
86
+ It re-hashes every artifact against the QBOM, verifies the producer's
87
+ attestation and the service's receipt, recomputes the CSNAP's and the
88
+ certificate's reproducibility hashes and bindings, and checks the certificate
89
+ signature against a key that is *anchored* (pinned from `/v1/keys`, or given
90
+ with `--keys` / `--service-key`). What it does not do, it says: the 24
91
+ controls are not re-run (that needs the gate, `verify_bundle.py` in the
92
+ repository). Verdicts: `VERIFIED` (exit 0), `FAILED`, or `UNANCHORED` when
93
+ every check passed but nothing was pinned.
94
+
95
+ **CLI / CI**
96
+
97
+ ```bash
98
+ quantbom certify --qpy circuit.qpy --release my-app@1.0 --mode gate --sign
99
+ quantbom certify --qasm3 program.qasm3 --release my-app@1.0
100
+ quantbom certify --demo --release smoke-test # needs the [qrisp] extra
101
+
102
+ # any supported framework, straight from your code (module:attr or file.py:attr;
103
+ # a function is called, an object such as a PennyLane QNode is passed as is)
104
+ quantbom certify --entry my_pkg.circuits:build --release my-app@1.0 --expect 10=1.0
105
+ ```
106
+
107
+ `--mode gate` exits non-zero on a non-compliant release (use it to fail CI);
108
+ `--mode report` (default) never fails your pipeline. `--expect` outcomes are
109
+ read in your framework's own bit order (`--expected-order qiskit` to override).
110
+ For Qrisp that depends on what you hand over: a `QuantumCircuit` reads like
111
+ `run()` (qubit 0 rightmost), a `QuantumSession` like `get_measurement()` and a
112
+ Jasp program like `measure()` (qubit 0 leftmost) — declare what Qrisp shows you.
113
+
114
+ **Adding evidence from other modules** — collect, add, then certify the bundle:
115
+
116
+ ```bash
117
+ quantbom collect --entry my_pkg.circuits:build --release my-app@1.0 --out bundle/
118
+ quantbom attest tests --bundle bundle/ --suite quantum-security-suite --outcome passed --passed 42
119
+ quantbom attest vulns --bundle bundle/ --policy-url https://example.org/security --contact mailto:security@example.org
120
+ quantbom attest constant-time --bundle bundle/ --tool dudect --target kyber_decaps --measurements timings.csv
121
+ quantbom attest crypto --bundle bundle/ --cbom cbom.cdx.json
122
+ quantbom sign --bundle bundle/ # last, so the signature covers it all
123
+ quantbom certify --bundle bundle/ --release my-app@1.0
124
+ ```
125
+
126
+ The four `attest` commands are the partner-module evidence the gate otherwise
127
+ reports as N-A: a MOD-05 security test report (`MOD05-TEST-01`), a VEX/VDR and
128
+ a coordinated-disclosure policy (`CRA-VULN-01`, `CRA-VDP-01`), a constant-time
129
+ proof from dudect / ctgrind / Binsec-Rel (`CRA-ESR-06`), and a CBOM
130
+ PQC-readiness assessment (`CRA-CRYPTO-01`). Each writes a hash-bound document
131
+ into the bundle; the same bytes the repository scripts write.
132
+
133
+ In Python: `quantbom.collect(...)`, then `quantbom.attest.tests(bundle, ...)`,
134
+ `.vulnerability_handling(...)`, `.constant_time(...)`, `.crypto(...)`, then
135
+ `quantbom.certify(bundle="bundle", release=..., sign=True)`.
136
+
137
+ **What can the harness do for me?**
138
+
139
+ ```bash
140
+ quantbom actions --framework cirq # every action, its status for Cirq, how to turn it on
141
+ quantbom actions --requirement CRA-II-3 # which actions produce evidence for this requirement
142
+ ```
143
+
144
+ Answered offline from the index shipped in the package — the same answer the
145
+ service gives at `GET /v1/harness`.
146
+
147
+ ## Behaviour
148
+
149
+ - **Non-intrusive & fail-soft.** If the service is unreachable or credits are
150
+ exhausted, a warning is logged and your quantum run continues. Certifying is
151
+ additive (unless you opt into `gate` mode).
152
+ - **Privacy by design.** Only the QBOM/evidence (hashes, metrics, backend
153
+ binding) is uploaded — not your program source.
154
+ - **Local mirror.** Every result is written to `./.quantbom/<release>/`
155
+ (the QBOM as the gate ran on it, CSNAP, certificate, attestation, the
156
+ service's receipt and public keys, verification) so you keep your own
157
+ audit bundle and can re-verify it offline with `quantbom verify`.
158
+
159
+ | Env var | Purpose |
160
+ |---|---|
161
+ | `QUANTBOM_API_KEY` | your API key (required for actions) |
162
+ | `QUANTBOM_API_URL` | service base URL (default `https://certify.zortenet.eu`) |
163
+ | `QUANTBOM_SIGNING_KEY` | producer signing key for `--sign` (default `~/.quantbom/signing.key`) |
@@ -0,0 +1,59 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "quantbom"
7
+ version = "0.6.0"
8
+ description = "QuantBOM SDK — certify quantum software releases from your Qrisp/Qiskit pipeline (a SecQDevOps MOD-08 service)."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "SecQDevOps / QuantBOM" }]
13
+ keywords = ["quantum", "qiskit", "qrisp", "compliance", "certification", "cra", "qbom", "sbom"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: Apache Software License",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Security",
20
+ "Topic :: Scientific/Engineering",
21
+ ]
22
+ # Core install is a lightweight, stdlib-only HTTP client. Evidence collection
23
+ # needs the quantum toolchain — opt in with the extras below.
24
+ dependencies = []
25
+
26
+ [project.optional-dependencies]
27
+ quantum = ["qiskit>=2.0,<3", "qiskit-qasm3-import>=0.5"]
28
+ qrisp = ["qrisp>=0.8,<1"]
29
+ # other frontends (one extra per adapter; the ranges are the ones the
30
+ # conformance suite holds for — harness_manifest.json `requires` must agree)
31
+ cirq = ["cirq-core>=1.4,<2"]
32
+ braket = ["amazon-braket-sdk>=1.80,<2"]
33
+ pennylane = ["pennylane>=0.41,<1"]
34
+ cudaq = ["cudaq>=0.9,<1"]
35
+ ibm = ["qiskit-ibm-runtime>=0.20"]
36
+ # >=3.10: earlier releases DECIDE circuits that 3.10+ refuses (a measurement deferred past a
37
+ # gate on the measured qubit — tests/harness/test_k0b.py B1); one circuit must get one verdict
38
+ # everywhere, so the floor is the version whose refusal is the honest answer
39
+ verify = ["mqt.qcec>=3.10"]
40
+ # producer signing from a pip install: `quantbom keygen` / `quantbom sign` / `certify --sign`
41
+ signing = ["cryptography>=42"]
42
+ # local execution of dynamic circuits, and the noise of the synthetic `generic` backend
43
+ sim = ["qiskit-aer>=0.15"]
44
+ # QIR as the second standards-named IR (K5): the QDK compiles the OpenQASM 3 export,
45
+ # pyqir inspects the module, qirrunner executes it for the consistency check (QNT-07)
46
+ qir = ["qdk>=1.30,<2", "pyqir>=0.10,<1", "qirrunner>=0.9,<1"]
47
+
48
+ [project.scripts]
49
+ quantbom = "quantbom.cli:main"
50
+
51
+ [project.urls]
52
+ Homepage = "https://certify.zortenet.eu"
53
+
54
+ [tool.setuptools]
55
+ packages = ["quantbom", "quantbom.frameworks", "quantbom.actions"]
56
+ license-files = ["LICENSE"]
57
+
58
+ [tool.setuptools.package-data]
59
+ quantbom = ["harness.json"]