@Override public Date engineGetCreationDate(String alias) { try { return getKeyStore().getCreationDate(alias); } catch (KeyStoreException e) { throw new IllegalStateException(e); } }
public Date getCreationDate(String alias) throws KeyStoreException { return store.getCreationDate(alias); }
@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; }
@Override public Date engineGetCreationDate(String alias) { try { return getKeyStore().getCreationDate(alias); } catch (KeyStoreException e) { throw new IllegalStateException(e); } }
@Override public Date engineGetCreationDate(String alias) { try { return getKeyStore().getCreationDate(alias); } catch (KeyStoreException e) { throw new IllegalStateException(e); } }
@Override public Date engineGetCreationDate(String alias) { try { return getKeyStore().getCreationDate(alias); } catch (KeyStoreException e) { throw new IllegalStateException(e); } }
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); } }
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");
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; }
System.out.println("Creation date: " + keyStore.getCreationDate(alias));
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; }
while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); System.err.println("Alias: " + alias + ", added " + dstKs.getCreationDate(alias));
@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); } }
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;
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);
data[i][iLastModifiedColumn] = keyStore.getCreationDate(alias); } else { data[i][iLastModifiedColumn] = null;
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);
kse.setDate(ks.getCreationDate(alias).getTime()); res.put(alias, kse);
kse.setDate(ks.getCreationDate(alias).getTime()); res.put(alias, kse);
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");