duendesoftware/duende-skills/identityserver-key-management
Claude Code and agent skill by duendesoftware/duende-skills
- community
- ext:[{"type":"plugin","description":"Custom plugin integration"}]
Checking that the SKILL.md file is still in the repository.
Managing cryptographic signing keys in Duende IdentityServer, including automatic key management, KeyManagementOptions, data protection at rest, static key configuration, migration from static to automatic, and multi-instance deployment considerations, HSM/cloud KMS signing, key backup, and key-compromise response.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver-key-managementSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-key-management.
Key Management and Signing
When to Use This Skill
- Configuring automatic key management for signing token keys
- Setting up static/manual signing keys from certificates or key vaults
- Configuring key rotation intervals and key lifecycle
- Migrating from static keys to automatic key management
- Deploying IdentityServer in load-balanced or multi-instance environments
- Protecting keys at rest using data protection
- Configuring per-algorithm or per-resource signing
- Troubleshooting key-related errors (CryptographicException, unprotecting key failures)
- Integrating an HSM or cloud KMS (e.g. Azure Key Vault) for signing
- Backing up signing keys and responding to a suspected key compromise
Docs: https://docs.duendesoftware.com/identityserver/fundamentals/key-management/
Core Concepts
IdentityServer issues cryptographically signed tokens: identity tokens, JWT access tokens, and logout tokens. These signatures require key material that can be managed automatically or manually (statically).
Supported Signing Algorithms
IdentityServer supports the RS, PS, and ES families:
| Family | Algorithms | Key Type | |
|---|---|---|---|
| RS | RS256, RS384, RS512 | RSA | |
| PS | PS256, PS384, PS512 | RSA | |
| ES | ES256, ES384, ES512 | ECDSA |
Core Rotation Rule
Regardless of approach, safe rotation obeys one rule: publish a new public key in discovery (JWKS) BEFORE using it to sign tokens, and keep a RETIRED public key published until every token signed with it has expired. Automatic Key Management enforces this overlap for you (Announced → Signing → Retired phases). With static/manual keys you must perform the overlap yourself via phased rotation (see Manual Key Rotation).
Automatic Key Management (Recommended)
Automatic Key Management handles key creation, rotation, announcement, and retirement. It is enabled by default and is part of the Business and Enterprise editions (per the current licensing page: an add-on for the Standard edition, included in Advanced/Enterprise; the entry-level edition is now called Lite). In v8 a missing entitlement throws at startup.
Key Lifecycle
Keys move through four phases:
| Phase | Duration (default) | Purpose | |
|---|---|---|---|
| Announced | 14 days (PropagationTime) | Published in discovery, not yet signing | |
| Signing | 76 days (RotationInterval - PropagationTime) | Active signing credential | |
| Retired | 14 days (RetentionDuration) | In discovery for token validation only | |
| Deleted | After retention | Removed from discovery and optionally deleted |
Default schedule: Keys rotate every 90 days, announced 14 days early, retained 14 days after rotation.
Configuration
KeyManagement Options Reference
| Property | Default | Description | |
|---|---|---|---|
Enabled | true | Enable automatic key management | |
SigningAlgorithms | [RS256] | Algorithms for which keys are managed | |
RsaKeySize | 2048 | RSA key size in bits | |
RotationInterval | 90 days | Age at which keys stop signing | |
PropagationTime | 14 days | Time for new keys to propagate to all servers and clients | |
RetentionDuration | 14 days | Duration retired keys remain in discovery | |
DeleteRetiredKeys | true | Delete keys after retention period | |
KeyPath | {ContentRootPath}/keys | File system path for default key store | |
DataProtectKeys | true | Encrypt keys at rest using data protection | |
KeyCacheDuration | 24 hours | Cache duration for keys from store | |
InitializationDuration | 5 minutes | Synchronization window on first key creation | |
InitializationSynchronizationDelay | 5 seconds | Delay between retries during initialization |
Multiple Signing Algorithms
Configure multiple algorithms to serve clients with different requirements. The first algorithm in the list is the default for signing tokens.
Override the default on a per-client or per-resource basis:
Key Storage
Default: File System
The default FileSystemKeyStore writes keys to the KeyPath directory (defaults to {ContentRootPath}/keys). This directory must be:
- Excluded from source control
- Accessible (read/write) to all load-balanced instances if using file-based storage
EntityFramework Store
Use the EF operational store for database-backed key storage:
Duende Storage Store (preview)
AddStorage(...) + AddOperationalStorage() stores signing keys through the Duende Storage layer (ISigningKeyStore). See identityserver-duende-storage.
Custom Store
Implement ISigningKeyStore for custom storage (e.g., Azure Key Vault, AWS KMS):
The store interface methods:
LoadKeysAsync- load all keys (cached forKeyCacheDuration)StoreKeyAsync- persist a new keyDeleteKeyAsync- remove a retired key
HSM and Cloud KMS
IdentityServer has no built-in HSM/KMS provider. Options depend on how the key is exposed:
- HSM key exposed to .NET (
X509Certificate2/RSA/ECDsabacked by CNG/PKCS#11): register as a static credential withAddSigningCredential; signing happens inside the HSM, no private-key export. - Remote KMS signing via API: custom
CryptoProviderFactory+SignatureProviderattached to theSecurityKey(signing is synchronous, so async KMS calls block), or subclassDefaultTokenCreationServiceand overrideCreateJwtAsyncto call the KMS async signing API. - Custom `ISigningKeyStore` only changes where automatic key management stores its (exportable) keys, e.g. a vault. It is not a way to use non-exportable keys.
Async remote KMS signing (Azure Key Vault example)
All JWTs (access, identity, JWT introspection) go through ITokenCreationService.
Caveats: IdentityServer still needs a signing credential (algorithm for at_hash/c_hash, id_token_signing_alg_values_supported, JWKS publishing), so use AddSigningCredential, not only AddValidationKey. Rotation is your job: publish the new public key ahead of time with AddValidationKey, keep the old one until tokens expire. SAML signing does not use `ITokenCreationService`; it reads the credential directly and needs a private key, so this approach doesn't cover SAML. Each token costs a KMS network call (latency/rate limits/availability). v7 differences: IClock instead of TimeProvider, no CancellationToken on CreateJwtAsync, GetSigningCredentialsAsync takes only the algorithms.
Backing Up Signing Keys
With automatic key management, stored keys are encrypted with ASP.NET Core Data Protection by default, so a key-store backup is only usable together with the Data Protection keys: back up and restore both. The restored key ring is only readable with the same application name (SetApplicationName) and access to whatever protects it at rest (certificate / Key Vault). With static keys, back up the certificate and private key with the same protections.
Responding to a Key Compromise
Rotate immediately; don't wait for the schedule:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/identityserver-key-management/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 3
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
pluginCustom plugin integration
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/duendesoftware/duende-skills/identityserver-key-management)