parent
bfa40e4a69
commit
5c3978c867
|
@ -427,7 +427,7 @@ def _load_crypto_pycrypto():
|
|||
return total
|
||||
|
||||
def decrypt(self, data):
|
||||
return _PKCS1_v1_5.new(self._rsa).decrypt(data, b'')
|
||||
return _PKCS1_v1_5.new(self._rsa).decrypt(data, 172)
|
||||
|
||||
return (ARC4, RSA, AES)
|
||||
|
||||
|
@ -1901,9 +1901,6 @@ class PDFDocument(object):
|
|||
return
|
||||
|
||||
def verify_book_key(self, bookkey):
|
||||
if len(bookkey) <= 16:
|
||||
return False
|
||||
|
||||
if bookkey[-17] != '\x00' and bookkey[-17] != 0:
|
||||
# Byte not null, invalid result
|
||||
return False
|
||||
|
@ -1988,6 +1985,7 @@ class PDFDocument(object):
|
|||
bookkey = codecs.decode(bookkey.encode('utf-8'),'base64')
|
||||
bookkey = rsa.decrypt(bookkey)
|
||||
|
||||
if len(bookkey) > 16:
|
||||
if (self.verify_book_key(bookkey)):
|
||||
bookkey = bookkey[-16:]
|
||||
length = 16
|
||||
|
|
Loading…
Reference in New Issue