Commit 99ff607c5fb774866afce47e17abac0c87724a85

Authored by Christian Herdtweck
1 parent fbed510b

crypto: Provide crypt-based errors and new constant

Showing 1 changed file with 8 additions and 0 deletions
oletools/crypto.py
@@ -88,6 +88,9 @@ import struct @@ -88,6 +88,9 @@ import struct
88 import os 88 import os
89 from os.path import splitext, isfile 89 from os.path import splitext, isfile
90 from tempfile import mkstemp 90 from tempfile import mkstemp
  91 +from oletools.common.errors import CryptoErrorBase, WrongEncryptionPassword, \
  92 + UnsupportedEncryptionError, MaxCryptoNestingReached
  93 +from olefile import OleFileIO
91 94
92 try: 95 try:
93 import msoffcrypto 96 import msoffcrypto
@@ -95,6 +98,11 @@ except ImportError: @@ -95,6 +98,11 @@ except ImportError:
95 msoffcrypto = None 98 msoffcrypto = None
96 99
97 100
  101 +#: if there is an encrypted file embedded in an encrypted file,
  102 +#: how deep down do we go
  103 +MAX_NESTING_DEPTH = 10
  104 +
  105 +
98 def is_encrypted(olefile): 106 def is_encrypted(olefile):
99 """ 107 """
100 Determine whether document contains encrypted content. 108 Determine whether document contains encrypted content.