Files
rr3-apk/decompiled/sources/com/mbridge/msdk/thrid/okhttp/Handshake.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

119 lines
4.4 KiB
Java

package com.mbridge.msdk.thrid.okhttp;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.mbridge.msdk.thrid.okhttp.internal.Util;
import java.io.IOException;
import java.security.Principal;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.Collections;
import java.util.List;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
/* loaded from: classes4.dex */
public final class Handshake {
private final CipherSuite cipherSuite;
private final List<Certificate> localCertificates;
private final List<Certificate> peerCertificates;
private final TlsVersion tlsVersion;
public CipherSuite cipherSuite() {
return this.cipherSuite;
}
public List<Certificate> localCertificates() {
return this.localCertificates;
}
public List<Certificate> peerCertificates() {
return this.peerCertificates;
}
public TlsVersion tlsVersion() {
return this.tlsVersion;
}
private Handshake(TlsVersion tlsVersion, CipherSuite cipherSuite, List<Certificate> list, List<Certificate> list2) {
this.tlsVersion = tlsVersion;
this.cipherSuite = cipherSuite;
this.peerCertificates = list;
this.localCertificates = list2;
}
public static Handshake get(SSLSession sSLSession) throws IOException {
Certificate[] certificateArr;
List emptyList;
List emptyList2;
String cipherSuite = sSLSession.getCipherSuite();
if (cipherSuite == null) {
throw new IllegalStateException("cipherSuite == null");
}
if ("SSL_NULL_WITH_NULL_NULL".equals(cipherSuite)) {
throw new IOException("cipherSuite == SSL_NULL_WITH_NULL_NULL");
}
CipherSuite forJavaName = CipherSuite.forJavaName(cipherSuite);
String protocol = sSLSession.getProtocol();
if (protocol == null) {
throw new IllegalStateException("tlsVersion == null");
}
if ("NONE".equals(protocol)) {
throw new IOException("tlsVersion == NONE");
}
TlsVersion forJavaName2 = TlsVersion.forJavaName(protocol);
try {
certificateArr = sSLSession.getPeerCertificates();
} catch (SSLPeerUnverifiedException unused) {
certificateArr = null;
}
if (certificateArr != null) {
emptyList = Util.immutableList(certificateArr);
} else {
emptyList = Collections.emptyList();
}
Certificate[] localCertificates = sSLSession.getLocalCertificates();
if (localCertificates != null) {
emptyList2 = Util.immutableList(localCertificates);
} else {
emptyList2 = Collections.emptyList();
}
return new Handshake(forJavaName2, forJavaName, emptyList, emptyList2);
}
public static Handshake get(TlsVersion tlsVersion, CipherSuite cipherSuite, List<Certificate> list, List<Certificate> list2) {
if (tlsVersion == null) {
throw new NullPointerException("tlsVersion == null");
}
if (cipherSuite == null) {
throw new NullPointerException("cipherSuite == null");
}
return new Handshake(tlsVersion, cipherSuite, Util.immutableList(list), Util.immutableList(list2));
}
public Principal peerPrincipal() {
if (this.peerCertificates.isEmpty()) {
return null;
}
return ((X509Certificate) this.peerCertificates.get(0)).getSubjectX500Principal();
}
public Principal localPrincipal() {
if (this.localCertificates.isEmpty()) {
return null;
}
return ((X509Certificate) this.localCertificates.get(0)).getSubjectX500Principal();
}
public boolean equals(Object obj) {
if (!(obj instanceof Handshake)) {
return false;
}
Handshake handshake = (Handshake) obj;
return this.tlsVersion.equals(handshake.tlsVersion) && this.cipherSuite.equals(handshake.cipherSuite) && this.peerCertificates.equals(handshake.peerCertificates) && this.localCertificates.equals(handshake.localCertificates);
}
public int hashCode() {
return ((((((IronSourceError.ERROR_NON_EXISTENT_INSTANCE + this.tlsVersion.hashCode()) * 31) + this.cipherSuite.hashCode()) * 31) + this.peerCertificates.hashCode()) * 31) + this.localCertificates.hashCode();
}
}