351 lines
7.7 KiB
Smali
351 lines
7.7 KiB
Smali
.class public final Ln0/g0/j/a;
|
|
.super Ln0/g0/j/c;
|
|
.source "BasicCertificateChainCleaner.kt"
|
|
|
|
|
|
# instance fields
|
|
.field public final a:Ln0/g0/j/e;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ln0/g0/j/e;)V
|
|
.locals 0
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-direct {p0}, Ln0/g0/j/c;-><init>()V
|
|
|
|
iput-object p1, p0, Ln0/g0/j/a;->a:Ln0/g0/j/e;
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "trustRootIndex"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a(Ljava/util/List;Ljava/lang/String;)Ljava/util/List;
|
|
.locals 8
|
|
.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/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_b
|
|
|
|
if-eqz p2, :cond_a
|
|
|
|
new-instance p2, Ljava/util/ArrayDeque;
|
|
|
|
invoke-direct {p2, p1}, Ljava/util/ArrayDeque;-><init>(Ljava/util/Collection;)V
|
|
|
|
new-instance p1, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {p1}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
invoke-interface {p2}, Ljava/util/Deque;->removeFirst()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "queue.removeFirst()"
|
|
|
|
invoke-static {v0, v1}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
const/16 v0, 0x9
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
if-ge v1, v0, :cond_9
|
|
|
|
invoke-interface {p1}, Ljava/util/List;->size()I
|
|
|
|
move-result v3
|
|
|
|
const/4 v4, 0x1
|
|
|
|
sub-int/2addr v3, v4
|
|
|
|
invoke-interface {p1, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v5, "null cannot be cast to non-null type java.security.cert.X509Certificate"
|
|
|
|
if-eqz v3, :cond_8
|
|
|
|
check-cast v3, Ljava/security/cert/X509Certificate;
|
|
|
|
iget-object v6, p0, Ln0/g0/j/a;->a:Ln0/g0/j/e;
|
|
|
|
invoke-interface {v6, v3}, Ln0/g0/j/e;->a(Ljava/security/cert/X509Certificate;)Ljava/security/cert/X509Certificate;
|
|
|
|
move-result-object v6
|
|
|
|
if-eqz v6, :cond_3
|
|
|
|
invoke-interface {p1}, Ljava/util/List;->size()I
|
|
|
|
move-result v2
|
|
|
|
if-gt v2, v4, :cond_0
|
|
|
|
invoke-static {v3, v6}, Lj0/n/c/h;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v2
|
|
|
|
xor-int/2addr v2, v4
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
:cond_0
|
|
invoke-interface {p1, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_1
|
|
invoke-virtual {p0, v6, v6}, Ln0/g0/j/a;->b(Ljava/security/cert/X509Certificate;Ljava/security/cert/X509Certificate;)Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
return-object p1
|
|
|
|
:cond_2
|
|
const/4 v2, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
:cond_3
|
|
invoke-interface {p2}, Ljava/util/Deque;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v6, "queue.iterator()"
|
|
|
|
invoke-static {v4, v6}, Lj0/n/c/h;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
:cond_4
|
|
invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v6
|
|
|
|
if-eqz v6, :cond_6
|
|
|
|
invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v6
|
|
|
|
if-eqz v6, :cond_5
|
|
|
|
check-cast v6, Ljava/security/cert/X509Certificate;
|
|
|
|
invoke-virtual {p0, v3, v6}, Ln0/g0/j/a;->b(Ljava/security/cert/X509Certificate;Ljava/security/cert/X509Certificate;)Z
|
|
|
|
move-result v7
|
|
|
|
if-eqz v7, :cond_4
|
|
|
|
invoke-interface {v4}, Ljava/util/Iterator;->remove()V
|
|
|
|
invoke-interface {p1, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
:goto_1
|
|
add-int/lit8 v1, v1, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_5
|
|
new-instance p1, Lkotlin/TypeCastException;
|
|
|
|
invoke-direct {p1, v5}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
:cond_6
|
|
if-eqz v2, :cond_7
|
|
|
|
return-object p1
|
|
|
|
:cond_7
|
|
new-instance p1, Ljavax/net/ssl/SSLPeerUnverifiedException;
|
|
|
|
new-instance p2, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v0, "Failed to find a trusted cert that signed "
|
|
|
|
invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-direct {p1, p2}, Ljavax/net/ssl/SSLPeerUnverifiedException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
:cond_8
|
|
new-instance p1, Lkotlin/TypeCastException;
|
|
|
|
invoke-direct {p1, v5}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
:cond_9
|
|
new-instance p2, Ljavax/net/ssl/SSLPeerUnverifiedException;
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v1, "Certificate chain too long: "
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p2, p1}, Ljavax/net/ssl/SSLPeerUnverifiedException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p2
|
|
|
|
:cond_a
|
|
const-string p1, "hostname"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_b
|
|
const-string p1, "chain"
|
|
|
|
invoke-static {p1}, Lj0/n/c/h;->c(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public final b(Ljava/security/cert/X509Certificate;Ljava/security/cert/X509Certificate;)Z
|
|
.locals 3
|
|
|
|
invoke-virtual {p1}, Ljava/security/cert/X509Certificate;->getIssuerDN()Ljava/security/Principal;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p2}, Ljava/security/cert/X509Certificate;->getSubjectDN()Ljava/security/Principal;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v0, v1}, Lj0/n/c/h;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
xor-int/2addr v0, v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return v2
|
|
|
|
:cond_0
|
|
:try_start_0
|
|
invoke-virtual {p2}, Ljava/security/cert/X509Certificate;->getPublicKey()Ljava/security/PublicKey;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, 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
|
|
const/4 v1, 0x0
|
|
|
|
:goto_0
|
|
return v1
|
|
.end method
|
|
|
|
.method public equals(Ljava/lang/Object;)Z
|
|
.locals 2
|
|
|
|
const/4 v0, 0x1
|
|
|
|
if-ne p1, p0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
instance-of v1, p1, Ln0/g0/j/a;
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
check-cast p1, Ln0/g0/j/a;
|
|
|
|
iget-object p1, p1, Ln0/g0/j/a;->a:Ln0/g0/j/e;
|
|
|
|
iget-object v1, p0, Ln0/g0/j/a;->a:Ln0/g0/j/e;
|
|
|
|
invoke-static {p1, v1}, Lj0/n/c/h;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public hashCode()I
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Ln0/g0/j/a;->a:Ln0/g0/j/e;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Object;->hashCode()I
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|