2 # SPDX-License-Identifier: LGPL-2.1-or-later
5 import cryptography.x509
11 sys.exit('USAGE: update-test-database.py server.pem output_header.h')
13 with open(in_path, 'rb') as in_file:
14 cert_data = in_file.read()
16 cert = cryptography.x509.load_pem_x509_certificate(cert_data)
18 header = '''/* This file is generated from update-certificate-test.py */
20 #define EXPECTED_NOT_VALID_BEFORE "{}Z"
21 #define EXPECTED_NOT_VALID_AFTER "{}Z"
22 '''.format(cert.not_valid_before.isoformat(), cert.not_valid_after.isoformat())
24 with open(out_path, 'w') as out_file:
25 out_file.write(header)