am 0e1bdee9
: am 21dc44d2
: Merge "Add analytics to track of what cipher suites are being used" into ub-gmail-ur14-dev
* commit '0e1bdee9ac1cbbaf296e7948c24921f15093278d': Add analytics to track of what cipher suites are being used
This commit is contained in:
commit
979511590c
@ -234,10 +234,10 @@ public class SSLSocketFactoryWrapper extends javax.net.ssl.SSLSocketFactory {
|
||||
ssl.startHandshake();
|
||||
|
||||
SSLSession session = ssl.getSession();
|
||||
LogUtils.d(LogUtils.TAG, "using cipherSuite %s", session.getCipherSuite());
|
||||
if (session == null) {
|
||||
throw new SSLException("Cannot verify SSL socket without session");
|
||||
}
|
||||
LogUtils.d(LogUtils.TAG, "using cipherSuite %s", session.getCipherSuite());
|
||||
if (!HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname, session)) {
|
||||
throw new SSLPeerUnverifiedException("Cannot verify hostname: " + hostname);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import com.android.emailcommon.mail.CertificateValidationException;
|
||||
import com.android.emailcommon.mail.MessagingException;
|
||||
import com.android.emailcommon.provider.HostAuth;
|
||||
import com.android.emailcommon.utility.SSLUtils;
|
||||
import com.android.mail.analytics.Analytics;
|
||||
import com.android.mail.utils.LogUtils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
@ -121,6 +122,13 @@ public class MailTransport {
|
||||
if (canTrySslSecurity() && !canTrustAllCertificates()) {
|
||||
verifyHostname(mSocket, getHost());
|
||||
}
|
||||
if (mSocket instanceof SSLSocket) {
|
||||
final SSLSocket sslSocket = (SSLSocket) mSocket;
|
||||
if (sslSocket.getSession() != null) {
|
||||
Analytics.getInstance().sendEvent("cipher_suite", "open",
|
||||
sslSocket.getSession().getCipherSuite(), 0);
|
||||
}
|
||||
}
|
||||
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
|
||||
mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512);
|
||||
mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);
|
||||
@ -159,6 +167,11 @@ public class MailTransport {
|
||||
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
|
||||
mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512);
|
||||
|
||||
final SSLSocket sslSocket = (SSLSocket) mSocket;
|
||||
if (sslSocket.getSession() != null) {
|
||||
Analytics.getInstance().sendEvent("cipher_suite", "reopenTls",
|
||||
sslSocket.getSession().getCipherSuite(), 0);
|
||||
}
|
||||
} catch (SSLException e) {
|
||||
if (DebugUtils.DEBUG) {
|
||||
LogUtils.d(Logging.LOG_TAG, e.toString());
|
||||
|
Loading…
Reference in New Issue
Block a user