public final PrivateKey retrievePrivateKey ( KeyStore keyStore , String keyName , char [ ] password ) { try { logger . entry ( ) ; PrivateKey privateKey = ( PrivateKey ) keyStore . getKey ( keyName , password ) ; logger . exit ( ) ; return privateKey ; } catch ( KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e ) { RuntimeException exception = new RuntimeException ( "An unexpected exception occurred while attempting to retrieve a private key." , e ) ; logger . error ( exception . toString ( ) ) ; throw exception ; } }
This method retrieves a private key from a key store .