Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fvfdvdfvdfv
.class public final Lokhttp3/k;
.super Ljava/lang/Object;
.source "CertificatePinner.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokhttp3/k$a;,
Lokhttp3/k$b;
}
.end annotation
# static fields
.field public static final a:Lokhttp3/k;
# instance fields
.field private final b:Ljava/util/Set;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Set",
"<",
"Lokhttp3/k$b;",
">;"
}
.end annotation
.end field
.field private final c:Lokhttp3/internal/f/b;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 1
new-instance v0, Lokhttp3/k$a;
invoke-direct {v0}, Lokhttp3/k$a;-><init>()V
invoke-virtual {v0}, Lokhttp3/k$a;->a()Lokhttp3/k;
move-result-object v0
sput-object v0, Lokhttp3/k;->a:Lokhttp3/k;
return-void
.end method
.method constructor <init>(Ljava/util/Set;Lokhttp3/internal/f/b;)V
.locals 0
.param p2 # Lokhttp3/internal/f/b;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Set",
"<",
"Lokhttp3/k$b;",
">;",
"Lokhttp3/internal/f/b;",
")V"
}
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lokhttp3/k;->b:Ljava/util/Set;
iput-object p2, p0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
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-nez v0, :cond_0
new-instance v0, Ljava/lang/IllegalArgumentException;
const-string v1, "Certificate pinning requires X509 certificates"
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v0
:cond_0
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "sha256/"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
check-cast p0, Ljava/security/cert/X509Certificate;
invoke-static {p0}, Lokhttp3/k;->b(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
move-result-object v1
invoke-virtual {v1}, Lokio/ByteString;->base64()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method static a(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
.locals 1
invoke-virtual {p0}, Ljava/security/cert/X509Certificate;->getPublicKey()Ljava/security/PublicKey;
move-result-object v0
invoke-interface {v0}, Ljava/security/PublicKey;->getEncoded()[B
move-result-object v0
invoke-static {v0}, Lokio/ByteString;->of([B)Lokio/ByteString;
move-result-object v0
invoke-virtual {v0}, Lokio/ByteString;->sha1()Lokio/ByteString;
move-result-object v0
return-object v0
.end method
.method static b(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
.locals 1
invoke-virtual {p0}, Ljava/security/cert/X509Certificate;->getPublicKey()Ljava/security/PublicKey;
move-result-object v0
invoke-interface {v0}, Ljava/security/PublicKey;->getEncoded()[B
move-result-object v0
invoke-static {v0}, Lokio/ByteString;->of([B)Lokio/ByteString;
move-result-object v0
invoke-virtual {v0}, Lokio/ByteString;->sha256()Lokio/ByteString;
move-result-object v0
return-object v0
.end method
# virtual methods
.method a(Ljava/lang/String;)Ljava/util/List;
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
")",
"Ljava/util/List",
"<",
"Lokhttp3/k$b;",
">;"
}
.end annotation
invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
move-result-object v1
iget-object v0, p0, Lokhttp3/k;->b:Ljava/util/Set;
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v2
:cond_0
:goto_0
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_2
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lokhttp3/k$b;
invoke-virtual {v0, p1}, Lokhttp3/k$b;->a(Ljava/lang/String;)Z
move-result v3
if-eqz v3, :cond_0
invoke-interface {v1}, Ljava/util/List;->isEmpty()Z
move-result v3
if-eqz v3, :cond_1
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
:cond_1
invoke-interface {v1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
:cond_2
return-object v1
.end method
.method a(Lokhttp3/internal/f/b;)Lokhttp3/k;
.locals 2
iget-object v0, p0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
invoke-static {v0, p1}, Lokhttp3/internal/c;->a(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
:goto_0
return-object p0
:cond_0
new-instance v0, Lokhttp3/k;
iget-object v1, p0, Lokhttp3/k;->b:Ljava/util/Set;
invoke-direct {v0, v1, p1}, Lokhttp3/k;-><init>(Ljava/util/Set;Lokhttp3/internal/f/b;)V
move-object p0, v0
goto :goto_0
.end method
.method public a(Ljava/lang/String;Ljava/util/List;)V
.locals 13
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
"Ljava/util/List",
"<",
"Ljava/security/cert/Certificate;",
">;)V"
}
.end annotation
const/4 v6, 0x0
const/4 v4, 0x0
invoke-virtual {p0, p1}, Lokhttp3/k;->a(Ljava/lang/String;)Ljava/util/List;
move-result-object v8
invoke-interface {v8}, Ljava/util/List;->isEmpty()Z
move-result v0
if-eqz v0, :cond_1
:cond_0
:goto_0
return-void
:cond_1
iget-object v0, p0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
if-eqz v0, :cond_2
iget-object v0, p0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
invoke-virtual {v0, p2, p1}, Lokhttp3/internal/f/b;->a(Ljava/util/List;Ljava/lang/String;)Ljava/util/List;
move-result-object p2
:cond_2
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v9
move v7, v4
:goto_1
if-ge v7, v9, :cond_9
invoke-interface {p2, v7}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/security/cert/X509Certificate;
invoke-interface {v8}, Ljava/util/List;->size()I
move-result v10
move v5, v4
move-object v2, v6
move-object v3, v6
:goto_2
if-ge v5, v10, :cond_8
invoke-interface {v8, v5}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v1
check-cast v1, Lokhttp3/k$b;
iget-object v11, v1, Lokhttp3/k$b;->c:Ljava/lang/String;
const-string v12, "sha256/"
invoke-virtual {v11, v12}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v11
if-eqz v11, :cond_5
if-nez v2, :cond_3
invoke-static {v0}, Lokhttp3/k;->b(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
move-result-object v2
:cond_3
iget-object v1, v1, Lokhttp3/k$b;->d:Lokio/ByteString;
invoke-virtual {v1, v2}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
move-result v1
if-nez v1, :cond_0
:cond_4
move-object v1, v2
move-object v2, v3
add-int/lit8 v3, v5, 0x1
move v5, v3
move-object v3, v2
move-object v2, v1
goto :goto_2
:cond_5
iget-object v11, v1, Lokhttp3/k$b;->c:Ljava/lang/String;
const-string v12, "sha1/"
invoke-virtual {v11, v12}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v11
if-eqz v11, :cond_7
if-nez v3, :cond_6
invoke-static {v0}, Lokhttp3/k;->a(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
move-result-object v3
:cond_6
iget-object v1, v1, Lokhttp3/k$b;->d:Lokio/ByteString;
invoke-virtual {v1, v3}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_4
goto :goto_0
:cond_7
new-instance v0, Ljava/lang/AssertionError;
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
throw v0
:cond_8
add-int/lit8 v0, v7, 0x1
move v7, v0
goto :goto_1
:cond_9
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "Certificate pinning failure!"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, "\n Peer certificate chain:"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-interface {p2}, Ljava/util/List;->size()I
move-result v3
move v1, v4
:goto_3
if-ge v1, v3, :cond_a
invoke-interface {p2, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/security/cert/X509Certificate;
const-string v5, "\n "
invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-static {v0}, Lokhttp3/k;->a(Ljava/security/cert/Certificate;)Ljava/lang/String;
move-result-object v6
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
const-string v6, ": "
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v0}, Ljava/security/cert/X509Certificate;->getSubjectDN()Ljava/security/Principal;
move-result-object v0
invoke-interface {v0}, Ljava/security/Principal;->getName()Ljava/lang/String;
move-result-object v0
invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
add-int/lit8 v0, v1, 0x1
move v1, v0
goto :goto_3
:cond_a
const-string v0, "\n Pinned certificates for "
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, ":"
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-interface {v8}, Ljava/util/List;->size()I
move-result v3
move v1, v4
:goto_4
if-ge v1, v3, :cond_b
invoke-interface {v8, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lokhttp3/k$b;
const-string v4, "\n "
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
add-int/lit8 v0, v1, 0x1
move v1, v0
goto :goto_4
:cond_b
new-instance v0, Ljavax/net/ssl/SSLPeerUnverifiedException;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-direct {v0, v1}, Ljavax/net/ssl/SSLPeerUnverifiedException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public equals(Ljava/lang/Object;)Z
.locals 3
.param p1 # Ljava/lang/Object;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
const/4 v1, 0x1
if-ne p1, p0, :cond_0
:goto_0
return v1
:cond_0
instance-of v0, p1, Lokhttp3/k;
if-eqz v0, :cond_1
iget-object v2, p0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
move-object v0, p1
check-cast v0, Lokhttp3/k;
iget-object v0, v0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
invoke-static {v2, v0}, Lokhttp3/internal/c;->a(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
iget-object v0, p0, Lokhttp3/k;->b:Ljava/util/Set;
check-cast p1, Lokhttp3/k;
iget-object v2, p1, Lokhttp3/k;->b:Ljava/util/Set;
invoke-interface {v0, v2}, Ljava/util/Set;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
move v0, v1
:goto_1
move v1, v0
goto :goto_0
:cond_1
const/4 v0, 0x0
goto :goto_1
.end method
.method public hashCode()I
.locals 2
iget-object v0, p0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
if-eqz v0, :cond_0
iget-object v0, p0, Lokhttp3/k;->c:Lokhttp3/internal/f/b;
invoke-virtual {v0}, Ljava/lang/Object;->hashCode()I
move-result v0
:goto_0
mul-int/lit8 v0, v0, 0x1f
iget-object v1, p0, Lokhttp3/k;->b:Ljava/util/Set;
invoke-interface {v1}, Ljava/util/Set;->hashCode()I
move-result v1
add-int/2addr v0, v1
return v0
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.