Skip to content

Verifying the Image

Sam Bent edited this page Dec 3, 2026 · 23 revisions

Verifying the Image

You're about to run software that protects where you are. You shouldn't have to trust that the image on the registry is really the one built from the public source. This page shows how to check.

There are two independent things you can verify: that the image was signed by the maintainer, and that it was built from the public source and nothing else.

Where to get it

The image is published to two registries:

docker pull sambent.dev/sam/hiddenforge:3.0.2   # the maintainer's own registry
docker pull doingfedtime/hiddenforge:3.0.2      # Docker Hub

Both serve the identical index (sha256:075ec87627abb1ad938b145741e0e77953cebf27a9a228fc8ac9a442067871ec for 3.0.2, covering linux/amd64 and linux/arm64), and the signature below verifies either one. If they ever disagree, that is exactly the kind of thing this page exists to catch: stop and ask.

The digest, not the tag, is what the signatures are over. Check which digest you received:

skopeo inspect --raw docker://sambent.dev/sam/hiddenforge:3.0.2 | sha256sum
# or
docker buildx imagetools inspect sambent.dev/sam/hiddenforge:3.0.2 | head -3

It must equal the contents of signatures/hiddenforge.digest on master in the code repository (sha256sum prints the bare hex; the file has a sha256: prefix).

1. Check the signatures

The release digest is signed with ML-DSA-87 and ML-DSA-65 (3.0.2 carries both; later releases carry ML-DSA-87 only), and a release may also carry a hardware-key (SSH-FIDO2) signature. Neither depends on an outside transparency log or third-party service. The verification material lives in the signatures/ folder of the code repository.

The one-command check

The hiddenforge CLI (scripts/hiddenforge in the repository, Python 3.10 or later) does the digest check and the signature checks together. Run it from the root of a clone of the repository, where it reads signatures/, or point it there with --sigdir:

git clone https://sambent.dev/sam/HiddenForge.git && cd HiddenForge
scripts/hiddenforge verify-image sambent.dev/sam/hiddenforge:3.0.2 --allow-pq-only --json

It reads the registry digest with skopeo, so install that first; without it the check fails with "could not resolve registry digest". --skip-registry checks the signatures alone.

If you pin the image by digest (sambent.dev/sam/hiddenforge@sha256:...), the CLI compares that digest with the signed digest on every run, including with --skip-registry, and refuses a reference pinned to any other digest. Before 3.0.0, --skip-registry ignored the digest after the @ and answered ok.

Verify from master, not from the tag. signatures/ on master holds the latest release's signatures. A release's signatures are committed after its tag (the digest depends on the tagged commit), so a checkout of a tag carries the release before it: v3.0.2 still holds the 3.0.1 signature files, which do not match the 3.0.2 digest. That mismatch means "look on master", not "tampered with". To verify an older release, check out the commit that added its signatures (git log -- signatures/hiddenforge.digest), not its tag.

It verifies against release keys pinned inside the CLI, never against keys it finds in the signatures/ folder, and it fails (exit 1) if either half of the signature cannot be checked, unless you accept that explicitly: --allow-classical-only when the post-quantum half is missing, --allow-pq-only when the hardware half is. Either way the result says complete: false. A signature that is present but wrong is never excused. From 3.0.2 the CLI also checks every ML-DSA signature in the set and requires the ML-DSA-87 one for any release after 3.0.1; ML-DSA-65 alone is accepted only for the releases made before that change, so removing the ML-DSA-87 files from a newer release is a failure.

3.0.2 has no hardware signature. It is signed with ML-DSA-87 and ML-DSA-65; 3.0.0, 3.0.1 and 2.1.0 to 2.1.6 were released with ML-DSA-65 only. There is no hiddenforge.digest.sig for any of them, so verify with --allow-pq-only (the result says complete: false) and use the ML-DSA checks below. A hardware signature may be added later over the same digest, which would not need a new image. The signing key is a file on the maintainer's workstation, so for these releases the reproducible build below is the second check: do not rely on the signature alone. Releases after 3.0.2 will be signed with ML-DSA-87 only, and verifying them needs the 3.0.2 CLI or later.

Check the keys first

A signature file verifies against whatever public key sits beside it. Someone able to replace the signatures could replace the keys next to them too, so the keys are the trust anchor. Before trusting the manual commands below, confirm the key files match these values (the same ones pinned in the CLI and printed in the README):

ssh-keygen -lf allowed-signers   # SHA256:YcUo1tBtj+Mlnpv9QpsWnJcMt77B4SipyD6OWSMjMB4
                                 # SHA256:wL6piZbyXpTOzT7Z66f/Q+vegj0Ml0ZwVouGJ06+3Q0
sha256sum sambent-mldsa87.pub    # cae6ae3e2c3e760b7a1cb9ef067ddb62c52c6be80b5154dc71f5410bd4e419f0
sha256sum sambent-mldsa.pub      # 4ae873ade7ee596c815f55f3052c0f01020b1817f86eaf15ab67c8fc77cbfd22

Compare them against a copy you got some other way (an earlier download, a trusted contact) rather than only against this page.

