@Test public void testGetTrustedCertificatesEmpty() throws Exception { Collection<Certificate> certificates = keyStoreManager.getTrustedCertificates(); assertNotNull(certificates); assertTrue(certificates.isEmpty()); }
@Override public Collection<Certificate> getTrustedCertificates() throws KeystoreException { trustedKeyStoreLock.readLock().lock(); try { String[] aliases = trustedKeyStore.listTrustCertificates(config.getTrustedKeyStorePassword()); List<Certificate> certificates = Lists.newArrayListWithCapacity(aliases.length); for (String alias : aliases) { Certificate cert = trustedKeyStore.getCertificate(alias); if (cert == null) { log.warn("Trust-store reports it contains certificate for alias '{}' but certificate is null", alias); continue; } certificates.add(cert); } return certificates; } finally { trustedKeyStoreLock.readLock().unlock(); } }
KeyStoreManagerImpl extends ComponentSupport implements KeyStoreManager { @Override public Collection<Certificate> getTrustedCertificates() throws KeystoreException { trustedKeyStoreLock.readLock().lock(); try { String[] aliases = trustedKeyStore.listTrustCertificates(config.getTrustedKeyStorePassword()); List<Certificate> certificates = Lists.newArrayListWithCapacity(aliases.length); for (String alias : aliases) { Certificate cert = trustedKeyStore.getCertificate(alias); if (cert == null) { log.warn("Trust-store reports it contains certificate for alias '{}' but certificate is null", alias); continue; } certificates.add(cert); } return certificates; } finally { trustedKeyStoreLock.readLock().unlock(); } } }
KeyStoreManagerImpl extends ComponentSupport implements KeyStoreManager { @Override public Collection<Certificate> getTrustedCertificates() throws KeystoreException { trustedKeyStoreLock.readLock().lock(); try { String[] aliases = trustedKeyStore.listTrustCertificates(config.getTrustedKeyStorePassword()); List<Certificate> certificates = Lists.newArrayListWithCapacity(aliases.length); for (String alias : aliases) { Certificate cert = trustedKeyStore.getCertificate(alias); if (cert == null) { log.warn("Trust-store reports it contains certificate for alias '{}' but certificate is null", alias); continue; } certificates.add(cert); } return certificates; } finally { trustedKeyStoreLock.readLock().unlock(); } } KeyStoreManagerImpl(final CryptoHelper crypto,
                             final KeyStoreStorageManager storageManager,
                             final KeyStoreManagerConfiguration config); @VisibleForTesting  KeyStoreManagerImpl(final CryptoHelper crypto,
                      final KeyStoreManagerConfiguration config,
                      final KeystoreInstance privateKeyStore,
                      final KeystoreInstance trustedKeyStore); }
KeyStoreManagerImpl extends ComponentSupport implements KeyStoreManager { @Override public Collection<Certificate> getTrustedCertificates() throws KeystoreException { trustedKeyStoreLock.readLock().lock(); try { String[] aliases = trustedKeyStore.listTrustCertificates(config.getTrustedKeyStorePassword()); List<Certificate> certificates = Lists.newArrayListWithCapacity(aliases.length); for (String alias : aliases) { Certificate cert = trustedKeyStore.getCertificate(alias); if (cert == null) { log.warn("Trust-store reports it contains certificate for alias '{}' but certificate is null", alias); continue; } certificates.add(cert); } return certificates; } finally { trustedKeyStoreLock.readLock().unlock(); } } KeyStoreManagerImpl(final CryptoHelper crypto,
                             final KeyStoreStorageManager storageManager,
                             final KeyStoreManagerConfiguration config); @VisibleForTesting  KeyStoreManagerImpl(final CryptoHelper crypto,
                      final KeyStoreManagerConfiguration config,
                      final KeystoreInstance privateKeyStore,
                      final KeystoreInstance trustedKeyStore); @Override TrustManager[] getTrustManagers(); @Override KeyManager[] getKeyManagers(); @Override void importTrustCertificate(Certificate certificate, String alias); @Override void importTrustCertificate(String certificateInPEM, String alias); @Override Certificate getTrustedCertificate(String alias); @Override Collection<Certificate> getTrustedCertificates(); @Override void removeTrustCertificate(String alias); @Override void generateAndStoreKeyPair(final String commonName,
                                      final String organizationalUnit,
                                      final String organization,
                                      final String locality,
                                      final String state,
                                      final String country); @Override boolean isKeyPairInitialized(); @Override Certificate getCertificate(); @Override PrivateKey getPrivateKey(); @Override void removePrivateKey(); }
KeyStoreManagerImpl extends ComponentSupport implements KeyStoreManager { @Override public Collection<Certificate> getTrustedCertificates() throws KeystoreException { trustedKeyStoreLock.readLock().lock(); try { String[] aliases = trustedKeyStore.listTrustCertificates(config.getTrustedKeyStorePassword()); List<Certificate> certificates = Lists.newArrayListWithCapacity(aliases.length); for (String alias : aliases) { Certificate cert = trustedKeyStore.getCertificate(alias); if (cert == null) { log.warn("Trust-store reports it contains certificate for alias '{}' but certificate is null", alias); continue; } certificates.add(cert); } return certificates; } finally { trustedKeyStoreLock.readLock().unlock(); } } KeyStoreManagerImpl(final CryptoHelper crypto,
                             final KeyStoreStorageManager storageManager,
                             final KeyStoreManagerConfiguration config); @VisibleForTesting  KeyStoreManagerImpl(final CryptoHelper crypto,
                      final KeyStoreManagerConfiguration config,
                      final KeystoreInstance privateKeyStore,
                      final KeystoreInstance trustedKeyStore); @Override TrustManager[] getTrustManagers(); @Override KeyManager[] getKeyManagers(); @Override void importTrustCertificate(Certificate certificate, String alias); @Override void importTrustCertificate(String certificateInPEM, String alias); @Override Certificate getTrustedCertificate(String alias); @Override Collection<Certificate> getTrustedCertificates(); @Override void removeTrustCertificate(String alias); @Override void generateAndStoreKeyPair(final String commonName,
                                      final String organizationalUnit,
                                      final String organization,
                                      final String locality,
                                      final String state,
                                      final String country); @Override boolean isKeyPairInitialized(); @Override Certificate getCertificate(); @Override PrivateKey getPrivateKey(); @Override void removePrivateKey();  }