From 64c7fa950cf1699748d813489e6acd7b039570b6 Mon Sep 17 00:00:00 2001 From: lash Date: Fri, 21 Jan 2022 10:06:29 +0000 Subject: [PATCH] Clean pollution from encrypt branch --- clicada/crypt.py | 38 -------------------------------------- clicada/user/file.py | 3 +-- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 clicada/crypt.py diff --git a/clicada/crypt.py b/clicada/crypt.py deleted file mode 100644 index b917098..0000000 --- a/clicada/crypt.py +++ /dev/null @@ -1,38 +0,0 @@ -# standard imports -import os -import logging - -from Crypto.Cipher import AES -from Crypto.Util import Counter - -logg = logging.getLogger(__name__) - - -class Encrypt: - - aesBlockSize = 1 << 7 - - def __init__(self, secret, db_dir): - fp = os.path.join(db_dir, '.aes_ctr_iv') - try: - f = open(fp, 'rb') - self.iv = f.read() - except FileNotFoundError: - logg.debug('generating new iv for aes-ctr') - self.iv = os.urandom(8) - f = open(fp, 'wb') - f.write(self.iv) - - f.close() - - iv_num = int.from_bytes(self.iv, 'big') - self.ctr = Counter.new(aesBlockSize, initial_value=iv_num) - self.cipher = AES.new(secret, AES.MODE_CTR, counter=self.ctr) - - - def encrypt(self, v): - return self.cipher.encrypt(v) - - - def decrypt(self, v): - return self.cipher.decrypt(v) diff --git a/clicada/user/file.py b/clicada/user/file.py index 846ffc2..8ca23d4 100644 --- a/clicada/user/file.py +++ b/clicada/user/file.py @@ -65,7 +65,7 @@ class Account(Person): class FileUserStore: - def __init__(self, metadata_opener, chain_spec, label, store_base_path, ttl, encrypter=None): + def __init__(self, metadata_opener, chain_spec, label, store_base_path, ttl): invalidate_before = datetime.datetime.now() - datetime.timedelta(seconds=ttl) self.invalidate_before = int(invalidate_before.timestamp()) self.have_xattr = False @@ -82,7 +82,6 @@ class FileUserStore: self.__validate_dir() self.metadata_opener = metadata_opener self.failed_entities = {} - self.encrypter = encrypter def __validate_dir(self):