Rabbit-R1/switch port/smali/smali_classes3/okhttp3/CertificatePinner$Pin.smali
2024-05-21 17:08:36 -04:00

819 lines
19 KiB
Smali

.class public final Lokhttp3/CertificatePinner$Pin;
.super Ljava/lang/Object;
.source "CertificatePinner.kt"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lokhttp3/CertificatePinner;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x19
name = "Pin"
.end annotation
.annotation runtime Lkotlin/Metadata;
bv = {
0x1,
0x0,
0x3
}
d1 = {
"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\u0008\u0003\n\u0002\u0018\u0002\n\u0002\u0008\u0007\n\u0002\u0010\u000b\n\u0002\u0008\u0002\n\u0002\u0010\u0008\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0004\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0005J\u0013\u0010\u000e\u001a\u00020\u000f2\u0008\u0010\u0010\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\u0008\u0010\u0011\u001a\u00020\u0012H\u0016J\u000e\u0010\u0013\u001a\u00020\u000f2\u0006\u0010\u0014\u001a\u00020\u0015J\u000e\u0010\u0016\u001a\u00020\u000f2\u0006\u0010\u0017\u001a\u00020\u0003J\u0008\u0010\u0018\u001a\u00020\u0003H\u0016R\u0011\u0010\u0006\u001a\u00020\u0007\u00a2\u0006\u0008\n\u0000\u001a\u0004\u0008\u0008\u0010\tR\u0011\u0010\n\u001a\u00020\u0003\u00a2\u0006\u0008\n\u0000\u001a\u0004\u0008\u000b\u0010\u000cR\u0011\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0008\n\u0000\u001a\u0004\u0008\r\u0010\u000c\u00a8\u0006\u0019"
}
d2 = {
"Lokhttp3/CertificatePinner$Pin;",
"",
"pattern",
"",
"pin",
"(Ljava/lang/String;Ljava/lang/String;)V",
"hash",
"Lokio/ByteString;",
"getHash",
"()Lokio/ByteString;",
"hashAlgorithm",
"getHashAlgorithm",
"()Ljava/lang/String;",
"getPattern",
"equals",
"",
"other",
"hashCode",
"",
"matchesCertificate",
"certificate",
"Ljava/security/cert/X509Certificate;",
"matchesHostname",
"hostname",
"toString",
"okhttp"
}
k = 0x1
mv = {
0x1,
0x4,
0x0
}
.end annotation
# instance fields
.field private final hash:Lokio/ByteString;
.field private final hashAlgorithm:Ljava/lang/String;
.field private final pattern:Ljava/lang/String;
# direct methods
.method public constructor <init>(Ljava/lang/String;Ljava/lang/String;)V
.locals 11
const-string v0, "pattern"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "pin"
invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 243
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const-string v0, "*."
const/4 v1, 0x0
const/4 v2, 0x2
const/4 v3, 0x0
.line 254
invoke-static {p1, v0, v1, v2, v3}, Lkotlin/text/StringsKt;->startsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result v0
const/4 v4, -0x1
if-eqz v0, :cond_0
move-object v5, p1
check-cast v5, Ljava/lang/CharSequence;
const-string v6, "*"
const/4 v7, 0x1
const/4 v8, 0x0
const/4 v9, 0x4
const/4 v10, 0x0
invoke-static/range {v5 .. v10}, Lkotlin/text/StringsKt;->indexOf$default(Ljava/lang/CharSequence;Ljava/lang/String;IZILjava/lang/Object;)I
move-result v0
if-eq v0, v4, :cond_2
:cond_0
const-string v0, "**."
.line 255
invoke-static {p1, v0, v1, v2, v3}, Lkotlin/text/StringsKt;->startsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_1
move-object v5, p1
check-cast v5, Ljava/lang/CharSequence;
const-string v6, "*"
const/4 v7, 0x2
const/4 v8, 0x0
const/4 v9, 0x4
const/4 v10, 0x0
invoke-static/range {v5 .. v10}, Lkotlin/text/StringsKt;->indexOf$default(Ljava/lang/CharSequence;Ljava/lang/String;IZILjava/lang/Object;)I
move-result v0
if-eq v0, v4, :cond_2
.line 256
:cond_1
move-object v5, p1
check-cast v5, Ljava/lang/CharSequence;
const-string v6, "*"
const/4 v7, 0x0
const/4 v8, 0x0
const/4 v9, 0x6
const/4 v10, 0x0
invoke-static/range {v5 .. v10}, Lkotlin/text/StringsKt;->indexOf$default(Ljava/lang/CharSequence;Ljava/lang/String;IZILjava/lang/Object;)I
move-result v0
if-ne v0, v4, :cond_3
:cond_2
const/4 v0, 0x1
goto :goto_0
:cond_3
move v0, v1
:goto_0
if-eqz v0, :cond_9
.line 261
invoke-static {p1}, Lokhttp3/internal/HostnamesKt;->toCanonicalHost(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
if-eqz v0, :cond_8
iput-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
const-string p1, "sha1/"
.line 264
invoke-static {p2, p1, v1, v2, v3}, Lkotlin/text/StringsKt;->startsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result p1
const-string v0, "Invalid pin hash: "
const-string v4, "(this as java.lang.String).substring(startIndex)"
if-eqz p1, :cond_5
const-string p1, "sha1"
iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
.line 266
sget-object p1, Lokio/ByteString;->Companion:Lokio/ByteString$Companion;
const/4 v1, 0x5
invoke-virtual {p2, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object v1
invoke-static {v1, v4}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {p1, v1}, Lokio/ByteString$Companion;->decodeBase64(Ljava/lang/String;)Lokio/ByteString;
move-result-object p1
if-eqz p1, :cond_4
iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
goto :goto_1
:cond_4
new-instance p0, Ljava/lang/IllegalArgumentException;
new-instance p1, Ljava/lang/StringBuilder;
invoke-direct {p1, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)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}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_5
const-string p1, "sha256/"
.line 268
invoke-static {p2, p1, v1, v2, v3}, Lkotlin/text/StringsKt;->startsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_7
const-string p1, "sha256"
iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
.line 270
sget-object p1, Lokio/ByteString;->Companion:Lokio/ByteString$Companion;
const/4 v1, 0x7
invoke-virtual {p2, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;
move-result-object v1
invoke-static {v1, v4}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {p1, v1}, Lokio/ByteString$Companion;->decodeBase64(Ljava/lang/String;)Lokio/ByteString;
move-result-object p1
if-eqz p1, :cond_6
iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
:goto_1
return-void
:cond_6
new-instance p0, Ljava/lang/IllegalArgumentException;
new-instance p1, Ljava/lang/StringBuilder;
invoke-direct {p1, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)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}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.line 272
:cond_7
new-instance p0, Ljava/lang/IllegalArgumentException;
new-instance p1, Ljava/lang/StringBuilder;
const-string v0, "pins must start with \'sha256/\' or \'sha1/\': "
invoke-direct {p1, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)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}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.line 261
:cond_8
new-instance p0, Ljava/lang/IllegalArgumentException;
new-instance p2, Ljava/lang/StringBuilder;
const-string v0, "Invalid pattern: "
invoke-direct {p2, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)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}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.line 257
:cond_9
new-instance p0, Ljava/lang/StringBuilder;
const-string p2, "Unexpected pattern: "
invoke-direct {p0, p2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
.line 254
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-virtual {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p1, Ljava/lang/Throwable;
throw p1
.end method
# virtual methods
.method public equals(Ljava/lang/Object;)Z
.locals 4
.line 307
move-object v0, p0
check-cast v0, Lokhttp3/CertificatePinner$Pin;
const/4 v0, 0x1
if-ne p0, p1, :cond_0
return v0
.line 308
:cond_0
instance-of v1, p1, Lokhttp3/CertificatePinner$Pin;
const/4 v2, 0x0
if-nez v1, :cond_1
return v2
:cond_1
iget-object v1, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
.line 310
check-cast p1, Lokhttp3/CertificatePinner$Pin;
iget-object v3, p1, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
invoke-static {v1, v3}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v1
xor-int/2addr v1, v0
if-eqz v1, :cond_2
return v2
:cond_2
iget-object v1, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
.line 311
iget-object v3, p1, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
invoke-static {v1, v3}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v1
xor-int/2addr v1, v0
if-eqz v1, :cond_3
return v2
:cond_3
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
.line 312
iget-object p1, p1, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
invoke-static {p0, p1}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result p0
xor-int/2addr p0, v0
if-eqz p0, :cond_4
return v2
:cond_4
return v0
.end method
.method public final getHash()Lokio/ByteString;
.locals 0
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
return-object p0
.end method
.method public final getHashAlgorithm()Ljava/lang/String;
.locals 0
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
return-object p0
.end method
.method public final getPattern()Ljava/lang/String;
.locals 0
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
return-object p0
.end method
.method public hashCode()I
.locals 2
iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
.line 318
invoke-virtual {v0}, Ljava/lang/String;->hashCode()I
move-result v0
mul-int/lit8 v0, v0, 0x1f
iget-object v1, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
.line 319
invoke-virtual {v1}, Ljava/lang/String;->hashCode()I
move-result v1
add-int/2addr v0, v1
mul-int/lit8 v0, v0, 0x1f
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
.line 320
invoke-virtual {p0}, Lokio/ByteString;->hashCode()I
move-result p0
add-int/2addr v0, p0
return v0
.end method
.method public final matchesCertificate(Ljava/security/cert/X509Certificate;)Z
.locals 3
const-string v0, "certificate"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
.line 297
invoke-virtual {v0}, Ljava/lang/String;->hashCode()I
move-result v1
const v2, -0x35dc49d9
if-eq v1, v2, :cond_1
const v2, 0x35d905
if-eq v1, v2, :cond_0
goto :goto_0
:cond_0
const-string v1, "sha1"
.line 299
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
sget-object v0, Lokhttp3/CertificatePinner;->Companion:Lokhttp3/CertificatePinner$Companion;
invoke-virtual {v0, p1}, Lokhttp3/CertificatePinner$Companion;->sha1Hash(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
move-result-object p1
invoke-static {p0, p1}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result p0
goto :goto_1
:cond_1
const-string v1, "sha256"
.line 298
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
sget-object v0, Lokhttp3/CertificatePinner;->Companion:Lokhttp3/CertificatePinner$Companion;
invoke-virtual {v0, p1}, Lokhttp3/CertificatePinner$Companion;->sha256Hash(Ljava/security/cert/X509Certificate;)Lokio/ByteString;
move-result-object p1
invoke-static {p0, p1}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result p0
goto :goto_1
:cond_2
:goto_0
const/4 p0, 0x0
:goto_1
return p0
.end method
.method public final matchesHostname(Ljava/lang/String;)Z
.locals 11
const-string v0, "hostname"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
const-string v1, "**."
const/4 v2, 0x0
const/4 v3, 0x2
const/4 v4, 0x0
.line 278
invoke-static {v0, v1, v2, v3, v4}, Lkotlin/text/StringsKt;->startsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result v0
const/4 v1, 0x1
if-eqz v0, :cond_1
iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
.line 280
invoke-virtual {v0}, Ljava/lang/String;->length()I
move-result v0
add-int/lit8 v7, v0, -0x3
.line 281
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result v0
sub-int/2addr v0, v7
.line 282
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result v3
sub-int v4, v3, v7
iget-object v5, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
const/4 v6, 0x3
const/4 v8, 0x0
const/16 v9, 0x10
const/4 v10, 0x0
move-object v3, p1
invoke-static/range {v3 .. v10}, Lkotlin/text/StringsKt;->regionMatches$default(Ljava/lang/String;ILjava/lang/String;IIZILjava/lang/Object;)Z
move-result p0
if-eqz p0, :cond_3
if-eqz v0, :cond_0
sub-int/2addr v0, v1
.line 283
invoke-virtual {p1, v0}, Ljava/lang/String;->charAt(I)C
move-result p0
const/16 p1, 0x2e
if-ne p0, p1, :cond_3
:cond_0
:goto_0
move v2, v1
goto :goto_1
:cond_1
iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
const-string v5, "*."
.line 285
invoke-static {v0, v5, v2, v3, v4}, Lkotlin/text/StringsKt;->startsWith$default(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2
iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
.line 287
invoke-virtual {v0}, Ljava/lang/String;->length()I
move-result v0
add-int/lit8 v7, v0, -0x1
.line 288
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result v0
sub-int/2addr v0, v7
.line 289
invoke-virtual {p1}, Ljava/lang/String;->length()I
move-result v3
sub-int v4, v3, v7
iget-object v5, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
const/4 v6, 0x1
const/4 v8, 0x0
const/16 v9, 0x10
const/4 v10, 0x0
move-object v3, p1
invoke-static/range {v3 .. v10}, Lkotlin/text/StringsKt;->regionMatches$default(Ljava/lang/String;ILjava/lang/String;IIZILjava/lang/Object;)Z
move-result p0
if-eqz p0, :cond_3
.line 290
move-object v3, p1
check-cast v3, Ljava/lang/CharSequence;
const/16 v4, 0x2e
add-int/lit8 v5, v0, -0x1
const/4 v6, 0x0
const/4 v7, 0x4
const/4 v8, 0x0
invoke-static/range {v3 .. v8}, Lkotlin/text/StringsKt;->lastIndexOf$default(Ljava/lang/CharSequence;CIZILjava/lang/Object;)I
move-result p0
const/4 p1, -0x1
if-ne p0, p1, :cond_3
goto :goto_0
:cond_2
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
.line 292
invoke-static {p1, p0}, Lkotlin/jvm/internal/Intrinsics;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v2
:cond_3
:goto_1
return v2
.end method
.method public toString()Ljava/lang/String;
.locals 2
.line 304
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
iget-object v1, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const/16 v1, 0x2f
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
move-result-object v0
iget-object p0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
invoke-virtual {p0}, Lokio/ByteString;->base64()Ljava/lang/String;
move-result-object p0
invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
return-object p0
.end method