mirror of
https://github.com/noDRM/DeDRM_tools.git
synced 2026-03-20 04:58:56 +00:00
Try to fix B&N issues
This commit is contained in:
@@ -521,6 +521,15 @@ def decryptBook(userkey, inpath, outpath):
|
||||
# Normal Adobe ADEPT
|
||||
rsa = RSA(userkey)
|
||||
bookkey = rsa.decrypt(base64.b64decode(bookkey.encode('ascii')))
|
||||
|
||||
# Verify key:
|
||||
if len(bookkey) > 16:
|
||||
# Padded as per RSAES-PKCS1-v1_5
|
||||
if verify_book_key(bookkey):
|
||||
bookkey = bookkey[-16:]
|
||||
else:
|
||||
print("Could not decrypt {0:s}. Wrong key".format(os.path.basename(inpath)))
|
||||
return 2
|
||||
else:
|
||||
# Adobe PassHash / B&N
|
||||
key = base64.b64decode(userkey)[:16]
|
||||
@@ -533,14 +542,8 @@ def decryptBook(userkey, inpath, outpath):
|
||||
|
||||
bookkey = bookkey[:-pad]
|
||||
|
||||
|
||||
# Padded as per RSAES-PKCS1-v1_5
|
||||
if len(bookkey) > 16:
|
||||
if verify_book_key(bookkey):
|
||||
if len(bookkey) > 16:
|
||||
bookkey = bookkey[-16:]
|
||||
else:
|
||||
print("Could not decrypt {0:s}. Wrong key".format(os.path.basename(inpath)))
|
||||
return 2
|
||||
|
||||
encryption = inf.read('META-INF/encryption.xml')
|
||||
decryptor = Decryptor(bookkey, encryption)
|
||||
|
||||
Reference in New Issue
Block a user