if (log.isDebugEnabled()) {
log.debug("Creating KeyStore from given CA certificates" +
" in the given directory : " + CACertificateFilesPath);
}
KeyStore trustStore = KeyStore.getInstance("JKS");
trustStore.load(null, null);
File certsPath = new File(CACertificateFilesPath);
File[] certs = certsPath.listFiles();
for (File currentCert : certs) {
FileInputStream inStream = new FileInputStream(currentCert);
BufferedInputStream bis = new BufferedInputStream(inStream);
CertificateFactory certFactory = CertificateFactory.getInstance("X509");
Certificate cert = certFactory.generateCertificate(bis);
trustStore.setCertificateEntry(currentCert.getName(), cert);
bis.close();
inStream.close();
}