KeyStore store = KeyStore.getInstance("jks");
store.load(fin, KEYSTORE_PASSWORD.toCharArray());
fin.close();
// initialize key manager factory
KeyManagerFactory keyManagerFactory = KeyManagerFactory
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(store, KEYSTORE_PASSWORD.toCharArray());
// initialize trust manager factory
TrustManagerFactory trustManagerFactory = TrustManagerFactory
.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(store);
clientKeyManager = keyManagerFactory.getKeyManagers()[0];
clientTrustManager = trustManagerFactory.getTrustManagers()[0];
ftpsClient.setKeyManager(clientKeyManager);
ftpsClient.setTrustManager(clientTrustManager);