tools: Strengthen BEGIN/END CERTIFICATE checks
insertkeys.py used beginswith() when checking that the BEGIN
and END CERTIFICATE clauses in PEM files were correct. It should
have done an explicit check on equality.
Change-Id: I5efb48d180bc674e6281a26a955acd248588b8bd
diff --git a/tools/insertkeys.py b/tools/insertkeys.py
index 7237d6f..ca1e432 100755
--- a/tools/insertkeys.py
+++ b/tools/insertkeys.py
@@ -40,7 +40,7 @@
for line in pkFile:
line = line.strip()
# Are we starting the certificate?
- if line.startswith("-----BEGIN CERTIFICATE-----"):
+ if line == "-----BEGIN CERTIFICATE-----":
if inCert:
sys.exit("Encountered another BEGIN CERTIFICATE without END CERTIFICATE on " +
"line: " + str(lineNo))
@@ -48,7 +48,7 @@
inCert = True
# Are we ending the ceritifcate?
- elif line.startswith("-----END CERTIFICATE-----"):
+ elif line == "-----END CERTIFICATE-----":
if not inCert:
sys.exit("Encountered END CERTIFICATE before BEGIN CERTIFICATE on line: "
+ str(lineNo))