Skip to content

Commit

Permalink
Increase resilience against oscrypto issues
Browse files Browse the repository at this point in the history
Guarding against ImportError is not good enough on systems with ossl3
only (which causes oscrypto to crash)
  • Loading branch information
MatthiasValvekens committed Mar 23, 2024
1 parent 8e870e6 commit f86278a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyhanko/pdf_utils/crypt/pubkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,11 +1102,11 @@ def read_seed_from_recipient_cms(
'rc2': symmetric.rc2_cbc_pkcs5_decrypt,
}
)
except ImportError: # pragma: nocover
except Exception as e: # pragma: nocover
if cipher_name in ('des', 'tripledes', 'rc2'):
raise NotImplementedError(
"DES, 3DES and RC2 require oscrypto to be present"
)
) from e

if cipher_name in with_iv:
decryption_fun = with_iv[cipher_name]
Expand Down

0 comments on commit f86278a

Please sign in to comment.