Keyboard shortcuts

Press โ† or โ†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sovereign, high-performance data protection

Key Rotation

Eviden KMS supports manual key rotation for all key types through the standard KMIP operations:

KMIP operationApplies toCLI command
Re-KeySymmetric keys, secret datackms sym keys re-key
Re-Key Key PairAsymmetric key pairs (RSA, EC, PQC, โ€ฆ)ckms {rsa,ec,pqc} keys re-key
ReCertifyX.509 certificatesckms certificates certify --certificate-id-to-re-certify

On every rotation the server:

  1. Generates a new cryptographic object (or new certificate) under a fresh UID.
  2. Sets a ReplacementObjectLink on the old object pointing to the new UID.
  3. Sets a ReplacedObjectLink on the new object pointing back to the old UID.
  4. Transitions the old key to Deactivated if it was Active (Deactivation Date = now; KMIP ยง4.57, transition 6 โ€” see below). A Deactivated or Compromised old key keeps its state and its Deactivation Date.
  5. Increments x-rotate-generation and records x-rotate-date on the new object.

Auto-rotation (scheduler-driven, policy-based) is covered separately in Auto-Rotation Policy. HSM key rotation is covered in HSM Key Rotation. Concurrent rotations of the same object, and the Conflict error the losing request receives, are explained in Concurrent Re-Key and Conflicts.

Key rotation: Re-Key, Re-Key Key Pair and ReCertify create a linked replacement


State restrictions

Only objects in the following states can be the source of a rotation:

StateRotation allowed?Rationale
Activeโœ…Primary valid source state.
Deactivatedโœ…KMIP ยง6.1.46 permits it; a replacement key should still be issued.
Compromisedโœ…Rotating a compromised key is the recommended incident response.
Pre-ActiveโŒKey material was never activated โ€” rotating unused material is premature.
DestroyedโŒObject no longer exists.
Destroyed_CompromisedโŒObject no longer exists.

Refusals for a source in another state are returned as Permission_Denied. The state is checked after the permission check.

This restriction applies to the source key only. Offset is an Interval in seconds. With an Offset, the new key's Activation Date is now + Offset and its Process Start, Protect Stop and Deactivation Dates are shifted by the same amount (when the old key has an Activation Date); the new key can then enter Pre-Active. Without an Offset, all four dates are copied from the old key. The Usage Limits Count is reset. The Revocation Reason, Destroy Date and Compromise Dates are not copied. The request Attributes are applied to the new key, except the attributes the server manages (identity, links, names, lifecycle dates, state, rotation metadata).


Old key Deactivated after rotation

Why deactivation is enforced

A key in the Deactivated state SHALL NOT be used for applying cryptographic protection (encryption, signing, wrapping, MACing, deriving). It MAY still be used to process already-protected data (decryption, signature verification, unwrapping). This asymmetry is the key principle behind post-rotation key handling:

  • Limit blast radius. If the old key material is compromised after rotation, no new data was ever encrypted with it โ€” the damage is bounded.
  • Enforce the cryptoperiod. NIST SP800-57-1 defines a cryptoperiod as the span during which a key is authorised to protect data. Key rotation ends that period; the Deactivated state makes the boundary enforceable by the server.
  • Preserve backward compatibility. Consumers holding ciphertexts produced before rotation must still be able to decrypt. Deactivated keeps the key accessible for decryption without allowing it to encrypt new data.

How KMIP ยง4.57 mandates it

KMIP ยง4.57 defines the State attribute and lists the only legal state transitions. Transition 6 governs Active โ†’ Deactivated and states that it SHALL occur in one of three ways:

  1. The object's Deactivation Date is reached.
  2. A client issues a Revoke operation with a non-Compromised reason.
  3. A client Modify Attribute sets the Deactivation Date to now or the past.

Re-Key / Re-Key Key Pair are not listed as a direct cause of transition 6. The spec mandates deactivation indirectly through path 1: the KMIP ยง4.33 Deactivation Date attribute rules list Re-key and Re-key Key Pair under "When implicitly set", meaning the server MUST set the Deactivation Date on the old key as part of the rotation operation. Because that date is set to now (or already passed), the condition "Deactivation Date is reached" immediately triggers transition 6.

In short: the spec does not have a direct Re-Key โ†’ Deactivated transition, but it mandates deactivation by requiring the server to set the Deactivation Date during Re-Key, which then fires transition 6 automatically.

