123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370 |
- .class final Lokhttp3/CertificatePinner$Pin;
- .super Ljava/lang/Object;
- .source ""
- # annotations
- .annotation system Ldalvik/annotation/EnclosingClass;
- value = Lokhttp3/CertificatePinner;
- .end annotation
- .annotation system Ldalvik/annotation/InnerClass;
- accessFlags = 0x18
- name = "Pin"
- .end annotation
- # static fields
- .field private static final WILDCARD:Ljava/lang/String; = "*."
- # instance fields
- .field final canonicalHostname:Ljava/lang/String;
- .field final hash:Lokio/ByteString;
- .field final hashAlgorithm:Ljava/lang/String;
- .field final pattern:Ljava/lang/String;
- # direct methods
- .method constructor <init>(Ljava/lang/String;Ljava/lang/String;)V
- .locals 2
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
- const-string v0, "*."
- invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v0
- const-string v1, "http://"
- if-eqz v0, :cond_0
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const/4 v1, 0x2
- invoke-virtual {p1, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;
- move-result-object p1
- goto :goto_0
- :cond_0
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- :goto_0
- invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- invoke-static {p1}, Lokhttp3/HttpUrl;->parse(Ljava/lang/String;)Lokhttp3/HttpUrl;
- move-result-object p1
- invoke-virtual {p1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
- move-result-object p1
- iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->canonicalHostname:Ljava/lang/String;
- const-string p1, "sha1/"
- invoke-virtual {p2, p1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v0
- if-eqz v0, :cond_1
- iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
- const/4 p1, 0x5
- :goto_1
- invoke-virtual {p2, p1}, Ljava/lang/String;->substring(I)Ljava/lang/String;
- move-result-object p1
- invoke-static {p1}, Lokio/ByteString;->decodeBase64(Ljava/lang/String;)Lokio/ByteString;
- move-result-object p1
- iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
- goto :goto_2
- :cond_1
- const-string p1, "sha256/"
- invoke-virtual {p2, p1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v0
- if-eqz v0, :cond_3
- iput-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
- const/4 p1, 0x7
- goto :goto_1
- :goto_2
- iget-object p1, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
- if-eqz p1, :cond_2
- return-void
- :cond_2
- new-instance p1, Ljava/lang/IllegalArgumentException;
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- const-string v1, "pins must be base64: "
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p2
- invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
- throw p1
- :cond_3
- new-instance p1, Ljava/lang/IllegalArgumentException;
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- const-string v1, "pins must start with \'sha256/\' or \'sha1/\': "
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p2
- invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
- goto :goto_4
- :goto_3
- throw p1
- :goto_4
- goto :goto_3
- .end method
- # virtual methods
- .method public equals(Ljava/lang/Object;)Z
- .locals 2
- instance-of v0, p1, Lokhttp3/CertificatePinner$Pin;
- if-eqz v0, :cond_0
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
- check-cast p1, Lokhttp3/CertificatePinner$Pin;
- iget-object v1, p1, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
- invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
- move-result v0
- if-eqz v0, :cond_0
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
- iget-object v1, p1, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
- invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
- move-result v0
- if-eqz v0, :cond_0
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
- iget-object p1, p1, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
- invoke-virtual {v0, p1}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
- move-result p1
- if-eqz p1, :cond_0
- const/4 p1, 0x1
- goto :goto_0
- :cond_0
- const/4 p1, 0x0
- :goto_0
- return p1
- .end method
- .method public hashCode()I
- .locals 2
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
- invoke-virtual {v0}, Ljava/lang/String;->hashCode()I
- move-result v0
- const/16 v1, 0x20f
- add-int/2addr v1, v0
- mul-int/lit8 v1, v1, 0x1f
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->hashAlgorithm:Ljava/lang/String;
- invoke-virtual {v0}, Ljava/lang/String;->hashCode()I
- move-result v0
- add-int/2addr v1, v0
- mul-int/lit8 v1, v1, 0x1f
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
- invoke-virtual {v0}, Lokio/ByteString;->hashCode()I
- move-result v0
- add-int/2addr v1, v0
- return v1
- .end method
- .method matches(Ljava/lang/String;)Z
- .locals 10
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->pattern:Ljava/lang/String;
- const-string v1, "*."
- invoke-virtual {v0, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v0
- if-eqz v0, :cond_1
- const/16 v0, 0x2e
- invoke-virtual {p1, v0}, Ljava/lang/String;->indexOf(I)I
- move-result v0
- invoke-virtual {p1}, Ljava/lang/String;->length()I
- move-result v1
- sub-int/2addr v1, v0
- const/4 v2, 0x1
- sub-int/2addr v1, v2
- iget-object v3, p0, Lokhttp3/CertificatePinner$Pin;->canonicalHostname:Ljava/lang/String;
- invoke-virtual {v3}, Ljava/lang/String;->length()I
- move-result v3
- if-ne v1, v3, :cond_0
- const/4 v5, 0x0
- add-int/lit8 v6, v0, 0x1
- iget-object v7, p0, Lokhttp3/CertificatePinner$Pin;->canonicalHostname:Ljava/lang/String;
- const/4 v8, 0x0
- invoke-virtual {v7}, Ljava/lang/String;->length()I
- move-result v9
- move-object v4, p1
- invoke-virtual/range {v4 .. v9}, Ljava/lang/String;->regionMatches(ZILjava/lang/String;II)Z
- move-result p1
- if-eqz p1, :cond_0
- goto :goto_0
- :cond_0
- const/4 v2, 0x0
- :goto_0
- return v2
- :cond_1
- iget-object v0, p0, Lokhttp3/CertificatePinner$Pin;->canonicalHostname:Ljava/lang/String;
- invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
- move-result p1
- return p1
- .end method
- .method public toString()Ljava/lang/String;
- .locals 2
- 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;
- iget-object v1, p0, Lokhttp3/CertificatePinner$Pin;->hash:Lokio/ByteString;
- 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;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v0
- return-object v0
- .end method
|