The Key module helps improve Drupal security by managing sensitive keys. It allows administrators to define where and how keys, such as API or encryption keys, are stored, offering options from configuration files to external key management solutions. This helps sites meet compliance requirements by securely handling sensitive information.
Key provides the ability to improve Drupal security by managing sensitive keys (such as API and encryption keys). It gives site administrators the ability to define how and where keys are stored, which allows the option of a high level of security and allows sites to meet regulatory or compliance requirements.
Examples of the types of keys that could be managed with Key are:
- An API key for connecting to an external service, such as PayPal, MailChimp, Authorize.net, UPS, an SMTP mail server, or Amazon Web Services
- A key used for encrypting data using the encrypt module
Managing keys
Key provides an administration page where users with the "administer keys" permission can add, edit, and delete keys.
By using key, administrators can choose to store their keys in the following locations:
- Configuration (development only): The Configuration key provider stores the key in Drupal’s database
- File (Better): The File key provider allows a key to be stored in a file, preferably outside of the webroot where it cannot be publicly accessed.
- Environment (Better): The Environment key provider allows a key to be stored in an environmental variable.
- External (Best): Use a key management solution external to Drupal. This allows your site to meet security best practices and compliance requirements.
A full list of modules that extend Key for various storage methods can be found here .
Generating a Random Encryption Key
An easy way to generate a random encryption key in a Unix environment is to enter the following command (changing the path and file name to suit your needs):
dd if=/dev/urandom bs=32 count=1 > /path/to/secret.key
This will create a binary file with a random 256-bit key. For a 128-bit key, change the 32 to 16 in the command.
Overriding Configuration
The Drupal 8 version of Key provides the ability to override any configuration value with a key. This allows site administrators to store configuration values in a more secure method than in the database or in settings.php.
Key configuration overrides can be created at /admin/config/development/configuration/key-overrides/add.
- Enter a name for the override
- Select the specific configuration item you wish to override
- Select an existing key that provides the value to be used; if the key doesn't exist, you'll need to create it
- Check "Clear overridden value" to clear any existing value for the overridden configuration item; this is important to make sure potentially sensitive data is removed from the configuration; if for some reason, you don't want to clear the value, uncheck this field
- Click "Save"
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
94 tracked projects depend on this one
- Encrypt 36,301 sites
- AI (Artificial Intelligence) 16,423 sites
- Cloudflare Turnstile 7,261 sites
- Pantheon Secrets 5,058 sites
- amazee.ai Private AI Provider 4,933 sites
- JSON Web Token Authentication (JWT) 4,016 sites
- TMGMT DeepL Integration 3,981 sites
- Easy Encryption 3,750 sites
- Asymmetric (private/public) Keys 1,309 sites
- Gemini Provider 1,165 sites
- Apigee 742 sites
- Vault - AppRole Authentication 481 sites
- Loqate (Address Capture) 463 sites
- Azure Blob Storage File System 395 sites
- Backup and Migrate: AWS S3 353 sites
- LTI Tool Provider 352 sites
- Model Context Protocol 324 sites
- Deepseek Provider 207 sites
- Drupal WhatsApp 205 sites
- Stripe API 157 sites
- Cloudflare: Node Cache Clear 135 sites
- Flickr Integration Suite 126 sites
- ElevenLabs 121 sites
- Augmentor AI 100 sites
- Encrypt KMS 80 sites
- Google Vertex Provider 79 sites
- Address Static Map 75 sites
- AI Provider moonshot (Kimi) 52 sites
- Azure Storage 45 sites
- OpenAI Compatible Provider 44 sites
- Pantheon Content Publisher 43 sites
- DXPR AI Provider 40 sites
- Scribit Pro 39 sites
- Redsys payment module 39 sites
- Media Remote Social (oEmbed) 38 sites
- SQLite VDB Provider 37 sites
- Qdrant VDB Provider 36 sites
- X Ai Provider 28 sites
- AnythingLLM Provider 25 sites
- Acquia Key Provider 25 sites
- IP Info 24 sites
- Opigno mobile application endpoints 24 sites
- Acquia AI Provider 23 sites
- YandexGPT Provider 12 sites
- RAG (Retrieval-Augmented Generation) Search 11 sites
- Fuzzy Config Key Provider 10 sites
- Feeds FileMaker 10 sites
- Nasjonalt vitenarkiv (NVA) 10 sites
- GraphQL Vertex AI 9 sites
- Editoria11y SI (SiteImprove) 8 sites
- Vault - KV Key Provider 7 sites
- Metatag AI Generate 6 sites
- JWT Authentication 6 sites
- BankID 6 sites
- Kameleoon 5 sites
- PCO - Planning Center Online API 5 sites
- NoBotIQ Spam Protection 5 sites
- Cloudflare Purger 5 sites
- MCP Sentinel 5 sites
- Vault - Token Authentication 5 sites
- Cision Integration 4 sites
- Webform JIRA service desk integration 4 sites
- Instagram Feed Block 3 sites
- AI Provider zhipuai 3 sites
- Audit Chain 3 sites
- Vault KV Integration 3 sites
- Workers AI Provider 2 sites
- Social Summaries 2 sites
- Quant Cloud AI Provider 2 sites
- AIDmi - AI, describe my image! - CKEditor image plugin for Alt/Caption text generation 2 sites
- Greenhouse Job Board API 2 sites
- ATLS 2 sites
- Virtuous CRM 1 sites
- CDNetworks Purge 1 sites
- PillarShield 1 sites
- Comment Moderation AI 1 sites
- Hashicorp Vault Secrets Key Integration 1 sites
- Page Refresh Webhook
- FlowSpeech
- Webform Monday.com
- Apex AI Orchestration
- RaiseDonors
- Twenty CRM integration
- TMGMT ModernMT
- AI Provider Baidu
- AI Provider SiliconFlow
- DID Ai Provider
- API plugins
- GTFS 511
- AI Natural Language Test
- TMGMT Tolgee Translator
- Media accessibility enhancer
- Vault - AWS Dynamic Key Provider
- Vault - Transit Encryption
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 2.0.0-alpha1 | Pre-release | 9–11 | Mar 20, 2026 | ||
| 8.x-1.22 | Stable | 9–11 | Jan 20, 2026 | ||
| 8.x-1.21 | Stable | 9–11 | Dec 18, 2025 | ||
| 2.0.x-dev | Dev | 9–11 | May 29, 2025 | ||
| 8.x-1.20 | Stable | 8–11 | Apr 13, 2025 |