code: public static X509Certificate getCertificate(String alias, File storeFile, String storePassword) {
          try {
              KeyStore store = openKeyStore(storeFile, storePassword);
              X509Certificate caCert = (X509Certificate) store.getCertificate(alias);
              return caCert;
          } catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
docs: Retrieves the X509 certificate with the specified alias from the certificate
  store.
  
  @param alias
  @param storeFile
  @param storePassword
  @return the certificate