Key management secrets engine
Note: This secrets engine requires Vault Enterprise (1.6.0+) with the Advanced Data Protection KMSE Module.
The Key Management secrets engine provides a consistent workflow for distribution and lifecycle management of cryptographic keys in various key management service (KMS) providers. It allows organizations to maintain centralized control of their keys in Vault while still taking advantage of cryptographic capabilities native to the KMS providers.
The secrets engine generates and owns original copies of key material. When an operator decides to distribute and manage the lifecycle of a key in one of the supported KMS providers, a copy of the key material is distributed. This provides additional durability and disaster recovery means for the complete lifecycle of the key in the KMS provider.
Key material will always be securely transferred in accordance with the key import specification of the supported KMS providers.
Setup
Most secrets engines must be configured in advance before they can perform their functions. These steps are usually completed by an operator or configuration management tool.
Enable the Key Management secrets engine:
By default, the secrets engine will mount at the name of the engine. To enable the secrets engine at a different path, use the
-path
argument.
Usage
After the secrets engine is mounted and a user/machine has a Vault token with the proper permission, it can use this secrets engine to generate, distribute, and manage the lifecycle of cryptographic keys in supported KMS providers.
Create a named cryptographic key of a specified type:
Keys created by the secrets engine are considered general-purpose until they're distributed to a KMS provider.
Configure a KMS provider:
Conceptually, a KMS provider resource represents a destination for keys to be distributed to and subsequently managed in. It is configured using a generic set of parameters. The values supplied to the generic set of parameters will differ depending on the specified
provider
.This operation creates a KMS provider that represents a named Azure Key Vault instance. This is accomplished by specifying the
azurekeyvault
provider along with other provider-specific parameter values. For details on how to configure each supported KMS provider, see the KMS Providers section.Distribute a key to a KMS provider:
This operation distributes a copy of the named key to the KMS provider with a specific
purpose
andprotection
. Thepurpose
defines the set of cryptographic capabilities that the key will have in the KMS provider. Theprotection
defines where cryptographic operations are performed with the key in the KMS provider. See the API documentation for a list of supported purpose and protection values.Note: The amount of time it takes to distribute a key to a KMS provider is proportional to the number of versions that the key has. If a timeout occurs when distributing a key to a KMS provider, you may need to increase the VAULT_CLIENT_TIMEOUT.
Rotate a key:
Rotating a key creates a new key version that contains new key material. The key will be rotated in both Vault and the KMS provider that the key has been distributed to. The new key version will be enabled and set as the current version for cryptographic operations in the KMS provider.
Enable or disable key versions:
The
min_enabled_version
of a key can be updated in order to enable or disable sequences of key versions. All versions of the key less than themin_enabled_version
will be disabled for cryptographic operations in the KMS provider that the key has been distributed to. Setting amin_enabled_version
of0
means that all key versions will be enabled.Remove a key from a KMS provider:
This operation results in the key being deleted from the KMS provider. The key will still exist in the secrets engine and can be redistributed to a KMS provider at a later time.
To permanently delete the key from the secrets engine, the delete key API may be invoked.
Key types
The Key Management secrets engine supports generation of the following key types:
aes256-gcm96
- AES-GCM with a 256-bit AES key and a 96-bit nonce (symmetric)rsa-2048
- RSA with bit size of 2048 (asymmetric)rsa-3072
- RSA with bit size of 3072 (asymmetric)rsa-4096
- RSA with bit size of 4096 (asymmetric)ecdsa-p256
- ECDSA using the P-256 elliptic curve (asymmetric)ecdsa-p384
- ECDSA using the P-384 elliptic curve (asymmetric)ecdsa-p521
- ECDSA using the P-521 elliptic curve (asymmetric)
KMS providers
The Key Management secrets engine supports lifecycle management of keys in the following KMS providers:
Refer to the provider-specific documentation for details on how to properly configure each provider.
Compatibility
The following table defines which key types are compatible with each KMS provider.
Key Type | Azure Key Vault | AWS KMS | GCP Cloud KMS |
---|---|---|---|
aes256-gcm96 | No | Yes | Yes |
rsa-2048 | Yes | No | Yes |
rsa-3072 | Yes | No | Yes |
rsa-4096 | Yes | No | Yes |
ecdsa-p256 | No | No | Yes |
ecdsa-p384 | No | No | Yes |
ecdsa-p521 | No | No | No |
Tutorial
Refer to the Key Management Secrets Engine tutorial series to learn how to use the key management secrets engine for Azure and GCP.
API
The Key Management secrets engine has a full HTTP API. Please see the Key Management Secrets Engine API for more details.