From 81648243439fa7c0754bfa3324ce0ab1de0c0674 Mon Sep 17 00:00:00 2001 From: Dain Nilsson Date: Tue, 1 Oct 2024 13:26:25 +0200 Subject: [PATCH] Fix deprecation warning (#636) --- yubikit/piv.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/yubikit/piv.py b/yubikit/piv.py index 4fef71d9..282f23db 100755 --- a/yubikit/piv.py +++ b/yubikit/piv.py @@ -165,7 +165,12 @@ def challenge_len(self) -> int: def _parse_management_key(key_type, management_key): if key_type == MANAGEMENT_KEY_TYPE.TDES: - return algorithms.TripleDES(management_key) + # TripleDES moved to decrepit in cryptography 43 + try: + from cryptography.hazmat.decrepit.ciphers.algorithms import TripleDES + except ImportError: + TripleDES = algorithms.TripleDES + return TripleDES(management_key) else: return algorithms.AES(management_key)