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 <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Alexander Bokovoy 2024-07-31 11:08:12 +03:00 committed by Rob Crittenden
parent 38b83c2b93
commit 531bd05de9

View File

@ -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