package org.bouncycastle.jce.provider; import java.security.InvalidAlgorithmParameterException; import java.security.cert.CertPath; import java.security.cert.CertPathParameters; import java.security.cert.CertPathValidatorException; import java.security.cert.CertPathValidatorResult; import java.security.cert.CertPathValidatorSpi; import java.security.cert.PKIXParameters; import java.util.HashSet; import org.bouncycastle.jcajce.PKIXExtendedParameters; import org.bouncycastle.jcajce.util.BCJcaJceHelper; import org.bouncycastle.jcajce.util.JcaJceHelper; import org.bouncycastle.x509.ExtendedPKIXParameters; import org.bouncycastle.x509.X509AttributeCertStoreSelector; /* loaded from: classes6.dex */ public class PKIXAttrCertPathValidatorSpi extends CertPathValidatorSpi { private final JcaJceHelper helper = new BCJcaJceHelper(); @Override // java.security.cert.CertPathValidatorSpi public CertPathValidatorResult engineValidate(CertPath certPath, CertPathParameters certPathParameters) throws CertPathValidatorException, InvalidAlgorithmParameterException { PKIXExtendedParameters pKIXExtendedParameters; boolean z = certPathParameters instanceof ExtendedPKIXParameters; if (!z && !(certPathParameters instanceof PKIXExtendedParameters)) { StringBuilder sb = new StringBuilder("Parameters must be a "); sb.append(ExtendedPKIXParameters.class.getName()); sb.append(" instance."); throw new InvalidAlgorithmParameterException(sb.toString()); } new HashSet(); new HashSet(); new HashSet(); new HashSet(); if (certPathParameters instanceof PKIXParameters) { PKIXExtendedParameters.Builder builder = new PKIXExtendedParameters.Builder((PKIXParameters) certPathParameters); if (z) { ExtendedPKIXParameters extendedPKIXParameters = (ExtendedPKIXParameters) certPathParameters; builder.setUseDeltasEnabled(extendedPKIXParameters.isUseDeltasEnabled()); builder.setValidityModel(extendedPKIXParameters.getValidityModel()); extendedPKIXParameters.getAttrCertCheckers(); extendedPKIXParameters.getProhibitedACAttributes(); extendedPKIXParameters.getNecessaryACAttributes(); } pKIXExtendedParameters = builder.build(); } else { pKIXExtendedParameters = (PKIXExtendedParameters) certPathParameters; } pKIXExtendedParameters.getTargetConstraints(); StringBuilder sb2 = new StringBuilder("TargetConstraints must be an instance of "); sb2.append(X509AttributeCertStoreSelector.class.getName()); sb2.append(" for "); sb2.append(getClass().getName()); sb2.append(" class."); throw new InvalidAlgorithmParameterException(sb2.toString()); } }