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