Rekor Verifier
Command-line tool that verifies entries and state of the Sigstore Rekor public transparency log (https://rekor.sigstore.dev). Built for NYU CS-GY 9223, Software Supply Chain Security.
Functionality
| Operation | Description |
|---|---|
| Checkpoint retrieval | Fetches the latest signed tree head (tree ID, tree size, root hash) from Rekor. |
| Inclusion verification | Given a log index and an artifact file: pulls the entry, extracts the signing certificate and signature, verifies the artifact signature (ECDSA / SHA-256), then verifies the entry's Merkle inclusion proof against the log root. |
| Consistency verification | Given a previously saved checkpoint, fetches the latest checkpoint and a consistency proof from Rekor, then verifies the old tree is a prefix of the new tree (RFC 6962). |
Requirements
- Python >= 3.11
- Network access to
rekor.sigstore.dev - Dependencies:
requests,cryptography
Installation
With Poetry (recommended; package-mode = false, dependencies only):
poetry install
poetry run python main.py --help
With pip:
python3 -m venv .venv
source .venv/bin/activate
pip install requests cryptography
Usage
python3 main.py [-d] [-c] [--inclusion LOG_INDEX --artifact PATH]
[--consistency --tree-id ID --tree-size N --root-hash HEX]
| Flag | Purpose |
|---|---|
-d, --debug |
Verbose output. Also writes the latest checkpoint to checkpoint.json. |
-c, --checkpoint |
Print the latest checkpoint as JSON. |
--inclusion LOG_INDEX |
Verify inclusion of the entry at LOG_INDEX. Requires --artifact. |
--artifact PATH |
Artifact file whose signature is verified against the entry. |
--consistency |
Verify a previous checkpoint against the latest one. Requires the three flags below. |
--tree-id ID |
Tree ID of the previous checkpoint. |
--tree-size N |
Tree size of the previous checkpoint. |
--root-hash HEX |
Root hash of the previous checkpoint, hex encoded. |
Examples
Get the latest checkpoint:
python3 main.py -c
Verify inclusion of an entry for the bundled sample artifact:
python3 main.py --inclusion 3256683300 --artifact artifact.md
Expected final line on success:
Successfully verified inclusion of log index 3256683300 for artifact 'artifact.md'.
Verify consistency of an older checkpoint with the current log:
python3 main.py --consistency \
--tree-id 1193050959916656506 \
--tree-size 3179970807 \
--root-hash 7d11ecb2538fcb98aae1405d31a2df1416e89a5f96045ba2feb05057067eea8f
Expected final line on success:
Consistency verification successful.
Typical workflow: run -c, save treeID, treeSize, rootHash, later run --consistency with those values.
Project Layout
.
├── main.py CLI, Rekor API calls, inclusion and consistency orchestration
├── merkle_proof.py RFC 6962 hashing, inclusion proof and consistency proof verification
├── util.py Certificate public key extraction, artifact signature verification
├── artifact.md Sample signed artifact
├── artifact_sigstore.json Sigstore bundle for the sample artifact (certificate, tlog entry, timestamp)
└── pyproject.toml Dependencies and tool configuration
How Verification Works
Inclusion
- Fetch the entry via
GET /api/v1/log/entries?logIndex=N. - Decode the base64
body; read the signature and the PEM certificate fromspec.signature. - Extract the public key from the certificate and verify the signature over the artifact bytes (ECDSA, SHA-256).
- Compute the leaf hash:
SHA256(0x00 || decoded body). - Recompute the root from the leaf hash and
inclusionProof.hashes, compare withinclusionProof.rootHash.
Consistency
- Validate the supplied checkpoint (
size >= 1, latest size >= supplied size, tree IDs match). - Fetch the proof via
GET /api/v1/log/proof?firstSize=..&lastSize=..&treeID=..(skipped when sizes are equal). - Recompute both the old and new roots from the proof and compare with the supplied and latest root hashes.
Development
Install dev tools:
poetry install --with dev
Tooling configured in pyproject.toml (line length 88):
poetry run black . # format
poetry run flake8 # lint
poetry run mypy # type check (main.py, merkle_proof.py, util.py)
poetry run bandit -c pyproject.toml -r . # security scan
Module responsibilities:
- Hashing and proof math belong in
merkle_proof.py. Keep it free of network and file I/O. - Key and signature handling belong in
util.py. - Network access and CLI wiring belong in
main.py.
Metadata
Release files for rekor_monitor_nmt8347 0.1.0
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 |
|---|---|---|---|---|
| rekor_monitor_nmt8347-0.1.0.tar.gz | 11.4 kB | Without provenance | Details for rekor_monitor_nmt8347-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rekor_monitor_nmt8347-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for rekor_monitor_nmt8347-0.1.0-py3-none-any.whl |
Total release size: 24.4 kB
Release files / rekor_monitor_nmt8347-0.1.0.tar.gz
| Download URL | rekor_monitor_nmt8347-0.1.0.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c71ddcfa8effce5f6449761040799250922ed8956e20be486c21c53aea60003a
|
|
BLAKE2b-256 checksum How to use checksums |
bbb22cc1271afe4da0f4e6f17df2d651dbcbbc7144f0f4fd6d2db634d94b8e48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.2 Darwin/27.2.0
|
Release files / rekor_monitor_nmt8347-0.1.0-py3-none-any.whl
| Download URL | rekor_monitor_nmt8347-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f710d6c901ec27caa198ba6438d4ae4d068913354549bf4d4b267f363952dc8
|
|
BLAKE2b-256 checksum How to use checksums |
0a213b98f5739c3b49e51f9adcd83f7f4bca9597e83e3faf3ee8deb956c3e015
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.2 Darwin/27.2.0
|
Security for rekor_monitor_nmt8347 0.1.0
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.