libtea-rs 0.2: Verify TEA Artifact Signatures With Your Own Keys

Caller-key signature verification, PURL and PEP 440 rules, ECMA-428 lifecycle fixes and new install routes in the Rust TEA client.

TL;DR. libtea-rs, an independent Rust client for the CycloneDX Transparency Exchange API (TEA), shipped two library releases (0.1.9 and 0.2.0) and three CLI releases (0.2.0 to 0.2.2) in the two days after 0.1.8, between 20 and 21 November 2026. The headline change is that it can now verify a detached artifact signature, but only under public keys you supply. It also gained stricter Package URL handling, PEP 440 and vers:pypi support, lifecycle (CLE) evaluation that follows ECMA-428, and the libtea CLI on crates.io. Everything below was checked against libtea-rs main (commit f36ae0b, 21 November 2026), libraries 0.2.0 and CLI 0.2.2.

Key facts at a glance

  • Libraries: libtea-core and libtea-client 0.2.0, on crates.io. Minimum supported Rust version: 1.89.
  • CLI: libtea-cli 0.2.2 (binary name libtea), on crates.io since 0.2.0 and versioned separately from the libraries.
  • New: download --signature-key and exit status 8; the signature-keys feature with KeyVerifier; Purl::check_type; pep440; cle --scheme pypi.
  • Breaking: the Experimental SignatureVerifier trait changed in 0.2.0.
  • Still true: it is an independent consumer, not an official CycloneDX or Ecma project. It is not a TEA server and it publishes nothing.
  • TEA spec pin: one upstream commit (962a0228af1bfcc1232ac3f79239317ff33fdb04, OpenAPI 1.0.0). The specification itself is still labelled beta.
  • License: Apache-2.0.

A quick refresher: what is TEA, and what is libtea-rs?

The Transparency Exchange API is a protocol for finding and fetching software transparency artifacts, such as SBOMs, for a product release. A client starts from a Transparency Exchange Identifier (TEI), such as tei://example.com/uuid/d4d9f54a-abcf-11ee-ac79-1a52914d44b1, finds the server through https://example.com/.well-known/tea, and then walks products, releases, collections and artifacts.

libtea-rs implements the consumer side of that conversation in Rust. In its own words it resolves a TEI, fetches releases, collections and artifacts, checks the checksums a server declares, and can write a lock file so a CI job notices when what a server publishes has changed. If you want the full tour, part1 covers the architecture, the security model and the 0.1.8 CLI. This article covers what changed afterwards.

What changed between 0.1.8 and 0.2.2?

The project moved quickly. In date order:

  • 19 Nov: libraries and CLI 0.1.8 (the baseline for my earlier article).
  • 20 Nov, libraries 0.1.9: PEP 440 version parsing and ordering (libtea_core::pep440), vers:pypi range evaluation, and pypi rules in Purl::canonical.
  • 20 Nov, CLI 0.2.0: the first libtea-cli on crates.io. No command, flag, exit code or JSON shape changed. The conformance checks moved into the CLI, and the separate libtea-conformance crate was removed.
  • 20 Nov, CLI 0.2.1: cle --scheme pypi.
  • 21 Nov, libraries 0.2.0 and CLI 0.2.2: signature verification under caller-supplied keys, purl-spec type rules, ECMA-428 alignment for CLE, and exit status 8.

Two things from my earlier article are therefore out of date. The conformance suite is now libtea conformance inside the CLI rather than its own crate, and “no signature verification” is no longer the whole story. The rest of this post explains the second point, because it matters most.

Can libtea-rs verify the signature of a TEA artifact?

Yes, with one important condition: you decide which keys to trust. libtea-rs checks raw detached Ed25519 and ECDSA P-256 (SHA-256) signatures over the decoded artifact bytes, under public keys you pass in. It never fetches a key from the server that served the artifact, and it never trusts a key by default.

That design is deliberate. The project’s design notes make the point that verifying a signature with a key delivered by the same host that delivered the artifact would be misleading, because that host could ship both. So Verified only appears when a verifier you configured says so.

This is worth separating from what libtea-rs already did. Checksum verification answers “do these bytes match what the server declared?” Signature verification answers “was this signed by a key I chose to trust?” Only the second one speaks to the publisher.

Verifying a signature from the command line

Suppose you already trust a publisher’s Ed25519 public key. Pass it to download:

libtea download \
--base https://api.example.com \
--artifact 11111111-1111-4111-8111-111111111111 \
--revision 1 \
--media-type application/vnd.cyclonedx+json \
--output sbom.json \
--signature-key publisher-pub.pem \
--signature-output sbom.json.sig

