Overview
The Keys client provides access to three types of keys:Signing Keys
Manage keys used to sign tokens (JWTs). Access viamanagementClient.Keys.Signing.
List Signing Keys
Retrieve all signing keys.Get Signing Key
Retrieve a specific signing key by ID.Rotate Signing Key
Rotate the signing key to a new key.Revoke Signing Key
Revoke a signing key to prevent its use.Custom Signing Keys
Manage custom keys for signing tokens. Access viamanagementClient.Keys.CustomSigning.
Create Custom Signing Key
List Custom Signing Keys
Get Custom Signing Key
Update Custom Signing Key
Delete Custom Signing Key
Encryption Keys
Manage keys used for encrypting sensitive data. Access viamanagementClient.Keys.Encryption.
List Encryption Keys
Get Encryption Key
Create Encryption Key
Delete Encryption Key
Key Properties
Keys typically have the following properties:- KID: Key identifier
- Algorithm: Cryptographic algorithm (RS256, RS384, HS256, etc.)
- Current: Whether this is the current active key
- Cert: PEM-encoded certificate (for public keys)
- Thumbprint: Certificate thumbprint
- CreatedAt: When the key was created
- RevokedAt: When the key was revoked (if applicable)
Complete Example
Here’s a complete example of managing signing keys:Key Rotation Best Practices
- Regular Rotation: Rotate signing keys periodically (e.g., every 90 days)
- Graceful Transition: Keep old keys active for a period to allow token validation during transition
- Monitor Usage: Track which keys are being used for signing and validation
- Revoke Old Keys: Revoke keys that are no longer needed
- Backup Keys: Store key information securely before rotation
Supported Algorithms
Common signing algorithms:- RS256: RSA with SHA-256 (recommended)
- RS384: RSA with SHA-384
- RS512: RSA with SHA-512
- HS256: HMAC with SHA-256
- HS384: HMAC with SHA-384
- HS512: HMAC with SHA-512
- ES256: ECDSA with SHA-256
- ES384: ECDSA with SHA-384
- ES512: ECDSA with SHA-512