6.3 Virtual Machine Encryption & Key Management

Key Takeaways

  • vSphere Native Key Provider (NKP) is built into vCenter, so no external KMS is needed, but it cannot be used until it has been backed up to a PKCS#12 (.p12) file; password-protecting the backup is optional but recommended.

  • vSphere encryption implements a two-tier key model: a Data Encryption Key (DEK) encrypts VM data files using XTS-AES-256, while a Key Encryption Key (KEK) from the key provider wraps and protects the DEK.

  • VM Encryption encrypts VM files such as .nvram, .vswp, and .vmsn plus virtual disk data in the hypervisor I/O path; log files, most of the .vmx file, and disk descriptor files stay unencrypted.

  • Encrypted vMotion provides three configuration states (Disabled, Opportunistic, and Required), automatically enforcing Required mode for any virtual machine protected by VM Encryption.

  • Virtual TPM 2.0 (vTPM) stores guest cryptographic credentials and enables Windows 11 / Virtualization-Based Security (VBS) without requiring physical TPM hardware on the underlying ESXi host.

Last updated: September 2026

6.3 Virtual Machine Encryption & Key Management

Virtual machine data residing on enterprise storage arrays is susceptible to unauthorized access through compromised storage fabrics, physical drive theft, or unauthorized hypervisor snapshots. VMware vSphere delivers native cryptographic protection through VM Encryption, Virtual TPM (vTPM), and Encrypted vMotion. Understanding how encryption keys are generated, distributed, and protected across the compute and storage tiers is fundamental to vSphere security engineering.


The Two-Tier Cryptographic Architecture: DEK and KEK

vSphere does not rely on a single cryptographic key to protect virtual machines. Instead, it enforces a robust, industry-standard two-tier key hierarchy that balances cryptographic performance with centralized key lifecycle governance:

+-----------------------------------------------------------------------------------+
| vSphere Two-Tier Key Architecture                                                 |
|                                                                                   |
|  [ Key Provider (Native Key Provider or External KMIP KMS) ]                      |
|                                  |                                                |
|                                  | Generates / Distributes                        |
|                                  v                                                |
|             [ Key Encryption Key (KEK) - AES-256 ]                                |
|             - Managed by Key Provider                                             |
|             - Never touches virtual disk storage                                  |
|             - Held in ESXi host memory while in use                               |
|                                  |                                                |
|                                  | Wraps (Encrypts)                               |
|                                  v                                                |
|          [ Data Encryption Key (DEK / Internal Key) - XTS-AES-256 ]              |
|          - Generated by ESXi hypervisor per disk / config file                    |
|          - Encrypts VM payload data (-flat.vmdk, .nvram, .vswp)                   |
|          - Stored in encrypted form in VM descriptor files (.vmx / .vmdk)         |
+-----------------------------------------------------------------------------------+

1. Data Encryption Key (DEK / Internal Key)

  • Generation & Algorithm: The DEK is generated by the ESXi host and uses the XTS-AES-256 cipher.
  • Scope: Separate DEKs protect the virtual disks and the VM's other encrypted files (such as .nvram, .vswp, and .vmsn).
  • Storage: The DEK is encrypted (wrapped) by the KEK and embedded directly into the header of the virtual machine's files. The plaintext DEK is never written to disk storage; it exists in plaintext only within the volatile, protected memory of the ESXi VMkernel while the VM is powered on.

2. Key Encryption Key (KEK)

  • Generation & Algorithm: The KEK is generated by the configured Key Provider (either the vSphere Native Key Provider or an external Key Management Server) using standard AES-256.
  • Function: The KEK acts as a key-wrapping key. It encrypts the DEKs before they are written to VM configuration headers.
  • Lifecycle: With a standard key provider (external KMS), vCenter retrieves the KEK and pushes it to the ESXi host, which keeps it in memory. After a reboot, the host needs the key again before it can unwrap the DEK and power on the encrypted VM.

Key Provider Architectures: Native Key Provider (NKP) vs. External KMS

vSphere 8 supports two key management architectures: the built-in vSphere Native Key Provider (NKP) and enterprise External Key Management Servers (KMS).

1. vSphere Native Key Provider (NKP)

