.withKeySpec(contentCryptoScheme.getKeySpec());
keyGenReq
.withGeneralProgressListener(req.getGeneralProgressListener())
.withRequestMetricCollector(req.getRequestMetricCollector())
;
GenerateDataKeyResult keyGenRes = kms.generateDataKey(keyGenReq);
final SecretKey cek =
new SecretKeySpec(copyAllBytesFrom(keyGenRes.getPlaintext()),
contentCryptoScheme.getKeyGeneratorAlgorithm());
byte[] keyBlob = copyAllBytesFrom(keyGenRes.getCiphertextBlob());
return ContentCryptoMaterial.wrap(cek, iv,
kekMaterials, contentCryptoScheme, provider,
new KMSSecuredCEK(keyBlob));
} else {
// Generate a one-time use symmetric key and initialize a cipher to encrypt object data