@Override protected TrustManager[] createTrustManagers() throws GeneralSecurityException { TrustManager[] tm = null; if (trustCerts != null && trustCerts.length > 0) { final KeyStore ks = KeyStoreUtils.newInstance(); KeyStoreUtils.setCertificateEntry("ldap_trust_", ks, trustCerts); final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); tm = tmf.getTrustManagers(); } return tm; }
/** * Creates a new trust manager factory. * * @param certs to add as trusted material * * @return trust manager factory * * @throws GeneralSecurityException if the trust manager factory cannot be initialized */ protected TrustManagerFactory getTrustManagerFactory(final X509Certificate[] certs) throws GeneralSecurityException { final KeyStore ks = KeyStoreUtils.newInstance(); KeyStoreUtils.setCertificateEntry("ldap_trust_", ks, certs); final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); return tmf; }
/** * Creates a new trust manager factory. * * @param certs to add as trusted material * * @return trust manager factory * * @throws GeneralSecurityException if the trust manager factory cannot be initialized */ protected TrustManagerFactory getTrustManagerFactory(final X509Certificate[] certs) throws GeneralSecurityException { final KeyStore ks = KeyStoreUtils.newInstance(); KeyStoreUtils.setCertificateEntry("ldap_trust_", ks, certs); final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); return tmf; }