Skip to content

Commit fbc4c70

Browse files
committed
add trust setting in readme
1 parent bc0d38d commit fbc4c70

2 files changed

Lines changed: 43 additions & 14 deletions

File tree

.github/workflows/cross_platform_tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Cross-Platform Tests
22

33
on:
44
push:
5-
branches: [ main, master ]
65
tags:
76
- 'v*.*.*' # Only trigger on tags like v1.0.0, v1.2.3
87
workflow_dispatch: # Allows manual triggering

README.md

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,48 @@ with open("path/to/image.jpg", "rb") as f:
7070
}
7171
```
7272

73+
## Trust Settings and Certificates
74+
75+
### Adding Trust Settings
76+
77+
To properly verify C2PA signatures, you may need to configure trust settings for specific certificate authorities or individual certificates. The Content Authenticity Initiative maintains a list of known certificates that can be used for verification.
78+
79+
```python
80+
from fast_c2pa_python import setup_trust_verification, read_c2pa_from_file
81+
82+
# Configure trust settings using certificate files
83+
setup_trust_verification(
84+
anchors_file="path/to/anchors.pem", # Root CA certificates
85+
allowed_file="path/to/allowed.pem", # Allowed intermediate certificates
86+
config_file="path/to/store.cfg" # Trust store configuration
87+
)
88+
89+
# After configuring trust, read C2PA metadata
90+
# The validation_state will be "Trusted" instead of just "Valid"
91+
metadata = read_c2pa_from_file("path/to/image.jpg")
92+
print(f"Validation state: {metadata['validation_state']}")
93+
```
94+
95+
### Validation States
96+
97+
Without trust configuration:
98+
```python
99+
metadata = read_c2pa_from_file("image.jpg")
100+
print(metadata['validation_state']) # "Valid" - signature verified but not trusted
101+
```
102+
103+
With trust configuration:
104+
```python
105+
setup_trust_verification("anchors.pem", "allowed.pem", "store.cfg")
106+
metadata = read_c2pa_from_file("image.jpg")
107+
print(metadata['validation_state']) # "Trusted" - signature verified and trusted
108+
```
109+
110+
### Finding Certificates
111+
112+
You can find trusted certificates and learn more about certificate verification at:
113+
- **CAI Known Certificate List**: https://opensource.contentauthenticity.org/docs/verify-known-cert-list/
114+
73115
## Testing
74116

75117
The library includes API compatibility tests to ensure functionality.
@@ -105,18 +147,6 @@ maturin develop
105147
maturin develop --release
106148
```
107149

108-
### Building Wheel Files
109-
110-
```bash
111-
# Build wheel for the current platform
112-
maturin build --release
113-
114-
Wheel files are generated in the `target/wheels/` directory and can be shared directly with users who can install them using pip:
115-
116-
```bash
117-
pip install /path/to/fast_c2pa_python-x.x.x-cp3xx-cp3xx-platform.whl
118-
```
119-
120150
## License
121151

122152
This project is dual-licensed under both MIT and Apache 2.0 licenses to ensure compatibility with the underlying c2pa-rs library.
@@ -131,4 +161,4 @@ This library is built upon the excellent work of the [c2pa-rs](https://github.co
131161
- [c2pa-rs](https://github.com/contentauth/c2pa-rs) - Core C2PA implementation
132162
- [PyO3](https://github.com/PyO3/pyo3) - Rust bindings for Python
133163

134-
Special thanks to the Content Authenticity Initiative and the c2pa-rs contributors for their foundational work on C2PA standards and implementation.
164+
Special thanks to the Content Authenticity Initiative and the c2pa-rs contributors for their foundational work on C2PA standards and implementation.

0 commit comments

Comments
 (0)