Jwt Certificate

Published
Length
3 min read

Luis Felipe Dias

All posts

A jwt certificate uses a public and private key pair to sign and check tokens. The issuer signs the token with a private key, and apps check it with the public certificate. Many teams set up this flow to manage user log in across services. Still, teams often grant broad roles inside these tokens to save time. When a token holds wide permissions, any user with that token can run risky commands. How a jwt certificate works in practice A JSON Web Token has three main parts. These parts are the h

Certificate-Based Authentication: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

A jwt certificate uses a public and private key pair to sign and check tokens. The issuer signs the token with a private key, and apps check it with the public certificate. Many teams set up this flow to manage user log in across services. Still, teams often grant broad roles inside these tokens to save time. When a token holds wide permissions, any user with that token can run risky commands.

How a jwt certificate works in practice

A JSON Web Token has three main parts. These parts are the header, the payload, and the signature. The header names the signing method and points to the right key. The payload holds user facts, like a role or an email, plus an expiration time. The signature proves that no one changed the payload in transit.

Instead of a shared secret password, teams use asymmetric keys for better safety. An identity server holds the private key and creates the signature. It then shares the public jwt certificate at a well-known web address. Downstream apps and databases fetch this public file to check incoming tokens. Because the public file cannot sign new tokens, sharing it across your team is safe.

When a user logs in, the identity server checks their password and issues a signed token. The user sends this token with each request to a backend service. The service reads the token header to find the key ID. It matches that ID to its cached public certificate and checks the signature. If the math matches and the time is valid, the request moves forward.

How to set up key rotation and trust

Keys should not last forever. A good setup swaps out signing keys on a set schedule. The identity server publishes a list of public certificates in a standard JSON format. Each entry in this list has a unique label and the public certificate data. When the server creates a new private key, it adds the new public certificate to the list.

During a rotation, the list holds both the old and new certificates for a short window. This lets apps check tokens signed just before the change without dropping active users. Once all old tokens expire, the server removes the old certificate from the list. Apps refresh their local copy of this list on a timer or when they see an unknown key label.

You must also check the claims inside the payload, not just the signature. Every app should check that the issuer name matches your identity server. It should also check that the audience field names that specific app. Skipping these checks lets a valid token from one app open doors in another app.

Certificate-Based Authentication: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native token checks leave open

Checking a jwt certificate proves who sent a request and that the token is real. It solves the problem of passing passwords between many backend services. It also stops attackers from forging their own role claims without the private key. For initial log in, public key cryptography is a strong foundation.

Yet token verification stops at the front door. A valid token tells a database or API who the user is, not what their next query will do. If an engineer logs in with an admin role token, they can run any command that role allows. They can drop a table or read raw card numbers and phone numbers.

Tokens also stay valid until their clock runs out. If a token lasts for an hour, a bad query can run at any second in that hour. Native certificate checks do not inspect individual SQL statements or CLI commands in flight. They also do not rewrite sensitive fields like national IDs or emails in query results.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

What is the difference between a shared secret and a jwt certificate?

A shared secret uses the same string to sign and check a token. Every service that checks tokens must store that secret, which increases risk if one service leaks it. A certificate setup keeps the private signing key in one place and shares only the public check key.

How often should teams rotate their signing certificates?

Most teams rotate their signing keys every thirty to ninety days using automated jobs. Automated rotation limits the blast radius if a private key ever leaks. Publishing keys through a standard discovery endpoint makes this swap smooth for checking apps.

Does a signed token hide sensitive data inside the payload?

No, a standard signed token only encodes the payload in plain text that anyone can read. The signature stops people from changing the data, not from reading it. Never put passwords, card numbers, or private keys inside a standard token payload.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.