214 lines
14 KiB
Java
214 lines
14 KiB
Java
|
package o;
|
||
|
|
||
|
import java.security.InvalidAlgorithmParameterException;
|
||
|
import java.security.InvalidParameterException;
|
||
|
import java.security.cert.CertPathBuilderException;
|
||
|
import java.security.cert.CertPathBuilderResult;
|
||
|
import java.security.cert.CertPathBuilderSpi;
|
||
|
import java.security.cert.CertPathParameters;
|
||
|
import java.security.cert.PKIXBuilderParameters;
|
||
|
import java.security.cert.X509Certificate;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collection;
|
||
|
import java.util.Collections;
|
||
|
import java.util.Iterator;
|
||
|
import o.C15457gqz;
|
||
|
import o.gqA;
|
||
|
import org.spongycastle.jce.exception.ExtCertPathBuilderException;
|
||
|
import org.spongycastle.jce.provider.AnnotatedException;
|
||
|
|
||
|
/* renamed from: o.gro, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class C15487gro extends CertPathBuilderSpi {
|
||
|
private Exception e;
|
||
|
|
||
|
@Override // java.security.cert.CertPathBuilderSpi
|
||
|
public CertPathBuilderResult engineBuild(CertPathParameters certPathParameters) throws CertPathBuilderException, InvalidAlgorithmParameterException {
|
||
|
gqA gqa;
|
||
|
Exception exc;
|
||
|
gqA.LWm lWm;
|
||
|
if (certPathParameters instanceof PKIXBuilderParameters) {
|
||
|
PKIXBuilderParameters pKIXBuilderParameters = (PKIXBuilderParameters) certPathParameters;
|
||
|
C15457gqz.LWm lWm2 = new C15457gqz.LWm(pKIXBuilderParameters);
|
||
|
if (certPathParameters instanceof C15472grZ) {
|
||
|
C15507gsc c15507gsc = (C15507gsc) certPathParameters;
|
||
|
Iterator it = Collections.unmodifiableList(c15507gsc.c).iterator();
|
||
|
while (it.hasNext()) {
|
||
|
lWm2.d.add((InterfaceC15455gqx) it.next());
|
||
|
}
|
||
|
lWm = new gqA.LWm(new C15457gqz(lWm2, (byte) 0));
|
||
|
lWm.d.addAll(Collections.unmodifiableSet(c15507gsc.b));
|
||
|
int i = c15507gsc.a;
|
||
|
if (i >= -1) {
|
||
|
lWm.a = i;
|
||
|
} else {
|
||
|
throw new InvalidParameterException("The maximum path length parameter can not be less than -1.");
|
||
|
}
|
||
|
} else {
|
||
|
lWm = new gqA.LWm(pKIXBuilderParameters);
|
||
|
}
|
||
|
gqa = new gqA(lWm, (byte) 0);
|
||
|
} else if (certPathParameters instanceof gqA) {
|
||
|
gqa = (gqA) certPathParameters;
|
||
|
} else {
|
||
|
StringBuilder sb = new StringBuilder("Parameters must be an instance of ");
|
||
|
sb.append(PKIXBuilderParameters.class.getName());
|
||
|
sb.append(" or ");
|
||
|
sb.append(gqA.class.getName());
|
||
|
sb.append(".");
|
||
|
throw new InvalidAlgorithmParameterException(sb.toString());
|
||
|
}
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
C15425gqD c15425gqD = gqa.e.g;
|
||
|
try {
|
||
|
Collection b = C15473gra.b(c15425gqD, gqa.e.e);
|
||
|
b.addAll(C15473gra.b(c15425gqD, gqa.e.b.getCertStores()));
|
||
|
if (b.isEmpty()) {
|
||
|
throw new CertPathBuilderException("No certificate found matching targetContraints.");
|
||
|
}
|
||
|
Iterator it2 = b.iterator();
|
||
|
CertPathBuilderResult certPathBuilderResult = null;
|
||
|
while (it2.hasNext() && certPathBuilderResult == null) {
|
||
|
certPathBuilderResult = b((X509Certificate) it2.next(), gqa, arrayList);
|
||
|
}
|
||
|
if (certPathBuilderResult == null && (exc = this.e) != null) {
|
||
|
if (exc instanceof AnnotatedException) {
|
||
|
throw new CertPathBuilderException(this.e.getMessage(), this.e.getCause());
|
||
|
}
|
||
|
throw new CertPathBuilderException("Possible certificate chain could not be validated.", this.e);
|
||
|
}
|
||
|
if (certPathBuilderResult == null && this.e == null) {
|
||
|
throw new CertPathBuilderException("Unable to find certificate chain.");
|
||
|
}
|
||
|
return certPathBuilderResult;
|
||
|
} catch (AnnotatedException e) {
|
||
|
throw new ExtCertPathBuilderException("Error finding target certificate.", e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Removed duplicated region for block: B:34:0x00dd */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
private java.security.cert.CertPathBuilderResult b(java.security.cert.X509Certificate r6, o.gqA r7, java.util.List r8) {
|
||
|
/*
|
||
|
r5 = this;
|
||
|
boolean r0 = r8.contains(r6)
|
||
|
r1 = 0
|
||
|
if (r0 == 0) goto L8
|
||
|
return r1
|
||
|
L8:
|
||
|
java.util.Set<java.security.cert.X509Certificate> r0 = r7.a
|
||
|
boolean r0 = r0.contains(r6)
|
||
|
if (r0 == 0) goto L11
|
||
|
return r1
|
||
|
L11:
|
||
|
int r0 = r7.c
|
||
|
r2 = -1
|
||
|
if (r0 == r2) goto L21
|
||
|
int r0 = r8.size()
|
||
|
int r0 = r0 + (-1)
|
||
|
int r2 = r7.c
|
||
|
if (r0 <= r2) goto L21
|
||
|
return r1
|
||
|
L21:
|
||
|
r8.add(r6)
|
||
|
o.gqC r0 = new o.gqC // Catch: java.lang.Exception -> Le1
|
||
|
r0.<init>() // Catch: java.lang.Exception -> Le1
|
||
|
o.grk r2 = new o.grk // Catch: java.lang.Exception -> Le1
|
||
|
r2.<init>() // Catch: java.lang.Exception -> Le1
|
||
|
o.gqz r3 = r7.e // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.util.Set<java.security.cert.TrustAnchor> r3 = r3.i // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
o.gqz r4 = r7.e // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.PKIXParameters r4 = r4.b // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.lang.String r4 = r4.getSigProvider() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.TrustAnchor r3 = o.C15473gra.e(r6, r3, r4) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
if (r3 == 0) goto L6e
|
||
|
java.security.cert.CertPath r0 = r0.engineGenerateCertPath(r8) // Catch: java.lang.Exception -> L65 org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.CertPathValidatorResult r7 = r2.engineValidate(r0, r7) // Catch: java.lang.Exception -> L5c org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.PKIXCertPathValidatorResult r7 = (java.security.cert.PKIXCertPathValidatorResult) r7 // Catch: java.lang.Exception -> L5c org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.TrustAnchor r2 = r7.getTrustAnchor() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.PolicyNode r3 = r7.getPolicyTree() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.PKIXCertPathBuilderResult r4 = new java.security.cert.PKIXCertPathBuilderResult // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.PublicKey r7 = r7.getPublicKey() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
r4.<init>(r0, r2, r3, r7) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
return r4
|
||
|
L5c:
|
||
|
r7 = move-exception
|
||
|
org.spongycastle.jce.provider.AnnotatedException r0 = new org.spongycastle.jce.provider.AnnotatedException // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.lang.String r2 = "Certification path could not be validated."
|
||
|
r0.<init>(r2, r7) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
throw r0 // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
L65:
|
||
|
r7 = move-exception
|
||
|
org.spongycastle.jce.provider.AnnotatedException r0 = new org.spongycastle.jce.provider.AnnotatedException // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.lang.String r2 = "Certification path could not be constructed from certificate list."
|
||
|
r0.<init>(r2, r7) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
throw r0 // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
L6e:
|
||
|
java.util.ArrayList r0 = new java.util.ArrayList // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
r0.<init>() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
o.gqz r2 = r7.e // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.util.List<o.gqx> r2 = r2.e // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
r0.addAll(r2) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
o.gnC r2 = o.C15394gpK.k // Catch: java.security.cert.CertificateParsingException -> Lcf org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.lang.String r2 = r2.d // Catch: java.security.cert.CertificateParsingException -> Lcf org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
byte[] r2 = r6.getExtensionValue(r2) // Catch: java.security.cert.CertificateParsingException -> Lcf org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
o.gqz r3 = r7.e // Catch: java.security.cert.CertificateParsingException -> Lcf org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.util.Map<o.gpO, o.gqx> r3 = r3.j // Catch: java.security.cert.CertificateParsingException -> Lcf org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.util.List r2 = o.C15473gra.e(r2, r3) // Catch: java.security.cert.CertificateParsingException -> Lcf org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
r0.addAll(r2) // Catch: java.security.cert.CertificateParsingException -> Lcf org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.util.HashSet r2 = new java.util.HashSet // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
r2.<init>() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
o.gqz r3 = r7.e // Catch: org.spongycastle.jce.provider.AnnotatedException -> Lc6
|
||
|
java.security.cert.PKIXParameters r3 = r3.b // Catch: org.spongycastle.jce.provider.AnnotatedException -> Lc6
|
||
|
java.util.List r3 = r3.getCertStores() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Lc6
|
||
|
java.util.Collection r0 = o.C15473gra.b(r6, r3, r0) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Lc6
|
||
|
r2.addAll(r0) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Lc6
|
||
|
boolean r0 = r2.isEmpty() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
if (r0 != 0) goto Lbe
|
||
|
java.util.Iterator r0 = r2.iterator() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
Lab:
|
||
|
boolean r2 = r0.hasNext() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
if (r2 == 0) goto Ldb
|
||
|
if (r1 != 0) goto Ldb
|
||
|
java.lang.Object r2 = r0.next() // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.X509Certificate r2 = (java.security.cert.X509Certificate) r2 // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.security.cert.CertPathBuilderResult r1 = r5.b(r2, r7, r8) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
goto Lab
|
||
|
Lbe:
|
||
|
org.spongycastle.jce.provider.AnnotatedException r7 = new org.spongycastle.jce.provider.AnnotatedException // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.lang.String r0 = "No issuer certificate for certificate in certification path found."
|
||
|
r7.<init>(r0) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
throw r7 // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
Lc6:
|
||
|
r7 = move-exception
|
||
|
org.spongycastle.jce.provider.AnnotatedException r0 = new org.spongycastle.jce.provider.AnnotatedException // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.lang.String r2 = "Cannot find issuer certificate for certificate in certification path."
|
||
|
r0.<init>(r2, r7) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
throw r0 // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
Lcf:
|
||
|
r7 = move-exception
|
||
|
org.spongycastle.jce.provider.AnnotatedException r0 = new org.spongycastle.jce.provider.AnnotatedException // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
java.lang.String r2 = "No additional X.509 stores can be added from certificate locations."
|
||
|
r0.<init>(r2, r7) // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
throw r0 // Catch: org.spongycastle.jce.provider.AnnotatedException -> Ld8
|
||
|
Ld8:
|
||
|
r7 = move-exception
|
||
|
r5.e = r7
|
||
|
Ldb:
|
||
|
if (r1 != 0) goto Le0
|
||
|
r8.remove(r6)
|
||
|
Le0:
|
||
|
return r1
|
||
|
Le1:
|
||
|
java.lang.RuntimeException r6 = new java.lang.RuntimeException
|
||
|
java.lang.String r7 = "Exception creating support classes."
|
||
|
r6.<init>(r7)
|
||
|
throw r6
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: o.C15487gro.b(java.security.cert.X509Certificate, o.gqA, java.util.List):java.security.cert.CertPathBuilderResult");
|
||
|
}
|
||
|
}
|