secConfig = config;
} else {
secConfig = Configuration.getGlobalSecurityConfiguration();
}
KeyEncryptionParameters kekParams = new KeyEncryptionParameters();
kekParams.setEncryptionCredential(encryptionCredential);
if (encryptionCredential == null) {
throw new SecurityException("Key encryption credential may not be null");
}
kekParams.setAlgorithm(secConfig.getKeyTransportEncryptionAlgorithmURI(encryptionCredential,
wrappedKeyAlgorithm));
KeyInfoGenerator kiGenerator = getKeyInfoGenerator(encryptionCredential, secConfig, keyInfoGenName);
if (kiGenerator != null) {
kekParams.setKeyInfoGenerator(kiGenerator);
} else {
log.info("No factory for named KeyInfoGenerator {} was found for credential type {}", keyInfoGenName,
encryptionCredential.getCredentialType().getName());
log.info("No KeyInfo will be generated for EncryptedKey");
}
kekParams.setRecipient(recipient);
return kekParams;
}