Skip to content

Commit 138ff74

Browse files
authored
feat: c2pa-rs and c2pa_c_ffi 0.68.0 update (#189)
* feat: Prepare 0.68.0 update * fix: Load trust for some tests * fix: Trust settings * fix: Update tests * fix: Restore deleted file * fix: Update the examples * fix: Clarify comment * fix: CLean up old tmp test * fix: Switch to json * fix: Add sign all files test with V2 spec * fix: Remove toml example
1 parent d211c0f commit 138ff74

File tree

8 files changed

+582
-79
lines changed

8 files changed

+582
-79
lines changed

c2pa-native-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c2pa-v0.67.1
1+
c2pa-v0.68.0

examples/sign.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
fixtures_dir = os.path.join(os.path.dirname(__file__), "../tests/fixtures/")
2727
output_dir = os.path.join(os.path.dirname(__file__), "../output/")
2828

29-
# Ensure the output directory exists
29+
# Ensure the output directory exists.
3030
if not os.path.exists(output_dir):
3131
os.makedirs(output_dir)
3232

@@ -43,7 +43,7 @@
4343
with open(fixtures_dir + "es256_private.key", "rb") as key_file:
4444
key = key_file.read()
4545

46-
# Define a callback signer function
46+
# Define a callback signer function.
4747
def callback_signer_es256(data: bytes) -> bytes:
4848
"""Callback function that signs data using ES256 algorithm."""
4949
private_key = serialization.load_pem_private_key(
@@ -60,7 +60,6 @@ def callback_signer_es256(data: bytes) -> bytes:
6060
# Create a manifest definition as a dictionary.
6161
# This manifest follows the V2 manifest format.
6262
manifest_definition = {
63-
"claim_generator": "python_example",
6463
"claim_generator_info": [{
6564
"name": "python_example",
6665
"version": "0.0.1",
@@ -87,7 +86,7 @@ def callback_signer_es256(data: bytes) -> bytes:
8786
}
8887

8988
# Sign the image with the signer created above,
90-
# which will use the callback signer
89+
# which will use the callback signer.
9190
print("\nSigning the image file...")
9291

9392
with c2pa.Signer.from_callback(
@@ -107,6 +106,9 @@ def callback_signer_es256(data: bytes) -> bytes:
107106
print("\nReading signed image metadata:")
108107
with open(output_dir + "A_signed.jpg", "rb") as file:
109108
with c2pa.Reader("image/jpeg", file) as reader:
109+
# The validation state will depend on loaded trust settings.
110+
# Without loaded trust settings,
111+
# the manifest validation_state will be "Invalid".
110112
print(reader.json())
111113

112114
print("\nExample completed successfully!")

examples/sign_info.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@
100100
print("\nReading signed image metadata:")
101101
with open(output_dir + "C_signed.jpg", "rb") as file:
102102
with c2pa.Reader("image/jpeg", file) as reader:
103+
# The validation state will depend on loaded trust settings.
104+
# Without loaded trust settings,
105+
# the manifest validation_state will be "Invalid".
103106
print(reader.json())
104107

105108
print("\nExample completed successfully!")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "c2pa-python"
7-
version = "0.27.1"
7+
version = "0.28.0"
88
requires-python = ">=3.10"
99
description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
1010
readme = { file = "README.md", content-type = "text/markdown" }

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Placeholder

0 commit comments

Comments
 (0)