Ciphertext-Policy Attribute-Based Encryption
The cpabe toolkit provides a set of programs implementing a ciphertext-policy attribute-based encryption scheme. It uses the jPBC library for the algebraic operations.
The scheme is implemented as described in the following paper.
Ciphertext-Policy Attribute-Based Encryption
John Bethencourt, Amit Sahai, and Brent Waters. 28th IEEE Symposium on Security and Privacy (Oakland) , May 2006.
Just use this software as the Demo in the source file. Besides, I also provide some tips.
public void setup(String pubfile, String mskfile)
setup is the process of initilize public parameters and master key, "pubfile" is your public file and "mskfile" is the path for your master key file.
public void keygen(String pubfile, String prvfile, String mskfile, String attr_str)
keygen is the process of generate private key, "prvfile" presents the path for you private key file and "attr_str" presents your private attributes(order of attributes is not important). For example,
tom_attr_str="Tom cat master_degree vice_monitor ";jack_attr_str="Jack mouse doctor_degree monitor 3_years_old"
public void enc(String pubfile, String policy, String inputfile, String encfile)
enc is the process of encrypt file with public file and policy. "policy" for the access structure, "inputfile" for the file to be encrypted and encfile is the result. The policy of "policy" is like follows,
"Tom mouse 2of2 doctor_degree vice_monitor 2of3 cat 1of2"
means one must keeps attribute that(at least 2 in ((Tom and mouse), doctore_degree,vice_monitor)) or cat
can decrypt the file.
public void dec(String pubfile, String prvfile, String encfile, String decfile)
dec is the process of decryption of "encfile", and result to "decfile".