private void initializeKeystore() throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException {
keystoreFile = null;
if (keyStoreLocation == null) {
File dir = info.getBaseDir();
if (dir != null) {
keystoreFile = new File(dir, "config" + File.separator + "fabric3-keystore.jks");
keyStoreLocation = keystoreFile.getAbsolutePath();
}
} else {
keystoreFile = new File(keyStoreLocation);
if (!keystoreFile.isAbsolute()) {
File dir = info.getBaseDir();
keystoreFile = new File(dir, "config" + File.separator + keyStoreLocation);
keyStoreLocation = keystoreFile.getAbsolutePath();
}
}
if (keyStorePassword != null) {
System.setProperty(keyStorePasswordProperty, keyStorePassword);
}
if (keystoreFile != null && keystoreFile.exists()) {
System.setProperty(keyStoreLocationProperty, keystoreFile.getAbsolutePath());
char[] keyStorePasswordChars = null;
if (keyStorePassword != null) {
keyStorePasswordChars = keyStorePassword.toCharArray();
}
keyStore = KeyStore.getInstance(keyStoreType);
InputStream stream = new FileInputStream(keyStoreLocation);
keyStore.load(stream, keyStorePasswordChars);
}
}