code: public static KeyStore getKeyStore(String keystoreLocation, String keystoreType) throws NoSuchAlgorithmException,
                                                                                      CertificateException, IOException,
                                                                                      KeyStoreException {
          KeyStore keystore = KeyStore.getInstance(keystoreType);
          InputStream is = CipherUtil.class.getResourceAsStream(keystoreLocation);
          
          if (is == null) {
              is = new FileInputStream(keystoreLocation);
          }
          
          keystore.load(is, null);
          return keystore;
      }
docs: Returns a key store instance of the specified type from the specified resource.
  
  @param keystoreLocation Path to key store location.
  @param keystoreType Key store type.
  @return A key store instance.
  @throws NoSuchAlgorithmException If algorithm not supported.
  @throws CertificateException If certificate invalid.
  @throws IOException If IO exception.
  @throws KeyStoreException If key store invalid.