am dcc645eb: am dd00a967: Merge "Revert the revert. (its time to sign MR1)" into klp-dev

* commit 'dcc645ebb1a87982d2a067b8584ff167ae2c5287':
  Revert the revert. (its time to sign MR1)
This commit is contained in:
Baligh Uddin
2013-11-12 16:46:48 -08:00
committed by Android Git Automerger
3 changed files with 53 additions and 17 deletions

View File

@@ -957,3 +957,18 @@ def GetTypeAndDevice(mount_point, info):
return PARTITION_TYPES[fstab[mount_point].fs_type], fstab[mount_point].device
else:
return None
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