Logger log = getLogger();
try {
KeyFactory keyFactory = KeyFactory.getInstance(keyAlgorithm);
return keyFactory.generatePublic(keySpec);
} catch (NoSuchAlgorithmException e) {
log.error(keyAlgorithm + " algorithm is not supported by this VM", e);
throw new KeyException(keyAlgorithm + "algorithm is not supported by the JCE", e);
} catch (InvalidKeySpecException e) {
log.error("Invalid key information", e);
throw new KeyException("Invalid key information", e);
}