Consequences

  • The old key can no longer be used for Encrypt or Sign operations (those require Active state).
  • The old key remains available for Decrypt and Verify (processing operations accept Active, Deactivated, and Compromised states per KMIP ยง3.31), so in-flight ciphertexts continue to decrypt.
  • Revoke on a Deactivated key succeeds only with a compromise reason (the key becomes Compromised); any other reason returns Wrong_Key_Lifecycle_State.
  • You can call Destroy on a Deactivated key directly โ€” no prior Revoke is required.

Keysets

A keyset is a named group of related key generations. Each generation is a distinct cryptographic key (different material, different UID) produced by successive Re-Key operations.

Creating a SQL key in a keyset

For SQL-backed keys the key's UID must equal the keyset name from the start. Supply both UniqueIdentifier and x-rotate-name in the same Create request:

# Create a key whose UID is the keyset name
ckms sym keys create --algorithm aes --number-of-bits 256 my-keyset
ckms sym keys set-rotation-policy --key-id my-keyset --rotation-name my-keyset

Attempting set-rotation-policy --rotation-name X on a SQL key whose UID is not X is rejected:

Invalid Request: SetAttribute: rotate_name ('X') must equal the key's UID โ€” create the key with the keyset name as its ID

SQL keyset UID scheme

UIDs are assigned deterministically at each generation:

my-keyset        โ† gen 0  (UID equals the keyset name)
my-keyset@1      โ† gen 1  (after first Re-Key)
my-keyset@2      โ† gen 2  (after second Re-Key)

The Re-Key response always returns the new key's real UID (e.g. my-keyset@1).

Addressing syntax

A keyset can be referenced by name wherever a UniqueIdentifier is accepted (Encrypt, Decrypt, Get, Re-Key, โ€ฆ):

SyntaxResolves to
my-keysetLatest generation (bare name = @latest)
my-keyset@latestLatest generation (explicit alias)
my-keyset@firstGeneration 0
my-keyset@0Generation 0 (numeric alias for @first)
my-keyset@NGeneration N

Encrypt / Sign always resolves to the latest generation.

Decrypt by a bare name walks the chain newest-to-oldest until one generation succeeds, allowing ciphertexts encrypted with an older (now Deactivated) key to continue to decrypt after rotation.

Signature Verify / MAC Verify by a bare name walks the chain newest-to-oldest until one generation answers Valid, so signatures and MACs made with an older generation still verify. When no generation verifies, the response is Invalid, not an error.

@latest is a virtual alias. It is never stored in the database and is never returned in a response. my-keyset (bare name) also resolves to the latest generation even though my-keyset is the literal UID of gen-0. To access gen-0 explicitly, use my-keyset@0 or my-keyset@first.

Bare-name decryption and wrong-key detection

The Decrypt chain walk relies on decryption failing with the wrong key. A Decrypt by a bare keyset name (SQL or HSM keyset) is therefore refused with Feature_Not_Supported when the mode used for a generation cannot detect a wrong key. The check runs for each generation tried, on its effective parameters: the request's cryptographic parameters when given, otherwise the parameters stored on that generation (SQL keys) or the default below (HSM keys).

Accepted for a bare keyset nameRefused for a bare keyset name
Block cipher modes GCM, GCM-SIV, CCM, AEAD; NIST key wrap (RFC 3394, RFC 5649)Every other block cipher mode (CBC, ECB, CTR, XTS, โ€ฆ); RSA PKCS#1 v1.5 padding

A bare HSM keyset name with no cryptographic parameters in the request decrypts with AES-GCM (AES keys) or RSA-OAEP with SHA-256 (RSA keys), even when the token does not support these mechanisms; it never falls back to AES-CBC or RSA PKCS#1 v1.5.

For a refused mode, address the generation explicitly (my-keyset@N). The reasoning is in HSM keysets explained.

Non-latest guard

Only the latest generation of a keyset can be rotated via Re-Key. Attempting to rotate a retired member is rejected:

Invalid Request: ReKey: key '<uid>' is not the latest in its keyset โ€”
only the latest generation can be rotated

Use my-keyset@0 (explicit generation) rather than my-keyset (bare name) to target an older generation โ€” and expect that call to fail.

Keyset internals (SQL)

Keyset state is stored as KMIP vendor attributes in the database:

AttributeTypeMeaning
x-rotate-namestringKeyset name; equals the key UID for gen-0.
x-rotate-generationi320 for gen-0, incremented on each Re-Key.
x-rotate-latestbooltrue on the current key; false on older keys.

KMIP link attributes mirror the chain for protocol compliance: ReplacementObjectLink (old โ†’ new) and ReplacedObjectLink (new โ†’ old). Keyset chain traversal for Decrypt / Verify uses x-rotate-generation (sorted descending), not the link back-pointers.


Rotation flows by key type

1. Plain symmetric key

A plain symmetric key carries only its own policy.

