Fix RSA.import_key (fixes #101)
Apparently "import_key" only exists in newer versions (as an alias to "importKey"). "importKey" works in all versions ...
This commit is contained in:
parent
077e8f5c2a
commit
c15135b12f
|
@ -69,4 +69,4 @@ List of changes since the fork of Apprentice Harper's repository:
|
||||||
|
|
||||||
## Fixes on master (not yet released):
|
## Fixes on master (not yet released):
|
||||||
|
|
||||||
- (None)
|
- Fix a bug introduced with #48 that breaks DeDRM'ing on Calibre 4 (fixes #101).
|
|
@ -302,7 +302,7 @@ def decryptBook(userkey, inpath, outpath):
|
||||||
|
|
||||||
if len(bookkey) != 64:
|
if len(bookkey) != 64:
|
||||||
# Normal or "hardened" Adobe ADEPT
|
# Normal or "hardened" Adobe ADEPT
|
||||||
rsakey = RSA.import_key(userkey) # parses the ASN1 structure
|
rsakey = RSA.importKey(userkey) # parses the ASN1 structure
|
||||||
bookkey = base64.b64decode(bookkey)
|
bookkey = base64.b64decode(bookkey)
|
||||||
if int(keytype, 10) > 2:
|
if int(keytype, 10) > 2:
|
||||||
bookkey = removeHardening(rights, keytype, bookkey)
|
bookkey = removeHardening(rights, keytype, bookkey)
|
||||||
|
|
|
@ -1669,7 +1669,7 @@ class PDFDocument(object):
|
||||||
|
|
||||||
def initialize_ebx_inept(self, password, docid, param):
|
def initialize_ebx_inept(self, password, docid, param):
|
||||||
self.is_printable = self.is_modifiable = self.is_extractable = True
|
self.is_printable = self.is_modifiable = self.is_extractable = True
|
||||||
rsakey = RSA.import_key(password) # parses the ASN1 structure
|
rsakey = RSA.importKey(password) # parses the ASN1 structure
|
||||||
length = int_value(param.get('Length', 0)) // 8
|
length = int_value(param.get('Length', 0)) // 8
|
||||||
rights = codecs.decode(param.get('ADEPT_LICENSE'), 'base64')
|
rights = codecs.decode(param.get('ADEPT_LICENSE'), 'base64')
|
||||||
rights = zlib.decompress(rights, -15)
|
rights = zlib.decompress(rights, -15)
|
||||||
|
|
Loading…
Reference in New Issue