/** * Get the KeyManagers for the the specified keystore * * @param ksFile The keystore to manager * @param ksPass The keystore password * @return KeyManagers that can manage the keystore * @throws Exception */ protected KeyManager[] getKeyManagers(String ksFile, String ksPass) throws Exception { if (HttpMessageContext.emptyString(ksFile)) { ksFile = System.getProperty("javax.net.ssl.keyStore"); } if (HttpMessageContext.emptyString(ksPass)) { ksPass = System.getProperty("javax.net.ssl.keyStorePassword", "changeit"); } KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(ksFile), ksPass.toCharArray()); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, ksPass.toCharArray()); return kmf.getKeyManagers(); }