Code example for KeyStore

Methods: getKey

0
  public Key getKey(String alias)
  { 
    Key key = null;
    try 
    { 
      key = keyStore.getKey(alias, password.getPassword());
    } 
    catch (KeyStoreException e)
    { 
      throw new KeyAccessException("The keystore could not be properly accessed.", e);
    } 
    catch (NoSuchAlgorithmException e)
    { 
      throw new KeyAccessException("The algorithm for recovering the key cannot be found.", e);
    } 
    catch (UnrecoverableKeyException e)
    { 
      throw new KeyAccessException("A key could not be found in the keystore.", e);
    } 
 
    return key;