Added a command to dump the current EMK and certificate.

This is useful for debugging enterprise device authentication issues
with the enterprise machine key (EMK).

Also cleaned up the stale 'chaps' command.

BUG=none
TEST=manual

Change-Id: I3bad18f027b428db93c58de9330d9e04c9469dca
Reviewed-on: https://chromium-review.googlesource.com/185144
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Darren Krahn <dkrahn@chromium.org>
Tested-by: Darren Krahn <dkrahn@chromium.org>
diff --git a/crosh b/crosh
index 94b9c77..de8792d 100755
--- a/crosh
+++ b/crosh
@@ -878,40 +878,6 @@
   rm -rf "$(dirname ${fifo})"
 )
 
-# TODO(dkrahn): Remove once this is the default. crosbug.com/22543
-cmd_chaps() (
-  local flag_file="/home/chronos/.disable_chaps"
-  local enabled=1
-  local changed=0
-  if [ -r ${flag_file} ]; then
-    enabled=0
-  fi
-  if [ -z "$1" ]; then
-    if [ ${enabled} -eq 1 ]; then
-      echo "Currently enabled"
-    else
-      echo "Currently disabled"
-    fi
-    return
-  fi
-  if [ "$1" = "on" ]; then
-    if [ $enabled -eq 0 ]; then
-      changed=1;
-    fi
-    rm -f "${flag_file}"
-  else
-    if [ $enabled -eq 1 ]; then
-      changed=1
-    fi
-    touch "${flag_file}"
-  fi
-  if [ $changed -eq 1 ]; then
-    echo "You must reboot for this to take effect."
-  else
-    echo "No change."
-  fi
-)
-
 cmd_progressive_scan() (
   local flag_file="/home/chronos/.progressive_scan"
   local enabled=0
@@ -1385,6 +1351,11 @@
   echo "Battery discharged ${bat_perc_int}.${bat_perc_dec}% in ${test_length}s"
 )
 
+cmd_dump_emk() (
+  /usr/sbin/cryptohome --action=tpm_attestation_key_status \
+                       --name=attest-ent-machine
+)
+
 substr() {
   local str="$1"
   local start="$2"