c2pa-verify 0.1.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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Maximiliano Telmo
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,12 @@
1
+ c2pa-verify
2
+ Copyright 2026 Maximiliano Telmo
3
+
4
+ Licenciado bajo Apache License 2.0 (ver LICENSE).
5
+
6
+ Incluye las listas de confianza de C2PA Conformance
7
+ (https://github.com/c2pa-org/conformance-public, carpeta trust-list/,
8
+ commit d6dec63476e2636095d1291d24b29ffa2d4e1ac0), bajo Creative Commons
9
+ Attribution 4.0 International, sin cambios. Texto en
10
+ src/c2pa_verify/trust/LICENSE-C2PA-TRUST-LIST.txt.
11
+
12
+ Depende de c2pa-python (MIT OR Apache-2.0), que se instala aparte.
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.4
2
+ Name: c2pa-verify
3
+ Version: 0.1.0
4
+ Summary: Verificación offline y determinista de manifiestos C2PA, con listas de confianza fijadas por hash.
5
+ Author: Maximiliano Telmo
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repositorio, https://github.com/Maxitelmo/c2pa-verify
8
+ Project-URL: Problemas, https://github.com/Maxitelmo/c2pa-verify/issues
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ License-File: src/c2pa_verify/trust/LICENSE-C2PA-TRUST-LIST.txt
14
+ Requires-Dist: c2pa-python==0.38.0
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest; extra == "dev"
17
+ Requires-Dist: cryptography; extra == "dev"
18
+ Requires-Dist: pillow; extra == "dev"
19
+ Dynamic: license-file
20
+
21
+ # c2pa-verify
22
+
23
+ Verificación **offline y determinista** de manifiestos C2PA, pensada para trabajo
24
+ forense. Informa el estado de la firma y lo que el manifiesto declara, con la
25
+ trazabilidad necesaria para reproducir el resultado.
26
+
27
+ > **Idioma:** por ahora, la herramienta y su documentación están solo en español.
28
+ >
29
+ > **Language:** for now, this tool and its documentation are available in Spanish
30
+ > only, including the API, the output and the state names. It does offline,
31
+ > deterministic C2PA manifest verification on top of c2pa-python, with hash-pinned
32
+ > trust lists and separate states for "valid" and "trusted".
33
+
34
+ ## Qué no hace
35
+
36
+ - No dice si el contenido es verdadero. Una firma confiable indica quién firmó y
37
+ que el archivo no cambió desde entonces.
38
+ - No detecta IA. Informa lo que el manifiesto **declara**; no analiza píxeles ni
39
+ puntúa.
40
+ - `AUSENTE` no descarta nada: la mayoría de los archivos no tiene manifiesto, y
41
+ las plataformas de mensajería suelen quitarlo.
42
+
43
+ ## Cuándo usar otra herramienta
44
+
45
+ [c2pareader](https://github.com/abrignoni/c2pareader) (MIT) lee lo que el archivo
46
+ declara, en Python puro y sin dependencias, pero no verifica firmas. Este paquete
47
+ hace el paso siguiente, verificar, a cambio de depender de c2pa-python y su
48
+ biblioteca nativa. Son complementarios: uno sirve para leer rápido en cualquier
49
+ lado, y el otro para saber si lo declarado tiene respaldo de firma.
50
+
51
+ ## Instalación y uso
52
+
53
+ Requiere Python 3.10 o posterior.
54
+
55
+ ```bash
56
+ pip install git+https://github.com/Maxitelmo/c2pa-verify.git
57
+ ```
58
+
59
+ ```bash
60
+ c2pa-verify foto.jpg video.mp4
61
+ ```
62
+
63
+ ```bash
64
+ c2pa-verify --json foto.jpg
65
+ ```
66
+
67
+ ```python
68
+ from c2pa_verify import verificar
69
+
70
+ r = verificar("foto.jpg")
71
+ print(r["estado"], r["etiqueta"], r["firmante"])
72
+ ```
73
+
74
+ ## Estados
75
+
76
+ | Estado | Significado |
77
+ |---|---|
78
+ | `CONFIABLE` | Manifiesto íntegro y firmante validado contra la lista de firmantes C2PA |
79
+ | `VALIDO_NO_CONFIABLE` | Manifiesto íntegro; el firmante no está en la lista cargada |
80
+ | `INVALIDO` + `invalidez: "credencial"` | Contenido íntegro, pero el certificado no es apto, venció o fue revocado |
81
+ | `INVALIDO` + `invalidez: "integridad"` | El contenido no coincide con el firmado, o la firma no verifica |
82
+ | `MALFORMADO` | Hay un manifiesto, pero no se puede leer |
83
+ | `REMOTO` | El archivo remite a un manifiesto en internet, que **no se descarga** (hacerlo le avisaría a quien controla esa dirección) |
84
+ | `AUSENTE` | No hay manifiesto |
85
+ | `None` | No se pudo determinar; ver `motivo`. No significa que no haya manifiesto |
86
+
87
+ ## Garantías
88
+
89
+ - **Sin red:** sin OCSP, sin manifiestos remotos y con la lista de hosts vacía. Los
90
+ tests lo comprueban con una escucha local y un control positivo.
91
+ - **Sin escrituras:** el archivo solo se lee.
92
+ - **Listas fijadas:** una lista cuyo SHA-256 no coincide con el fijado no se carga,
93
+ y entonces nadie sale confiable.
94
+ - **Confianza atribuible:** `CONFIABLE` exige que el SDK haya validado contra la
95
+ lista de firmantes, no contra la de sellos de tiempo.
96
+ - **Trazable:** cada resultado registra SHA-256 del archivo, fecha de lectura,
97
+ versiones, hash de las listas y EKU aceptados.
98
+
99
+ ## El resultado depende de la fecha
100
+
101
+ Una firma sin sello de tiempo de una TSA anclada se valida con la fecha de lectura:
102
+ cuando el certificado vence, el mismo archivo pasa a `INVALIDO` por credencial.
103
+ Registrá siempre `fecha_lectura_utc` junto con el resultado.
104
+
105
+ ## Limitaciones conocidas
106
+
107
+ - El SDK corre dentro del proceso: un archivo que haga fallar la biblioteca nativa
108
+ puede cerrar el programa. Para lotes no confiables, conviene aislarlo en un
109
+ proceso hijo.
110
+ - Se detecta una biblioteca nativa ajena en la carpeta de trabajo y no se la carga,
111
+ pero no se verifica el hash de la biblioteca efectivamente cargada.
112
+ - Las identidades CAWG no se decodifican ni se resuelven.
113
+ - Instalado pesa bastante: el paquete `c2pa` de c2pa-python ocupa unos 300 MB en
114
+ Windows.
115
+ - Las listas envejecen: actualizarlas requiere publicar una versión nueva (ver
116
+ [trust/README.md](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/trust/README.md)).
117
+
118
+ Ver también [docs/HALLAZGOS-SDK.md](https://github.com/Maxitelmo/c2pa-verify/blob/main/docs/HALLAZGOS-SDK.md).
119
+
120
+ ## Cómo verificar el método
121
+
122
+ El método está pensado para que cualquiera lo revise y lo reproduzca.
123
+
124
+ 1. **Leer las reglas:** los estados salen de `_estado_c2pa`, `_tipo_invalidez` y
125
+ `_extraer_info_c2pa`, en
126
+ [verificador.py](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/verificador.py). La configuración del SDK está
127
+ en `settings_c2pa`, en [listas.py](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/listas.py).
128
+ 2. **Correr los tests:**
129
+
130
+ ```bash
131
+ git clone https://github.com/Maxitelmo/c2pa-verify.git
132
+ ```
133
+
134
+ ```bash
135
+ cd c2pa-verify
136
+ ```
137
+
138
+ ```bash
139
+ pip install -e .[dev]
140
+ ```
141
+
142
+ ```bash
143
+ python -m pytest
144
+ ```
145
+
146
+ Firman sus propios archivos con una CA y una TSA descartables, contra el SDK
147
+ real, y cubren cada estado.
148
+ 3. **Cotejar las listas:** el SHA-256 de cada lista debe coincidir con el archivo
149
+ original de [conformance-public](https://github.com/c2pa-org/conformance-public)
150
+ en el commit indicado en
151
+ [trust/README.md](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/trust/README.md).
152
+ 4. **Contrastar resultados:** lo declarado se puede comparar con c2pareader o
153
+ c2patool. El estado de la firma solo es comparable si la otra herramienta carga
154
+ las mismas listas y acepta los mismos EKU.
155
+
156
+ **Límite de la validación:** el repositorio no incluye imágenes reales. También se
157
+ midió sobre un banco propio de 54 archivos que no se publica porque incluye material
158
+ de terceros, así que esa medición no se puede reproducir desde acá. Los tests sí.
159
+
160
+ Si encontrás un resultado incorrecto, abrí un issue. **No subas evidencia ni archivos
161
+ de una causa:** alcanza con los códigos de `--json`, sin datos que identifiquen, o con
162
+ un archivo de prueba propio.
163
+
164
+ ## Licencia
165
+
166
+ Apache-2.0 (ver [LICENSE](https://github.com/Maxitelmo/c2pa-verify/blob/main/LICENSE) y [NOTICE](https://github.com/Maxitelmo/c2pa-verify/blob/main/NOTICE)). Las listas de confianza son
167
+ de C2PA Conformance, bajo CC BY 4.0.
@@ -0,0 +1,147 @@
1
+ # c2pa-verify
2
+
3
+ Verificación **offline y determinista** de manifiestos C2PA, pensada para trabajo
4
+ forense. Informa el estado de la firma y lo que el manifiesto declara, con la
5
+ trazabilidad necesaria para reproducir el resultado.
6
+
7
+ > **Idioma:** por ahora, la herramienta y su documentación están solo en español.
8
+ >
9
+ > **Language:** for now, this tool and its documentation are available in Spanish
10
+ > only, including the API, the output and the state names. It does offline,
11
+ > deterministic C2PA manifest verification on top of c2pa-python, with hash-pinned
12
+ > trust lists and separate states for "valid" and "trusted".
13
+
14
+ ## Qué no hace
15
+
16
+ - No dice si el contenido es verdadero. Una firma confiable indica quién firmó y
17
+ que el archivo no cambió desde entonces.
18
+ - No detecta IA. Informa lo que el manifiesto **declara**; no analiza píxeles ni
19
+ puntúa.
20
+ - `AUSENTE` no descarta nada: la mayoría de los archivos no tiene manifiesto, y
21
+ las plataformas de mensajería suelen quitarlo.
22
+
23
+ ## Cuándo usar otra herramienta
24
+
25
+ [c2pareader](https://github.com/abrignoni/c2pareader) (MIT) lee lo que el archivo
26
+ declara, en Python puro y sin dependencias, pero no verifica firmas. Este paquete
27
+ hace el paso siguiente, verificar, a cambio de depender de c2pa-python y su
28
+ biblioteca nativa. Son complementarios: uno sirve para leer rápido en cualquier
29
+ lado, y el otro para saber si lo declarado tiene respaldo de firma.
30
+
31
+ ## Instalación y uso
32
+
33
+ Requiere Python 3.10 o posterior.
34
+
35
+ ```bash
36
+ pip install git+https://github.com/Maxitelmo/c2pa-verify.git
37
+ ```
38
+
39
+ ```bash
40
+ c2pa-verify foto.jpg video.mp4
41
+ ```
42
+
43
+ ```bash
44
+ c2pa-verify --json foto.jpg
45
+ ```
46
+
47
+ ```python
48
+ from c2pa_verify import verificar
49
+
50
+ r = verificar("foto.jpg")
51
+ print(r["estado"], r["etiqueta"], r["firmante"])
52
+ ```
53
+
54
+ ## Estados
55
+
56
+ | Estado | Significado |
57
+ |---|---|
58
+ | `CONFIABLE` | Manifiesto íntegro y firmante validado contra la lista de firmantes C2PA |
59
+ | `VALIDO_NO_CONFIABLE` | Manifiesto íntegro; el firmante no está en la lista cargada |
60
+ | `INVALIDO` + `invalidez: "credencial"` | Contenido íntegro, pero el certificado no es apto, venció o fue revocado |
61
+ | `INVALIDO` + `invalidez: "integridad"` | El contenido no coincide con el firmado, o la firma no verifica |
62
+ | `MALFORMADO` | Hay un manifiesto, pero no se puede leer |
63
+ | `REMOTO` | El archivo remite a un manifiesto en internet, que **no se descarga** (hacerlo le avisaría a quien controla esa dirección) |
64
+ | `AUSENTE` | No hay manifiesto |
65
+ | `None` | No se pudo determinar; ver `motivo`. No significa que no haya manifiesto |
66
+
67
+ ## Garantías
68
+
69
+ - **Sin red:** sin OCSP, sin manifiestos remotos y con la lista de hosts vacía. Los
70
+ tests lo comprueban con una escucha local y un control positivo.
71
+ - **Sin escrituras:** el archivo solo se lee.
72
+ - **Listas fijadas:** una lista cuyo SHA-256 no coincide con el fijado no se carga,
73
+ y entonces nadie sale confiable.
74
+ - **Confianza atribuible:** `CONFIABLE` exige que el SDK haya validado contra la
75
+ lista de firmantes, no contra la de sellos de tiempo.
76
+ - **Trazable:** cada resultado registra SHA-256 del archivo, fecha de lectura,
77
+ versiones, hash de las listas y EKU aceptados.
78
+
79
+ ## El resultado depende de la fecha
80
+
81
+ Una firma sin sello de tiempo de una TSA anclada se valida con la fecha de lectura:
82
+ cuando el certificado vence, el mismo archivo pasa a `INVALIDO` por credencial.
83
+ Registrá siempre `fecha_lectura_utc` junto con el resultado.
84
+
85
+ ## Limitaciones conocidas
86
+
87
+ - El SDK corre dentro del proceso: un archivo que haga fallar la biblioteca nativa
88
+ puede cerrar el programa. Para lotes no confiables, conviene aislarlo en un
89
+ proceso hijo.
90
+ - Se detecta una biblioteca nativa ajena en la carpeta de trabajo y no se la carga,
91
+ pero no se verifica el hash de la biblioteca efectivamente cargada.
92
+ - Las identidades CAWG no se decodifican ni se resuelven.
93
+ - Instalado pesa bastante: el paquete `c2pa` de c2pa-python ocupa unos 300 MB en
94
+ Windows.
95
+ - Las listas envejecen: actualizarlas requiere publicar una versión nueva (ver
96
+ [trust/README.md](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/trust/README.md)).
97
+
98
+ Ver también [docs/HALLAZGOS-SDK.md](https://github.com/Maxitelmo/c2pa-verify/blob/main/docs/HALLAZGOS-SDK.md).
99
+
100
+ ## Cómo verificar el método
101
+
102
+ El método está pensado para que cualquiera lo revise y lo reproduzca.
103
+
104
+ 1. **Leer las reglas:** los estados salen de `_estado_c2pa`, `_tipo_invalidez` y
105
+ `_extraer_info_c2pa`, en
106
+ [verificador.py](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/verificador.py). La configuración del SDK está
107
+ en `settings_c2pa`, en [listas.py](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/listas.py).
108
+ 2. **Correr los tests:**
109
+
110
+ ```bash
111
+ git clone https://github.com/Maxitelmo/c2pa-verify.git
112
+ ```
113
+
114
+ ```bash
115
+ cd c2pa-verify
116
+ ```
117
+
118
+ ```bash
119
+ pip install -e .[dev]
120
+ ```
121
+
122
+ ```bash
123
+ python -m pytest
124
+ ```
125
+
126
+ Firman sus propios archivos con una CA y una TSA descartables, contra el SDK
127
+ real, y cubren cada estado.
128
+ 3. **Cotejar las listas:** el SHA-256 de cada lista debe coincidir con el archivo
129
+ original de [conformance-public](https://github.com/c2pa-org/conformance-public)
130
+ en el commit indicado en
131
+ [trust/README.md](https://github.com/Maxitelmo/c2pa-verify/blob/main/src/c2pa_verify/trust/README.md).
132
+ 4. **Contrastar resultados:** lo declarado se puede comparar con c2pareader o
133
+ c2patool. El estado de la firma solo es comparable si la otra herramienta carga
134
+ las mismas listas y acepta los mismos EKU.
135
+
136
+ **Límite de la validación:** el repositorio no incluye imágenes reales. También se
137
+ midió sobre un banco propio de 54 archivos que no se publica porque incluye material
138
+ de terceros, así que esa medición no se puede reproducir desde acá. Los tests sí.
139
+
140
+ Si encontrás un resultado incorrecto, abrí un issue. **No subas evidencia ni archivos
141
+ de una causa:** alcanza con los códigos de `--json`, sin datos que identifiquen, o con
142
+ un archivo de prueba propio.
143
+
144
+ ## Licencia
145
+
146
+ Apache-2.0 (ver [LICENSE](https://github.com/Maxitelmo/c2pa-verify/blob/main/LICENSE) y [NOTICE](https://github.com/Maxitelmo/c2pa-verify/blob/main/NOTICE)). Las listas de confianza son
147
+ de C2PA Conformance, bajo CC BY 4.0.
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "c2pa-verify"
7
+ description = "Verificación offline y determinista de manifiestos C2PA, con listas de confianza fijadas por hash."
8
+ readme = "README.md"
9
+ requires-python = ">=3.10"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE", "NOTICE", "src/c2pa_verify/trust/LICENSE-C2PA-TRUST-LIST.txt"]
12
+ authors = [{ name = "Maximiliano Telmo" }]
13
+ dynamic = ["version"]
14
+ # Fijada: claves de configuración, trustListUri y códigos están verificados contra esta versión.
15
+ dependencies = ["c2pa-python==0.38.0"]
16
+
17
+ [project.urls]
18
+ Repositorio = "https://github.com/Maxitelmo/c2pa-verify"
19
+ Problemas = "https://github.com/Maxitelmo/c2pa-verify/issues"
20
+
21
+ [project.optional-dependencies]
22
+ dev = ["pytest", "cryptography", "pillow"]
23
+
24
+ [project.scripts]
25
+ c2pa-verify = "c2pa_verify.__main__:main"
26
+
27
+ [tool.setuptools.dynamic]
28
+ version = { attr = "c2pa_verify.__version__" }
29
+
30
+ [tool.setuptools.packages.find]
31
+ where = ["src"]
32
+
33
+ [tool.setuptools.package-data]
34
+ c2pa_verify = ["trust/*"]
35
+
36
+ [tool.pytest.ini_options]
37
+ testpaths = ["tests"]
38
+ pythonpath = ["src", "tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Verificación offline de manifiestos C2PA. Ver verificador.verificar()."""
3
+
4
+ __version__ = "0.1.0"
5
+
6
+
7
+ def verificar(ruta):
8
+ """Atajo a verificador.verificar (importa el módulo recién al usarlo)."""
9
+ from .verificador import verificar as _verificar
10
+ return _verificar(ruta)
@@ -0,0 +1,56 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Línea de comandos: python -m c2pa_verify [--json] ARCHIVO [ARCHIVO ...]
3
+
4
+ Sale con 0 si todos los archivos se pudieron leer y con 1 si alguno no.
5
+ """
6
+
7
+ import argparse
8
+ import json
9
+ import sys
10
+
11
+ from . import __version__
12
+ from .verificador import verificar
13
+
14
+ _CAMPOS = (("Firmante declarado", "firmante"), ("Generador declarado", "generador"),
15
+ ("DigitalSourceType declarado", "digital_source_type"),
16
+ ("Lista de confianza", "trust_list_uri"), ("Dirección remota (no descargada)", "url_remota"),
17
+ ("Motivo", "motivo"))
18
+
19
+
20
+ def _texto(r: dict) -> str:
21
+ lineas = [r["archivo"], f" SHA-256: {r['sha256'] or 'no calculado'}",
22
+ f" Estado: {r['estado'] or 'no determinado'}"]
23
+ if r["etiqueta"]:
24
+ lineas.append(f" Firma C2PA: {r['etiqueta']}")
25
+ lineas += [f" {rotulo}: {r[clave]}" for rotulo, clave in _CAMPOS if r.get(clave)]
26
+ lineas += [f" Hallazgo: {h}" for h in r["hallazgos"]]
27
+ lineas += [f" Ingrediente con IA declarada: {i['titulo'] or i['manifiesto']} "
28
+ f"({i['firmante'] or 'firmante no informado'}, {i['estado_c2pa'] or 'sin estado'})"
29
+ for i in r["ingredientes_ia"]]
30
+ lineas.append(f" Leído: {r['fecha_lectura_utc']} con c2pa-python {r['c2pa_python']}")
31
+ return "\n".join(lineas)
32
+
33
+
34
+ def main(argv=None) -> int:
35
+ parser = argparse.ArgumentParser(prog="c2pa-verify",
36
+ description="Verifica manifiestos C2PA sin red y sin modificar los archivos.")
37
+ parser.add_argument("archivos", nargs="+", metavar="ARCHIVO")
38
+ parser.add_argument("--json", action="store_true", help="salida JSON con el resultado completo")
39
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
40
+ args = parser.parse_args(argv)
41
+
42
+ # Redirigida en Windows, la salida usa cp1252: un firmante con otro alfabeto
43
+ # cortaría el programa con UnicodeEncodeError.
44
+ if hasattr(sys.stdout, "reconfigure"):
45
+ sys.stdout.reconfigure(encoding="utf-8")
46
+
47
+ resultados = [verificar(a) for a in args.archivos]
48
+ if args.json:
49
+ print(json.dumps(resultados, ensure_ascii=False, indent=2))
50
+ else:
51
+ print("\n\n".join(_texto(r) for r in resultados))
52
+ return 1 if any(r["sha256"] is None for r in resultados) else 0
53
+
54
+
55
+ if __name__ == "__main__":
56
+ sys.exit(main())