Sub topic 6
Keyless signing: OIDC identity and short-lived certificates
This chapter assumes you can sign and verify an image with a Cosign key pair, and that you know what an image digest is. You should also know the basics of public-key cryptography. If any of that is unfamiliar, review the earlier chapters on digests and key-based signing first.
The problem keyless signing solves
A key pair has a cost. Someone must store the private key, protect it, rotate it, and revoke it if it leaks. Keyless signing removes the long-lived private key. Cosign creates a throwaway key pair for each signing operation. It then asks a certificate authority to bind the public key to your identity for a few minutes.
"Keyless" is a slight misnomer. Keys still exist, but they live only in memory and are discarded after signing.
The moving parts
Three components take part in a keyless signature:
- OIDC provider. OpenID Connect (OIDC) is a protocol for proving who you are. Providers include Google, GitHub, and Microsoft. The provider issues an ID token, which is a signed statement such as "this is [email protected]".
- Fulcio. This is the Sigstore certificate authority. It checks the ID token and issues an X.509 certificate that contains your identity and the ephemeral public key.
- Rekor. This is the transparency log. It records the signature and certificate so that anyone can later confirm that the signing happened.
The signing flow
- Cosign generates the ephemeral key pair.
- You authenticate with an OIDC provider. In a terminal, this opens a browser login. In CI, the platform supplies a token automatically.
- Cosign sends the ID token and the public key to Fulcio. It also proves it holds the private key by signing a value taken from the token.
- Fulcio returns a certificate that is valid for about ten minutes.
- Cosign signs the image digest and discards the private key.
- The signature and certificate are pushed to the registry, and an entry is written to Rekor.
Running it
# Keyless signing: opens an OIDC login in the browser, no key file needed
cosign sign "$IMAGE"Cosign shows a notice that the signing event will be recorded in a public transparency log, and asks you to confirm. In scripts, add --yes to skip the prompt.
The command signs $IMAGE, which should be a digest reference such as registry.example.com/team/app@sha256:<digest>. Signing a tag works, but Cosign warns you, because the tag can later point at different content.
Why a ten-minute certificate is enough
The certificate expires almost immediately, so a verifier cannot simply check the clock. Instead, the Rekor entry carries a timestamp from the log. Verification confirms that the signature was logged while the certificate was still valid. The signature therefore stays trustworthy after the certificate has expired.
This also explains the security model. There is no long-lived secret to steal. An attacker would need to control your OIDC identity at the moment of signing.
What you now trust
With key-based signing, trust rests on possession of a private key. With keyless signing, trust rests on an identity and on the parties that vouch for it: the OIDC provider and Fulcio. A valid signature only tells you that Fulcio certified some identity. It does not tell you that the identity is one you approve of. The next chapters cover checking identity and issuer on the verifier side.
Common errors
| Symptom | Likely cause |
|---|---|
| Browser login never completes | Headless or remote shell. Use the device flow or a CI-provided token. |
| `no matching signatures` on verify | You signed a different digest, or the signature is in another repository. |
| Signing fails in CI with a token error | The job lacks permission to request an OIDC token (`id-token: write` on GitHub Actions). |
| Private repositories expose names | The public Rekor log records identity and digest. Avoid keyless signing for secret artifacts, or run a private Sigstore instance. |
Exercise
A teammate says a keyless signature cannot be trusted a day later because the Fulcio certificate lasted only about ten minutes. What is wrong with that reasoning, and what does the verifier rely on instead?
Show answer
The verifier does not compare the certificate expiry with the current time. It uses the Rekor log entry, which has a trusted timestamp, to confirm that the signature was created while the certificate was valid. The signature therefore remains verifiable after the certificate expires.