- Clone the repository.
- cd into the cloned directory.
- Run the command:
chmod 744 check.sh
chmod 744 compile.sh
- Run
./check.sh
in terminal(sudo password will be asked). - Add the following command to the end of Makefile in cpabe and libswabe folder:
new: clean
$(MAKE)
(Add this line after a tab)
- Make a new branch with your name as firstname_lastname using the command :
git branch <your_name>
- Change to that branch using the command:
git checkout <your_name>
- Alternatively to above 2 commands, use :
git checkout -b <your_name>
. This command will bring you to this branch after creating it. - Make the desired changes and add commit push the changes.
- Make a pull request to the master branch of the repo.
- Do not merge the pull request. Wait for all others to check your code.
- Check your current branch using :
git branch
. The branch with * mark is the current directory. Use :git checkout master
to goto master branch. - Once your code is merged, you can delete your branch using the command:
git branch -d <your_name>
. git pull
to bring all the new changes in the master branch to your local.- To make more changes, goto step 1.
Reference: working with git branches
- Run
./compile.sh
-
If any changes are made to files in libswabe folder:
- Goto libswabe directory using terminal
- Run :
make new
- Run :
sudo make install
-
- Goto cpabe folder using terminal
- Run the command:
gcc -o setupdemo setup.c common.c -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pbc -I/usr/local/include/pbc -lglib-2.0 -Wl,-rpath /usr/local/lib -lgmp -Wl,-rpath /usr/local/lib -lpbc -lbswabe -lcrypto -lcrypto -lgmp -w
- If no error,
setupdemo
executable file is created. ./setupdemo
- Enter number of attributes in the attribute universe, defined as 'n' in the research paper.
- Files "pub_key" and "master_key" will be created, to be used in next steps.
-
- Goto cpabe folder using Terminal
- Run the command:
gcc -o keygendemo keygen.c common.c policy_lang.c -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pbc -I/usr/local/include/pbc -lglib-2.0 -Wl,-rpath /usr/local/lib -lgmp -Wl,-rpath /usr/local/lib -lpbc -lbswabe -lcrypto -lcrypto -lgmp -w
- If no error,
keygendemo
executable file is created. - Run
./keygendemo pub_key master_key [Attrs..]
where n is number of attributes entered in setup program while [Attrs.. ] represents list of attributes in binary separated by space. Eg. If n=4 then a sample attribute list will be 1 0 0 1 . - File named "priv_key" will be created unless "-o" option is used in step 4 in which case, the mentioned name will be the output file.
-
- Run the command:
gcc -o encdemo enc.c common.c policy_lang.c -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pbc -I/usr/local/include/pbc -O3 -Wall -lglib-2.0 -Wl,-rpath /usr/local/lib -lgmp -Wl,-rpath /usr/local/lib -lpbc -lbswabe -lcrypto -lcrypto -lgmp -w
- If no error,
encdemo
executable file is created. - Before running this file, create/bring a sample file that needs to be encrypted, say
trial.txt
- Run
./encdemo pub_key trial.txt 1 0 1 1
, where pub_key is name of public key file generated in setup phase, and 1 0 1 1 is a sample policy corresponding to n=4 (specified in keygen step), which will be used in encrypting the doc. - File named "trial.txt.cpabe" will replace the originally existing file containing the encrypted unreadable text.
- Run the command:
-
- Run the command:
gcc -o decdemo dec.c common.c -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pbc -I/usr/local/include/pbc -O3 -Wall -lglib-2.0 -Wl,-rpath /usr/local/lib -lgmp -Wl,-rpath /usr/local/lib -lpbc -lbswabe -lcrypto -lcrypto -lgmp -w
- If no error,
decdemo
executable file is created. - Ensure that the previously encrypted file is available in the present directory.
- Run
./decdemo pub_key priv_key trial.txt.cpabe
- If the user's ID is available on the server and is not revoked from access, then decryption will pass and "trial.txt" will be produced, otherwise decryption will fail.
- Run the command:
- demo.c : Extra file to try and test code bits before putting them into main files.
- ecc.c : openSSL way of defining a curve, doing point addition, double and multiplication. For reference. (requires openSSL to be installed in the system)