--signature-key accepts a PEM or DER SubjectPublicKeyInfo, or a raw key, and can be repeated; one of the keys must verify. It implies --signature. --signature-output saves the signature bytes to a new file and refuses to overwrite an existing path or follow a symbolic link.

I ran this against a local mock TEA server that serves an artifact and a signature made with OpenSSL. With the right key:

integrity verified (decoded-byte checksums only; not publisher authenticity) strong_etag false bytes 74
signature present format unknown bytes 64
signature saved to got.sig
signature verified caller key ed25519 sha256:435fbc4076bc08ff460220e62463743dbcf1d4c9fae259f6c352f38625484477

With a different key, the command exits with the new status 8:

signature invalid caller keys (1): sha256:f3af93ce7282... the signature does not verify under any of the keys
Error: signature not verified: the signature is invalid; out.json was written (its checksums matched), do not use it

Read that last line twice. The checksum check passes first, so with --output the file is already on disk when the signature check fails. The command tells you not to use it, but your script has to honour exit 8 and delete or quarantine the file. Without --signature-key, the same flag only reports the signature’s apparent container format and prints signature not verified (no --signature-key given).

With --json, the signature member of the download output gains outcome, policy, detail, saved_to and a verified boolean. The policy string names the key that verified, by the SHA-256 of its SubjectPublicKeyInfo, which is the same value openssl pkey -pubin -outform DER | sha256sum prints. That makes a result auditable later.

Verifying a signature from Rust

In the library, signature verification sits behind a Cargo feature that is off by default:

[dependencies]
libtea-client = { version = "0.2.0", features = ["signature-keys"] }

The feature adds KeyVerifier, PublicKey, KeyAlgorithm and KeyError, built on ring, which is already in the dependency tree through rustls. The example below parses a key, verifies a file on disk, then shows what happens when one byte changes and when no keys are configured. It compiled against the published 0.2.0 crate.

use std::path::Path;
use libtea_client::signature::{
KeyVerifier, PublicKey, SignatureVerifier, SignedContent, VerifyRequest,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = std::env::args().skip(1);
let (key_path, artifact_path, sig_path) = (
args.next().ok_or("usage: verify_sig PUBKEY ARTIFACT SIGNATURE")?,
args.next().ok_or("missing ARTIFACT")?,
args.next().ok_or("missing SIGNATURE")?,
);
// You choose the keys. Nothing is fetched from the server that served the artifact.
let key = PublicKey::parse(&std::fs::read(&key_path)?)?;
println!("key {:?} {}", key.algorithm(), key.fingerprint());
let verifier = KeyVerifier::new(vec![key]);
let artifact = std::fs::read(&artifact_path)?;
let signature = std::fs::read(&sig_path)?;
// 1. The content as written to disk by a download.
let on_disk = VerifyRequest::new(SignedContent::File(Path::new(&artifact_path)), &signature);
let r = verifier.verify(&on_disk);
println!("file -> {} ({})", r.outcome.as_str(), r.policy);
// 2. The same bytes in memory, with one byte changed.
let mut tampered = artifact.clone();
tampered[0] ^= 1;
let r = verifier.verify(&VerifyRequest::new(SignedContent::Bytes(&tampered), &signature));
println!("tampered -> {} ({})", r.outcome.as_str(), r.policy);
// 3. No trusted keys configured: never "verified".
let r = KeyVerifier::new(vec![]).verify(&VerifyRequest::new(SignedContent::Bytes(&artifact), &signature));
println!("no keys -> {}", r.outcome.as_str());
Ok(())
}

Output, using an Ed25519 key and signature generated with OpenSSL:

key Ed25519 sha256:435fbc4076bc08ff460220e62463743dbcf1d4c9fae259f6c352f38625484477
file -> verified (caller key ed25519 sha256:435fbc4076bc08ff460220e62463743dbcf1d4c9fae259f6c352f38625484477)
tampered -> invalid (caller keys (1): sha256:435fbc4076bc08ff460220e62463743dbcf1d4c9fae259f6c352f38625484477)
no keys -> no_trust_anchor

Three details are worth knowing:

  • SignedContent::File lets you verify the file that download_format_to_file wrote, and SignedContent::Bytes verifies bytes already in memory. KeyVerifier reads a file whole, because Ed25519 and ECDSA need the whole message.
  • An empty key list yields NoTrustAnchor, never Verified.
  • The trait is yours to implement. SignatureVerifier::verify takes a VerifyRequest and returns a SignatureVerification, so you can plug in another scheme without changing the client.

