Exemplo n.º 1
0
  /**
   * Returns true if the entry identified by the given alias is a <i>trusted certificate entry</i>,
   * and false otherwise.
   *
   * @return true if the entry identified by the given alias is a <i>trusted certificate entry</i>,
   *     false otherwise.
   */
  public boolean engineIsCertificateEntry(String alias) {

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

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

    return false;
  }