As far as I know the implemented Charm schemes only allow you to encrypt either randomly generated group element or msg string encoded as a group element. But these have limitations too, as the order of group elements are derived from prime numbers.
Is there a way to extend charm schemes to encrypt files?
Edited according to Artjom B's comment:
def encrypt(self, pk, M, object):
key = self.group.random(GT)
c1 = abenc.encrypt(pk, key, object)
# instantiate a symmetric enc scheme from this key
cipher = AuthenticatedCryptoAbstraction(sha1(key))
c2 = cipher.encrypt(M)
return { 'c1':c1, 'c2':c2 }
f = open(pth,'r')
message = f.read()
pk, mk = abenc.setup()
att_list=['TWO','FOUR']
access_policy = '((four or three) and (two or one))'
sk = abenc.keygen(pk, mk, att_list)
ct = encrypt(pk, message, access_policy)