586 lines
26 KiB
Java
586 lines
26 KiB
Java
|
package o;
|
||
|
|
||
|
import com.huawei.hms.android.SystemUtils;
|
||
|
import java.io.ByteArrayOutputStream;
|
||
|
import java.io.IOException;
|
||
|
import java.math.BigInteger;
|
||
|
import java.security.GeneralSecurityException;
|
||
|
import java.security.PublicKey;
|
||
|
import java.security.cert.CRLException;
|
||
|
import java.security.cert.CertPath;
|
||
|
import java.security.cert.CertPathValidatorException;
|
||
|
import java.security.cert.CertStore;
|
||
|
import java.security.cert.CertStoreException;
|
||
|
import java.security.cert.Certificate;
|
||
|
import java.security.cert.CertificateParsingException;
|
||
|
import java.security.cert.PolicyQualifierInfo;
|
||
|
import java.security.cert.TrustAnchor;
|
||
|
import java.security.cert.X509CRL;
|
||
|
import java.security.cert.X509CRLEntry;
|
||
|
import java.security.cert.X509CRLSelector;
|
||
|
import java.security.cert.X509CertSelector;
|
||
|
import java.security.cert.X509Certificate;
|
||
|
import java.security.cert.X509Extension;
|
||
|
import java.security.interfaces.DSAParams;
|
||
|
import java.security.interfaces.DSAPublicKey;
|
||
|
import java.security.spec.DSAPublicKeySpec;
|
||
|
import java.text.ParseException;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collection;
|
||
|
import java.util.Collections;
|
||
|
import java.util.Date;
|
||
|
import java.util.Enumeration;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.LinkedHashSet;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import java.util.Set;
|
||
|
import javax.security.auth.x500.X500Principal;
|
||
|
import o.C15425gqD;
|
||
|
import o.C15454gqw;
|
||
|
import org.bouncycastle.jce.provider.RFC3280CertPathUtilities;
|
||
|
import org.spongycastle.asn1.ASN1Integer;
|
||
|
import org.spongycastle.jce.exception.ExtCertPathValidatorException;
|
||
|
import org.spongycastle.jce.provider.AnnotatedException;
|
||
|
import org.spongycastle.util.StoreException;
|
||
|
|
||
|
/* renamed from: o.gra, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes6.dex */
|
||
|
final class C15473gra {
|
||
|
private static String a;
|
||
|
private static String b;
|
||
|
private static String c;
|
||
|
|
||
|
C15473gra() {
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
new C15478grf();
|
||
|
String str = C15394gpK.i.d;
|
||
|
String str2 = C15394gpK.b.d;
|
||
|
String str3 = C15394gpK.q.d;
|
||
|
String str4 = C15394gpK.s.d;
|
||
|
String str5 = C15394gpK.l.d;
|
||
|
String str6 = C15394gpK.n.d;
|
||
|
String str7 = C15394gpK.f.d;
|
||
|
c = C15394gpK.f9146o.d;
|
||
|
String str8 = C15394gpK.h.d;
|
||
|
String str9 = C15394gpK.m.d;
|
||
|
String str10 = C15394gpK.j.d;
|
||
|
String str11 = C15394gpK.c.d;
|
||
|
b = C15394gpK.d.d;
|
||
|
a = C15394gpK.e.d;
|
||
|
new String[]{"unspecified", "keyCompromise", "cACompromise", "affiliationChanged", "superseded", "cessationOfOperation", "certificateHold", SystemUtils.UNKNOWN, "removeFromCRL", "privilegeWithdrawn", "aACompromise"};
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static TrustAnchor e(X509Certificate x509Certificate, Set set, String str) throws AnnotatedException {
|
||
|
X509CertSelector x509CertSelector = new X509CertSelector();
|
||
|
C15417gpt d = C15484grl.d(x509Certificate);
|
||
|
try {
|
||
|
x509CertSelector.setSubject(d.l());
|
||
|
Iterator it = set.iterator();
|
||
|
TrustAnchor trustAnchor = null;
|
||
|
Exception exc = null;
|
||
|
PublicKey publicKey = null;
|
||
|
while (it.hasNext() && trustAnchor == null) {
|
||
|
trustAnchor = (TrustAnchor) it.next();
|
||
|
if (trustAnchor.getTrustedCert() != null) {
|
||
|
if (x509CertSelector.match(trustAnchor.getTrustedCert())) {
|
||
|
publicKey = trustAnchor.getTrustedCert().getPublicKey();
|
||
|
}
|
||
|
trustAnchor = null;
|
||
|
} else {
|
||
|
if (trustAnchor.getCAName() != null && trustAnchor.getCAPublicKey() != null) {
|
||
|
try {
|
||
|
if (d.equals(C15417gpt.c(trustAnchor.getCA().getEncoded()))) {
|
||
|
publicKey = trustAnchor.getCAPublicKey();
|
||
|
}
|
||
|
} catch (IllegalArgumentException unused) {
|
||
|
}
|
||
|
}
|
||
|
trustAnchor = null;
|
||
|
}
|
||
|
if (publicKey != null) {
|
||
|
if (str == null) {
|
||
|
try {
|
||
|
x509Certificate.verify(publicKey);
|
||
|
} catch (Exception e) {
|
||
|
exc = e;
|
||
|
trustAnchor = null;
|
||
|
publicKey = null;
|
||
|
}
|
||
|
} else {
|
||
|
x509Certificate.verify(publicKey, str);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (trustAnchor != null || exc == null) {
|
||
|
return trustAnchor;
|
||
|
}
|
||
|
throw new AnnotatedException("TrustAnchor found but certificate validation failed.", exc);
|
||
|
} catch (IOException e2) {
|
||
|
throw new AnnotatedException("Cannot set subject search criteria for trust anchor.", e2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static List<InterfaceC15455gqx> e(byte[] bArr, Map<gpO, InterfaceC15455gqx> map) throws CertificateParsingException {
|
||
|
if (bArr != null) {
|
||
|
byte[] b2 = gnD.b((Object) bArr).b();
|
||
|
gpO[] gpoArr = (b2 != null ? new gpP(AbstractC15317gnH.a(b2)) : null).b;
|
||
|
int length = gpoArr.length;
|
||
|
gpO[] gpoArr2 = new gpO[length];
|
||
|
System.arraycopy(gpoArr, 0, gpoArr2, 0, gpoArr.length);
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
for (int i = 0; i != length; i++) {
|
||
|
InterfaceC15455gqx interfaceC15455gqx = map.get(gpoArr2[i]);
|
||
|
if (interfaceC15455gqx != null) {
|
||
|
arrayList.add(interfaceC15455gqx);
|
||
|
}
|
||
|
}
|
||
|
return arrayList;
|
||
|
}
|
||
|
return Collections.EMPTY_LIST;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static boolean c(X509Certificate x509Certificate) {
|
||
|
return x509Certificate.getSubjectDN().equals(x509Certificate.getIssuerDN());
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static AbstractC15315gnE a(X509Extension x509Extension, String str) throws AnnotatedException {
|
||
|
byte[] extensionValue = x509Extension.getExtensionValue(str);
|
||
|
if (extensionValue == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return b(str, extensionValue);
|
||
|
}
|
||
|
|
||
|
private static AbstractC15315gnE b(String str, byte[] bArr) throws AnnotatedException {
|
||
|
try {
|
||
|
return new C15348gnx(((gnD) new C15348gnx(bArr).b()).b()).b();
|
||
|
} catch (Exception e) {
|
||
|
throw new AnnotatedException("exception processing extension ".concat(String.valueOf(str)), e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static C15423gpz b(PublicKey publicKey) throws CertPathValidatorException {
|
||
|
try {
|
||
|
AbstractC15315gnE b2 = new C15348gnx(publicKey.getEncoded()).b();
|
||
|
return (b2 != null ? new gpZ(AbstractC15317gnH.a(b2)) : null).e;
|
||
|
} catch (Exception e) {
|
||
|
throw new ExtCertPathValidatorException("Subject public key cannot be decoded.", e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static final Set b(AbstractC15317gnH abstractC15317gnH) throws CertPathValidatorException {
|
||
|
HashSet hashSet = new HashSet();
|
||
|
if (abstractC15317gnH == null) {
|
||
|
return hashSet;
|
||
|
}
|
||
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||
|
gnG gng = new gnG(byteArrayOutputStream);
|
||
|
Enumeration b2 = abstractC15317gnH.b();
|
||
|
while (b2.hasMoreElements()) {
|
||
|
try {
|
||
|
gng.d((InterfaceC15342gnr) b2.nextElement());
|
||
|
hashSet.add(new PolicyQualifierInfo(byteArrayOutputStream.toByteArray()));
|
||
|
byteArrayOutputStream.reset();
|
||
|
} catch (IOException e) {
|
||
|
throw new ExtCertPathValidatorException("Policy qualifier info cannot be decoded.", e);
|
||
|
}
|
||
|
}
|
||
|
return hashSet;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static C15485grm a(C15485grm c15485grm, List[] listArr, C15485grm c15485grm2) {
|
||
|
C15485grm c15485grm3 = (C15485grm) c15485grm2.getParent();
|
||
|
if (c15485grm == null) {
|
||
|
return null;
|
||
|
}
|
||
|
if (c15485grm3 == null) {
|
||
|
for (int i = 0; i < listArr.length; i++) {
|
||
|
listArr[i] = new ArrayList();
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
c15485grm3.d.remove(c15485grm2);
|
||
|
c(listArr, c15485grm2);
|
||
|
return c15485grm;
|
||
|
}
|
||
|
|
||
|
private static void c(List[] listArr, C15485grm c15485grm) {
|
||
|
listArr[c15485grm.getDepth()].remove(c15485grm);
|
||
|
if (!c15485grm.d.isEmpty()) {
|
||
|
Iterator children = c15485grm.getChildren();
|
||
|
while (children.hasNext()) {
|
||
|
c(listArr, (C15485grm) children.next());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static boolean a(int i, List[] listArr, C15314gnC c15314gnC, Set set) {
|
||
|
List list = listArr[i - 1];
|
||
|
for (int i2 = 0; i2 < list.size(); i2++) {
|
||
|
C15485grm c15485grm = (C15485grm) list.get(i2);
|
||
|
if (c15485grm.getExpectedPolicies().contains(c15314gnC.d)) {
|
||
|
HashSet hashSet = new HashSet();
|
||
|
hashSet.add(c15314gnC.d);
|
||
|
C15485grm c15485grm2 = new C15485grm(new ArrayList(), i, hashSet, c15485grm, set, c15314gnC.d, false);
|
||
|
c15485grm.d.add(c15485grm2);
|
||
|
c15485grm2.b = c15485grm;
|
||
|
listArr[i].add(c15485grm2);
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static void d(int i, List[] listArr, C15314gnC c15314gnC, Set set) {
|
||
|
List list = listArr[i - 1];
|
||
|
for (int i2 = 0; i2 < list.size(); i2++) {
|
||
|
C15485grm c15485grm = (C15485grm) list.get(i2);
|
||
|
if (RFC3280CertPathUtilities.ANY_POLICY.equals(c15485grm.getValidPolicy())) {
|
||
|
HashSet hashSet = new HashSet();
|
||
|
hashSet.add(c15314gnC.d);
|
||
|
C15485grm c15485grm2 = new C15485grm(new ArrayList(), i, hashSet, c15485grm, set, c15314gnC.d, false);
|
||
|
c15485grm.d.add(c15485grm2);
|
||
|
c15485grm2.b = c15485grm;
|
||
|
listArr[i].add(c15485grm2);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static boolean d(Set set) {
|
||
|
return set == null || set.contains(RFC3280CertPathUtilities.ANY_POLICY) || set.isEmpty();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static Collection b(C15425gqD c15425gqD, List list) throws AnnotatedException {
|
||
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
||
|
for (Object obj : list) {
|
||
|
if (obj instanceof InterfaceC15465grJ) {
|
||
|
try {
|
||
|
linkedHashSet.addAll(((InterfaceC15465grJ) obj).b());
|
||
|
} catch (StoreException e) {
|
||
|
throw new AnnotatedException("Problem while picking certificates from X.509 store.", e);
|
||
|
}
|
||
|
} else {
|
||
|
try {
|
||
|
linkedHashSet.addAll(((CertStore) obj).getCertificates(new C15425gqD.HBt(c15425gqD)));
|
||
|
} catch (CertStoreException e2) {
|
||
|
throw new AnnotatedException("Problem while picking certificates from certificate store.", e2);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return linkedHashSet;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static List<InterfaceC15456gqy> d(gpC gpc, Map<gpO, InterfaceC15456gqy> map) throws AnnotatedException {
|
||
|
gpP gpp;
|
||
|
if (gpc != null) {
|
||
|
try {
|
||
|
C15392gpI[] d = gpc.d();
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
for (C15392gpI c15392gpI : d) {
|
||
|
C15395gpL c15395gpL = c15392gpI.d;
|
||
|
if (c15395gpL != null && c15395gpL.e == 0) {
|
||
|
InterfaceC15342gnr interfaceC15342gnr = c15395gpL.c;
|
||
|
if (interfaceC15342gnr instanceof gpP) {
|
||
|
gpp = (gpP) interfaceC15342gnr;
|
||
|
} else {
|
||
|
gpp = interfaceC15342gnr != null ? new gpP(AbstractC15317gnH.a(interfaceC15342gnr)) : null;
|
||
|
}
|
||
|
gpO[] gpoArr = gpp.b;
|
||
|
int length = gpoArr.length;
|
||
|
gpO[] gpoArr2 = new gpO[length];
|
||
|
System.arraycopy(gpoArr, 0, gpoArr2, 0, gpoArr.length);
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
InterfaceC15456gqy interfaceC15456gqy = map.get(gpoArr2[i]);
|
||
|
if (interfaceC15456gqy != null) {
|
||
|
arrayList.add(interfaceC15456gqy);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return arrayList;
|
||
|
} catch (Exception e) {
|
||
|
throw new AnnotatedException("Distribution points could not be read.", e);
|
||
|
}
|
||
|
}
|
||
|
return Collections.EMPTY_LIST;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static void a(Date date, X509CRL x509crl, Object obj, gqY gqy) throws AnnotatedException {
|
||
|
X509CRLEntry revokedCertificate;
|
||
|
C15417gpt c2;
|
||
|
try {
|
||
|
if (C15491grs.a(x509crl)) {
|
||
|
revokedCertificate = x509crl.getRevokedCertificate(((X509Certificate) obj).getSerialNumber());
|
||
|
if (revokedCertificate == null) {
|
||
|
return;
|
||
|
}
|
||
|
X500Principal certificateIssuer = revokedCertificate.getCertificateIssuer();
|
||
|
if (certificateIssuer != null) {
|
||
|
c2 = C15417gpt.c(certificateIssuer.getEncoded());
|
||
|
} else {
|
||
|
c2 = C15417gpt.c(x509crl.getIssuerX500Principal().getEncoded());
|
||
|
}
|
||
|
if (!C15484grl.d(obj).equals(c2)) {
|
||
|
return;
|
||
|
}
|
||
|
} else if (!C15484grl.d(obj).equals(C15417gpt.c(x509crl.getIssuerX500Principal().getEncoded())) || (revokedCertificate = x509crl.getRevokedCertificate(((X509Certificate) obj).getSerialNumber())) == null) {
|
||
|
return;
|
||
|
}
|
||
|
C15350gnz c15350gnz = null;
|
||
|
AbstractC15315gnE b2 = null;
|
||
|
if (revokedCertificate.hasExtensions()) {
|
||
|
try {
|
||
|
String str = C15394gpK.r.d;
|
||
|
byte[] extensionValue = revokedCertificate.getExtensionValue(str);
|
||
|
if (extensionValue != null) {
|
||
|
b2 = b(str, extensionValue);
|
||
|
}
|
||
|
c15350gnz = C15350gnz.a(b2);
|
||
|
} catch (Exception e) {
|
||
|
throw new AnnotatedException("Reason code CRL entry extension could not be decoded.", e);
|
||
|
}
|
||
|
}
|
||
|
if (date.getTime() >= revokedCertificate.getRevocationDate().getTime() || c15350gnz == null || new BigInteger(c15350gnz.a).intValue() == 0 || new BigInteger(c15350gnz.a).intValue() == 1 || new BigInteger(c15350gnz.a).intValue() == 2 || new BigInteger(c15350gnz.a).intValue() == 8) {
|
||
|
if (c15350gnz != null) {
|
||
|
gqy.c = new BigInteger(c15350gnz.a).intValue();
|
||
|
} else {
|
||
|
gqy.c = 0;
|
||
|
}
|
||
|
gqy.e = revokedCertificate.getRevocationDate();
|
||
|
}
|
||
|
} catch (CRLException e2) {
|
||
|
throw new AnnotatedException("Failed check for indirect CRL.", e2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static Set e(Date date, X509CRL x509crl, List<CertStore> list, List<InterfaceC15456gqy> list2) throws AnnotatedException {
|
||
|
X509CRLSelector x509CRLSelector = new X509CRLSelector();
|
||
|
try {
|
||
|
x509CRLSelector.addIssuerName(C15417gpt.c(x509crl.getIssuerX500Principal().getEncoded()).l());
|
||
|
try {
|
||
|
String str = a;
|
||
|
byte[] extensionValue = x509crl.getExtensionValue(str);
|
||
|
byte[] bArr = null;
|
||
|
AbstractC15315gnE b2 = extensionValue == null ? null : b(str, extensionValue);
|
||
|
BigInteger bigInteger = b2 != null ? new BigInteger(1, ASN1Integer.e((Object) b2).b) : null;
|
||
|
try {
|
||
|
byte[] extensionValue2 = x509crl.getExtensionValue(c);
|
||
|
x509CRLSelector.setMinCRLNumber(bigInteger == null ? null : bigInteger.add(BigInteger.valueOf(1L)));
|
||
|
C15454gqw.HBt hBt = new C15454gqw.HBt(x509CRLSelector);
|
||
|
if (extensionValue2 != null) {
|
||
|
bArr = new byte[extensionValue2.length];
|
||
|
System.arraycopy(extensionValue2, 0, bArr, 0, extensionValue2.length);
|
||
|
}
|
||
|
hBt.d = bArr;
|
||
|
hBt.c = true;
|
||
|
hBt.f = bigInteger;
|
||
|
Set<X509CRL> b3 = C15478grf.b(new C15454gqw(hBt, (byte) 0), date, list, list2);
|
||
|
HashSet hashSet = new HashSet();
|
||
|
for (X509CRL x509crl2 : b3) {
|
||
|
Set<String> criticalExtensionOIDs = x509crl2.getCriticalExtensionOIDs();
|
||
|
if (criticalExtensionOIDs != null && criticalExtensionOIDs.contains(C15492grt.e)) {
|
||
|
hashSet.add(x509crl2);
|
||
|
}
|
||
|
}
|
||
|
return hashSet;
|
||
|
} catch (Exception e) {
|
||
|
throw new AnnotatedException("Issuing distribution point extension value could not be read.", e);
|
||
|
}
|
||
|
} catch (Exception e2) {
|
||
|
throw new AnnotatedException("CRL number extension could not be extracted from CRL.", e2);
|
||
|
}
|
||
|
} catch (IOException e3) {
|
||
|
throw new AnnotatedException("Cannot extract issuer from CRL.", e3);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static Set d(C15392gpI c15392gpI, Object obj, C15457gqz c15457gqz) throws AnnotatedException {
|
||
|
X509CRLSelector x509CRLSelector = new X509CRLSelector();
|
||
|
try {
|
||
|
HashSet hashSet = new HashSet();
|
||
|
hashSet.add(C15484grl.d(obj));
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
if (c15392gpI.c != null) {
|
||
|
gpO[] gpoArr = c15392gpI.c.b;
|
||
|
int length = gpoArr.length;
|
||
|
gpO[] gpoArr2 = new gpO[length];
|
||
|
System.arraycopy(gpoArr, 0, gpoArr2, 0, gpoArr.length);
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
if (gpoArr2[i].e == 4) {
|
||
|
try {
|
||
|
arrayList.add(C15417gpt.c(gpoArr2[i].d.i().l()));
|
||
|
} catch (IOException e) {
|
||
|
throw new AnnotatedException("CRL issuer information from distribution point cannot be decoded.", e);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
if (c15392gpI.d == null) {
|
||
|
throw new AnnotatedException("CRL issuer is omitted from distribution point but no distributionPoint field present.");
|
||
|
}
|
||
|
Iterator it = hashSet.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
arrayList.add(it.next());
|
||
|
}
|
||
|
}
|
||
|
Iterator it2 = arrayList.iterator();
|
||
|
while (it2.hasNext()) {
|
||
|
try {
|
||
|
x509CRLSelector.addIssuerName(((C15417gpt) it2.next()).l());
|
||
|
} catch (IOException e2) {
|
||
|
throw new AnnotatedException("Cannot decode CRL issuer information.", e2);
|
||
|
}
|
||
|
}
|
||
|
if (obj instanceof X509Certificate) {
|
||
|
x509CRLSelector.setCertificateChecking((X509Certificate) obj);
|
||
|
}
|
||
|
C15454gqw.HBt hBt = new C15454gqw.HBt(x509CRLSelector);
|
||
|
hBt.a = true;
|
||
|
C15454gqw c15454gqw = new C15454gqw(hBt, (byte) 0);
|
||
|
new Date(c15457gqz.a.getTime());
|
||
|
Set b2 = C15478grf.b(c15454gqw, new Date(c15457gqz.a.getTime()), c15457gqz.b.getCertStores(), c15457gqz.d);
|
||
|
if (!b2.isEmpty()) {
|
||
|
return b2;
|
||
|
}
|
||
|
if (obj instanceof InterfaceC15508gsd) {
|
||
|
StringBuilder sb = new StringBuilder("No CRLs found for issuer \"");
|
||
|
sb.append(((InterfaceC15508gsd) obj).e().e()[0]);
|
||
|
sb.append("\"");
|
||
|
throw new AnnotatedException(sb.toString());
|
||
|
}
|
||
|
StringBuilder sb2 = new StringBuilder("No CRLs found for issuer \"");
|
||
|
sb2.append(C15420gpw.d.a(C15417gpt.c(((X509Certificate) obj).getIssuerX500Principal().getEncoded())));
|
||
|
sb2.append("\"");
|
||
|
throw new AnnotatedException(sb2.toString());
|
||
|
} catch (AnnotatedException e3) {
|
||
|
throw new AnnotatedException("Could not get issuer information from distribution point.", e3);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static Date a(C15457gqz c15457gqz, CertPath certPath, int i) throws AnnotatedException {
|
||
|
if (c15457gqz.l != 1) {
|
||
|
return new Date(c15457gqz.a.getTime());
|
||
|
}
|
||
|
if (i <= 0) {
|
||
|
return new Date(c15457gqz.a.getTime());
|
||
|
}
|
||
|
int i2 = i - 1;
|
||
|
if (i2 == 0) {
|
||
|
try {
|
||
|
byte[] extensionValue = ((X509Certificate) certPath.getCertificates().get(i2)).getExtensionValue(InterfaceC15398gpa.c.d);
|
||
|
C15349gny d = extensionValue != null ? C15349gny.d(AbstractC15315gnE.b(extensionValue)) : null;
|
||
|
if (d != null) {
|
||
|
try {
|
||
|
return d.e();
|
||
|
} catch (ParseException e) {
|
||
|
throw new AnnotatedException("Date from date of cert gen extension could not be parsed.", e);
|
||
|
}
|
||
|
}
|
||
|
return ((X509Certificate) certPath.getCertificates().get(i2)).getNotBefore();
|
||
|
} catch (IOException unused) {
|
||
|
throw new AnnotatedException("Date of cert gen extension could not be read.");
|
||
|
} catch (IllegalArgumentException unused2) {
|
||
|
throw new AnnotatedException("Date of cert gen extension could not be read.");
|
||
|
}
|
||
|
}
|
||
|
return ((X509Certificate) certPath.getCertificates().get(i2)).getNotBefore();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static PublicKey c(List list, int i, gqQ gqq) throws CertPathValidatorException {
|
||
|
DSAPublicKey dSAPublicKey;
|
||
|
PublicKey publicKey = ((Certificate) list.get(i)).getPublicKey();
|
||
|
if (!(publicKey instanceof DSAPublicKey)) {
|
||
|
return publicKey;
|
||
|
}
|
||
|
DSAPublicKey dSAPublicKey2 = (DSAPublicKey) publicKey;
|
||
|
if (dSAPublicKey2.getParams() != null) {
|
||
|
return dSAPublicKey2;
|
||
|
}
|
||
|
do {
|
||
|
i++;
|
||
|
if (i < list.size()) {
|
||
|
PublicKey publicKey2 = ((X509Certificate) list.get(i)).getPublicKey();
|
||
|
if (!(publicKey2 instanceof DSAPublicKey)) {
|
||
|
throw new CertPathValidatorException("DSA parameters cannot be inherited from previous certificate.");
|
||
|
}
|
||
|
dSAPublicKey = (DSAPublicKey) publicKey2;
|
||
|
} else {
|
||
|
throw new CertPathValidatorException("DSA parameters cannot be inherited from previous certificate.");
|
||
|
}
|
||
|
} while (dSAPublicKey.getParams() == null);
|
||
|
DSAParams params = dSAPublicKey.getParams();
|
||
|
try {
|
||
|
return gqq.b("DSA").generatePublic(new DSAPublicKeySpec(dSAPublicKey2.getY(), params.getP(), params.getQ(), params.getG()));
|
||
|
} catch (Exception e) {
|
||
|
throw new RuntimeException(e.getMessage());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static Collection b(X509Certificate x509Certificate, List<CertStore> list, List<InterfaceC15455gqx> list2) throws AnnotatedException {
|
||
|
X509CertSelector x509CertSelector = new X509CertSelector();
|
||
|
try {
|
||
|
x509CertSelector.setSubject(C15417gpt.c(x509Certificate.getIssuerX500Principal().getEncoded()).l());
|
||
|
try {
|
||
|
byte[] extensionValue = x509Certificate.getExtensionValue(b);
|
||
|
if (extensionValue != null) {
|
||
|
byte[] b2 = gnD.b((Object) extensionValue).b();
|
||
|
gnD gnd = (b2 != null ? new C15419gpv(AbstractC15317gnH.a(b2)) : null).a;
|
||
|
byte[] b3 = gnd != null ? gnd.b() : null;
|
||
|
if (b3 != null) {
|
||
|
x509CertSelector.setSubjectKeyIdentifier(new C15382gov(b3).l());
|
||
|
}
|
||
|
}
|
||
|
} catch (Exception unused) {
|
||
|
}
|
||
|
C15425gqD c15425gqD = new C15425gqD(new C15425gqD.RVV(x509CertSelector).a, (byte) 0);
|
||
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
||
|
try {
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
arrayList.addAll(b(c15425gqD, list));
|
||
|
arrayList.addAll(b(c15425gqD, list2));
|
||
|
Iterator it = arrayList.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
linkedHashSet.add((X509Certificate) it.next());
|
||
|
}
|
||
|
return linkedHashSet;
|
||
|
} catch (AnnotatedException e) {
|
||
|
throw new AnnotatedException("Issuer certificate cannot be searched.", e);
|
||
|
}
|
||
|
} catch (IOException e2) {
|
||
|
throw new AnnotatedException("Subject criteria for certificate selector to find issuer certificate could not be set.", e2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static void e(X509Certificate x509Certificate, PublicKey publicKey, String str) throws GeneralSecurityException {
|
||
|
if (str == null) {
|
||
|
x509Certificate.verify(publicKey);
|
||
|
} else {
|
||
|
x509Certificate.verify(publicKey, str);
|
||
|
}
|
||
|
}
|
||
|
}
|