Here you can find the source of getKeyStore(String keyStoreName, String password)
private static KeyStore getKeyStore(String keyStoreName, String password) throws IOException
//package com.java2s; //License from project: Apache License import java.io.FileInputStream; import java.io.IOException; import java.security.KeyStore; public class Main { private static KeyStore getKeyStore(String keyStoreName, String password) throws IOException { KeyStore ks = null;/*from w w w.j av a 2s . c o m*/ FileInputStream fis = null; try { ks = KeyStore.getInstance("JKS"); char[] passwordArray = password.toCharArray(); fis = new java.io.FileInputStream(keyStoreName); ks.load(fis, passwordArray); fis.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (fis != null) { fis.close(); } } return ks; } }