encryptionKey = generateEncryptionKey(encryptionAlgorithmURI);
}
EncryptedData encryptedData = encryptElement(xmlObject, encryptionKey, encryptionAlgorithmURI, false);
if (encParams.getKeyInfoGenerator() != null) {
KeyInfoGenerator generator = encParams.getKeyInfoGenerator();
log.debug("Dynamically generating KeyInfo from Credential for EncryptedData using generator: {}",
generator.getClass().getName());
try {
encryptedData.setKeyInfo( generator.generate(encParams.getEncryptionCredential()) );
} catch (SecurityException e) {
throw new EncryptionException("Error generating EncryptedData KeyInfo", e);
}
}