.class public final Lokhttp3/internal/tls/BasicCertificateChainCleaner; .super Lokhttp3/internal/tls/CertificateChainCleaner; .source "BasicCertificateChainCleaner.kt" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Lokhttp3/internal/tls/BasicCertificateChainCleaner$Companion; } .end annotation .annotation runtime Lkotlin/Metadata; bv = { 0x1, 0x0, 0x3 } d1 = { "\u0000@\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0008\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0003\u0018\u0000 \u00152\u00020\u0001:\u0001\u0015B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0004J$\u0010\u0005\u001a\u0008\u0012\u0004\u0012\u00020\u00070\u00062\u000c\u0010\u0008\u001a\u0008\u0012\u0004\u0012\u00020\u00070\u00062\u0006\u0010\t\u001a\u00020\nH\u0016J\u0013\u0010\u000b\u001a\u00020\u000c2\u0008\u0010\r\u001a\u0004\u0018\u00010\u000eH\u0096\u0002J\u0008\u0010\u000f\u001a\u00020\u0010H\u0016J\u0018\u0010\u0011\u001a\u00020\u000c2\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0013H\u0002R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0016" } d2 = { "Lokhttp3/internal/tls/BasicCertificateChainCleaner;", "Lokhttp3/internal/tls/CertificateChainCleaner;", "trustRootIndex", "Lokhttp3/internal/tls/TrustRootIndex;", "(Lokhttp3/internal/tls/TrustRootIndex;)V", "clean", "", "Ljava/security/cert/Certificate;", "chain", "hostname", "", "equals", "", "other", "", "hashCode", "", "verifySignature", "toVerify", "Ljava/security/cert/X509Certificate;", "signingCert", "Companion", "okhttp" } k = 0x1 mv = { 0x1, 0x4, 0x0 } .end annotation # static fields .field public static final Companion:Lokhttp3/internal/tls/BasicCertificateChainCleaner$Companion; .field private static final MAX_SIGNERS:I = 0x9 # instance fields .field private final trustRootIndex:Lokhttp3/internal/tls/TrustRootIndex; # direct methods .method static constructor ()V .locals 2 new-instance v0, Lokhttp3/internal/tls/BasicCertificateChainCleaner$Companion; const/4 v1, 0x0 invoke-direct {v0, v1}, Lokhttp3/internal/tls/BasicCertificateChainCleaner$Companion;->(Lkotlin/jvm/internal/DefaultConstructorMarker;)V sput-object v0, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->Companion:Lokhttp3/internal/tls/BasicCertificateChainCleaner$Companion; return-void .end method .method public constructor (Lokhttp3/internal/tls/TrustRootIndex;)V .locals 1 const-string v0, "trustRootIndex" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 38 invoke-direct {p0}, Lokhttp3/internal/tls/CertificateChainCleaner;->()V iput-object p1, p0, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->trustRootIndex:Lokhttp3/internal/tls/TrustRootIndex; return-void .end method .method private final verifySignature(Ljava/security/cert/X509Certificate;Ljava/security/cert/X509Certificate;)Z .locals 2 .line 100 invoke-virtual {p1}, Ljava/security/cert/X509Certificate;->getIssuerDN()Ljava/security/Principal; move-result-object p0 invoke-virtual {p2}, Ljava/security/cert/X509Certificate;->getSubjectDN()Ljava/security/Principal; move-result-object v0 invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result p0 const/4 v0, 0x1 xor-int/2addr p0, v0 const/4 v1, 0x0 if-eqz p0, :cond_0 return v1 .line 104 :cond_0 :try_start_0 invoke-virtual {p2}, Ljava/security/cert/X509Certificate;->getPublicKey()Ljava/security/PublicKey; move-result-object p0 invoke-virtual {p1, p0}, Ljava/security/cert/X509Certificate;->verify(Ljava/security/PublicKey;)V :try_end_0 .catch Ljava/security/GeneralSecurityException; {:try_start_0 .. :try_end_0} :catch_0 goto :goto_0 :catch_0 move v0, v1 :goto_0 return v0 .end method # virtual methods .method public clean(Ljava/util/List;Ljava/lang/String;)Ljava/util/List; .locals 7 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/util/List<", "+", "Ljava/security/cert/Certificate;", ">;", "Ljava/lang/String;", ")", "Ljava/util/List<", "Ljava/security/cert/Certificate;", ">;" } .end annotation .annotation system Ldalvik/annotation/Throws; value = { Ljavax/net/ssl/SSLPeerUnverifiedException; } .end annotation const-string v0, "chain" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "hostname" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 49 new-instance p2, Ljava/util/ArrayDeque; check-cast p1, Ljava/util/Collection; invoke-direct {p2, p1}, Ljava/util/ArrayDeque;->(Ljava/util/Collection;)V check-cast p2, Ljava/util/Deque; .line 50 new-instance p1, Ljava/util/ArrayList; invoke-direct {p1}, Ljava/util/ArrayList;->()V check-cast p1, Ljava/util/List; .line 51 invoke-interface {p2}, Ljava/util/Deque;->removeFirst()Ljava/lang/Object; move-result-object v0 const-string v1, "queue.removeFirst()" invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z const/4 v0, 0x0 move v1, v0 :goto_0 const/16 v2, 0x9 if-ge v0, v2, :cond_9 .line 56 invoke-interface {p1}, Ljava/util/List;->size()I move-result v2 const/4 v3, 0x1 sub-int/2addr v2, v3 invoke-interface {p1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object; move-result-object v2 const-string v4, "null cannot be cast to non-null type java.security.cert.X509Certificate" if-eqz v2, :cond_8 check-cast v2, Ljava/security/cert/X509Certificate; iget-object v5, p0, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->trustRootIndex:Lokhttp3/internal/tls/TrustRootIndex; .line 61 invoke-interface {v5, v2}, Lokhttp3/internal/tls/TrustRootIndex;->findByIssuerAndSignature(Ljava/security/cert/X509Certificate;)Ljava/security/cert/X509Certificate; move-result-object v5 if-eqz v5, :cond_3 .line 63 invoke-interface {p1}, Ljava/util/List;->size()I move-result v1 if-gt v1, v3, :cond_0 invoke-static {v2, v5}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result v1 xor-int/2addr v1, v3 if-eqz v1, :cond_1 .line 64 :cond_0 invoke-interface {p1, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z .line 66 :cond_1 invoke-direct {p0, v5, v5}, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->verifySignature(Ljava/security/cert/X509Certificate;Ljava/security/cert/X509Certificate;)Z move-result v1 if-eqz v1, :cond_2 return-object p1 :cond_2 move v1, v3 goto :goto_1 .line 75 :cond_3 invoke-interface {p2}, Ljava/util/Deque;->iterator()Ljava/util/Iterator; move-result-object v3 const-string v5, "queue.iterator()" invoke-static {v3, v5}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V .line 76 :cond_4 invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z move-result v5 if-eqz v5, :cond_6 .line 77 invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v5 if-eqz v5, :cond_5 check-cast v5, Ljava/security/cert/X509Certificate; .line 78 invoke-direct {p0, v2, v5}, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->verifySignature(Ljava/security/cert/X509Certificate;Ljava/security/cert/X509Certificate;)Z move-result v6 if-eqz v6, :cond_4 .line 79 invoke-interface {v3}, Ljava/util/Iterator;->remove()V .line 80 invoke-interface {p1, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z :goto_1 add-int/lit8 v0, v0, 0x1 goto :goto_0 .line 77 :cond_5 new-instance p0, Ljava/lang/NullPointerException; invoke-direct {p0, v4}, Ljava/lang/NullPointerException;->(Ljava/lang/String;)V throw p0 :cond_6 if-eqz v1, :cond_7 return-object p1 .line 91 :cond_7 new-instance p0, Ljavax/net/ssl/SSLPeerUnverifiedException; .line 92 new-instance p1, Ljava/lang/StringBuilder; const-string p2, "Failed to find a trusted cert that signed " invoke-direct {p1, p2}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {p1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object p1 invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p1 .line 91 invoke-direct {p0, p1}, Ljavax/net/ssl/SSLPeerUnverifiedException;->(Ljava/lang/String;)V check-cast p0, Ljava/lang/Throwable; throw p0 .line 56 :cond_8 new-instance p0, Ljava/lang/NullPointerException; invoke-direct {p0, v4}, Ljava/lang/NullPointerException;->(Ljava/lang/String;)V throw p0 .line 95 :cond_9 new-instance p0, Ljavax/net/ssl/SSLPeerUnverifiedException; new-instance p2, Ljava/lang/StringBuilder; const-string v0, "Certificate chain too long: " invoke-direct {p2, v0}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object p1 invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p1 invoke-direct {p0, p1}, Ljavax/net/ssl/SSLPeerUnverifiedException;->(Ljava/lang/String;)V check-cast p0, Ljava/lang/Throwable; throw p0 .end method .method public equals(Ljava/lang/Object;)Z .locals 2 .line 116 move-object v0, p0 check-cast v0, Lokhttp3/internal/tls/BasicCertificateChainCleaner; const/4 v0, 0x1 if-ne p1, p0, :cond_0 goto :goto_0 .line 119 :cond_0 instance-of v1, p1, Lokhttp3/internal/tls/BasicCertificateChainCleaner; if-eqz v1, :cond_1 check-cast p1, Lokhttp3/internal/tls/BasicCertificateChainCleaner; iget-object p1, p1, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->trustRootIndex:Lokhttp3/internal/tls/TrustRootIndex; iget-object p0, p0, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->trustRootIndex:Lokhttp3/internal/tls/TrustRootIndex; invoke-static {p1, p0}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z move-result p0 if-eqz p0, :cond_1 goto :goto_0 :cond_1 const/4 v0, 0x0 :goto_0 return v0 .end method .method public hashCode()I .locals 0 iget-object p0, p0, Lokhttp3/internal/tls/BasicCertificateChainCleaner;->trustRootIndex:Lokhttp3/internal/tls/TrustRootIndex; .line 112 invoke-virtual {p0}, Ljava/lang/Object;->hashCode()I move-result p0 return p0 .end method