what-the-bank/sources/org/bouncycastle/x509/ExtendedPKIXBuilderParamete...

81 lines
3.2 KiB
Java

package org.bouncycastle.x509;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidParameterException;
import java.security.cert.PKIXBuilderParameters;
import java.security.cert.PKIXParameters;
import java.security.cert.X509CertSelector;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.bouncycastle.util.Selector;
/* loaded from: classes6.dex */
public class ExtendedPKIXBuilderParameters extends ExtendedPKIXParameters {
private Set excludedCerts;
private int maxPathLength;
/* JADX INFO: Access modifiers changed from: protected */
@Override // org.bouncycastle.x509.ExtendedPKIXParameters
public void setParams(PKIXParameters pKIXParameters) {
super.setParams(pKIXParameters);
if (pKIXParameters instanceof ExtendedPKIXBuilderParameters) {
ExtendedPKIXBuilderParameters extendedPKIXBuilderParameters = (ExtendedPKIXBuilderParameters) pKIXParameters;
this.maxPathLength = extendedPKIXBuilderParameters.maxPathLength;
this.excludedCerts = new HashSet(extendedPKIXBuilderParameters.excludedCerts);
}
if (pKIXParameters instanceof PKIXBuilderParameters) {
this.maxPathLength = ((PKIXBuilderParameters) pKIXParameters).getMaxPathLength();
}
}
public void setMaxPathLength(int i) {
if (i < -1) {
throw new InvalidParameterException("The maximum path length parameter can not be less than -1.");
}
this.maxPathLength = i;
}
public void setExcludedCerts(Set set) {
if (set != null) {
this.excludedCerts = new HashSet(set);
}
}
public int getMaxPathLength() {
return this.maxPathLength;
}
public Set getExcludedCerts() {
return Collections.unmodifiableSet(this.excludedCerts);
}
@Override // org.bouncycastle.x509.ExtendedPKIXParameters, java.security.cert.PKIXParameters, java.security.cert.CertPathParameters
public Object clone() {
try {
ExtendedPKIXBuilderParameters extendedPKIXBuilderParameters = new ExtendedPKIXBuilderParameters(getTrustAnchors(), getTargetConstraints());
extendedPKIXBuilderParameters.setParams(this);
return extendedPKIXBuilderParameters;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
public static ExtendedPKIXParameters getInstance(PKIXParameters pKIXParameters) {
try {
ExtendedPKIXBuilderParameters extendedPKIXBuilderParameters = new ExtendedPKIXBuilderParameters(pKIXParameters.getTrustAnchors(), X509CertStoreSelector.getInstance((X509CertSelector) pKIXParameters.getTargetCertConstraints()));
extendedPKIXBuilderParameters.setParams(pKIXParameters);
return extendedPKIXBuilderParameters;
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
public ExtendedPKIXBuilderParameters(Set set, Selector selector) throws InvalidAlgorithmParameterException {
super(set);
this.maxPathLength = 5;
this.excludedCerts = Collections.EMPTY_SET;
setTargetConstraints(selector);
}
}