java.security.KeyStore.getCreationDate()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中java.security.KeyStore.getCreationDate()方法的一些代码示例,展示了KeyStore.getCreationDate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyStore.getCreationDate()方法的具体详情如下:
包路径:java.security.KeyStore
类名称:KeyStore
方法名:getCreationDate

KeyStore.getCreationDate介绍

[英]Returns the creation date of the entry with the given alias.
[中]返回具有给定别名的条目的创建日期。

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public Date engineGetCreationDate(String alias) {
  try {
    return getKeyStore().getCreationDate(alias);
  } catch (KeyStoreException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: nu.zoom/portunis

public Date getCreationDate(String alias) throws KeyStoreException
{
  return store.getCreationDate(alias);
}

代码示例来源:origin: fbacchella/LogHub

@Override
public Date engineGetCreationDate(String alias) {
  for (KeyStore ks: stores) {
    try {
      Date val = ks.getCreationDate(alias);
      if (val != null) {
        return val;
      }
    } catch (KeyStoreException e) {
      // This keystore is broken, just skip it
    }
  }
  return null;
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

@Override
public Date engineGetCreationDate(String alias) {
  try {
    return getKeyStore().getCreationDate(alias);
  } catch (KeyStoreException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-credential

@Override
public Date engineGetCreationDate(String alias) {
  try {
    return getKeyStore().getCreationDate(alias);
  } catch (KeyStoreException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public Date engineGetCreationDate(String alias) {
  try {
    return getKeyStore().getCreationDate(alias);
  } catch (KeyStoreException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: kaikramer/keystore-explorer

private void createLastModifiedNode(DefaultMutableTreeNode parentNode, String alias) throws CryptoException {
  try {
    KeyStore keyStore = currentState.getKeyStore();
    if (KeyStoreType.resolveJce(keyStore.getType()) != KeyStoreType.PKCS12) {
      String lastModified = MessageFormat.format(res.getString("DProperties.properties.LastModified"),
          StringUtils.formatDate(keyStore.getCreationDate(alias)));
      parentNode.add(new DefaultMutableTreeNode(lastModified));
    }
  } catch (ProviderException e) {
    // some keystore types do not provide creation dates for their entries => simply create no node
  } catch (KeyStoreException e) {
    throw new CryptoException(res.getString("DProperties.NoGetProperties.exception.message"), e);
  }
}

代码示例来源:origin: edu.vt.middleware/vt-crypt

final String alias = aliases.nextElement();
System.out.println("Alias name: " + alias);
System.out.println("Creation date: " + store.getCreationDate(alias));
if (store.isKeyEntry(alias)) {
 System.out.println("Entry type: keyEntry");

代码示例来源:origin: org.apache.geronimo.plugins/console-core

public KeyEntryInfo getKeyEntryInfo(String alias) throws KeyStoreException {
  KeyEntryInfo info = null;
  if (this.keystore.isCertificateEntry(alias)) {
    // certificate entry
    info = new KeyEntryInfo(alias, "trusted certificate", keystore
        .getCreationDate(alias));
  } else if (this.keystore.isKeyEntry(alias)) {
    // private key entry
    info = new KeyEntryInfo(alias, "private key", keystore
        .getCreationDate(alias));
  } else {
    throw new KeyStoreException("invalid key entry type");
  }
  return info;
}

代码示例来源:origin: Evolveum/midpoint

System.out.println("Creation date: " + keyStore.getCreationDate(alias));

代码示例来源:origin: org.kuali.rice/rice-ksb-client-impl

public List<KeyStoreEntryDataContainer> getListOfModuleKeyStoreEntries() {
  List<KeyStoreEntryDataContainer> keyStoreEntries = new ArrayList<KeyStoreEntryDataContainer>();
  try {
    KeyStore moduleKeyStore = getModuleKeyStore();
    // List the aliases
    for (Enumeration<String> enumer = moduleKeyStore.aliases(); enumer.hasMoreElements();) {
      String alias = (String) enumer.nextElement();
      KeyStoreEntryDataContainer dataContainer = new KeyStoreEntryDataContainer(alias,moduleKeyStore.getCreationDate(alias));
      KeyStore.PasswordProtection passwordProtection = null;
      if (moduleKeyStore.isKeyEntry(alias)) {
        passwordProtection = new KeyStore.PasswordProtection(getModuleKeyStorePassword().toCharArray());
      }
      KeyStore.Entry entry = moduleKeyStore.getEntry(alias, passwordProtection);
      dataContainer.setType(entry.getClass());
      keyStoreEntries.add(dataContainer);
    }
  } catch (KeyStoreException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  } catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  } catch (UnrecoverableEntryException e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  }
  return keyStoreEntries;
}

代码示例来源:origin: sensepost/apostille

while (aliases.hasMoreElements()) {
  String alias = aliases.nextElement();
  System.err.println("Alias: " + alias + ", added " + dstKs.getCreationDate(alias));

代码示例来源:origin: wildfly/wildfly-core

@Override
protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {
  String alias = ALIAS.resolveModelAttribute(context, operation).asString();
  KeyStore keyStore = getKeyStore(context);
  try {
    ModelNode result = context.getResult();
    if ( ! keyStore.containsAlias(alias)) {
      ROOT_LOGGER.tracef("Alias [%s] does not exists in KeyStore");
      return;
    }
    result.get(ElytronDescriptionConstants.ALIAS).set(alias);
    result.get(ElytronDescriptionConstants.ENTRY_TYPE).set(getEntryType(keyStore, alias));
    Date creationDate = keyStore.getCreationDate(alias);
    if (creationDate != null) {
      SimpleDateFormat sdf = new SimpleDateFormat(ISO_8601_FORMAT);
      result.get(ElytronDescriptionConstants.CREATION_DATE).set(sdf.format(creationDate));
    }
    Certificate[] chain = keyStore.getCertificateChain(alias);
    if (chain == null) {
      Certificate cert = keyStore.getCertificate(alias);
      if (cert != null) {
        writeCertificate(result.get(ElytronDescriptionConstants.CERTIFICATE), cert);
      }
    } else {
      writeCertificates(result.get(ElytronDescriptionConstants.CERTIFICATE_CHAIN), chain);
    }
  } catch (KeyStoreException | NoSuchAlgorithmException | CertificateEncodingException e) {
    throw new OperationFailedException(e);
  }
}

代码示例来源:origin: Microsoft/AppCenter-SDK-Android

String alias0MC = getAlias(handler, 0, true);
String alias1MC = getAlias(handler, 1, true);
Date aliasDate0 = mKeyStore.getCreationDate(alias0);
Date aliasDate1 = mKeyStore.getCreationDate(alias1);
Date aliasDate0MC = mKeyStore.getCreationDate(alias0MC);
Date aliasDate1MC = mKeyStore.getCreationDate(alias1MC);
int index = 0, indexMC = 0;
String alias = alias0;

代码示例来源:origin: com.addc/addc-security

sb.append(tr.translate(ALIAS_NAME)).append(alias).append(eol);
sb.append(tr.translate(CREATION_DATE))
    .append(DateUtils.getISO8601DateFormatForDisplay().format(ks.getCreationDate(alias))).append(eol);
if (ks.entryInstanceOf(alias, KeyStore.PrivateKeyEntry.class)) {
  sb.append(tr.translate(ENTRY_TYPE)).append(KeyStore.PrivateKeyEntry.class.getSimpleName()).append(eol);

代码示例来源:origin: kaikramer/keystore-explorer

data[i][iLastModifiedColumn] = keyStore.getCreationDate(alias);
} else {
  data[i][iLastModifiedColumn] = null;

代码示例来源:origin: Microsoft/AppCenter-SDK-Android

when(mKeyStore.getCreationDate(alias0)).thenReturn(d);
when(mKeyStore.getCreationDate(alias1)).thenReturn(d);
when(mKeyStore.getCreationDate(alias0MC)).thenReturn(d);
calendar.add(Calendar.YEAR, 1);
d = calendar.getTime();
when(mKeyStore.getCreationDate(alias1MC)).thenReturn(d);
when(mKeyStore.getCreationDate(alias0MC)).thenReturn(d);
when(mKeyStore.getCreationDate(alias1MC)).thenReturn(d);

代码示例来源:origin: org.activecomponents.jadex/jadex-platform

kse.setDate(ks.getCreationDate(alias).getTime());
res.put(alias, kse);

代码示例来源:origin: net.sourceforge.jadex/jadex-platform

kse.setDate(ks.getCreationDate(alias).getTime());
res.put(alias, kse);

代码示例来源:origin: Microsoft/AppCenter-SDK-Android

when(mKeyStore.containsAlias(alias1)).thenReturn(true);
Calendar calendar = Calendar.getInstance();
when(mKeyStore.getCreationDate(alias0)).thenReturn(calendar.getTime());
calendar.add(Calendar.YEAR, 1);
when(mKeyStore.getCreationDate(alias1)).thenReturn(calendar.getTime());
cryptoUtils = new CryptoUtils(mContext, mCryptoFactory, apiLevel);
encrypted = cryptoUtils.encrypt("anything");
when(mKeyStore.getCreationDate(alias0)).thenReturn(calendar.getTime());
cryptoUtils = new CryptoUtils(mContext, mCryptoFactory, apiLevel);
encrypted = cryptoUtils.encrypt("anything");

相关文章