-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Update to use latest c2pa-python SDK #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d410c2d
fix: kms sign works again
tmathern 122e160
fix: KMS signs
tmathern edc0178
fix: Client example working too
tmathern 2758a43
fix: Docs
tmathern 120cfe8
fix: Clean up imports
tmathern 78ac680
fix: Format
tmathern e035803
fix: Lint readme
tmathern de7e3ec
fix: Clean up imports
tmathern 3100586
fix: Remove debug leftovers
tmathern b1a021e
fix: CLeaning up
tmathern e776dc6
fix: Bump Python SDK
tmathern 864b026
Copy edits to README
crandmck 0e6ace4
a few more edits
crandmck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| c2pa-python==0.6.1 | ||
| c2pa-python>=0.25.0 | ||
| boto3 | ||
| pyyaml | ||
| pyasn1==0.4.8 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # C2PA Python example client | ||
|
|
||
| NOTE: This documentation is for the example developer. | ||
|
|
||
| This directory contains the client for signing JPEG images with Content Credentials. The client works with the C2PA Python example server in development mode using demo certificates (included in this repository). | ||
|
|
||
| ## Overview | ||
|
|
||
| The `client.py` file is a command-line test tool that signs JPEG image files. It connects to the signing server defined in `app.py` to add Content Credentials to JPEG images. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. Install Python dependencies. Enter this command in the top level of the repo: | ||
|
|
||
| ```bash | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| 2. Run the signing server (`app.py`). It uses local certificates and must be accessible to the client: | ||
|
|
||
| ```bash | ||
| python app.py | ||
| ``` | ||
|
|
||
| 3. Run the client as explained below to submit images for the server to sign. | ||
|
|
||
| ## Usage | ||
|
|
||
| NOTE: This test client supports only JPEG images. | ||
|
|
||
| ### Basic command | ||
|
|
||
| ```bash | ||
| python tests/client.py <image-file> -o <output-directory> | ||
| ``` | ||
|
|
||
| ### Command line arguments | ||
|
|
||
| | Argument | Type | Required | Description | | ||
| |----------|------|----------|-------------| | ||
| | `files` | string | Yes | One or more image files to be signed | | ||
| | `-o, --output` | string | Yes | Output directory where signed images will be saved | | ||
| | `-f, --envfile` | string | No | Path to environment configuration file | | ||
|
|
||
| ### Examples | ||
|
|
||
| #### Sign a single image | ||
|
|
||
| ```bash | ||
| python tests/client.py ./image-to-sign.jpeg -o signed-images | ||
| ``` | ||
|
|
||
| #### Use custom configuration | ||
|
|
||
| ```bash | ||
| python tests/client.py ./image-to-sign.jpeg -o signed-images -f ./my-config.env | ||
| ``` | ||
|
|
||
| ## Signing flow when using the client | ||
|
|
||
| 1. **Server Connection**: Client connects to the signing server's `/signer_data` endpoint. | ||
| 2. **Configuration Retrieval**: Gets signing algorithm, certificate chain, and signing URL. | ||
| 3. **Signer Creation**: Creates a remote signer using the modern C2PA API (`Signer.from_callback`)/ | ||
| 4. **Manifest Creation**: Generates a default C2PA manifest. | ||
| 5. **Image Processing**: Creates a thumbnail for the manifest and adds it as resource. | ||
| 6. **Remote Signing**: Uses the `Builder.sign()` method with remote signing callback. | ||
| 7. **Output**: Saves the signed image to the specified output directory. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| -----BEGIN CERTIFICATE----- | ||
| MIIChzCCAi6gAwIBAgIUcCTmJHYF8dZfG0d1UdT6/LXtkeYwCgYIKoZIzj0EAwIw | ||
| gYwxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTESMBAGA1UEBwwJU29tZXdoZXJl | ||
| MScwJQYDVQQKDB5DMlBBIFRlc3QgSW50ZXJtZWRpYXRlIFJvb3QgQ0ExGTAXBgNV | ||
| BAsMEEZPUiBURVNUSU5HX09OTFkxGDAWBgNVBAMMD0ludGVybWVkaWF0ZSBDQTAe | ||
| Fw0yMjA2MTAxODQ2NDBaFw0zMDA4MjYxODQ2NDBaMIGAMQswCQYDVQQGEwJVUzEL | ||
| MAkGA1UECAwCQ0ExEjAQBgNVBAcMCVNvbWV3aGVyZTEfMB0GA1UECgwWQzJQQSBU | ||
| ZXN0IFNpZ25pbmcgQ2VydDEZMBcGA1UECwwQRk9SIFRFU1RJTkdfT05MWTEUMBIG | ||
| A1UEAwwLQzJQQSBTaWduZXIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQPaL6R | ||
| kAkYkKU4+IryBSYxJM3h77sFiMrbvbI8fG7w2Bbl9otNG/cch3DAw5rGAPV7NWky | ||
| l3QGuV/wt0MrAPDoo3gwdjAMBgNVHRMBAf8EAjAAMBYGA1UdJQEB/wQMMAoGCCsG | ||
| AQUFBwMEMA4GA1UdDwEB/wQEAwIGwDAdBgNVHQ4EFgQUFznP0y83joiNOCedQkxT | ||
| tAMyNcowHwYDVR0jBBgwFoAUDnyNcma/osnlAJTvtW6A4rYOL2swCgYIKoZIzj0E | ||
| AwIDRwAwRAIgOY/2szXjslg/MyJFZ2y7OH8giPYTsvS7UPRP9GI9NgICIDQPMKrE | ||
| LQUJEtipZ0TqvI/4mieoyRCeIiQtyuS0LACz | ||
| -----END CERTIFICATE----- | ||
| -----BEGIN CERTIFICATE----- | ||
| MIICajCCAg+gAwIBAgIUfXDXHH+6GtA2QEBX2IvJ2YnGMnUwCgYIKoZIzj0EAwIw | ||
| dzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQHDAlTb21ld2hlcmUx | ||
| GjAYBgNVBAoMEUMyUEEgVGVzdCBSb290IENBMRkwFwYDVQQLDBBGT1IgVEVTVElO | ||
| R19PTkxZMRAwDgYDVQQDDAdSb290IENBMB4XDTIyMDYxMDE4NDY0MFoXDTMwMDgy | ||
| NzE4NDY0MFowgYwxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTESMBAGA1UEBwwJ | ||
| U29tZXdoZXJlMScwJQYDVQQKDB5DMlBBIFRlc3QgSW50ZXJtZWRpYXRlIFJvb3Qg | ||
| Q0ExGTAXBgNVBAsMEEZPUiBURVNUSU5HX09OTFkxGDAWBgNVBAMMD0ludGVybWVk | ||
| aWF0ZSBDQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABHllI4O7a0EkpTYAWfPM | ||
| D6Rnfk9iqhEmCQKMOR6J47Rvh2GGjUw4CS+aLT89ySukPTnzGsMQ4jK9d3V4Aq4Q | ||
| LsOjYzBhMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW | ||
| BBQOfI1yZr+iyeUAlO+1boDitg4vazAfBgNVHSMEGDAWgBRembiG4Xgb2VcVWnUA | ||
| UrYpDsuojDAKBggqhkjOPQQDAgNJADBGAiEAtdZ3+05CzFo90fWeZ4woeJcNQC4B | ||
| 84Ill3YeZVvR8ZECIQDVRdha1xEDKuNTAManY0zthSosfXcvLnZui1A/y/DYeg== | ||
| -----END CERTIFICATE----- | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| -----BEGIN PRIVATE KEY----- | ||
| MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgfNJBsaRLSeHizv0m | ||
| GL+gcn78QmtfLSm+n+qG9veC2W2hRANCAAQPaL6RkAkYkKU4+IryBSYxJM3h77sF | ||
| iMrbvbI8fG7w2Bbl9otNG/cch3DAw5rGAPV7NWkyl3QGuV/wt0MrAPDo | ||
| -----END PRIVATE KEY----- |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.