apkfuckery/com.discord/smali_classes2/okhttp3/g.smali

621 lines
14 KiB
Smali
Raw Normal View History

2019-07-24 11:27:29 +00:00
.class public final Lokhttp3/g;
.super Ljava/lang/Object;
.source "CertificatePinner.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokhttp3/g$a;,
Lokhttp3/g$b;
}
.end annotation
# static fields
2019-11-20 22:09:14 +00:00
.field public static final bnL:Lokhttp3/g;
2019-07-24 11:27:29 +00:00
# instance fields
2019-11-20 22:09:14 +00:00
.field final bnM:Ljava/util/Set;
2019-07-24 11:27:29 +00:00
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set<",
"Lokhttp3/g$b;",
">;"
}
.end annotation
.end field
2019-11-20 22:09:14 +00:00
.field final bnN:Lokhttp3/internal/i/c;
2019-07-24 11:27:29 +00:00
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 3
new-instance v0, Lokhttp3/g$a;
invoke-direct {v0}, Lokhttp3/g$a;-><init>()V
new-instance v1, Lokhttp3/g;
new-instance v2, Ljava/util/LinkedHashSet;
2019-11-20 22:09:14 +00:00
iget-object v0, v0, Lokhttp3/g$a;->beP:Ljava/util/List;
2019-07-24 11:27:29 +00:00
invoke-direct {v2, v0}, Ljava/util/LinkedHashSet;-><init>(Ljava/util/Collection;)V
const/4 v0, 0x0
invoke-direct {v1, v2, v0}, Lokhttp3/g;-><init>(Ljava/util/Set;Lokhttp3/internal/i/c;)V
2019-11-20 22:09:14 +00:00
sput-object v1, Lokhttp3/g;->bnL:Lokhttp3/g;
2019-07-24 11:27:29 +00:00
return-void
.end method
.method constructor <init>(Ljava/util/Set;Lokhttp3/internal/i/c;)V
.locals 0
.param p2 # Lokhttp3/internal/i/c;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Set<",
"Lokhttp3/g$b;",
">;",
"Lokhttp3/internal/i/c;",
")V"
}
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
2019-11-20 22:09:14 +00:00
iput-object p1, p0, Lokhttp3/g;->bnM:Ljava/util/Set;
2019-07-24 11:27:29 +00:00
2019-11-20 22:09:14 +00:00
iput-object p2, p0, Lokhttp3/g;->bnN:Lokhttp3/internal/i/c;
2019-07-24 11:27:29 +00:00
return-void
.end method
.method public static a(Ljava/security/cert/Certificate;)Ljava/lang/String;
.locals 2
instance-of v0, p0, Ljava/security/cert/X509Certificate;
if-eqz v0, :cond_0
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "sha256/"
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/security/cert/X509Certificate;
invoke-static {p0}, Lokhttp3/g;->d(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
move-result-object p0
2019-11-15 02:21:15 +00:00
invoke-virtual {p0}, Lokio/ByteString;->Hx()Ljava/lang/String;
2019-07-24 11:27:29 +00:00
move-result-object p0
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
return-object p0
:cond_0
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string v0, "Certificate pinning requires X509 certificates"
invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
.end method
.method private static d(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
.locals 0
invoke-virtual {p0}, Ljava/security/cert/X509Certificate;->getPublicKey()Ljava/security/PublicKey;
move-result-object p0
invoke-interface {p0}, Ljava/security/PublicKey;->getEncoded()[B
move-result-object p0
2019-10-07 23:23:22 +00:00
invoke-static {p0}, Lokio/ByteString;->F([B)Lokio/ByteString;
2019-07-24 11:27:29 +00:00
move-result-object p0
2019-11-15 02:21:15 +00:00
invoke-virtual {p0}, Lokio/ByteString;->Hz()Lokio/ByteString;
2019-07-24 11:27:29 +00:00
move-result-object p0
return-object p0
.end method
# virtual methods
2019-10-07 23:23:22 +00:00
.method public final equals(Ljava/lang/Object;)Z
.locals 3
.param p1 # Ljava/lang/Object;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
const/4 v0, 0x1
if-ne p1, p0, :cond_0
return v0
:cond_0
instance-of v1, p1, Lokhttp3/g;
if-eqz v1, :cond_1
2019-11-20 22:09:14 +00:00
iget-object v1, p0, Lokhttp3/g;->bnN:Lokhttp3/internal/i/c;
2019-10-07 23:23:22 +00:00
check-cast p1, Lokhttp3/g;
2019-11-20 22:09:14 +00:00
iget-object v2, p1, Lokhttp3/g;->bnN:Lokhttp3/internal/i/c;
2019-10-07 23:23:22 +00:00
invoke-static {v1, v2}, Lokhttp3/internal/c;->equal(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_1
2019-11-20 22:09:14 +00:00
iget-object v1, p0, Lokhttp3/g;->bnM:Ljava/util/Set;
2019-10-07 23:23:22 +00:00
2019-11-20 22:09:14 +00:00
iget-object p1, p1, Lokhttp3/g;->bnM:Ljava/util/Set;
2019-10-07 23:23:22 +00:00
invoke-interface {v1, p1}, Ljava/util/Set;->equals(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_1
return v0
:cond_1
const/4 p1, 0x0
return p1
.end method
.method public final f(Ljava/lang/String;Ljava/util/List;)V
2019-07-24 11:27:29 +00:00
.locals 15
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
"Ljava/util/List<",
"Ljava/security/cert/Certificate;",
">;)V"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljavax/net/ssl/SSLPeerUnverifiedException;
}
.end annotation
move-object v0, p0
move-object/from16 v7, p1
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object v1
2019-11-20 22:09:14 +00:00
iget-object v2, v0, Lokhttp3/g;->bnM:Ljava/util/Set;
2019-07-24 11:27:29 +00:00
invoke-interface {v2}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v8
move-object v9, v1
:cond_0
:goto_0
invoke-interface {v8}, Ljava/util/Iterator;->hasNext()Z
move-result v1
const/4 v10, 0x0
if-eqz v1, :cond_4
invoke-interface {v8}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
move-object v11, v1
check-cast v11, Lokhttp3/g$b;
iget-object v1, v11, Lokhttp3/g$b;->pattern:Ljava/lang/String;
const-string v2, "*."
invoke-virtual {v1, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v1
const/4 v12, 0x1
if-eqz v1, :cond_1
const/16 v1, 0x2e
invoke-virtual {v7, v1}, Ljava/lang/String;->indexOf(I)I
move-result v1
invoke-virtual/range {p1 .. p1}, Ljava/lang/String;->length()I
move-result v2
sub-int/2addr v2, v1
sub-int/2addr v2, v12
2019-11-20 22:09:14 +00:00
iget-object v3, v11, Lokhttp3/g$b;->bnO:Ljava/lang/String;
2019-07-24 11:27:29 +00:00
invoke-virtual {v3}, Ljava/lang/String;->length()I
move-result v3
if-ne v2, v3, :cond_2
const/4 v2, 0x0
add-int/lit8 v3, v1, 0x1
2019-11-20 22:09:14 +00:00
iget-object v4, v11, Lokhttp3/g$b;->bnO:Ljava/lang/String;
2019-07-24 11:27:29 +00:00
const/4 v5, 0x0
2019-11-20 22:09:14 +00:00
iget-object v1, v11, Lokhttp3/g$b;->bnO:Ljava/lang/String;
2019-07-24 11:27:29 +00:00
invoke-virtual {v1}, Ljava/lang/String;->length()I
move-result v6
move-object/from16 v1, p1
invoke-virtual/range {v1 .. v6}, Ljava/lang/String;->regionMatches(ZILjava/lang/String;II)Z
move-result v1
if-eqz v1, :cond_2
const/4 v10, 0x1
goto :goto_1
:cond_1
2019-11-20 22:09:14 +00:00
iget-object v1, v11, Lokhttp3/g$b;->bnO:Ljava/lang/String;
2019-07-24 11:27:29 +00:00
invoke-virtual {v7, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v10
:cond_2
:goto_1
if-eqz v10, :cond_0
invoke-interface {v9}, Ljava/util/List;->isEmpty()Z
move-result v1
if-eqz v1, :cond_3
new-instance v9, Ljava/util/ArrayList;
invoke-direct {v9}, Ljava/util/ArrayList;-><init>()V
:cond_3
invoke-interface {v9, v11}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_4
invoke-interface {v9}, Ljava/util/List;->isEmpty()Z
move-result v1
if-eqz v1, :cond_5
return-void
:cond_5
2019-11-20 22:09:14 +00:00
iget-object v1, v0, Lokhttp3/g;->bnN:Lokhttp3/internal/i/c;
2019-07-24 11:27:29 +00:00
move-object/from16 v2, p2
2019-08-30 20:04:20 +00:00
if-eqz v1, :cond_6
2019-07-24 11:27:29 +00:00
invoke-virtual {v1, v2, v7}, Lokhttp3/internal/i/c;->b(Ljava/util/List;Ljava/lang/String;)Ljava/util/List;
move-result-object v1
goto :goto_2
:cond_6
move-object v1, v2
:goto_2
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v2
const/4 v3, 0x0
:goto_3
if-ge v3, v2, :cond_d
invoke-interface {v1, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v4
check-cast v4, Ljava/security/cert/X509Certificate;
invoke-interface {v9}, Ljava/util/List;->size()I
move-result v5
const/4 v6, 0x0
move-object v8, v6
move-object v11, v8
const/4 v6, 0x0
:goto_4
if-ge v6, v5, :cond_c
invoke-interface {v9, v6}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v12
check-cast v12, Lokhttp3/g$b;
2019-11-20 22:09:14 +00:00
iget-object v13, v12, Lokhttp3/g$b;->bnP:Ljava/lang/String;
2019-07-24 11:27:29 +00:00
const-string v14, "sha256/"
invoke-virtual {v13, v14}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v13
if-eqz v13, :cond_8
if-nez v8, :cond_7
invoke-static {v4}, Lokhttp3/g;->d(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
move-result-object v8
:cond_7
2019-11-20 22:09:14 +00:00
iget-object v12, v12, Lokhttp3/g$b;->bnQ:Lokio/ByteString;
2019-07-24 11:27:29 +00:00
invoke-virtual {v12, v8}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
move-result v12
if-eqz v12, :cond_a
return-void
:cond_8
2019-11-20 22:09:14 +00:00
iget-object v13, v12, Lokhttp3/g$b;->bnP:Ljava/lang/String;
2019-07-24 11:27:29 +00:00
const-string v14, "sha1/"
invoke-virtual {v13, v14}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v13
if-eqz v13, :cond_b
if-nez v11, :cond_9
invoke-virtual {v4}, Ljava/security/cert/X509Certificate;->getPublicKey()Ljava/security/PublicKey;
move-result-object v11
invoke-interface {v11}, Ljava/security/PublicKey;->getEncoded()[B
move-result-object v11
2019-10-07 23:23:22 +00:00
invoke-static {v11}, Lokio/ByteString;->F([B)Lokio/ByteString;
2019-07-24 11:27:29 +00:00
move-result-object v11
2019-11-15 02:21:15 +00:00
invoke-virtual {v11}, Lokio/ByteString;->Hy()Lokio/ByteString;
2019-07-24 11:27:29 +00:00
move-result-object v11
:cond_9
2019-11-20 22:09:14 +00:00
iget-object v12, v12, Lokhttp3/g$b;->bnQ:Lokio/ByteString;
2019-07-24 11:27:29 +00:00
invoke-virtual {v12, v11}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
move-result v12
if-eqz v12, :cond_a
return-void
:cond_a
add-int/lit8 v6, v6, 0x1
goto :goto_4
:cond_b
new-instance v1, Ljava/lang/AssertionError;
new-instance v2, Ljava/lang/StringBuilder;
const-string v3, "unsupported hashAlgorithm: "
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
2019-11-20 22:09:14 +00:00
iget-object v3, v12, Lokhttp3/g$b;->bnP:Ljava/lang/String;
2019-07-24 11:27:29 +00:00
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
throw v1
:cond_c
add-int/lit8 v3, v3, 0x1
goto :goto_3
:cond_d
new-instance v2, Ljava/lang/StringBuilder;
const-string v3, "Certificate pinning failure!\n Peer certificate chain:"
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-interface {v1}, Ljava/util/List;->size()I
move-result v3
const/4 v4, 0x0
:goto_5
const-string v5, "\n "
if-ge v4, v3, :cond_e
invoke-interface {v1, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v6
check-cast v6, Ljava/security/cert/X509Certificate;
invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-static {v6}, Lokhttp3/g;->a(Ljava/security/cert/Certificate;)Ljava/lang/String;
move-result-object v5
invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v5, ": "
invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v6}, Ljava/security/cert/X509Certificate;->getSubjectDN()Ljava/security/Principal;
move-result-object v5
invoke-interface {v5}, Ljava/security/Principal;->getName()Ljava/lang/String;
move-result-object v5
invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
add-int/lit8 v4, v4, 0x1
goto :goto_5
:cond_e
const-string v1, "\n Pinned certificates for "
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v1, ":"
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-interface {v9}, Ljava/util/List;->size()I
move-result v1
:goto_6
if-ge v10, v1, :cond_f
invoke-interface {v9, v10}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Lokhttp3/g$b;
invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
add-int/lit8 v10, v10, 0x1
goto :goto_6
:cond_f
new-instance v1, Ljavax/net/ssl/SSLPeerUnverifiedException;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v1, v2}, Ljavax/net/ssl/SSLPeerUnverifiedException;-><init>(Ljava/lang/String;)V
throw v1
.end method
.method public final hashCode()I
.locals 2
2019-11-20 22:09:14 +00:00
iget-object v0, p0, Lokhttp3/g;->bnN:Lokhttp3/internal/i/c;
2019-07-24 11:27:29 +00:00
if-eqz v0, :cond_0
invoke-virtual {v0}, Ljava/lang/Object;->hashCode()I
move-result v0
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
mul-int/lit8 v0, v0, 0x1f
2019-11-20 22:09:14 +00:00
iget-object v1, p0, Lokhttp3/g;->bnM:Ljava/util/Set;
2019-07-24 11:27:29 +00:00
invoke-interface {v1}, Ljava/util/Set;->hashCode()I
move-result v1
add-int/2addr v0, v1
return v0
.end method