Error message when journal is corrupted, closes #22

This commit is contained in:
Manuel Ebert 2012-05-24 17:04:10 +02:00
parent 7125b887b7
commit 7b0829121f

View file

@ -50,7 +50,11 @@ class Journal:
if not cipher:
return ""
crypto = AES.new(self.key, AES.MODE_CBC, cipher[:16])
try:
plain = crypto.decrypt(cipher[16:])
except ValueError:
print("ERROR: Your journal file seems to be corrupted. You do have a backup, don't you?")
sys.exit(-1)
if plain[-1] != " ": # Journals are always padded
return None
else: