From 531bd05de9b3764b90804fcdad3b0b49ceb06110 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 31 Jul 2024 11:08:12 +0300 Subject: [PATCH] ipalib/x509.py: support Cryptography 43 Cryptography 43 added two new abstract methods to Certificate class of which we are using one, public_key_algorithm_oid. Fixes: https://pagure.io/freeipa/issue/9641 Signed-off-by: Alexander Bokovoy Reviewed-By: Rob Crittenden --- ipalib/x509.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ipalib/x509.py b/ipalib/x509.py index daeea8195..dfc31081e 100644 --- a/ipalib/x509.py +++ b/ipalib/x509.py @@ -294,6 +294,15 @@ class IPACertificate(crypto_x509.Certificate): tzinfo=datetime.timezone.utc ) + if hasattr(crypto_x509.Certificate, "public_key_algorithm_oid"): + # added in python-cryptography 43.0.0 + @property + def public_key_algorithm_oid(self): + """ + Returns the ObjectIdentifier of the public key. + """ + return self._cert.public_key_algorithm_oid() + @property def tbs_certificate_bytes(self): return self._cert.tbs_certificate_bytes