log.trace("Global truststore is not correctly initialized. Using local truststore configuration");
delegate.init(spec);
}
else
{
CertPathTrustManagerParameters parameters = (CertPathTrustManagerParameters) spec;
PKIXBuilderParameters oldParams = (PKIXBuilderParameters) parameters.getParameters();
PKIXBuilderParameters xparams = null;
try
{
xparams = new PKIXBuilderParameters(trustStore, new X509CertSelector());
xparams.setAnyPolicyInhibited(oldParams.isAnyPolicyInhibited());
xparams.setCertPathCheckers(oldParams.getCertPathCheckers());
xparams.setCertStores(oldParams.getCertStores());
xparams.setDate(oldParams.getDate());
xparams.setExplicitPolicyRequired(oldParams.isExplicitPolicyRequired());
xparams.setInitialPolicies(oldParams.getInitialPolicies());
xparams.setMaxPathLength(oldParams.getMaxPathLength());
xparams.setPolicyMappingInhibited(oldParams.isPolicyMappingInhibited());
xparams.setPolicyQualifiersRejected(oldParams.getPolicyQualifiersRejected());
xparams.setRevocationEnabled(oldParams.isRevocationEnabled());
xparams.setSigProvider(oldParams.getSigProvider());
}
catch (KeyStoreException ke)
{
log.error("Error initializing TrustManagerFactory", ke);
}
if (log.isTraceEnabled())
log.trace("Using global truststore configuration");
ManagerFactoryParameters mfp = new CertPathTrustManagerParameters(xparams);
delegate.init(mfp);
}
}