Add benchmark for loading DER certificates (#8597)

This commit is contained in:
Alex Gaynor 2023-03-24 18:16:56 -04:00 committed by GitHub
parent 3df3fc8987
commit e565402f2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,16 @@ def test_aki_public_bytes(benchmark):
benchmark(aki.public_bytes)
def test_load_der_certificate(benchmark):
cert_bytes = load_vectors_from_file(
os.path.join("x509", "PKITS_data", "certs", "GoodCACert.crt"),
loader=lambda pemfile: pemfile.read(),
mode="rb",
)
benchmark(x509.load_der_x509_certificate, cert_bytes)
def test_load_pem_certificate(benchmark):
cert_bytes = load_vectors_from_file(
os.path.join("x509", "cryptography.io.pem"),