{
if(keyStore.containsAlias(alias))
{
return keyStore.getKey(alias, password.toCharArray());
}
throw new KeyStoreException("the keystore does not contain the given alias");
}
}
catch(UnrecoverableKeyException ex)
{
throw new KeyStoreException("the private key is not recoverable");
}
catch(NoSuchAlgorithmException ex)
{
throw new KeyStoreException("the algorithm necessary to recover the key is not available");
}
}