import aesutil from buffer import FileBuffer class AesBuffer(FileBuffer): btype = 'aesfile' def __init__(self, path, password, name=None): '''ab = AesBuffer(path, password)''' FileBuffer.__init__(self, path, name) self.crypter = aesutil.Crypter(password) def read_filter(self, data): return self.crypter.decrypt(data) def write_filter(self, data): return self.crypter.encrypt(data)