protected TrustManager[] getTrustManagers(String keystoreType,
String algorithm) throws Exception {
if(attributes.get("truststoreAlgorithm") == null) {
// in 1.5, the Trust default isn't the same as the Key default.
algorithm = TrustManagerFactory.getDefaultAlgorithm();
}
String crlf = (String)attributes.get("crlFile");
if(crlf == null) {
return super.getTrustManagers(keystoreType, algorithm);
}
TrustManager[] tms = null;
String truststoreType = (String)attributes.get("truststoreType");
if(truststoreType == null) {
truststoreType = keystoreType;
}
KeyStore trustStore = getTrustStore(truststoreType);
if (trustStore != null) {
TrustManagerFactory tmf = TrustManagerFactory.getInstance(algorithm);
CertPathParameters params = getParameters(algorithm, crlf, trustStore);
ManagerFactoryParameters mfp = new CertPathTrustManagerParameters(params);
tmf.init(mfp);
tms = tmf.getTrustManagers();
}
return tms;
}
Gets the intialized trust managers. |