// execute the keytool utility to create our key store
String keytool_dir = System.getProperty("java.home") + File.separator + "bin";
String keytool_exe = System.getProperty("os.name").toLowerCase().startsWith("windows") ? "keytool.exe"
: "keytool";
StartCommand keytool_cmd = new StartCommand();
keytool_cmd.setProgramDirectory(keytool_dir);
keytool_cmd.setProgramExecutable(keytool_exe);
keytool_cmd.setWaitForExit(Long.valueOf(30000L));
keytool_cmd.setCaptureOutput(Boolean.FALSE);
keytool_cmd.setCommandInResponse(true);
keytool_cmd.setArguments(new String[] { "-genkey", "-alias", key_alias, "-dname", domain_name, "-keystore",
keystore.getAbsolutePath(), "-storepass", keystore_password, "-keypass", key_password, "-keyalg",
key_algorithm, "-validity", Integer.toString(validity) });
StartCommandResponse keytool_results = new ProcessExec().execute(keytool_cmd);
if (!keytool_results.isSuccessful() || !keystore.exists()) {
throw new RuntimeException(LOG.getMsgString(CommI18NResourceKeys.KEYSTORE_CREATION_FAILURE,
keytool_results, Arrays.asList(keytool_cmd.getArguments()).toString()), keytool_results.getException());
}
LOG.debug(CommI18NResourceKeys.KEYSTORE_CREATED, keystore.getAbsolutePath());
return;