Post-quantum signatures (ML-DSA-87 and ML-DSA-65)

ML-DSA is the post-quantum signature standardized in FIPS 204. Stock OpenSSL 3.5 or later verifies it; older OpenSSL has no ML-DSA. The key and signature files carry a 16-byte header in front of the standard encoding, which the first two lines of each check strip. Run both inside signatures/:

# ML-DSA-87 with stock OpenSSL 3.5 or later
tail -c +17 sambent-mldsa87.pub > /tmp/mldsa87.key
tail -c +17 hiddenforge.digest.mldsa87 > /tmp/mldsa87.sig
{ printf '\060\202\012\062\060\013\006\011\140\206\110\001\145\003\004\003\023\003\202\012\041\000'
  cat /tmp/mldsa87.key; } > /tmp/mldsa87.der
openssl pkeyutl -verify -pubin -keyform DER -inkey /tmp/mldsa87.der \
  -in hiddenforge.digest -sigfile /tmp/mldsa87.sig

# ML-DSA-65 with stock OpenSSL 3.5 or later (strip pqsign's 16-byte headers,
# wrap the raw key as a SubjectPublicKeyInfo, verify)
tail -c +17 sambent-mldsa.pub > /tmp/mldsa.key
tail -c +17 hiddenforge.digest.mldsa > /tmp/mldsa.sig
{ printf '\060\202\007\262\060\013\006\011\140\206\110\001\145\003\004\003\022\003\202\007\241\000'
  cat /tmp/mldsa.key; } > /tmp/mldsa.der
openssl pkeyutl -verify -pubin -keyform DER -inkey /tmp/mldsa.der \
  -in hiddenforge.digest -sigfile /tmp/mldsa.sig

Each prints Signature Verified Successfully. For 3.0.2 both must pass. pqsign is the tool the signatures are made with; you do not need it. The CLI uses it only if it is installed and OpenSSL cannot do the key's level.

If your OpenSSL is older than 3.5

On an older OpenSSL (Ubuntu 24.04 ships 3.0) the registry digest still matches the signed digest, but the ML-DSA signatures are not checked, so verify-image prints NOT VERIFIED, says why and exits 1. That is not a verified image. A throwaway container with OpenSSL 3.5 can do the check. It has no network, writes nothing to the clone, and compares the digest in the image reference with the signed one (the registry is not asked, so the result is complete: false; pull image@digest on the host first). Run it from the root of the clone:

docker run --rm --network none -v "$PWD":/hf:ro -w /hf dhi.io/python:3.12-alpine3.23-dev \
  python3 scripts/hiddenforge verify-image \
  "sambent.dev/sam/hiddenforge@$(cat signatures/hiddenforge.digest)" --skip-registry --allow-pq-only

Any image with Python 3.10 or later and OpenSSL 3.5 or later works in place of that one. This one is Docker Hardened Images' Python image, so run docker login dhi.io first.

Hardware key (YubiKey / SSH-FIDO2)

This signature is made by a physical security key, so it can't be produced by software alone, not even by someone who has stolen the maintainer's disk. 3.0.2 does not carry one (hiddenforge.digest.sig is not published for it; see the note above). When a release does, check it with:

ssh-keygen -Y verify \
  -f allowed-signers \
  -I sam@sambent.com \
  -n file \
  -s hiddenforge.digest.sig \
  < hiddenforge.digest

When both are present they sign the same image digest and cover different kinds of risk: a future quantum attack, and impersonation without the hardware token.

A note on cosign, and on the signing key

Releases up to 2.0.3 additionally carried a cosign signature. From 2.0.4 cosign is no longer used: it was the last part of the process that depended on external tooling, and the ML-DSA signature, with the hardware signature when a release has one, is the attestation. cosign.pub is kept in the repository so the older releases remain verifiable.

Also from 2.0.4, the maintainer signs with a single per-identity key rather than a per-project one. allowed-signers retains every key that has ever signed a release, so earlier releases still verify. If you verified an earlier release, you are accepting a new key. Check why before you do: a signing key that changes without explanation is what a compromise looks like.

2. Reproduce the build yourself

Signatures tell you who signed the image. A reproducible build tells you what is in it: that it was built from the public source and nothing else was added to it. Build the release tag from a fresh clone, with no network in any build step, from the release's published input archive (a generic package hiddenforge-inputs on sambent.dev, fetched and verified with scripts/build_inputs.py), and you get the same two-platform index digest as signatures/hiddenforge.digest.

The full procedure, the flags that make it work and the reasons a fresh clone is required are on Reproducing the Build.

Reproducibility applies from 2.0.4 onward. The 2.x tags no longer rebuild: they pinned exact Alpine package versions, and Alpine has pruned them (v2.0.4 and v2.1.6 fail at apk add); their signatures still verify. 3.0 builds from an input archive that the repository's build-inputs.sha256 locks, kept for each 3.x release.

If a check fails

If a signature doesn't verify, or a rebuild doesn't match the documented digest, do not run the image. Stop and ask on the project's channels. A failed check is exactly the signal this is here to give you.

Clone this wiki locally