Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

KEK Size vs DEK Size (Important Distinction)

WhatSourceUsed For
KEK sizekeybits parameter in createKMSKey / rotateKMSKey (stored in kms_keys.key_bits)Size of the Key Encryption Key stored in the HSM or database. Used when creating or rotating a KEK.
DEK sizeGlobal config kms.dek.size.bitsSize of the Data Encryption Key generated per volume. Used in generateVolumeKeyWithKek().
  • The KMS key's keybits controls only the KEK size (e.g., 256-bit AES key in the HSM).
  • The global setting kms.dek.size.bits controls the DEK size for all new encrypted volumes.
  • DEK size is independent of the KMS key; all volumes get DEKs of the configured global size.

...

  • Authorization: Admin, ResourceAdmin, DomainAdmin, User
  • Async: No

Parameters:

ParameterRequiredTypeDescription
nameYesStringName of the KMS key
descriptionNoStringDescription of the KMS key
purposeYesStringPurpose of the key (volume, tls)
zoneidYesUUIDZone ID where the key will be valid
hsmprofileidYesUUIDHSM profile ID to create the KEK in
keybitsNoIntegerKEK size in bits (128, 192, 256). Default: 256
accountNoStringAccount name (admin use)
domainidNoUUIDDomain ID (admin use)

listKMSKeys

Lists KMS keys available to the caller.

  • Authorization: Admin, ResourceAdmin, DomainAdmin, User

Parameters:

ParameterRequiredTypeDescription
idNoUUIDList KMS key by UUID
purposeNoStringFilter by purpose
zoneidNoUUIDFilter by zone
stateNoStringFilter by state (Enabled, Disabled)

updateKMSKey

Updates KMS key name, description, or state.

  • Authorization: Admin, ResourceAdmin, DomainAdmin, User
  • Async: Yes

Parameters:

ParameterRequiredTypeDescription
idYesUUIDKMS key UUID
nameNoStringNew name
descriptionNoStringNew description
enabledNoBooleanEnable/disable the key

deleteKMSKey

Deletes a KMS key (only if not referenced by volumes or wrapped keys).

  • Authorization: Admin, ResourceAdmin, DomainAdmin, User
  • Async: Yes

Parameters:

ParameterRequiredTypeDescription
idYesUUIDKMS key UUID

rotateKMSKey

Rotates KEK by creating a new version and scheduling gradual re-encryption of wrapped keys.

  • Authorization: Admin only
  • Async: Yes

Parameters:

ParameterRequiredTypeDescription
idYesUUIDKMS key UUID to rotate
keybitsNoIntegerKey size for new KEK (default: same as current)
hsmprofileidNoUUIDTarget HSM profile for cross-HSM migration

migrateVolumesToKMS

Migrates passphrase-based volumes to KMS encryption.

  • Authorization: Admin only
  • Async: Yes

Parameters:

ParameterRequiredTypeDescription
zoneidYesUUIDZone ID
idYesUUIDKMS key ID to migrate volumes to
accountNoStringMigrate volumes for specific account
domainidNoUUIDDomain ID

HSM Profile APIs

addHSMProfile

...

  • Authorization: Admin only
  • Request has sensitive info: Yes (PIN, passwords)

Parameters:

ParameterRequiredTypeDescription
nameYesStringHSM profile name
protocolNoStringProtocol (PKCS11, KMIP, etc.). Default: pkcs11
zoneidNoUUIDZone ID (null = global scope)
domainidNoUUIDDomain ID
accountNoStringAccount name
systemNoBooleanSystem profile (globally available, root admin only)
vendornameNoStringHSM vendor name
detailsNoMapHSM configuration details

PKCS#11 details keys: library (path to PKCS#11 library), slot (slot number), pin (HSM PIN, encrypted at rest), token_label (token label), minSessions, maxSessions

...

  • Authorization: Admin, ResourceAdmin, DomainAdmin, User
  • Response has sensitive info: Yes (encrypted values shown as ENC(...))

Parameters:

ParameterRequiredTypeDescription
idNoUUIDHSM profile ID
zoneidNoUUIDZone ID
protocolNoStringProtocol filter
enabledNoBooleanEnabled filter

updateHSMProfile

Updates an HSM profile name or enabled state.

  • Authorization: Admin only

Parameters:

ParameterRequiredTypeDescription
idYesUUIDHSM profile UUID
nameNoStringNew name
enabledNoBooleanEnable/disable

deleteHSMProfile

Deletes an HSM profile (only if not in use by any KEK versions).

  • Authorization: Admin only

Parameters:

ParameterRequiredTypeDescription
idYesUUIDHSM profile UUID

Global Settings

Setting KeyScopeTypeDefaultDescription
kms.dek.size.bitsGlobalInteger256Size of DEKs in bits for new volumes (128, 192, 256)
kms.retry.countGlobalInteger3Number of retry attempts for transient KMS failures
kms.retry.delay.msGlobalInteger1000Delay in milliseconds between retry attempts
kms.operation.timeout.secGlobalInteger30Per-attempt timeout for KMS operations
kms.rewrap.batch.sizeGlobalInteger50Wrapped keys rewrapped per batch in background job
kms.rewrap.interval.msGlobalLong300000Interval between background rewrap executions (5 min)

Database Changes

New Tables

...

Code Block
CREATE TABLE IF NOT EXISTS `cloud`.`kms_hsm_profiles` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    `uuid` VARCHAR(40) NOT NULL,
    `name` VARCHAR(255) NOT NULL,
    `protocol` VARCHAR(32) NOT NULL COMMENT 'PKCS11, KMIP, AWS_KMS, etc.',
    `account_id` BIGINT UNSIGNED COMMENT 'null = admin-provided',
    `domain_id` BIGINT UNSIGNED,
    `zone_id` BIGINT UNSIGNED COMMENT 'null = global scope',
    `vendor_name` VARCHAR(64),
    `enabled` BOOLEAN NOT NULL DEFAULT TRUE,
    `system``is_public` BOOLEAN NOT NULL DEFAULT FALSE,
    `created` DATETIME NOT NULL,
    `removed` DATETIME,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_uuid` (`uuid`),
    UNIQUE KEY `uk_account_name` (`account_id`, `name`, `removed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

...