Research Article

Data Access Control Based on Blockchain in Medical Cyber Physical Systems

Algorithm 2

User registration.
Input: attrID, attrName, pwd
Output: user.setMspId which is the ID of the user in MSP
(1)FabricUser user getUser (attrID, attrName, pwd);
(2)RegistrationRequest request newRegistrationRequest (attrID, attrName, pwd);
(3)request.setSecret (pwd);
(4)request.addAttribute (new Attribute (”attrID ”));
(5)request.addAttribute (new Attribute (”attrName ”));
(6)request.addAttribute (new Attribute (”pwd ”));
(7)RegistrationRequest request = new
RegistrationRequest (attribute);
(8)request.setSecret (pwd);
(9)if !user.getEnrollmentSecret ().equals(pwd) then
(10) throw new RuntimeException (” The password is
(11) abnormal. The password you set is inconsistent
(12) with the password in the system: yourPWD:”
(13) +pwd+,” system: ”+user.getEnrollmentSecret ());
(14)end
(15)user.setEnrollment (ca.enroll (NAME, pwd));