Skip to main content

tsp-client is an implementation of the RFC 3161 TSP protocol in Python.

TSP is used for point-in-time attestation and non-repudiation as part of various electronic signature and code signing schemes, including eIDAS XAdES (tsp-client is used by SignXML to implement XAdES).

Installation

pip install tsp-client

Synopsis

from tsp_client import TSPSigner, TSPVerifier

# Sign a message online by transmitting its digest to the timestamp authority
message = b"abc"
signer = TSPSigner()
signed = signer.sign(message)  # Returns raw bytes of the verified timestamp token.

# Verify a presented timestamp token offline using the original message
verified = TSPVerifier().verify(signed, message=message)

# Or sign and verify using the message digest (digest algorithm may vary)
import hashlib

digest = hashlib.sha512(message).digest()

signer.sign(message_digest=digest)
verified = TSPVerifier().verify(signed, message_digest=digest)

print(verified.tst_info)  # Parsed TSTInfo (CMS SignedData) structure
print(verified.signed_attrs)  # Parsed CMS SignedAttributes structure

Specifying a custom TSA

To provide a timestamped signature with non-repudiation verifiable via a chain of trust, TSP requires the use of a TSA (time-stamp authority) server when generating timestamp tokens. TSA servers can be thought of as digital notaries. Verification of tokens can be done offline using your system’s certificate authority (CA) trust store.

By default, tsp-client uses the DigiCert TSA server when signing tokens. To use a different TSA, set the SigningSettings.tsp_server attribute as follows:

from tsp_client import TSPSigner, TSPVerifier, SigningSettings
signing_settings = SigningSettings(tsp_server="http://timestamp.identrust.com")
signer = TSPSigner()
signed = signer.sign(message, signing_settings=signing_settings)

There is currently no credible public TSA that offers HTTPS transport security and does not apply throttling. DigiCert provides a relatively high throughput public TSA endpoint, but your message digests and tokens will be transmitted unencrypted over the network. As an alternative, Sectigo offers an HTTPS TSA (https://timestamp.sectigo.com) but applies throttling so is only suitable for low throughput applications.

The European Union maintains a list of trusted TSAs as part of the eIDAS dashboard, however this list only serves as a root of trust and does not link directly to the TSA endpoints of listed providers.

Authors

  • Andrey Kislyuk

License

Copyright 2022-2023, Andrey Kislyuk and tsp-client contributors. Licensed under the terms of the Apache License, Version 2.0. Distribution of the LICENSE and NOTICE files with source copies of this package and derivative works is REQUIRED as specified by the Apache License.

Metadata

Release files for tsp-client 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsp-client 0.2.1
File Size Uploaded
tsp_client-0.2.1.tar.gz 17.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tsp-client 0.2.1
File Interpreter ABI Platform
tsp_client-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / tsp_client-0.2.1.tar.gz

Download URL tsp_client-0.2.1.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
415ff89aa15775533801bb18bd6b287f30a293d976b8fbb4d30f48873af41ba4
BLAKE2b-256 checksum
How to use checksums
a8da102a7b02b9fc3b1b1cd2cb407c7907c3c6757deecec8470d0594f32991ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.15

Release files / tsp_client-0.2.1-py3-none-any.whl

Download URL tsp_client-0.2.1-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db7f98e26ac370f5aab0055f74e7b3e4fd5245ef2f57cc56db3caa2694b82fd6
BLAKE2b-256 checksum
How to use checksums
fc7ab1fdeda5ab0a692bb362759229edc7ea8b9c3822e5b6a9029e8de76c2a4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.15

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page