Integrate local OpenSSL TSA for timestamping
Replaced HTTPTimeStamper with LocalOpensslTimestamp for TSA operations using a local OpenSSL CLI. Updated related configurations and dependencies to support this change, enhancing the timestamping process's reliability and security.
This commit is contained in:
@@ -7,11 +7,15 @@ from pyhanko.sign import signers, timestamps, fields
|
||||
from pyhanko_certvalidator import ValidationContext
|
||||
from typing_extensions import Buffer
|
||||
|
||||
from pythonProject.timestamp import LocalOpensslTimestamp
|
||||
|
||||
|
||||
class SignOrchestrator:
|
||||
"""Orchestrate the signature on document"""
|
||||
|
||||
def __init__(self, pkcs12_path: str, timestamp_url: str, pkcs12_password: Optional[bytes] = None):
|
||||
def __init__(self, pkcs12_path: str,
|
||||
tsa_config_path: str, tsa_password: str, tsa_cert_chain: str,
|
||||
pkcs12_password: Optional[bytes] = None):
|
||||
# Load signer key material from PKCS#12 file
|
||||
# This assumes that any relevant intermediate certs are also included
|
||||
# in the PKCS#12 file.
|
||||
@@ -20,9 +24,7 @@ class SignOrchestrator:
|
||||
)
|
||||
|
||||
# Set up a timestamping client to fetch timestamps tokens
|
||||
self.timestamper = timestamps.HTTPTimeStamper(
|
||||
url=timestamp_url,
|
||||
)
|
||||
self.timestamper = LocalOpensslTimestamp(tsa_config_path, tsa_password, tsa_cert_chain)
|
||||
|
||||
self.stamp_style = stamp.TextStampStyle(
|
||||
stamp_text="Signé par:\n%(signer_text)s\nLe %(ts)s",
|
||||
|
||||
Reference in New Issue
Block a user