Misc cleanups and avoid logging PII
Change-Id: I9f906dabe0dd00a434ff88878f0639c835b2e2a7
This commit is contained in:
parent
1ce33fd93f
commit
877b9070fa
@ -45,7 +45,7 @@ public class SSLUtils {
|
|||||||
*
|
*
|
||||||
* @param insecure if true, bypass all SSL certificate checks
|
* @param insecure if true, bypass all SSL certificate checks
|
||||||
*/
|
*/
|
||||||
public synchronized static final SSLCertificateSocketFactory getSSLSocketFactory(
|
public synchronized static SSLCertificateSocketFactory getSSLSocketFactory(
|
||||||
boolean insecure) {
|
boolean insecure) {
|
||||||
if (insecure) {
|
if (insecure) {
|
||||||
if (sInsecureFactory == null) {
|
if (sInsecureFactory == null) {
|
||||||
@ -102,7 +102,6 @@ public class SSLUtils {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private static abstract class StubKeyManager extends X509ExtendedKeyManager {
|
private static abstract class StubKeyManager extends X509ExtendedKeyManager {
|
||||||
@Override public abstract String chooseClientAlias(
|
@Override public abstract String chooseClientAlias(
|
||||||
String[] keyTypes, Principal[] issuers, Socket socket);
|
String[] keyTypes, Principal[] issuers, Socket socket);
|
||||||
@ -204,15 +203,19 @@ public class SSLUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (certificateChain == null || privateKey == null) {
|
if (certificateChain == null || privateKey == null) {
|
||||||
throw new CertificateException(
|
throw new CertificateException("Can't access certificate from keystore");
|
||||||
"Can't access certificate from keystore for alias [" + alias + "]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new KeyChainKeyManager(alias, certificateChain, privateKey);
|
return new KeyChainKeyManager(alias, certificateChain, privateKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void logError(String alias, String type, Exception ex) {
|
private static void logError(String alias, String type, Exception ex) {
|
||||||
|
// Avoid logging PII when explicit logging is not on.
|
||||||
|
if (LOG_ENABLED) {
|
||||||
Log.e(TAG, "Unable to retrieve " + type + " for [" + alias + "] due to " + ex);
|
Log.e(TAG, "Unable to retrieve " + type + " for [" + alias + "] due to " + ex);
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Unable to retrieve " + type + " due to " + ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyChainKeyManager(
|
private KeyChainKeyManager(
|
||||||
|
Loading…
Reference in New Issue
Block a user