mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
Checks if password is wrong
This commit is contained in:
parent
acb7fa2ed4
commit
196531aafc
1 changed files with 6 additions and 4 deletions
10
jrnl.py
10
jrnl.py
|
@ -103,10 +103,12 @@ class Journal:
|
||||||
key = self._block_tail(key)
|
key = self._block_tail(key)
|
||||||
self.crypto = AES.new(key, AES.MODE_ECB)
|
self.crypto = AES.new(key, AES.MODE_ECB)
|
||||||
journal_plain = self.crypto.decrypt(journal_encrypted)
|
journal_plain = self.crypto.decrypt(journal_encrypted)
|
||||||
|
# encrypted files should end with spaces. No spaces, no luck.
|
||||||
print len(journal_plain)
|
while journal_plain[-1] != " ":
|
||||||
print journal_plain[-16:]
|
key = getpass.getpass('Wrong password. Try again: ')
|
||||||
print 'xxxxxxxxxx'
|
key = self._block_tail(key)
|
||||||
|
self.crypto = AES.new(key, AES.MODE_ECB)
|
||||||
|
journal_plain = self.crypto.decrypt(journal_encrypted)
|
||||||
else:
|
else:
|
||||||
journal_plain = f.read()
|
journal_plain = f.read()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue