Bug 1894783 - check cert format in gen_cert_header.py. r=nkulatova

Differential Revision: https://phabricator.services.mozilla.com/D209285
This commit is contained in:
John Schanck 2024-05-14 19:34:49 +00:00
parent 49e35282ae
commit 23814bc74f

View File

@ -7,6 +7,9 @@ def _file_byte_generator(filename):
with open(filename, "rb") as f:
contents = f.read()
if b"-----BEGIN CERTIFICATE-----" in contents:
raise Exception(f"{filename} contains a PEM certificate. Expected DER.")
# Treat empty files the same as a file containing a lone 0;
# a single-element array will fail cert verifcation just as an
# empty array would.