summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/Log.java
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2017-12-22 13:45:27 -0800
committerBrad Ebinger <breadley@google.com>2017-12-22 13:45:27 -0800
commitf784b29c9dce6361dd2f1f45c92df30d4a6d3c7c (patch)
treee11c2e1369e0fe455bc248190180fc9e27cac8c8 /telecomm/java/android/telecom/Log.java
parent138d07f82def85bb9dd076aeac158763769701a4 (diff)
Remove hashing for PII in Telecom Logging
Replaces the MD5 hash for logging PII in Telecom with "***" instead. Test: Manual Bug: 67823981 Change-Id: Ieb089fe806663062a551ce7b9071e8b8f5fa9af7
Diffstat (limited to 'telecomm/java/android/telecom/Log.java')
-rw-r--r--telecomm/java/android/telecom/Log.java53
1 files changed, 2 insertions, 51 deletions
diff --git a/telecomm/java/android/telecom/Log.java b/telecomm/java/android/telecom/Log.java
index 3361b5b6e777..83ca4702287d 100644
--- a/telecomm/java/android/telecom/Log.java
+++ b/telecomm/java/android/telecom/Log.java
@@ -340,24 +340,6 @@ public class Log {
return sSessionManager;
}
- private static MessageDigest sMessageDigest;
-
- public static void initMd5Sum() {
- new AsyncTask<Void, Void, Void>() {
- @Override
- public Void doInBackground(Void... args) {
- MessageDigest md;
- try {
- md = MessageDigest.getInstance("SHA-1");
- } catch (NoSuchAlgorithmException e) {
- md = null;
- }
- sMessageDigest = md;
- return null;
- }
- }.execute();
- }
-
public static void setTag(String tag) {
TAG = tag;
DEBUG = isLoggable(android.util.Log.DEBUG);
@@ -425,44 +407,13 @@ public class Log {
/**
* Redact personally identifiable information for production users.
* If we are running in verbose mode, return the original string,
- * and return "****" if we are running on the user build, otherwise
- * return a SHA-1 hash of the input string.
+ * and return "***" otherwise.
*/
public static String pii(Object pii) {
if (pii == null || VERBOSE) {
return String.valueOf(pii);
}
- return "[" + secureHash(String.valueOf(pii).getBytes()) + "]";
- }
-
- private static String secureHash(byte[] input) {
- // Refrain from logging user personal information in user build.
- if (USER_BUILD) {
- return "****";
- }
-
- if (sMessageDigest != null) {
- sMessageDigest.reset();
- sMessageDigest.update(input);
- byte[] result = sMessageDigest.digest();
- return encodeHex(result);
- } else {
- return "Uninitialized SHA1";
- }
- }
-
- private static String encodeHex(byte[] bytes) {
- StringBuffer hex = new StringBuffer(bytes.length * 2);
-
- for (int i = 0; i < bytes.length; i++) {
- int byteIntValue = bytes[i] & 0xff;
- if (byteIntValue < 0x10) {
- hex.append("0");
- }
- hex.append(Integer.toString(byteIntValue, 16));
- }
-
- return hex.toString();
+ return "***";
}
private static String getPrefixFromObject(Object obj) {