If you used the SignatureVerifier trait in 0.1.x, note that the trait changed in 0.2.0. That is allowed by the project’s policy because the module is Experimental, but it will break your implementation.

What it does not verify

This is the part to read before you rely on it:

  • OpenPGP, CMS and Sigstore signatures are reported as Unsupported. The CLI can still tell you which container format a signature appears to use.
  • Only raw detached signatures over the decoded bytes are checked. Base64-encoded signatures are not.
  • No server has been tested publishing signatures. The compatibility notes state that download --signature-key is tested against OpenSSL-made fixtures and mock servers only, because neither public server the project has probed publishes artifact signatures.
  • Lock files record nothing about signatures.

Package URLs now follow the type definitions

A Package URL (PURL) names a package, for example pkg:npm/left-pad@1.3.0. Two spellings can name the same package, and until now libtea-rs compared them using only the rules that apply to every type.

Libraries 0.1.9 and 0.2.0 apply the purl-spec type definitions as data. In 0.2.0, Purl::canonical lowercases every component that a type definition marks case-insensitive, for 21 types (for example the namespace and name of github, deb and composer). In 0.1.9, pypi PURLs get PEP 503 name normalization. A new method, Purl::check_type, reports type-specific rule violations that Purl::parse deliberately does not enforce, such as a missing required namespace or qualifier.

Crucially, nothing is rewritten on the wire. Purl::as_str returns exactly what you wrote, and a PURL sent to a server is sent as given. Canonical forms are only for the question “do these two spellings name the same package?”

use libtea_client::core::{same_package_url, Purl};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Canonical comparison now applies type rules from the purl-spec definitions.
let pairs = [
("pkg:github/Package-url/purl-Spec", "pkg:github/package-url/purl-spec"),
("pkg:pypi/Zope.Interface@5.0", "pkg:pypi/zope-interface@5.0"),
("pkg:npm/Left-Pad@1.3.0", "pkg:npm/left-pad@1.3.0"), // no npm-specific rule: generic comparison only
];
for (a, b) in pairs {
let (a, b) = (Purl::parse(a)?, Purl::parse(b)?);
println!(
"{:<38} == {:<38} -> {} ({:?})",
a.as_str(),
b.as_str(),
same_package_url(&a, &b),
a.canonical().rules()
);
}
// Parsing never rewrites the text you gave it.
let p = Purl::parse("pkg:pypi/Zope.Interface@5.0")?;
println!("as written: {}", p.as_str());
// Parse is lenient; check_type reports type-specific rule violations.
for text in ["pkg:julia/Flux.jl@0.14.0", "pkg:maven/guava@33.0.0", "pkg:github/package-url/purl-spec"] {
match Purl::parse(text)?.check_type() {
Ok(()) => println!("{text}: ok"),
Err(e) => println!("{text}: {e}"),
}
}
Ok(())
}
pkg:github/Package-url/purl-Spec == pkg:github/package-url/purl-spec -> true (CaseInsensitive)
pkg:pypi/Zope.Interface@5.0 == pkg:pypi/zope-interface@5.0 -> true (Pypi)
pkg:npm/Left-Pad@1.3.0 == pkg:npm/left-pad@1.3.0 -> false (Generic)
as written: pkg:pypi/Zope.Interface@5.0
pkg:julia/Flux.jl@0.14.0: this Package URL type requires the qualifier `uuid`
pkg:maven/guava@33.0.0: this Package URL type requires a namespace
pkg:github/package-url/purl-spec: ok

The npm row stays false because the library applies only the generic rules to that type, so names that differ in case compare as different. These modules are Experimental, so the canonical text for 21 types changed in a minor release, and the project says to expect that.

Lifecycle (CLE) evaluation: ECMA-428 and PEP 440

Common Lifecycle Enumeration (CLE) data tells you when a version was released, when development or support ended, and what superseded it. libtea-rs retrieves it as the TEA projection and can evaluate it for a given version.

