一个用于验证 RFC3161 时间戳签名的库
Project description
libts
一个用于验证 RFC3161 时间戳签名的库
pip install libts
example
以下为示例代码
from libts import libts_ctx
ctx = libts_ctx()
ctx.load_system_ca()
code = ctx.ts_verify("example.txt", "example.txt.tsr")
print(ctx.format_return_code(code))
print(ctx.get_last_gentime_utc_formatted())
print(ctx.get_last_gentime_bj_formatted())
如果验证成功,则应该显示
> python test.py
验证成功
2025-07-08 11:50:24
2025-07-08 19:50:24
否则,会显示出详细错误信息,以下错误信息提示文件的哈希值和tsr中记录的哈希值不匹配
验证失败同样能获取时间戳,二者并不冲突
> python test-corrupted.py
验证失败 error:17800067:time stamp routines::message imprint mismatch
2025-07-08 11:50:24
2025-07-08 19:50:24
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
libts-0.0.2.tar.gz
(3.8 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
libts-0.0.2-py3-none-any.whl
(3.8 MB
view details)
File details
Details for the file libts-0.0.2.tar.gz.
File metadata
- Download URL: libts-0.0.2.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2620f588425287c853c2d8283099807d2229206624ccdec3716d19edd3f40c38
|
|
| MD5 |
768565f9e1a6a8c71f122393d45a23cc
|
|
| BLAKE2b-256 |
648474e0bbf81234d2eb2486f73988fe61895626de1eac8594b90a9cd5fc4e16
|
File details
Details for the file libts-0.0.2-py3-none-any.whl.
File metadata
- Download URL: libts-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18d462a967915c65fdb5cc781d8897951c03998567efd5330ffe0823af9b7579
|
|
| MD5 |
f7ff39a83b00e474abee461b32b62bca
|
|
| BLAKE2b-256 |
d0a5d397d6d97e9d6f25e9b9df30eb21aedf9e01196f1f1a2359596f581cd533
|