abenc_maabe_rw15¶
Multi-Authority Attribute-Based Encryption (RW15)
Authors: Yannis Rouselakis, Brent Waters
Scheme Properties
Type: multi-authority attribute-based encryption (public key)
Setting: Bilinear pairing group of prime order
Assumption: Complex q-type assumption
Implementation
- Authors:
Yannis Rouselakis
- Date:
11/2012
- class abenc_maabe_rw15.MaabeRW15(group, verbose=False)[source]¶
Bases:
ABEncMultiAuthEfficient Statically-Secure Large-Universe Multi-Authority Attribute-Based Encryption Rouselakis - Waters
>>> group = PairingGroup('SS512') >>> maabe = MaabeRW15(group) >>> public_parameters = maabe.setup()
Setup the attribute authorities
>>> attributes1 = ['ONE', 'TWO'] >>> attributes2 = ['THREE', 'FOUR'] >>> (public_key1, secret_key1) = maabe.authsetup(public_parameters, 'UT') >>> (public_key2, secret_key2) = maabe.authsetup(public_parameters, 'OU') >>> public_keys = {'UT': public_key1, 'OU': public_key2}
Setup a user and give him some keys
>>> gid = "bob" >>> user_attributes1 = ['STUDENT@UT', 'PHD@UT'] >>> user_attributes2 = ['STUDENT@OU'] >>> user_keys1 = maabe.multiple_attributes_keygen(public_parameters, secret_key1, gid, user_attributes1) >>> user_keys2 = maabe.multiple_attributes_keygen(public_parameters, secret_key2, gid, user_attributes2) >>> user_keys = {'GID': gid, 'keys': merge_dicts(user_keys1, user_keys2)}
Create a random message
>>> message = group.random(GT)
Encrypt the message
>>> access_policy = '(STUDENT@UT or PROFESSOR@OU) and (STUDENT@UT or MASTERS@OU)' >>> cipher_text = maabe.encrypt(public_parameters, public_keys, message, access_policy)
Decrypt the message
>>> decrypted_message = maabe.decrypt(public_parameters, user_keys, cipher_text) >>> decrypted_message == message True
- authsetup(gp, name)[source]¶
Setup an attribute authority. :param gp: The global parameters :param name: The name of the authority :return: The public and private key of the authority
- decrypt(gp, sk, ct)[source]¶
Decrypt the ciphertext using the secret keys of the user. :param gp: The global parameters. :param sk: The secret keys of the user. :param ct: The ciphertext to decrypt. :return: The decrypted message. :raise Exception: When the access policy can not be satisfied with the user’s attributes.
- encrypt(gp, pks, message, policy_str)[source]¶
Encrypt a message under an access policy :param gp: The global parameters. :param pks: The public keys of the relevant attribute authorities, as dict from authority name to public key. :param message: The message to encrypt. :param policy_str: The access policy to use. :return: The encrypted message.
- keygen(gp, sk, gid, attribute)[source]¶
Generate a user secret key for the attribute. :param gp: The global parameters. :param sk: The secret key of the attribute authority. :param gid: The global user identifier. :param attribute: The attribute. :return: The secret key for the attribute for the user with identifier gid.
- multiple_attributes_keygen(gp, sk, gid, attributes)[source]¶
Generate a dictionary of secret keys for a user for a list of attributes. :param gp: The global parameters. :param sk: The secret key of the attribute authority. :param gid: The global user identifier. :param attributes: The list of attributes. :return: A dictionary with attribute names as keys, and secret keys for the attributes as values.
- setup()[source]¶
Setup this multi-authority attribute based encryption scheme. :return: The result of the central setup, for example some global parameters.
- unpack_attribute(attribute)[source]¶
Unpacks an attribute in attribute name, authority name and index :param attribute: The attribute to unpack :return: The attribute name, authority name and the attribute index, if present.
>>> group = PairingGroup('SS512') >>> maabe = MaabeRW15(group) >>> maabe.unpack_attribute('STUDENT@UT') ('STUDENT', 'UT', None) >>> maabe.unpack_attribute('STUDENT@UT_2') ('STUDENT', 'UT', '2')