What happens:

  1. Fresh key material is generated (same algorithm and length).
  2. The new key gets a new UID (my-keyset@N for keyset keys, fresh UUID otherwise).
  3. ReplacedObjectLink on the new key โ†’ old key.
  4. ReplacementObjectLink on the old key โ†’ new key.
  5. Old key โ†’ Deactivated.

KMIP link chain after two rotations:

Rotated keys form a chain of replacement and replaced links

CLI:

# Manual rotation of a SQL keyset key
ckms sym keys re-key --key-id my-keyset
# Response: new UID = my-keyset@1

# Manual rotation of a plain UUID key
ckms sym keys re-key --key-id <KEY_UID>

2. Wrapping key

A wrapping key is referenced by one or more wrapped keys via a WrappingKeyLink attribute. Rotating a wrapping key re-wraps all its dependants atomically.

What happens:

  1. A new wrapping key is generated in memory; it is not yet visible to any client.
  2. Every key owned by the same user whose WrappingKeyLink points to the old wrapping key is fetched โ€” regardless of its state (Active, Deactivated, Pre-Active, Compromised, โ€ฆ) โ€” unwrapped in memory (plaintext never stored), and re-wrapped with the new wrapping key.
  3. Each wrapped key's WrappingKeyLink is updated to the new wrapping key UID.
  4. Standard rotation metadata is applied; old wrapping key โ†’ Deactivated.
  5. The new wrapping key, the retired old key and every re-wrapped dependant are committed in one atomic batch. If the old wrapping key changed since it was read, nothing is committed (see Concurrent Re-Key and Conflicts).

No state filter on dependants. The server queries all keys with a wrapping_key_id matching the rotated key, with no restriction on their lifecycle state. Only the owner check applies: dependants owned by a different user are skipped (with a warning logged).

Re-Key of a wrapping key: re-wrap every dependant in one atomic batch


3. Wrapped key

A wrapped key stores its key material encrypted under a wrapping key.

What happens:

  1. The wrapped key is exported and unwrapped in memory using the current wrapping key (plaintext never stored).
  2. Fresh plaintext key material is generated from the unwrapped attributes.
  3. The new material is re-wrapped with the same wrapping key.
  4. The new ciphertext is stored under a new UID with an active WrappingKeyLink.
  5. Standard rotation metadata is applied; old wrapped key โ†’ Deactivated.

Re-Key of a wrapped key: unwrap in memory, generate, re-wrap, store


4. Asymmetric key pair

Re-Key Key Pair targets the private key UID. The server resolves the associated public key via the PublicKeyLink attribute. The caller also needs the Rekey permission on that public key; otherwise the request fails with Object_Not_Found.

What happens:

  1. A new private key + public key pair is generated (same algorithm).
  2. Both receive new UIDs; the new private key carries a PublicKeyLink to the new public key.
  3. Standard ReplacementObjectLink / ReplacedObjectLink links are set on both pairs.
  4. An Active old private key and an Active old public key โ†’ Deactivated; keys in another state keep their state.

Re-Key Key Pair: new pair generated, old pair retired in one atomic batch

CLI:

# EC key pair
ckms ec keys re-key --key-id <PRIVATE_KEY_UID>

# RSA key pair
ckms rsa keys re-key --key-id <PRIVATE_KEY_UID>

# Post-quantum (ML-KEM, ML-DSA, SLH-DSA)
ckms pqc keys re-key --key-id <PRIVATE_KEY_UID>

5. Wrapped private key (Covercrypt)

A Covercrypt master private key follows the same Re-Key Key Pair flow. The wrapped key is unwrapped in memory, the Covercrypt partition attributes are re-keyed, and the new wrapped private key is stored under a fresh UID.

Setting a rotation policy on a wrapped private key always works: the x-rotate-* attributes are stored in the metadata column (not inside the ciphertext block) and do not require the key to be unwrapped first.


6. Certificate renewal (ReCertify)

Certificate renewal creates a new certificate for the same key pair โ€” no new key material is generated.

What happens:

  1. The existing certificate is retrieved and its issuer / subject are resolved.
  2. A new certificate is built and signed (same key pair, same issuer).
  3. The new certificate receives a fresh UID.
  4. ReplacedObjectLink on the new cert โ†’ old cert.
  5. ReplacementObjectLink on the old cert โ†’ new cert.
  6. All keys linked to the old certificate have their CertificateLink updated.
  7. x-rotate-generation and x-rotate-date are updated.

ReCertify: new certificate for the same key pair, old one retired atomically

Attribute changes (KMIP 2.1 ยง6.1.45):

