Recrypt Both Key and Disk
Encryption Keys
For deep recrypt, which affects both KEKs
and disk encryption keys (DEKs), set the
crypto
property in the
VirtualMachineConfigSpec
to
CryptoSpecDeepRecrypt
and call the
Reconfigure
method.
Deep Recrypt
void DeepRecrypt() throws Exception { // Deep recrypt follows the same flow as encrypt. The two differences are: // - Instead of using a new encryption profile, just get the previously // applied profile from the virtual machine to be reconfigured and use it. // - The type of CryptoSpec object created is CryptoSpecDeepRecrypt() // Create CryptoSpec for deep recrypt // Get Key Id from CryptoManager as newKeyId CryptoSpecDeepRecrypt cryptoSpec = new CryptoSpecDeepRecrypt(); cryptoSpec.setNewKeyId(newKeyId); // Follow steps from Encrypt() }