mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Encryption reads and writes in binary mode
This commit is contained in:
parent
76c9006ed3
commit
4a7a8cb7a4
2 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,7 @@ class EncryptedJournal(Journal.Journal):
|
|||
def _store(self, filename, text):
|
||||
key = make_key(self.config['password'])
|
||||
journal = Fernet(key).encrypt(text.encode('utf-8'))
|
||||
with open(filename, 'w') as f:
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(journal)
|
||||
|
||||
@classmethod
|
||||
|
@ -70,7 +70,7 @@ class LegacyEncryptedJournal(Journal.LegacyJournal):
|
|||
self.config['encrypt'] = True
|
||||
|
||||
def _load(self, filename, password=None):
|
||||
with open(filename) as f:
|
||||
with open(filename, 'rb') as f:
|
||||
journal_encrypted = f.read()
|
||||
iv, cipher = journal_encrypted[:16], journal_encrypted[16:]
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ def prompt(msg):
|
|||
|
||||
|
||||
def py23_input(msg=""):
|
||||
STDERR.write(u(msg))
|
||||
prompt(msg)
|
||||
return STDIN.readline().strip()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue