-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
Description
I have modified our code just slightly for the new 0.10.0+ methods, but it fails our local test suite which worked under 0.6.0
def write(filename: str, manifest: dict, public_key: str, signing_function: Callable) -> tuple[int, bytes | None]:
manifest_json = json.dumps(manifest)
builder = c2pa.Builder(manifest_json)
signer = c2pa.Signer.from_callback(
signing_function,
c2pa.C2paSigningAlg.ES256,
public_key,
"http://timestamp.digicert.com"
)
tmp_output = os.path.join('/tmp', 'tmp.' + os.path.splitext(filename)[1])
signed_bytes = builder.sign_file(filename, tmp_output, signer)
os.rename(tmp_output, filename)
return signed_bytes
c2pa_signer_create
c_callback: signed_size: 0
[ERROR] C2paError: Signature: invalid signature value
Traceback (most recent call last):
File "/index.py", line 96, in lambda_handler
signed_manifest_bytes = c2pa_lib.write(file_path, manifest_payload, public_key, sign)
File "/c2pa_lib.py", line 17, in write
signed_bytes = builder.sign_file(filename, tmp_output, signer)
File "/usr/local/lib/python3.12/site-packages/c2pa/c2pa.py", line 1836, in sign_file
return self._sign_internal(signer, mime_type, source_stream, dest_stream)
File "/usr/local/lib/python3.12/site-packages/c2pa/c2pa.py", line 1769, in _sign_internal
raise C2paError(error)