Hi,
Thank you very much for the prompt reply.
So basically, I'm trying to implement an auth protocol based on the CPabe scheme using a web socket in charm-crypto.
This is a part of my code :
def Server_state1(self, input):
group = PairingGroup('SS512')
cpabe = CPabe_BSW07(group)
msg group random(GT)
attributes = ['ONE', 'TWO', 'THREE']
access_policy = ' ((four or three_ and (three or one)) '
(master_public_key, master_key ) = cpabe.setup()
secret_key = cpabe.keygen(master_public_key,master_key, attributes)
cipher_text = cpabe.encrypt(master_public, msg, access_policy) # type (cipher_text) = dict
Ciph = objectToBytes(cipher_text, group)
p_k= objectToBytes(
master_public_key , group)
S_k= objectToBytes(
secret_key , group)
return {'cipher': Ciph, 'pk' : p_k, 'sk' : S_k}
def User_state3(self,input):
ciph_rec = input.get('cipher')
pk_rec = input.get('pk')
sk_rec = input.get('sk')
cipher_text = bytesToObject(ciph_rec, group)
public_key = bytesToObject(pk_rec, group)
Secret_key = bytesToObject(sk_rec, group)
decrypt_text = cpabe.decrypt(public_key, Secret_key, cipher_text)
print(decrypt_text)
### result