Three changes landed:

  1. PEP 440 support. Pep440Version parses and orders Python versions the way Python tooling does (1.0 == 1.0.0, and 1.0.dev1 < 1.0a1 < 1.0 < 1.0.post1). VersRange::contains_pypi evaluates vers:pypi ranges, and Cle::status_for_pypi evaluates a whole CLE document for a PEP 440 version.
  2. A CLI switch. libtea cle --scheme pypi --version 1.4.0 parses the version as PEP 440. semver stays the default, so existing commands behave as before.
  3. ECMA-428 corrections in 0.2.0. After the project checked its lifecycle code against the ECMA-428 text, a withdrawn event that is itself withdrawn no longer cancels anything, and a withdrawal that names an event not older than itself is reported as malformed. CLE vers ranges are now parsed as the standard’s Annex A.4 describes (whitespace removed, empty | segments ignored) through VersRange::parse_cle. The strict VersRange::parse is unchanged.

One design choice deserves attention: an event libtea-rs cannot compare is reported, never silently treated as “does not apply”. In the example below, the SemVer range on the end-of-life event cannot be evaluated for a PEP 440 version, so it shows up as unevaluated instead of producing a misleading “no end of life”.

use libtea_client::core::{Cle, Pep440Version};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// PEP 440 ordering, as Python tooling sees it.
let v = |s: &str| Pep440Version::parse(s);
println!("1.0 == 1.0.0 : {}", v("1.0")? == v("1.0.0")?);
println!("1.0.dev1 < 1.0a1 < 1.0 : {}", v("1.0.dev1")? < v("1.0a1")? && v("1.0a1")? < v("1.0")?);
println!("1.0 < 1.0.post1 : {}", v("1.0")? < v("1.0.post1")?);
// A CLE document, as a server would send it, evaluated for one version.
let cle: Cle = serde_json::from_str(
r#"{"events": [
{"id": 3, "type": "endOfLife", "effective": "2026-06-01T00:00:00Z",
"published": "2025-01-01T00:00:00Z", "versions": [{"range": "vers:semver/<2.0.0"}]},
{"id": 2, "type": "endOfSupport", "effective": "2025-06-01T00:00:00Z",
"published": "2025-01-01T00:00:00Z", "versions": [{"range": "vers:pypi/<2.0"}]},
{"id": 1, "type": "released", "effective": "2024-01-01T00:00:00Z",
"published": "2024-01-01T00:00:00Z", "version": "1.4"}
]}"#,
)?;
let status = cle.status_for_pypi(&v("1.4.0")?);
println!("released {:?}", status.released.as_ref().map(|t| t.as_str()));
println!("end_of_support {:?}", status.end_of_support.as_ref().map(|t| t.as_str()));
println!("end_of_life {:?}", status.end_of_life.as_ref().map(|t| t.as_str()));
// An event this scheme cannot compare is reported, never silently treated as "does not apply".
for u in &status.unevaluated {
println!("not evaluated: {u:?}");
}
Ok(())
}
1.0 == 1.0.0 : true
1.0.dev1 < 1.0a1 < 1.0 : true
1.0 < 1.0.post1 : true
released Some("2024-01-01T00:00:00Z")
end_of_support Some("2025-06-01T00:00:00Z")
end_of_life None
not evaluated: UnsupportedScheme { event_id: 3, scheme: "semver" }

This example also needs serde_json = "1" in your Cargo.toml, since the CLE document is deserialized from JSON the way a server would send it.

On real servers, the project’s own interoperability notes record a read-only run of the 0.1.8 inspect, search, discover --purl and cle commands against two public deployments, Vulnetix and the ReARM demo, on 20 November 2026. CLE queries passed on both. Vulnetix returned documents with released and supersededBy events, and cle --version was not run there because its versions are not SemVer. That evidence predates the PEP 440 and ECMA-428 changes, and the project says cle --scheme pypi is tested against mock servers only.

How do I install the libtea CLI now?

There are more routes than before, and they offer different assurances. Ordered from strongest verification to weakest:

  1. Release archive from GitHub. Archives exist for seven targets, alongside a SHA256SUMS file, a CycloneDX SBOM and a build-provenance attestation. Run the checksum and attestation checks in the project’s docs/installing.md before installing. This is the only route that ties the binary to the release workflow.
  2. cargo install libtea-cli --locked (CLI 0.2.0 and later, Rust 1.89 or newer). You compile the published source yourself. There is no SHA256SUMS and no attestation; Cargo’s checksum only shows that you received what crates.io serves.
  3. From a tag: cargo install --git https://github.com/Mehrn0ush/libtea-rs --tag v0.2.2 --locked libtea-cli. Same caveats as above.
  4. Homebrew. The docs describe brew install mehrn0ush/tap/libtea for 0.2.2 and later, with the formula’s SHA-256 values copied from a release whose SHA256SUMS passed attestation verification. Homebrew does not check the attestation itself, and the tap is updated by hand, so it can lag a release. I did not test the tap.
  5. cargo-binstall. The packaging metadata is merged on main, but it takes effect only from the first CLI release after 0.2.2. binstall does not check SHA256SUMS or the attestation either.

