use of com.sun.enterprise.security.ssl.manager.UnifiedX509TrustManager in project Payara by payara.
the class SecuritySupportImpl method getTrustManagers.
public TrustManager[] getTrustManagers(String algorithm) throws IOException, KeyStoreException, NoSuchAlgorithmException {
KeyStore[] tstores = getTrustStores();
ArrayList<TrustManager> trustManagers = new ArrayList<TrustManager>();
for (KeyStore tstore : tstores) {
checkCertificateDates(tstore);
TrustManagerFactory tmf = TrustManagerFactory.getInstance((algorithm != null) ? algorithm : TrustManagerFactory.getDefaultAlgorithm());
tmf.init(tstore);
TrustManager[] tmgrs = tmf.getTrustManagers();
if (tmgrs != null) {
trustManagers.addAll(Arrays.asList(tmgrs));
}
}
TrustManager trustManager;
if (trustManagers.size() == 1) {
trustManager = trustManagers.get(0);
} else {
trustManager = new UnifiedX509TrustManager(trustManagers.toArray(new X509TrustManager[trustManagers.size()]));
}
return new TrustManager[] { trustManager };
}
Aggregations