abenc_adapt_hybrid¶
Hybrid Encryption Adapter for CP-ABE (CP-ABE Hybrid)
Description: Converts a Ciphertext-Policy Attribute-Based Encryption scheme into a hybrid encryption scheme capable of encrypting arbitrary-length messages.
Notes: Uses symmetric encryption (AES) with a randomly generated session key.
The session key is encrypted using the underlying CP-ABE scheme.
Adapter Properties
Type: hybrid encryption adapter
Underlying Scheme: any Ciphertext-Policy ABE scheme
Purpose: enables CP-ABE schemes to encrypt arbitrary-length byte messages
Implementation
- Authors:
Ayo Akinyele
- Date:
2011
- class abenc_adapt_hybrid.HybridABEnc(scheme, groupObj)[source]¶
Bases:
ABEnc>>> group = PairingGroup("SS512") >>> cpabe = CPabe_BSW07(group) >>> hyb_abe = HybridABEnc(cpabe, group) >>> access_policy = '((four or three) and (two or one))' >>> msg = b"hello world this is an important message." >>> (master_public_key, master_key) = hyb_abe.setup() >>> secret_key = hyb_abe.keygen(master_public_key, master_key, ['ONE', 'TWO', 'THREE']) >>> cipher_text = hyb_abe.encrypt(master_public_key, msg, access_policy) >>> hyb_abe.decrypt(master_public_key, secret_key, cipher_text) b'hello world this is an important message.'