Commit e2ee81dafb3ccca867373d088b34a0caa72c3c0d
1 parent
03c467a6
crypto: Create a public non-throwing check for msoffcrypto
Showing
1 changed file
with
5 additions
and
0 deletions
oletools/crypto.py
| @@ -209,6 +209,11 @@ def _check_msoffcrypto(): | @@ -209,6 +209,11 @@ def _check_msoffcrypto(): | ||
| 209 | raise CryptoLibNotImported() | 209 | raise CryptoLibNotImported() |
| 210 | 210 | ||
| 211 | 211 | ||
| 212 | +def check_msoffcrypto(): | ||
| 213 | + """Return `True` iff :py:mod:`msoffcrypto` could be imported.""" | ||
| 214 | + return msoffcrypto is not None | ||
| 215 | + | ||
| 216 | + | ||
| 212 | def decrypt(filename, passwords=None, **temp_file_args): | 217 | def decrypt(filename, passwords=None, **temp_file_args): |
| 213 | """ | 218 | """ |
| 214 | Try to decrypt an encrypted file | 219 | Try to decrypt an encrypted file |