BasicTrustRootIndex.smali 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. .class public final Lokhttp3/internal/tls/BasicTrustRootIndex;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokhttp3/internal/tls/TrustRootIndex;
  6. # instance fields
  7. .field private final subjectToCaCerts:Ljava/util/Map;
  8. .annotation system Ldalvik/annotation/Signature;
  9. value = {
  10. "Ljava/util/Map<",
  11. "Ljavax/security/auth/x500/X500Principal;",
  12. "Ljava/util/Set<",
  13. "Ljava/security/cert/X509Certificate;",
  14. ">;>;"
  15. }
  16. .end annotation
  17. .end field
  18. # direct methods
  19. .method public varargs constructor <init>([Ljava/security/cert/X509Certificate;)V
  20. .locals 6
  21. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  22. new-instance v0, Ljava/util/LinkedHashMap;
  23. invoke-direct {v0}, Ljava/util/LinkedHashMap;-><init>()V
  24. iput-object v0, p0, Lokhttp3/internal/tls/BasicTrustRootIndex;->subjectToCaCerts:Ljava/util/Map;
  25. array-length v0, p1
  26. const/4 v1, 0x0
  27. :goto_0
  28. if-ge v1, v0, :cond_1
  29. aget-object v2, p1, v1
  30. invoke-virtual {v2}, Ljava/security/cert/X509Certificate;->getSubjectX500Principal()Ljavax/security/auth/x500/X500Principal;
  31. move-result-object v3
  32. iget-object v4, p0, Lokhttp3/internal/tls/BasicTrustRootIndex;->subjectToCaCerts:Ljava/util/Map;
  33. invoke-interface {v4, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
  34. move-result-object v4
  35. check-cast v4, Ljava/util/Set;
  36. if-nez v4, :cond_0
  37. new-instance v4, Ljava/util/LinkedHashSet;
  38. const/4 v5, 0x1
  39. invoke-direct {v4, v5}, Ljava/util/LinkedHashSet;-><init>(I)V
  40. iget-object v5, p0, Lokhttp3/internal/tls/BasicTrustRootIndex;->subjectToCaCerts:Ljava/util/Map;
  41. invoke-interface {v5, v3, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  42. :cond_0
  43. invoke-interface {v4, v2}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
  44. add-int/lit8 v1, v1, 0x1
  45. goto :goto_0
  46. :cond_1
  47. return-void
  48. .end method
  49. # virtual methods
  50. .method public equals(Ljava/lang/Object;)Z
  51. .locals 2
  52. const/4 v0, 0x1
  53. if-ne p1, p0, :cond_0
  54. return v0
  55. :cond_0
  56. instance-of v1, p1, Lokhttp3/internal/tls/BasicTrustRootIndex;
  57. if-eqz v1, :cond_1
  58. check-cast p1, Lokhttp3/internal/tls/BasicTrustRootIndex;
  59. iget-object p1, p1, Lokhttp3/internal/tls/BasicTrustRootIndex;->subjectToCaCerts:Ljava/util/Map;
  60. iget-object v1, p0, Lokhttp3/internal/tls/BasicTrustRootIndex;->subjectToCaCerts:Ljava/util/Map;
  61. invoke-interface {p1, v1}, Ljava/util/Map;->equals(Ljava/lang/Object;)Z
  62. move-result p1
  63. if-eqz p1, :cond_1
  64. goto :goto_0
  65. :cond_1
  66. const/4 v0, 0x0
  67. :goto_0
  68. return v0
  69. .end method
  70. .method public findByIssuerAndSignature(Ljava/security/cert/X509Certificate;)Ljava/security/cert/X509Certificate;
  71. .locals 4
  72. invoke-virtual {p1}, Ljava/security/cert/X509Certificate;->getIssuerX500Principal()Ljavax/security/auth/x500/X500Principal;
  73. move-result-object v0
  74. iget-object v1, p0, Lokhttp3/internal/tls/BasicTrustRootIndex;->subjectToCaCerts:Ljava/util/Map;
  75. invoke-interface {v1, v0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
  76. move-result-object v0
  77. check-cast v0, Ljava/util/Set;
  78. const/4 v1, 0x0
  79. if-nez v0, :cond_0
  80. return-object v1
  81. :cond_0
  82. invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
  83. move-result-object v0
  84. :goto_0
  85. invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
  86. move-result v2
  87. if-eqz v2, :cond_1
  88. invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
  89. move-result-object v2
  90. check-cast v2, Ljava/security/cert/X509Certificate;
  91. invoke-virtual {v2}, Ljava/security/cert/X509Certificate;->getPublicKey()Ljava/security/PublicKey;
  92. move-result-object v3
  93. :try_start_0
  94. invoke-virtual {p1, v3}, Ljava/security/cert/X509Certificate;->verify(Ljava/security/PublicKey;)V
  95. :try_end_0
  96. .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
  97. return-object v2
  98. :catch_0
  99. nop
  100. goto :goto_0
  101. :cond_1
  102. return-object v1
  103. .end method
  104. .method public hashCode()I
  105. .locals 1
  106. iget-object v0, p0, Lokhttp3/internal/tls/BasicTrustRootIndex;->subjectToCaCerts:Ljava/util/Map;
  107. invoke-interface {v0}, Ljava/util/Map;->hashCode()I
  108. move-result v0
  109. return v0
  110. .end method