Lab Project Attribute-Based Access Control: Healthcare Scenario (Cryptography-Based Approach)
Lab Project Attribute-Based Access Control: Healthcare Scenario (Cryptography-Based Approach)
Lab Project
Attribute-based Access Control: Healthcare Scenario
(Cryptography-based Approach)
Version 2.1
LERSAIS
This lab is designed by Runhua Xu and also part of lab module Electronic Health Record Security in SAHI Project
2
Suppose that a patient/user-centric health application allows a patient/user to store and manage all of his
Electronic Health Records (EHRs) by storing them in a Cloud Service Provider (CSP). The CSP is assumed to be
honest-but-curious. Using an attribute-based access control (cryptography approach), a patient stores his EHRs in
cloud storage. A typical usage scenario of attribute-based encryption is depicted as follows:
A patient encrypts his/her EHRs with a specified access policy and then sends to the CSP. With a provided link,
anyone in the hospital can download the outsourced encrypted EHRs. However, only a user who has attributes that
satisfy the access policy can access(decrypt) the encrypted EHRs.
In this lab, you will develop an advanced crypto system that supports attribute-based access
control to protect the users’ sensitive EHR data and provide access control features.
The Goal and Roadmap.
• Learn the usage of attribute-based encryption via a specific CP-ABE toolkit in the above
scenario.
• Learn the usage of Charm-Crypto lib (How to develop a specific scheme by adopting
Charm-Crypto).
• Use Charm-Crypto to develop a simple public key crypto scheme.
• Use Charm-Crypto to develop a CP-ABE scheme.
3
The recommended environment for this lab is Xnix OS, e.g., Unix, Linux, Mac OS. If you don’t
have them, try to use a virtual machine. It will help you save time dealing with environment
setting/configuration.
Part II: An Overview of Attribute-based Access Control in Cryptography Approach
2.1 Environment Setting
First, verify that you have installed the following dependencies:
• [GMP 5.x] (http://gmplib.org/)
• [OPENSSL](http://www.openssl.org/source/)
• [PBC](http://crypto.stanford.edu/pbc/download.html)
If your environment does not include such libs, we have provided them in the tools folder. Install
GMP and OPENSSL lib first and then the PBC lib. You can download the last version from the
official website. Note that the CPABE toolkit might not compile against versions of PBC older
than 0.5.4.
Then, install the CP-ABE toolkit. You may follow the instructions as follows:
• Install libbswabe
When you install the CP-ABE toolkit successfully, you will have following four tools that can be
executed in the terminal environment.
• cpabe-setup – generates a public key and a master secret key
• cpabe-keygen – generates a private key with a given set of attributes
• cpabe-enc – encrypts a file according to a policy, which is an expression in terms of attributes
• cpabe-dec – decrypts a file using a private key
To check the availability of these tools, you can check the version, e.g.,
To find the specific usage of these tools, check the manual, e.g.,
Example Scenario
Suppose that in a company an employee Alice who wants to share a secret report to a group of employees who
should satisfy one of the following conditions:
• an employee who is the system administrator and is also in the security group
• an employee who is in the market group and also satisfies two of the following requirements:
1) Her/His executive level should be 5
2) She/He should be conjunctively enrolled in audit group
3) She/He should be conjunctively enrolled in strategy group
Try this example scenario first.
Demonstration Steps:
1) Create five folders to represent five parties
2) The Third Part Authority initializes the system and delivers the public key
3) Alice designs the following access policy based on the attribute identities:
(system_admin and security_group) or (market_group and 2 of (executive_level = 5, audit_group,
strategy_group))
Then, she encrypts the secret report and outsources it to the cloud:
6
(Note that we just output the encrypted file “secret_report.pdf.cpabe” to the cloud folder instead of
outsourcing to the real cloud for the purpose of simulation.)
4) Suppose that bob has attribute identities: security_group, market_group, executive_level = 5,
strategy_group; while Chris has attribute identities: system_admin, market_group, audit_group. Thus,
according to our manual verification, we can learn that Bob can access the secret report while Chris
cannot access the secret report. Now we verify this statement by using CP-ABE toolkit.
5) Bob and Chris apply their secret key from the TTP.
(Note that we just output the generated private key to the folder of Bob and Chris instead of sending
through the secure channel.)
7
6) Bob and Chris download the encrypted file from the cloud and decrypt it to access by using their private
key, respectively.
8
Now, it is your turn to demonstrate the application in the healthcare example. Consider the
following access requirements.
Suppose that a patient Alice who wants to share an EHR document to a group of staffs who work
at the hospital. However, the staff should satisfy one of the following conditions:
• a staff who is the senior physician
• a staff who is the junior physician but with privilege level 5
• a staff who is a pharmacist and also satisfies two of the following requirements:
1) the pharmacist works in Pittsburgh area
2) the pharmacist has privilege level 5
3) the pharmacist works at UPMC
Q1: Write similar steps as the example above. You need to abstract proper attribute identities
first and then design the access policy. Then, give two test cases: one to demonstrate the access
successfully, the other to demonstrates a failed access.
9
Note that the option “--enable-darwin” is for Mac OS X system. The command “make install”
and command “make test” may require super-user privileges of your system.
Q2: Show that you have installed charm successfully and pass the test session by attaching
screenshots.
10
We have provided the skeleton of such a PKC CS98 scheme (lab_pkc_cs98.py) with
implementation of Key Generation algorithm. Compare the existing implementation with above
algorithm descriptions to complete the Encryption and Decryption algorithms. Then run the test
file (test_pkc_cs98.py) to check your work. (Note that you need to keep both scheme file and test
file in the same folder)
Q5: Submit your implementation and show the screenshot of the result(s) showing that your
work has passed the test case.
13
Implementation.
14
We have provided the skeleton of such an ABE scheme (lab_abe.py) with implementation of the
Setup algorithm. Compare the existing implementation with above algorithm descriptions to
complete the KeyGen, Encryption and Decryption algorithms. Then run the test file (test_abe.py)
to check your work. (Note that you need to keep both the scheme file and the test file in the same
folder)
Q6: Submit your implementation and show the screenshot of result(s) showing that your work
has passed the test case.