private TrustManager[] getTrustManagerFactory(String truststoreFile, String storePass) throws IOException, GeneralSecurityException {
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
InputStream is = null;
try {
is = new FileInputStream(truststoreFile);
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(is, storePass.toCharArray());
tmf.init(ks);
return tmf.getTrustManagers();
}
finally {
try {
if (is != null) {
is.close();
}
}
catch (IOException e) {
}
}
}
|