pyhanko.sign.timestamps.aiohttp_client module

class pyhanko.sign.timestamps.aiohttp_client.AIOHttpTimeStamper(url, session: Union[aiohttp.client.ClientSession, pyhanko_certvalidator.fetchers.aiohttp_fetchers.util.LazySession], https=False, timeout=5, headers=None, auth: Optional[aiohttp.helpers.BasicAuth] = None)

Bases: pyhanko.sign.timestamps.api.TimeStamper

async async_request_headers() dict

Format the HTTP request headers. Subclasses can override this to perform their own header generation logic.

Returns

Header dictionary.

async get_session() aiohttp.client.ClientSession
async async_timestamp(message_digest, md_algorithm) asn1crypto.cms.ContentInfo

Request a timestamp for the given message digest.

Parameters
  • message_digest – Message digest to which the timestamp will apply.

  • md_algorithm

    Message digest algorithm to use.

    Note

    As per RFC 8933, md_algorithm should also be the algorithm used to compute message_digest.

Returns

A timestamp token, encoded as an asn1crypto.cms.ContentInfo object.

Raises
  • IOError – Raised in case of an I/O issue in the communication with the timestamping server.

  • TimestampRequestError – Raised if the timestamp server did not return a success response, or if the server’s response is invalid.

async async_request_tsa_response(req: asn1crypto.tsp.TimeStampReq) asn1crypto.tsp.TimeStampResp

Submit the specified timestamp request to the server.

Parameters

req – Request body to submit.

Returns

A timestamp response from the server.

Raises

IOError – Raised in case of an I/O issue in the communication with the timestamping server.