AttributeNew certificateOld certificate
Unique IdentifierFresh UUIDUnchanged
Initial DateNowUnchanged
Link[ReplacedObjectLink]โ†’ old cert UIDโ€”
Link[ReplacementObjectLink]โ€”โ†’ new cert UID
Link[PublicKeyLink]Copied from oldUnchanged
Link[PrivateKeyLink]Copied from oldUnchanged
NameInherited from oldRemoved (per KMIP spec)
StateActive if its Activation Date โ‰ค now, else Pre-ActiveDeactivated (Deactivation Date = now) if it was Active, unchanged otherwise
x-rotate-generationold + 1Unchanged
x-rotate-dateNowUnchanged

CLI:

# Renew a CA-signed certificate (same key pair, new validity period)
ckms certificates certify \
    --certificate-id-to-re-certify <OLD_CERT_UID> \
    --issuer-private-key-id <ISSUER_SK_UID> \
    --days 365

# Self-signed certificate renewal
ckms certificates certify \
    --certificate-id-to-re-certify <OLD_CERT_UID> \
    --days 3650

Standards:

StandardRelevance
KMIP 2.1 ยง6.1.45Normative definition of ReCertify
RFC 4210 ยง5.3.5โ€“5.3.6CMP Key Update Request / Response (kur/kup) โ€” the wire-protocol equivalent
RFC 5280X.509v3 certificate structure and validity periods

7. KEK-protected key (server-wide key-encryption key)

When the KMS server is started with --key-encryption-key <KEK_UID>, every object stored in the database is transparently wrapped by the KEK. Rotation works identically to the wrapped-key flow above โ€” the server unwraps in memory, generates fresh material, re-wraps, and stores the result.

# Example server startup with SoftHSM2 KEK
cosmian_kms \
  --database-type sqlite \
  --hsm-model softhsm2 \
  --hsm-slot 0 \
  --hsm-password 12345678 \
  --key-encryption-key "hsm::softhsm2::0::my-kek"

No special handling is required for rotation policy โ€” SetAttribute on a KEK-wrapped key writes the x-rotate-* attributes to the metadata column, not into the ciphertext, so no unwrap is needed.


Rotation dispatch overview

Re-Key dispatch: object type selects the rotation flow, then metadata is updated


KMIP attribute changes on manual rotation

When the user explicitly calls Re-Key (e.g. ckms sym keys re-key), the following attributes are set on the old and new key:

AttributeOld keyNew key
Unique Identifierunchangedfresh UUID (or name@N for keyset keys)
StateDeactivated (ยง4.57) if it was Active, unchanged otherwiseActive (Pre-Active with an Offset in the future)
Link[ReplacementObjectLink]โ†’ new key UIDโ€”
Link[ReplacedObjectLink]โ€”โ†’ old key UID
Link[WrappingKeyLink]unchangedcopied from old key
x-rotate-generationunchangedold value + 1
x-rotate-dateunchangedtimestamp of rotation
x-rotate-intervalset to 0 (disabled)0 โ€” must be re-armed explicitly on the new key
x-rotate-nameunchangedinherited from old key
x-rotate-offsetunchangedNone (not inherited for manual rekey)
Nameremovedinherited from old key

Manual vs auto-rotation difference: x-rotate-interval is intentionally set to 0 (not inherited) on the new key after a manual rotation. This forces the operator to re-evaluate the rotation policy for the new key rather than blindly continuing the old schedule.

# After a manual re-key, re-arm the rotation policy on the new key:
ckms sym keys set-rotation-policy \
    --key-id  <NEW_KEY_UID> \
    --interval 3600 \
    --rotation-name "my-keyset"

Revoking superseded keys

After rotation the old key is Deactivated (not Destroyed). Its material persists so that in-flight Decrypt / Verify operations against old ciphertexts continue to work. Once all consumers have migrated, destroy the old key:

# Find the old key UID from the new key's ReplacedObjectLink attribute
ckms objects get-attributes --key-id <NEW_KEY_UID>

# Destroy the old key directly (Deactivated keys do not need a prior Revoke)
ckms sym keys destroy --key-id <OLD_KEY_UID>

If you need to place the old key into Compromised state (e.g. for audit records), call Revoke with a compromise reason. A Deactivated key accepts no other reason (Wrong_Key_Lifecycle_State):

# Symmetric key
ckms sym keys revoke -k <OLD_KEY_UID> --reason-code key-compromise "key was compromised"

# Asymmetric key pair (revokes both private and linked public key)
ckms ec keys revoke -k <OLD_KEY_UID> --reason-code key-compromise "key was compromised"

# Certificate
ckms certificates revoke -c <OLD_CERT_UID> --reason-code key-compromise "key was compromised"