Skip to content
Snippets Groups Projects
Commit 14138335 authored by William Roberts's avatar William Roberts
Browse files

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
parent 070c01f8
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ class GenerateKeys(object): ...@@ -40,7 +40,7 @@ class GenerateKeys(object):
for line in pkFile: for line in pkFile:
line = line.strip() line = line.strip()
# Are we starting the certificate? # Are we starting the certificate?
if line.startswith("-----BEGIN CERTIFICATE-----"): if line == "-----BEGIN CERTIFICATE-----":
if inCert: if inCert:
sys.exit("Encountered another BEGIN CERTIFICATE without END CERTIFICATE on " + sys.exit("Encountered another BEGIN CERTIFICATE without END CERTIFICATE on " +
"line: " + str(lineNo)) "line: " + str(lineNo))
...@@ -48,7 +48,7 @@ class GenerateKeys(object): ...@@ -48,7 +48,7 @@ class GenerateKeys(object):
inCert = True inCert = True
# Are we ending the ceritifcate? # Are we ending the ceritifcate?
elif line.startswith("-----END CERTIFICATE-----"): elif line == "-----END CERTIFICATE-----":
if not inCert: if not inCert:
sys.exit("Encountered END CERTIFICATE before BEGIN CERTIFICATE on line: " sys.exit("Encountered END CERTIFICATE before BEGIN CERTIFICATE on line: "
+ str(lineNo)) + str(lineNo))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment