Checks if password is wrong

This commit is contained in:
Stephan Gabler 2012-04-13 20:38:36 +02:00
parent acb7fa2ed4
commit 196531aafc

10
jrnl.py
View file

@ -103,10 +103,12 @@ class Journal:
key = self._block_tail(key)
self.crypto = AES.new(key, AES.MODE_ECB)
journal_plain = self.crypto.decrypt(journal_encrypted)
print len(journal_plain)
print journal_plain[-16:]
print 'xxxxxxxxxx'
# encrypted files should end with spaces. No spaces, no luck.
while journal_plain[-1] != " ":
key = getpass.getpass('Wrong password. Try again: ')
key = self._block_tail(key)
self.crypto = AES.new(key, AES.MODE_ECB)
journal_plain = self.crypto.decrypt(journal_encrypted)
else:
journal_plain = f.read()