Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Trash 3.0.33 Minor update available for module trash (3.0.33). EOL Warning: Drupal 11.0 has reached end of life and no longer receives security updates. EOL Warning: Drupal 10.3 has reached end of life and no longer receives security updates. Release: UI Patterns (SDC in Drupal UI) 2.0.20 Minor update available for module ui_patterns (2.0.20). Release: Trash 3.1.0-rc1 First release candidate for module trash (3.1.0-rc1). Release: Country 2.2.0 Minor update available for module country (2.2.0). Usage Milestone: jQuery UI Datepicker Module jquery_ui_datepicker crossed 1,000 active installs. Release: Scheduler Content Moderation Defaults 1.1.2 Minor update available for module scheduler_content_moderation_defaults (1.1.2). Release: Flags 2.1.0 Minor update available for module flags (2.1.0). Release: Login Disable 2.2.0 Minor update available for module login_disable (2.2.0).

Key

79,005 sites Security covered Drupal 9–11 KEY ecosystem
View on drupal.org

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"

Drupal 7 Documentation

Drupal 8 Documentation

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

94 tracked projects depend on this one

Activity

Tracked releases
5
Tracked since
Apr 2025
Latest release
5 months ago
Releases (12 mo)
3 ▲ from 2
Maintenance
Active

Release Timeline

Releases

Version Type Core 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