Reputation: 9
I'd like digital signature PDFs in Python with pyHanko SDK. I have problem with timestamping. I connect to the Timestamp server with certificate (with chain). But I connected with pyHanko HTTPTimeStamper, return SSL error, because self isgned certificate is in chain (and with rfc3161ng library too).
If I connect with request and requests-pkcs12, then the connecttion is correct, but the request content is 0. How can I get timestamp from server and add to digital signed PDF?
My code with requests / requests-pkcs12 library:
with requests.Session() as s:
s.mount(ts_server,
requests_pkcs12.Pkcs12Adapter(pkcs12_filename=ts_cert_path, pkcs12_password=ts_cert_password))
headers = {'Content-Type': 'application/timestamp-query', 'Accept': 'text/plain'}
r = s.post(ts_server, verify='root-ca-in-chain', headers=headers, data=data)
print(r.content.decode('utf-8'))
My code with pyHanko:
tssigner = signers.SimpleSigner.load_pkcs12(pfx_file=ts_cert_path, passphrase=ts_cert_password, ca_chain_files={'root-ca-in-chain, 'intermediate-ca-in-chain'})
tsper = timestamps.HTTPTimeStamper(url=ts_server, https=True, auth=tssigner, headers=headers)
print(tsper.async_request_tsa_response())
Help me please! The TSA server don't add response (the certs in the p12 store use ECDSA, SHA384).
Upvotes: 0
Views: 182