AM
ES
Comenzar gratis
Menú
Tipos

Clave de Cliente

Par de claves para firmar tokens con clave pública en JWKS.

cryptography jwt jwks signing keys

Clave de Cliente

Una Clave de Cliente es un par criptográfico para firmar tokens. La clave pública se expone via JWKS; la privada nunca se expone.

Schema

interface ClientKey {
  kid: string; // Key ID used in JWT headers
  credential_id: string; // Client ID (cid...)
  jwk: object; // Public JWK
  public_key: string; // PEM public key
}

Propiedades

PropiedadTipoDescripción
kidstringKey ID
credential_idstringCliente dueño de la clave
jwkobjectJWK público
public_keystringClave pública PEM

JWKS

Claves públicas en /.well-known/jwks.json:

{
  "keys": [
    {
      "kty": "RSA",
      "use": "sig",
      "kid": "key_2kHfPZcN9xW4mE8RtY7vB",
      "alg": "RS256",
      "n": "0vx7agoebG...",
      "e": "AQAB"
    }
  ]
}

Rotación

Crear nueva claveFirmar con la nueva claveClave anterior en JWKSEliminar clave anterior

Buenas prácticas:

  • Rotar claves periódicamente
  • Mantener 2-4 claves activas durante transición
  • Claves antiguas siguen en JWKS

Ejemplo

{
  "kid": "key_2kHfPZcN9xW4mE8RtY7vB",
  "credential_id": "cid_1jGePYbM8wV3lD7QsX6uA",
  "jwk": { "kty": "RSA", "kid": "key_..." },
  "public_key": "-----BEGIN PUBLIC KEY-----..."
}

Relacionado