alias = aliases.nextElement();
getLogger().info("Keystore contains alias: " + alias);
length++;
}
if (length > 1) {
throw new ErrorAdminCommandException("Keystore contains more than one alias, alias must be provided as argument.");
} else if (length < 1) {
throw new ErrorAdminCommandException("Keystore does not contains any aliases. It can not be used for a CA.");
}
// else alias already contains the only alias, so we can use that
}
ejb.getCAAdminSession().restoreCAKeyStore(getAdmin(), caName, keystorebytes, kspwd, kspwd, alias, encryptionAlias);
} catch (ErrorAdminCommandException e) {
throw e;
} catch (Exception e) {
throw new ErrorAdminCommandException(e);
}
}