KeyStore ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream(file), storePassword.toCharArray());
X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
PrivateKey key = (PrivateKey)ks.getKey(alias, keyPassword.toCharArray());
return new X500PrivateCredential(cert, key, alias);