@Test(expected = CertificateParsingException.class) public void testImportNullPEMString() throws Exception { keyStoreManager.importTrustCertificate((String) null, "empty-cert-alias"); }
@Override public void importTrustCertificate(Certificate certificate, String alias) throws KeystoreException { trustedKeyStoreLock.writeLock().lock(); try { log.debug("Importing trust certificate w/alias: {}", alias); if (trustedKeyStore.getCertificate(alias) != null) { log.warn("Certificate already exists in trust-store w/alias: {}; replacing certificate", alias); trustedKeyStore.deleteEntry(alias, config.getTrustedKeyStorePassword()); } trustedKeyStore.importTrustCertificate(certificate, alias, config.getTrustedKeyStorePassword()); logTrustedCertificateAliases(trustedKeyStore); getTrustManagers(); } finally { trustedKeyStoreLock.writeLock().unlock(); } }
KeyStoreManagerImpl extends ComponentSupport implements KeyStoreManager { @Override public void importTrustCertificate(Certificate certificate, String alias) throws KeystoreException { trustedKeyStoreLock.writeLock().lock(); try { log.debug("Importing trust certificate w/alias: {}", alias); if (trustedKeyStore.getCertificate(alias) != null) { log.warn("Certificate already exists in trust-store w/alias: {}; replacing certificate", alias); trustedKeyStore.deleteEntry(alias, config.getTrustedKeyStorePassword()); } trustedKeyStore.importTrustCertificate(certificate, alias, config.getTrustedKeyStorePassword()); logTrustedCertificateAliases(trustedKeyStore); getTrustManagers(); } finally { trustedKeyStoreLock.writeLock().unlock(); } } }
KeyStoreManagerImpl extends ComponentSupport implements KeyStoreManager { @Override public void importTrustCertificate(Certificate certificate, String alias) throws KeystoreException { trustedKeyStoreLock.writeLock().lock(); try { log.debug("Importing trust certificate w/alias: {}", alias); if (trustedKeyStore.getCertificate(alias) != null) { log.warn("Certificate already exists in trust-store w/alias: {}; replacing certificate", alias); trustedKeyStore.deleteEntry(alias, config.getTrustedKeyStorePassword()); } trustedKeyStore.importTrustCertificate(certificate, alias, config.getTrustedKeyStorePassword()); logTrustedCertificateAliases(trustedKeyStore); getTrustManagers(); } finally { trustedKeyStoreLock.writeLock().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 void importTrustCertificate(Certificate certificate, String alias) throws KeystoreException { trustedKeyStoreLock.writeLock().lock(); try { log.debug("Importing trust certificate w/alias: {}", alias); if (trustedKeyStore.getCertificate(alias) != null) { log.warn("Certificate already exists in trust-store w/alias: {}; replacing certificate", alias); trustedKeyStore.deleteEntry(alias, config.getTrustedKeyStorePassword()); } trustedKeyStore.importTrustCertificate(certificate, alias, config.getTrustedKeyStorePassword()); logTrustedCertificateAliases(trustedKeyStore); getTrustManagers(); } finally { trustedKeyStoreLock.writeLock().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 void importTrustCertificate(Certificate certificate, String alias) throws KeystoreException { trustedKeyStoreLock.writeLock().lock(); try { log.debug("Importing trust certificate w/alias: {}", alias); if (trustedKeyStore.getCertificate(alias) != null) { log.warn("Certificate already exists in trust-store w/alias: {}; replacing certificate", alias); trustedKeyStore.deleteEntry(alias, config.getTrustedKeyStorePassword()); } trustedKeyStore.importTrustCertificate(certificate, alias, config.getTrustedKeyStorePassword()); logTrustedCertificateAliases(trustedKeyStore); getTrustManagers(); } finally { trustedKeyStoreLock.writeLock().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();  }