Introduced to democratize encryption across mid-market and enterprise environments, the vSphere Native Key Provider (NKP) removes the prerequisite for expensive third-party KMIP appliances:

  • No External KMS: Built into vCenter Server and ESXi, so there is no separate KMIP appliance to buy or run. Feature availability still depends on your vSphere edition.
  • Distributed Key Derivation: When configured, vCenter Server generates a cryptographically secure Primary Key. vCenter uses this primary key to derive Key Encryption Keys (KEKs) and securely pushes the key material to all ESXi hosts in the cluster using TLS.
  • Host-Side Keys: vCenter generates a primary key, the Key Derivation Key (KDK), and pushes it to the ESXi hosts in the cluster. The hosts can then generate data encryption keys (for example for vTPMs) even when not connected to vCenter. A TPM 2.0 is not required but adds protection, and you can choose Use key provider only with TPM protected ESXi hosts. vCenter and ESXi must run 7.0 Update 2 or later. Because vCenter file-based backups contain the KDK, store them securely.
  • Mandatory Backup Prerequisite: An administrator cannot use NKP to encrypt VMs or provision vTPMs until the NKP has been backed up. The backup is a .p12 (PKCS#12) file. Password protection is optional but strongly recommended. After the backup, the NKP becomes usable.

2. External Key Management Server (KMS / KMIP)

For organizations requiring centralized cryptographic governance across heterogeneous platforms (storage arrays, public clouds, databases), vSphere integrates with external KMS appliances:

  • Standards Compliance: Communicates using the Key Management Interoperability Protocol (KMIP) version 1.1 or higher over TCP port 5696.
  • Mutual TLS Authentication: Trust between vCenter Server and the external KMS cluster is established using mutual X.509 certificate authentication (client certificate on vCenter, server certificate on KMS).
  • High Availability Clustering: KMS providers (e.g., Thales CipherTrust, Entrust KeyControl, HashiCorp Vault) are deployed in clustered configurations with active/standby or active/active replication across geographical datacenters.

Comparison: Native Key Provider (NKP) vs. External KMS

Architectural AttributevSphere Native Key Provider (NKP)External KMS (KMIP 1.1+)
Infrastructure FootprintZero external servers; built into vCenter & ESXiRequires dedicated external KMS cluster
Communication ProtocolInternal vCenter/ESXi TLS PushKMIP 1.1+ over TCP port 5696
ESXi Host Key AvailabilityHosts hold the KDK and can generate keys without contacting vCentervCenter retrieves keys from the KMS for hosts
Mandatory Configuration GateMust be backed up (.p12) before first useMust establish mutual TLS certificate trust
Supported Security FeaturesVM Encryption, vTPM 2.0, vSAN EncryptionVM Encryption, vTPM 2.0, vSAN Encryption

VM Encryption Mechanics, vTPM 2.0 & Encrypted vMotion

VM Encryption Scope & Storage Policy Based Management (SPBM)

VM Encryption operates at the hypervisor layer, positioned between the virtual machine's virtual SCSI controller and the underlying datastore storage fabric:

  • Encryption Boundary: Because encryption occurs inside the ESXi VMkernel, data is encrypted before it leaves the host bus adapter (HBA) or network card. Data is protected in-flight across the SAN/NAS fabric and at-rest on physical media.
  • Encrypted Files: Virtual disk data plus VM files that hold guest state: NVRAM (.nvram), swap (.vswp), snapshot memory state (.vmsn), and core dumps. Log files, most of the .vmx configuration file, and disk descriptor files are not encrypted. The .vmx and descriptors carry the wrapped keys so the host can find and unlock them.
  • Storage Policy Integration: Administrators apply encryption by assigning the default VM Encryption Policy (or a custom storage policy) under VM > Configure > Storage Policies. Policies can be applied to the VM home namespace, individual virtual disks, or both.
  • Storage Array Deduplication Trade-Off: Because encryption transforms data into pseudorandom ciphertext with maximum entropy, array-based deduplication and compression engines cannot compress or deduplicate VM-encrypted virtual disks. If storage efficiency is required, organizations should evaluate native vSAN Encryption, which deduplicates and compresses data before applying encryption.

Virtual TPM 2.0 (vTPM)

A Virtual Trusted Platform Module (vTPM 2.0) is a software-emulated cryptographic processor added to virtual hardware (Virtual Machine Hardware Version 14 or higher):

  • Guest Security Features: Enables Microsoft Windows 11 installation prerequisites, Windows Server 2022/2025 Credential Guard, BitLocker drive encryption, and Virtualization-Based Security (VBS).
  • Key Provider Requirement: Adding a vTPM strictly requires an active Key Provider (either NKP or external KMS). The sensitive TPM state (endorsement keys, storage root keys, platform configuration registers) is stored in the virtual machine's .nvram file, which is automatically encrypted by the key provider.
  • Physical Hardware Independence: A virtual machine does not require a physical TPM 2.0 chip on the ESXi host to run a vTPM. The ESXi host merely executes the emulated vTPM device code and secures its state with the key provider.

Encrypted vMotion

Encrypted vMotion protects VM memory pages and migration state as they traverse the physical vMotion network during a live migration:

+-----------------------------------------------------------------------------------+
| Encrypted vMotion Operational Modes                                               |
|                                                                                   |
| 1. Disabled:                                                                      |
|    vMotion traffic is transmitted in unencrypted plaintext across the wire.      |
|                                                                                   |
| 2. Opportunistic (Default for Standard VMs):                                      |
|    Uses encryption if both source and destination hosts support it; falls back    |
|    to plaintext migration if the destination host does not support encryption.    |
|                                                                                   |
| 3. Required (Enforced Automatically for Encrypted VMs):                           |
|    Mandates encryption. Migration will FAIL if the target host does not support   |
|    encryption or lacks the necessary key material.                                |
+-----------------------------------------------------------------------------------+
  • Ephemeral Session Keys: When an encrypted vMotion migration begins, vCenter Server generates a unique, one-time 256-bit ephemeral session key. vCenter securely transmits this session key to both the source and target ESXi hosts over TLS. The hosts encrypt the vMotion stream, and the session key is discarded immediately upon migration completion.

Encrypting an Existing VM and Migration Settings (Objectives 7.12.1-7.12.3)

Convert a Non-Encrypted VM to an Encrypted VM

  1. Confirm a key provider (NKP or standard KMS) is configured and is the default.
  2. Power off the VM.
  3. Right-click the VM and select VM Policies > Edit VM Storage Policies. Apply the VM Encryption Policy (or a custom policy that includes encryption) to the VM home and each disk you want encrypted.
  4. Power the VM back on. From now on its encrypted vMotion setting is fixed at Required.

Decrypting reverses the process: power off and assign a non-encryption storage policy. Users need cryptographic privileges (for example, the built-in No cryptography administrator role deliberately omits them).

Migrate an Encrypted VM

  • Within one vCenter: Encrypted VMs can be migrated with vMotion. The destination host must be able to obtain the keys, and the migration always uses encrypted vMotion.
  • Across vCenter instances: Encrypted cross-vCenter vMotion (vSphere 7.0 and later) needs both vCenter systems to have access to the same key provider, configured with the same name.

Configure vMotion Encryption Properties

In Edit Settings > VM Options > Encryption, set Encrypted vMotion for a non-encrypted VM:

SettingBehavior
DisabledNever encrypt the migration stream
Opportunistic (default)Encrypt if both hosts support it (ESXi 6.5 and later), otherwise fall back to unencrypted
RequiredEncrypt or fail the migration; always used for encrypted VMs

Exam Trap: Encrypted vMotion protects the memory and state stream on the wire. It does not encrypt the VM's disks. Disk encryption comes from VM Encryption, vSAN encryption, or array-level encryption.

Loading diagram...
vSphere Encryption Key Distribution & Cryptographic Architecture

Realistic Troubleshooting & Exam Traps

Scenario 1: Native Key Provider Cannot Be Used (Not Backed Up Warning)

Problem: A system engineer configures a vSphere Native Key Provider named Corp-NKP in vCenter Server to deploy Windows 11 virtual machines. However, when attempting to add a Virtual TPM to a VM, the option is grayed out, and attempting to assign the VM Encryption policy generates the error: The Native Key Provider Corp-NKP is not in a usable state.

Root Cause Analysis:

  • Examination of Key Providers under vCenter > Configure > Security reveals the status of Corp-NKP is listed with a yellow warning icon: "Not Backed Up".
  • VMware enforces an intentional security safety gate: to protect against catastrophic loss of encryption keys (which would render all encrypted VMs permanently unrecoverable if vCenter were destroyed), an NKP cannot be used until an administrator backs it up (a password on the backup is optional but recommended).

Resolution:

  1. In the vSphere Client, select the vCenter Server object and navigate to Configure > Security > Key Providers.
  2. Select Corp-NKP and click the Back Up button.
  3. In the backup dialog, select Protect Native Key Provider data with password (recommended) and enter a strong password.
  4. Click Back Up and download the resulting .p12 archive to a secure vault.
  5. The warning clears and the NKP becomes usable. Administrators can now assign encryption policies and provision vTPMs.

Scenario 2: Live Migration Fails for Encrypted VM with Key Access Error

Problem: An administrator attempts to perform a live vMotion of an encrypted database virtual machine from esxi-01.corp.local to esxi-04.corp.local. The migration immediately aborts at 10% with the error: The target host does not have access to the encryption key provider.

Root Cause Analysis:

  • esxi-04 was recently added to the cluster. During network setup, host firewall rules blocked outgoing TCP port 5696 traffic to the external KMS cluster, or the host failed to complete client certificate enrollment with the Key Provider.
  • When vCenter instructed esxi-04 to prepare for incoming encrypted vMotion and load the VM's KEK, esxi-04 was unable to retrieve the key.

Resolution:

  1. Verify ESXi host firewall and network routing to the KMS cluster on port 5696.
  2. In the vSphere Client, select the host, navigate to Configure > Security > Key Providers, and click Sync Keys or Test Connection.
  3. Once the key provider status shows green on all cluster hosts, re-initiate the vMotion migration.

Exam Trap: Be alert to questions claiming that a physical TPM 2.0 chip is mandatory on an ESXi host in order to add a Virtual TPM (vTPM) to a virtual machine. This is completely false. A vTPM requires only a configured Key Provider (NKP or KMS). Physical host TPMs are used for ESXi host attestation, not for providing vTPM services to guest workloads.

Test Your Knowledge

An enterprise wants to deploy Microsoft Windows 11 virtual machines across a vSphere 8.0 cluster. The organization does not own a third-party Key Management Server (KMS) or KMIP appliance. What is the most cost-effective and architecturally supported VMware solution to satisfy the vTPM prerequisite?

A

Purchase and install physical TPM 2.0 microchips on every ESXi host motherboard and pass them through via DirectPath I/O

B

Enable vSphere Trust Authority on all workload clusters to bypass the cryptographic key requirement

C

Configure the built-in vSphere Native Key Provider (NKP) in vCenter and complete its mandatory backup

D

Deploy an unencrypted virtual machine and inject a counterfeit software TPM registry bypass inside the guest OS

Test Your Knowledge

A virtual machine is protected using standard vSphere VM Encryption. The administrator initiates a live vMotion migration to move the running virtual machine to another ESXi host in the same cluster. What is the operational behavior of the migration stream?

A

The migration stream is sent in plaintext because VM Encryption applies only to storage disks at rest

B

The migration stream strictly enforces Encrypted vMotion, failing the migration if the destination host cannot secure the stream

C

vMotion automatically falls back to an unencrypted stream if network latency between hosts exceeds 10 milliseconds

D

The virtual machine must be powered off before any migration operation can be performed on an encrypted virtual machine

Test Your Knowledge

In the vSphere VM Encryption two-tier key management architecture, what is the specific role of the Data Encryption Key (DEK / Internal Key)?

A

The DEK is generated directly by the ESXi hypervisor to encrypt the virtual machine's files and disks using XTS-AES-256

B

The DEK is generated by the external KMIP server to wrap and encrypt the Key Encryption Key (KEK)

C

The DEK is stored in plaintext within vCenter Server's PostgreSQL database to authenticate administrators

D

The DEK is used exclusively to generate digital certificates for ESXi host secure boot verification

Sections you finish are checked off in the contents.