Waiting till post MR0 - this impacts signing tools for MR0.

Revert "Modify release tools to replace certs in MMAC files."

This reverts commit a6e0466ab5771ab1b9f806b9411015b5ff9852f6.

Change-Id: Ib7819185bad119013f307ce4301d5f02190e14ed
diff --git a/tools/releasetools/check_target_files_signatures b/tools/releasetools/check_target_files_signatures
index 45d30a6..ae372ba 100755
--- a/tools/releasetools/check_target_files_signatures
+++ b/tools/releasetools/check_target_files_signatures
@@ -135,7 +135,7 @@
 
     for i in to_load:
       f = open(i)
-      cert = common.ParseCertificate(f.read())
+      cert = ParseCertificate(f.read())
       f.close()
       name, _ = os.path.splitext(i)
       name, _ = os.path.splitext(name)
@@ -144,6 +144,21 @@
 ALL_CERTS = CertDB()
 
 
+def ParseCertificate(data):
+  """Parse a PEM-format certificate."""
+  cert = []
+  save = False
+  for line in data.split("\n"):
+    if "--END CERTIFICATE--" in line:
+      break
+    if save:
+      cert.append(line)
+    if "--BEGIN CERTIFICATE--" in line:
+      save = True
+  cert = "".join(cert).decode('base64')
+  return cert
+
+
 def CertFromPKCS7(data, filename):
   """Read the cert out of a PKCS#7-format file (which is what is
   stored in a signed .apk)."""
@@ -160,7 +175,7 @@
       AddProblem("error reading cert:\n" + err)
       return None
 
-    cert = common.ParseCertificate(out)
+    cert = ParseCertificate(out)
     if not cert:
       AddProblem("error parsing cert output")
       return None