code: public static PrivateKey getPrivateKey(String alias, File storeFile, String storePassword) {
          try {
              KeyStore store = openKeyStore(storeFile, storePassword);
              PrivateKey key = (PrivateKey) store.getKey(alias, storePassword.toCharArray());
              return key;
          } catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
docs: Retrieves the private key for the specified alias from the certificate
  store.
  
  @param alias
  @param storeFile
  @param storePassword
  @return the private key