timestamping_enricher.timestamping_enricher
===========================================

.. py:module:: timestamping_enricher.timestamping_enricher




Module Contents
---------------

.. py:class:: TimestampingEnricher

   Bases: :py:obj:`auto_archiver.core.Enricher`


   Uses several RFC3161 Time Stamp Authorities to generate a timestamp token that will be preserved. This can be used to prove that a certain file existed at a certain time, useful for legal purposes, for example, to prove that a certain file was not tampered with after a certain date.

   The information that gets timestamped is concatenation (via paragraphs) of the file hashes existing in the current archive. It will depend on which archivers and enrichers ran before this one. Inner media files (like thumbnails) are not included in the .txt file. It should run AFTER the hash_enricher.

   See https://gist.github.com/Manouchehri/fd754e402d98430243455713efada710 for list of timestamp authorities.


   .. py:attribute:: session
      :value: None



   .. py:method:: setup()


   .. py:method:: cleaup() -> None

      Terminates the underlying network session.



   .. py:method:: enrich(to_enrich: auto_archiver.core.Metadata) -> None

      Enriches a Metadata object with additional information or context.

      Takes the metadata object to enrich as an argument and modifies it in place, returning None.



   .. py:method:: save_timestamp_token(timestamp_token: bytes, tsa_url: str) -> str

      Takes a timestamp token, and saves it to a file with the TSA URL as part of the filename.



   .. py:method:: verify_signed(timestamp_response: rfc3161_client.TimeStampResponse, message: bytes) -> cryptography.x509.Certificate

      Verify a Signed Timestamp Response is trusted by a known Certificate Authority.

      :param timestamp_response: The signed timestamp response.
      :type timestamp_response: TimeStampResponse
      :param message: The message that was timestamped.
      :type message: bytes

      :returns: A valid root certificate that was used to sign the timestamp response, or None
      :rtype: x509.Certificate

      :raises ValueError: If no valid root certificate was found in the trusted root store.



   .. py:method:: sign_data(tsa_url: str, bytes_data: bytes) -> rfc3161_client.TimeStampResponse


   .. py:method:: tst_certs(tsp_response: rfc3161_client.TimeStampResponse)


   .. py:method:: save_certificate(tsp_response: rfc3161_client.TimeStampResponse, verified_root_cert: cryptography.x509.Certificate) -> list[auto_archiver.core.Media]


