def __init__(self, store_dir): self.last_action = 'init' self.create_key() self.tmp_file_id = base64.urlsafe_b64encode(os.urandom(32)).strip('=') self.filepath = os.path.join(store_dir, "{}.aes".format(self.tmp_file_id)) self.file = open(self.filepath, 'w+b') _TemporaryFileWrapper.__init__(self, self.file, self.filepath, delete=True)
def __init__(self, filepath): self.filepath = filepath self.key_id = os.path.basename(self.filepath).split('.')[0] log.debug("Opening secure file %s with %s", self.filepath, self.key_id) self.file = open(self.filepath, 'r+b') # last argument is 'False' because the file has not to be deleted on .close() _TemporaryFileWrapper.__init__(self, self.file, self.filepath, False) # pylint: disable=W0233 self.load_key()
def __init__(self, filepath): self.filepath = filepath self.key_id = os.path.basename(self.filepath).split('.')[0] log.debug("Opening secure file %s with %s" % (self.filepath, self.key_id)) self.file = open(self.filepath, 'r+b') # last argument is 'False' because the file has not to be deleted on .close() _TemporaryFileWrapper.__init__(self, self.file, self.filepath, False) self.load_key()
def __init__(self, filedir): """ filedir: directory where to store files """ self.create_key() # XXX remind enhance file name with incremental number self.filepath = os.path.join(filedir, "%s.aes" % self.key_id) log.debug("++ Creating %s filetmp" % self.filepath) self.file = open(self.filepath, 'w+b') # last argument is 'True' because the file has to be deleted on .close() _TemporaryFileWrapper.__init__(self, self.file, self.filepath, True)
def __init__(self, filedir): """ filedir: dir target to keep GL. """ self.create_key() # XXX remind enhance file name with incremental number self.filepath = os.path.join(filedir, "%s.aes" % self.key_id) log.debug("++ Creating %s filetmp" % self.filepath) self.file = open(self.filepath, 'w+b') # last argument is 'True' because the file has to be deleted on .close() _TemporaryFileWrapper.__init__(self, self.file, self.filepath, True)
def __init__(self, filedir): """ filedir: directory where to store files """ self.creation_date = time.time() self.create_key() self.encryptor_finalized = False # XXX remind enhance file name with incremental number self.filepath = os.path.join(filedir, "%s.aes" % self.key_id) log.debug("++ Creating %s filetmp" % self.filepath) self.file = open(self.filepath, 'w+b') # last argument is 'True' because the file has to be deleted on .close() _TemporaryFileWrapper.__init__(self, self.file, self.filepath, True)