Install & Compatibility
Where this runs
tested against v1.0.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 40.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.6s · import 0.000s · 41MB
39MB installed
● package 39MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TimeStampRequest
✓ from rfc3161_client import TimeStampRequest
✗ from rfc3161_client import TimestampRequest
TimeStampResponse
✓ from rfc3161_client import TimeStampResponse
Verifier
✓ from rfc3161_client import Verifier
This quickstart demonstrates how to request an RFC 3161 timestamp for a message hash and then verify the received response. It highlights the basic flow: hashing data, sending a `TimestampRequest`, and using a `VerifierBuilder` to confirm the authenticity and integrity of the timestamp.
import os
import hashlib
from rfc3161_client import TimestampRequest, VerifierBuilder, HashAlgorithm
from rfc3161_client.exceptions import TSAResponseError, TimestampVerificationError
# Use a public TSA URL. For production, ensure this is a trusted service.
# Example: http://timestamp.digicert.com or a URL from your trusted provider.
TSA_URL = os.environ.get('RFC3161_TSA_URL', 'http://timestamp.digicert.com')
# 1. Prepare data to be timestamped
message = b"This is the data to be timestamped."
message_hash = hashlib.sha256(message).digest()
print(f"Attempting to timestamp data using TSA: {TSA_URL}")
# 2. Request a timestamp from the TSA
try:
request = TimestampRequest(
tsa_url=TSA_URL,
hashed_message=message_hash,
hash_algorithm=HashAlgorithm.SHA256,
)
timestamp_response = request.get_timestamp_response()
print("Timestamp received successfully.")
# 3. Verify the timestamp response
# For robust verification, provide 'trusted_root_certs' of the TSA.
# If not provided, the verifier attempts to build a chain from certs
# embedded in the response or system CAs where possible (less secure).
verifier = VerifierBuilder().build()
is_valid = verifier.verify(
timestamp_response=timestamp_response,
hashed_message=message_hash,
hash_algorithm=HashAlgorithm.SHA256,
# trusted_root_certs=[b"-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"],
)
if is_valid:
print("Timestamp verification successful.")
else:
print("Timestamp verification FAILED.")
except TSAResponseError as e:
print(f"Error from TSA: {e}")
except TimestampVerificationError as e:
print(f"Timestamp verification error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
Upgrade
Version history
1.0.6latest on PyPI · released Apr 8, 2026
Audit
Dependencies
cryptographyrequiredProvides core cryptographic primitives for hash operations, certificate handling, and signature verification.