2024-06-27 07:51:32 +00:00
|
|
|
from sign import SignOrchestrator
|
|
|
|
|
2024-10-11 13:07:21 +00:00
|
|
|
"""
|
|
|
|
This is a script to sign a file with the dummy assets
|
|
|
|
|
|
|
|
It is created mainly for testing purpose
|
|
|
|
"""
|
|
|
|
|
|
|
|
orchestrator = SignOrchestrator('./assets/dummy.p12',
|
|
|
|
'/home/julien/dev/chill/sign-pdf-worker/ts-authority/rootca.conf',
|
|
|
|
'5678',
|
|
|
|
'/home/julien/dev/chill/sign-pdf-worker/ts-authority/ca/tsa-chain.pem',
|
|
|
|
pkcs12_password=None)
|
2024-06-27 07:51:32 +00:00
|
|
|
|
|
|
|
with open('./assets/test.pdf', 'rb') as input:
|
2024-10-15 05:47:58 +00:00
|
|
|
signed_content = orchestrator.sign(reason="first signer", signature_index=None,
|
2024-06-27 07:51:32 +00:00
|
|
|
input_content=input.read(), box_place=(300, 600, 500, 660), on_page=0,
|
|
|
|
signer_text="Mme Caroline Diallo")
|
|
|
|
|
|
|
|
with open('./assets/test_signed_0.pdf', 'wb') as output:
|
|
|
|
output.write(signed_content.read())
|
|
|
|
|
|
|
|
with open('./assets/test_signed_0.pdf', 'rb') as input:
|
2024-10-15 05:47:58 +00:00
|
|
|
signed_content = orchestrator.sign(reason="second signer", signature_index=None,
|
2024-10-11 13:07:21 +00:00
|
|
|
input_content=input.read(), box_place=(100, 600, 300, 660), on_page=0,
|
|
|
|
signer_text="M. Bah Mamadou")
|
2024-06-27 07:51:32 +00:00
|
|
|
|
2024-10-11 13:07:21 +00:00
|
|
|
with open('./assets/test_signed_1.pdf', 'wb') as output:
|
|
|
|
output.write(signed_content.read())
|