From d1e9aecea9f77e2368ead3917e505eb303750d4a Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 28 May 2024 16:14:00 +0200 Subject: [PATCH] Compatibility with python-cryptography 42 based on initial changes proposed in #534 which did not work for the old cryptography, but this should work for both. Signed-off-by: Jakub Jelen --- test/test_crypto.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_crypto.py b/test/test_crypto.py index b8a2a4e9..7abbecb4 100644 --- a/test/test_crypto.py +++ b/test/test_crypto.py @@ -8,6 +8,7 @@ from base64 import b64decode from hashlib import sha256, sha384 from cryptography.hazmat.primitives.serialization import load_pem_public_key +from cryptography.exceptions import UnsupportedAlgorithm rsa_private_key = b""" -----BEGIN RSA PRIVATE KEY----- @@ -206,7 +207,7 @@ def setUp(self): self._has_sect163r2 = True try: load_pem_public_key(ecc_bad_curve) - except ValueError: + except (ValueError, UnsupportedAlgorithm): self._has_sect163r2 = False def test_public_from_pem_rsa(self):