pmacs3/buffer/aes.py

14 lines
432 B
Python
Raw Normal View History

import aes
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 = aes2.Crypter(password)
def read_filter(self, data):
return self.crypter.decrypt(data)
def write_filter(self, data):
return self.crypter.encrypt(data)