Fix for decryption check
This commit is contained in:
parent
be57bcca7d
commit
77dcc462aa
|
@ -375,7 +375,6 @@ class InterfacePluginAction(InterfaceAction):
|
||||||
#print ('Kobo library filename: {0}'.format(book.filename))
|
#print ('Kobo library filename: {0}'.format(book.filename))
|
||||||
for userkey in self.userkeys:
|
for userkey in self.userkeys:
|
||||||
print (_('Trying key: '), codecs.encode(userkey, 'hex'))
|
print (_('Trying key: '), codecs.encode(userkey, 'hex'))
|
||||||
check = True
|
|
||||||
try:
|
try:
|
||||||
fileout = PersistentTemporaryFile('.epub', dir=self.tdir)
|
fileout = PersistentTemporaryFile('.epub', dir=self.tdir)
|
||||||
#print ('Temp file: {0}'.format(fileout.name))
|
#print ('Temp file: {0}'.format(fileout.name))
|
||||||
|
@ -396,8 +395,7 @@ class InterfacePluginAction(InterfaceAction):
|
||||||
file = book.encryptedfiles[filename]
|
file = book.encryptedfiles[filename]
|
||||||
contents = file.decrypt(userkey, contents)
|
contents = file.decrypt(userkey, contents)
|
||||||
# Parse failures mean the key is probably wrong.
|
# Parse failures mean the key is probably wrong.
|
||||||
if check:
|
file.check(contents)
|
||||||
check = not file.check(contents)
|
|
||||||
zout.writestr(filename, contents)
|
zout.writestr(filename, contents)
|
||||||
zout.close()
|
zout.close()
|
||||||
zin.close()
|
zin.close()
|
||||||
|
|
Loading…
Reference in New Issue