The libraries are a one-line change:

[dependencies]
libtea-client = "0.2.0"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

The GitHub Action takes version: "0.2.2" and should be pinned by commit SHA, as before. Its command input still lists sync, diff, discover, download, product-release, collections, parse-tei, spec and conformance; inspect, search and cle are not in that list.

What is still experimental or missing?

Being clear about maturity is part of this project’s character, so here is the honest summary:

  • Experimental, may change in a minor release before 0.9: signature verification (SignatureVerifier, KeyVerifier) and format detection, purl, vers, lifecycle, pep440, the lock file format and the response cache.
  • Not implemented: Sigstore, OpenPGP and CMS verification; HTTPS SVCB lookup; OAuth profiles beyond the API-key client_credentials baseline; a TEA publisher API; and a full ECMA-428 CLE document (CLE is fetched as the TEA projection).
  • Evidence limits: interoperability results cover a small number of named deployments. They are not a certification and not a statement about the TEA ecosystem. A server that works with libtea-rs is not, by that fact, a conforming TEA server.
  • Spec risk: the TEA specification is still beta, and libtea-rs follows one pinned commit instead of tracking upstream.

Frequently asked questions

What is libtea-rs?

libtea-rs is an independent set of Rust libraries (libtea-core, libtea-client) and a command-line tool (libtea) for consuming the CycloneDX Transparency Exchange API (TEA). It resolves a TEI, fetches product releases, collections and artifacts, and checks declared checksums. It is not an official CycloneDX or Ecma project and not a TEA server.

Can libtea-rs verify the signature of a TEA artifact?

Yes, since libraries 0.2.0 and CLI 0.2.2, but only under public keys you supply. It checks raw detached Ed25519 and ECDSA P-256 (SHA-256) signatures over the decoded artifact bytes. OpenPGP, CMS and Sigstore signatures are reported as unsupported. It never fetches or trusts a key from the server that served the artifact.

What is the difference between checksum verification and signature verification in libtea-rs?

A verified checksum means every checksum the server declared matched the decoded bytes. That shows integrity relative to what the server said, not who published the artifact. A verified signature means the signature is valid under a key you chose, which is the part that speaks to the publisher.

What does exit code 8 mean in the libtea CLI?

Exit code 8 means signature verification failed in libtea download --signature-key: the signature was invalid, in an unchecked format, or not published. If you used --output, the checksum-verified file has already been written, and the error message tells you not to use it.

How do I install the libtea CLI?

Run cargo install libtea-cli --locked (Rust 1.89 or later, CLI 0.2.0 and later), or download a release archive from GitHub and verify its SHA256SUMS and build-provenance attestation first. The crates.io route has no checksum file or attestation. The docs also describe a Homebrew tap, and cargo-binstall support that starts with the first CLI release after 0.2.2.

Which TEA specification version does libtea-rs support?

libtea-rs is written against one pinned upstream commit of the TEA specification (962a0228af1bfcc1232ac3f79239317ff33fdb04, OpenAPI 1.0.0). By default it accepts API version 1.0.0 only. The TEA specification itself is still labelled beta.

Is libtea-rs stable enough for production?

Treat it as experimental. The project says it is experimental until 0.9 and expects breaking changes before 1.0. Signature verification, PURL rules, PEP 440 and CLE evaluation are labelled Experimental, and download --signature-key is tested against fixtures and mock servers only.

Conclusion

The most useful sentence in this release is also the most restrictive one: libtea-rs verifies signatures only under keys you give it. That keeps Verified honest. If you consume TEA artifacts today, a reasonable next step is to keep using checksum verification and lock files for drift detection, and add --signature-key for any publisher whose key you already have a trustworthy way to obtain. Wire your scripts to treat exit 8 as a hard failure.

If you try it against a TEA server, the project asks for interoperability reports as GitHub issues: server name and version, date, repository commit and the commands you ran, without credentials.

Sources and further reading

libtea-rs is an independent project. It is not an official CycloneDX or Ecma project and is not affiliated with Vulnetix, ReARM or any other TEA server vendor mentioned here. Code examples compiled against the published libtea-client 0.2.0 crate and ran against a local mock server and OpenSSL-generated test keys, not against a live deployment.

Leave a Reply