Handshake.smali 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. .class public final Lokhttp3/Handshake;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # instance fields
  5. .field private final cipherSuite:Lokhttp3/CipherSuite;
  6. .field private final localCertificates:Ljava/util/List;
  7. .annotation system Ldalvik/annotation/Signature;
  8. value = {
  9. "Ljava/util/List<",
  10. "Ljava/security/cert/Certificate;",
  11. ">;"
  12. }
  13. .end annotation
  14. .end field
  15. .field private final peerCertificates:Ljava/util/List;
  16. .annotation system Ldalvik/annotation/Signature;
  17. value = {
  18. "Ljava/util/List<",
  19. "Ljava/security/cert/Certificate;",
  20. ">;"
  21. }
  22. .end annotation
  23. .end field
  24. .field private final tlsVersion:Lokhttp3/TlsVersion;
  25. # direct methods
  26. .method private constructor <init>(Lokhttp3/TlsVersion;Lokhttp3/CipherSuite;Ljava/util/List;Ljava/util/List;)V
  27. .locals 0
  28. .annotation system Ldalvik/annotation/Signature;
  29. value = {
  30. "(",
  31. "Lokhttp3/TlsVersion;",
  32. "Lokhttp3/CipherSuite;",
  33. "Ljava/util/List<",
  34. "Ljava/security/cert/Certificate;",
  35. ">;",
  36. "Ljava/util/List<",
  37. "Ljava/security/cert/Certificate;",
  38. ">;)V"
  39. }
  40. .end annotation
  41. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  42. iput-object p1, p0, Lokhttp3/Handshake;->tlsVersion:Lokhttp3/TlsVersion;
  43. iput-object p2, p0, Lokhttp3/Handshake;->cipherSuite:Lokhttp3/CipherSuite;
  44. iput-object p3, p0, Lokhttp3/Handshake;->peerCertificates:Ljava/util/List;
  45. iput-object p4, p0, Lokhttp3/Handshake;->localCertificates:Ljava/util/List;
  46. return-void
  47. .end method
  48. .method public static get(Ljavax/net/ssl/SSLSession;)Lokhttp3/Handshake;
  49. .locals 4
  50. invoke-interface {p0}, Ljavax/net/ssl/SSLSession;->getCipherSuite()Ljava/lang/String;
  51. move-result-object v0
  52. if-eqz v0, :cond_3
  53. invoke-static {v0}, Lokhttp3/CipherSuite;->forJavaName(Ljava/lang/String;)Lokhttp3/CipherSuite;
  54. move-result-object v0
  55. invoke-interface {p0}, Ljavax/net/ssl/SSLSession;->getProtocol()Ljava/lang/String;
  56. move-result-object v1
  57. if-eqz v1, :cond_2
  58. invoke-static {v1}, Lokhttp3/TlsVersion;->forJavaName(Ljava/lang/String;)Lokhttp3/TlsVersion;
  59. move-result-object v1
  60. :try_start_0
  61. invoke-interface {p0}, Ljavax/net/ssl/SSLSession;->getPeerCertificates()[Ljava/security/cert/Certificate;
  62. move-result-object v2
  63. :try_end_0
  64. .catch Ljavax/net/ssl/SSLPeerUnverifiedException; {:try_start_0 .. :try_end_0} :catch_0
  65. goto :goto_0
  66. :catch_0
  67. const/4 v2, 0x0
  68. :goto_0
  69. if-eqz v2, :cond_0
  70. invoke-static {v2}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List;
  71. move-result-object v2
  72. goto :goto_1
  73. :cond_0
  74. invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
  75. move-result-object v2
  76. :goto_1
  77. invoke-interface {p0}, Ljavax/net/ssl/SSLSession;->getLocalCertificates()[Ljava/security/cert/Certificate;
  78. move-result-object p0
  79. if-eqz p0, :cond_1
  80. invoke-static {p0}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List;
  81. move-result-object p0
  82. goto :goto_2
  83. :cond_1
  84. invoke-static {}, Ljava/util/Collections;->emptyList()Ljava/util/List;
  85. move-result-object p0
  86. :goto_2
  87. new-instance v3, Lokhttp3/Handshake;
  88. invoke-direct {v3, v1, v0, v2, p0}, Lokhttp3/Handshake;-><init>(Lokhttp3/TlsVersion;Lokhttp3/CipherSuite;Ljava/util/List;Ljava/util/List;)V
  89. return-object v3
  90. :cond_2
  91. new-instance p0, Ljava/lang/IllegalStateException;
  92. const-string v0, "tlsVersion == null"
  93. invoke-direct {p0, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  94. throw p0
  95. :cond_3
  96. new-instance p0, Ljava/lang/IllegalStateException;
  97. const-string v0, "cipherSuite == null"
  98. invoke-direct {p0, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  99. throw p0
  100. .end method
  101. .method public static get(Lokhttp3/TlsVersion;Lokhttp3/CipherSuite;Ljava/util/List;Ljava/util/List;)Lokhttp3/Handshake;
  102. .locals 1
  103. .annotation system Ldalvik/annotation/Signature;
  104. value = {
  105. "(",
  106. "Lokhttp3/TlsVersion;",
  107. "Lokhttp3/CipherSuite;",
  108. "Ljava/util/List<",
  109. "Ljava/security/cert/Certificate;",
  110. ">;",
  111. "Ljava/util/List<",
  112. "Ljava/security/cert/Certificate;",
  113. ">;)",
  114. "Lokhttp3/Handshake;"
  115. }
  116. .end annotation
  117. if-eqz p0, :cond_1
  118. if-eqz p1, :cond_0
  119. new-instance v0, Lokhttp3/Handshake;
  120. invoke-static {p2}, Lokhttp3/internal/Util;->immutableList(Ljava/util/List;)Ljava/util/List;
  121. move-result-object p2
  122. invoke-static {p3}, Lokhttp3/internal/Util;->immutableList(Ljava/util/List;)Ljava/util/List;
  123. move-result-object p3
  124. invoke-direct {v0, p0, p1, p2, p3}, Lokhttp3/Handshake;-><init>(Lokhttp3/TlsVersion;Lokhttp3/CipherSuite;Ljava/util/List;Ljava/util/List;)V
  125. return-object v0
  126. :cond_0
  127. new-instance p0, Ljava/lang/NullPointerException;
  128. const-string p1, "cipherSuite == null"
  129. invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  130. throw p0
  131. :cond_1
  132. new-instance p0, Ljava/lang/NullPointerException;
  133. const-string p1, "tlsVersion == null"
  134. invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
  135. throw p0
  136. .end method
  137. # virtual methods
  138. .method public cipherSuite()Lokhttp3/CipherSuite;
  139. .locals 1
  140. iget-object v0, p0, Lokhttp3/Handshake;->cipherSuite:Lokhttp3/CipherSuite;
  141. return-object v0
  142. .end method
  143. .method public equals(Ljava/lang/Object;)Z
  144. .locals 3
  145. instance-of v0, p1, Lokhttp3/Handshake;
  146. const/4 v1, 0x0
  147. if-nez v0, :cond_0
  148. return v1
  149. :cond_0
  150. check-cast p1, Lokhttp3/Handshake;
  151. iget-object v0, p0, Lokhttp3/Handshake;->tlsVersion:Lokhttp3/TlsVersion;
  152. iget-object v2, p1, Lokhttp3/Handshake;->tlsVersion:Lokhttp3/TlsVersion;
  153. invoke-virtual {v0, v2}, Ljava/lang/Enum;->equals(Ljava/lang/Object;)Z
  154. move-result v0
  155. if-eqz v0, :cond_1
  156. iget-object v0, p0, Lokhttp3/Handshake;->cipherSuite:Lokhttp3/CipherSuite;
  157. iget-object v2, p1, Lokhttp3/Handshake;->cipherSuite:Lokhttp3/CipherSuite;
  158. invoke-virtual {v0, v2}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
  159. move-result v0
  160. if-eqz v0, :cond_1
  161. iget-object v0, p0, Lokhttp3/Handshake;->peerCertificates:Ljava/util/List;
  162. iget-object v2, p1, Lokhttp3/Handshake;->peerCertificates:Ljava/util/List;
  163. invoke-interface {v0, v2}, Ljava/util/List;->equals(Ljava/lang/Object;)Z
  164. move-result v0
  165. if-eqz v0, :cond_1
  166. iget-object v0, p0, Lokhttp3/Handshake;->localCertificates:Ljava/util/List;
  167. iget-object p1, p1, Lokhttp3/Handshake;->localCertificates:Ljava/util/List;
  168. invoke-interface {v0, p1}, Ljava/util/List;->equals(Ljava/lang/Object;)Z
  169. move-result p1
  170. if-eqz p1, :cond_1
  171. const/4 v1, 0x1
  172. :cond_1
  173. return v1
  174. .end method
  175. .method public hashCode()I
  176. .locals 2
  177. iget-object v0, p0, Lokhttp3/Handshake;->tlsVersion:Lokhttp3/TlsVersion;
  178. invoke-virtual {v0}, Ljava/lang/Enum;->hashCode()I
  179. move-result v0
  180. const/16 v1, 0x20f
  181. add-int/2addr v1, v0
  182. mul-int/lit8 v1, v1, 0x1f
  183. iget-object v0, p0, Lokhttp3/Handshake;->cipherSuite:Lokhttp3/CipherSuite;
  184. invoke-virtual {v0}, Ljava/lang/Object;->hashCode()I
  185. move-result v0
  186. add-int/2addr v1, v0
  187. mul-int/lit8 v1, v1, 0x1f
  188. iget-object v0, p0, Lokhttp3/Handshake;->peerCertificates:Ljava/util/List;
  189. invoke-interface {v0}, Ljava/util/List;->hashCode()I
  190. move-result v0
  191. add-int/2addr v1, v0
  192. mul-int/lit8 v1, v1, 0x1f
  193. iget-object v0, p0, Lokhttp3/Handshake;->localCertificates:Ljava/util/List;
  194. invoke-interface {v0}, Ljava/util/List;->hashCode()I
  195. move-result v0
  196. add-int/2addr v1, v0
  197. return v1
  198. .end method
  199. .method public localCertificates()Ljava/util/List;
  200. .locals 1
  201. .annotation system Ldalvik/annotation/Signature;
  202. value = {
  203. "()",
  204. "Ljava/util/List<",
  205. "Ljava/security/cert/Certificate;",
  206. ">;"
  207. }
  208. .end annotation
  209. iget-object v0, p0, Lokhttp3/Handshake;->localCertificates:Ljava/util/List;
  210. return-object v0
  211. .end method
  212. .method public localPrincipal()Ljava/security/Principal;
  213. .locals 2
  214. iget-object v0, p0, Lokhttp3/Handshake;->localCertificates:Ljava/util/List;
  215. invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
  216. move-result v0
  217. if-nez v0, :cond_0
  218. iget-object v0, p0, Lokhttp3/Handshake;->localCertificates:Ljava/util/List;
  219. const/4 v1, 0x0
  220. invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
  221. move-result-object v0
  222. check-cast v0, Ljava/security/cert/X509Certificate;
  223. invoke-virtual {v0}, Ljava/security/cert/X509Certificate;->getSubjectX500Principal()Ljavax/security/auth/x500/X500Principal;
  224. move-result-object v0
  225. goto :goto_0
  226. :cond_0
  227. const/4 v0, 0x0
  228. :goto_0
  229. return-object v0
  230. .end method
  231. .method public peerCertificates()Ljava/util/List;
  232. .locals 1
  233. .annotation system Ldalvik/annotation/Signature;
  234. value = {
  235. "()",
  236. "Ljava/util/List<",
  237. "Ljava/security/cert/Certificate;",
  238. ">;"
  239. }
  240. .end annotation
  241. iget-object v0, p0, Lokhttp3/Handshake;->peerCertificates:Ljava/util/List;
  242. return-object v0
  243. .end method
  244. .method public peerPrincipal()Ljava/security/Principal;
  245. .locals 2
  246. iget-object v0, p0, Lokhttp3/Handshake;->peerCertificates:Ljava/util/List;
  247. invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
  248. move-result v0
  249. if-nez v0, :cond_0
  250. iget-object v0, p0, Lokhttp3/Handshake;->peerCertificates:Ljava/util/List;
  251. const/4 v1, 0x0
  252. invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
  253. move-result-object v0
  254. check-cast v0, Ljava/security/cert/X509Certificate;
  255. invoke-virtual {v0}, Ljava/security/cert/X509Certificate;->getSubjectX500Principal()Ljavax/security/auth/x500/X500Principal;
  256. move-result-object v0
  257. goto :goto_0
  258. :cond_0
  259. const/4 v0, 0x0
  260. :goto_0
  261. return-object v0
  262. .end method
  263. .method public tlsVersion()Lokhttp3/TlsVersion;
  264. .locals 1
  265. iget-object v0, p0, Lokhttp3/Handshake;->tlsVersion:Lokhttp3/TlsVersion;
  266. return-object v0
  267. .end method