Exemple #1
0
  /**
   * Checks if the given alias exists in this keystore.
   *
   * @param alias the alias name
   * @return true if the alias exists, false otherwise
   */
  public boolean engineContainsAlias(String alias) {

    AbstractMap.SimpleEntry<String, Collection<KeyStore>> pair = getKeystoresForReading(alias);

    try {
      String entryAlias = pair.getKey();
      for (KeyStore keystore : pair.getValue()) {
        if (keystore.containsAlias(entryAlias)) {
          return true;
        }
      }
    } catch (KeyStoreException e) {
      throw new IllegalStateException(e);
    }

    return false;
  }