rfc3161ng
A simple client library for cryptographic timestamping service implementing the protocol from RFC3161.
This started as a fork of https://dev.entrouvert.org/projects/python-rfc3161 and has some additional patches such as Python3 support.
The latest version of this library is available from https://github.com/trbs/rfc3161ng/ .
Public providers
There are several timestamping services around. Here is a list of publicly available services you can try:
Example
>>> import rfc3161ng
>>> certificate = open('data/certum_certificate.crt', 'rb').read()
>>> rt = rfc3161ng.RemoteTimestamper('http://time.certum.pl', certificate=certificate)
>>> tst = rt.timestamp(data=b'John Doe')
>>> rt.check(tst, data=b'John Doe')
True
>>> rfc3161ng.get_timestamp(tst)
datetime.datetime(2017, 8, 31, 15, 42, 58, tzinfo=tzutc())
Example for a server that insist on SHA256:
>> import rfc3161ng >> timestamper = rfc3161ng.RemoteTimestamper(’https://interop.redwax.eu/test/timestamp’, hashname=’sha256’) >> tsr = timestamper(data=b’The RedWax Project’, return_tsr=True) >> print(‘{}’.format(tsr))
Verifying timestamp using OpenSSL
One can verify the timestamp returned by the timeserver by using OpenSSL. For example with:
$ openssl ts -verify -data data_file.txt -in data_file.tsr -CAfile cacert.pem -untrusted tsa.crt
To save the tsr you can use code similar to:
>>> from pyasn1.codec.der import encoder
>>> import rfc3161ng
>>> ...
>>> timestamper = rfc3161ng.RemoteTimestamper('http://freetsa.org/tsr', certificate=certificate_data)
>>> tsr = timestamper(data=data_file.read(), return_tsr=True)
>>> with open("data_file.tsr", "wb") as f:
>>> f.write(encoder.encode(tsr))
Alternatively you can just save the raw response.content returned from the certification server.
There is a test which also covers this in test_verify_timestamp_response_with_openssl.
Metadata
Release files for rfc3161ng 2.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rfc3161ng-2.1.3.tar.gz | 22.4 kB | Without provenance | Details for rfc3161ng-2.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rfc3161ng-2.1.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for rfc3161ng-2.1.3-py2.py3-none-any.whl |
Total release size: 32.4 kB
Release files / rfc3161ng-2.1.3.tar.gz
| Download URL | rfc3161ng-2.1.3.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e88614da61b22abd591577f9dd39d3a030335f9e8a12d8bc001149c17d0a01e
|
|
BLAKE2b-256 checksum How to use checksums |
87ab7b1cc11019fb63d9420093ed9ff339ea544d0158141ac0daf33961a200cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.6
|
Release files / rfc3161ng-2.1.3-py2.py3-none-any.whl
| Download URL | rfc3161ng-2.1.3-py2.py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
81fe7e4488f523c758b1206bf5e72ba2066b78f2812107b1b7bb16a7596e524b
|
|
BLAKE2b-256 checksum How to use checksums |
6c66cf13725b4ad06527ca482c99202a683ca3b35586eec9bad5f9e19efb43b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.6
|
Security for rfc3161ng 2.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.