# Privacy-Preserved Image Protection Supporting Different Access Rights
## 3 Proposed Scheme
### Image Protection Method
#### 3.1.2 The Image Protection Phase  
In order to protect data privacy, the privacy-preserved image should be processed before sending to the cloud server. The image manager executes Image Protection Algorithm (Algorithm 2) to generate an encrypted image \(EI\), image map \(IM\), authentication information \(AI\), and the number of authorized classes \(\delta\). Then, \(EI\), \(IM\), \(AI\) and \(\delta\) are uploaded to the cloud server. The flowchart of the Image Protection Algorithm (Algorithm 2) is shown in Figure 2.  
Image Protection Algorithm (Algorithm 2) consists of Image Map and Authentication Information Generation Algorithm (Algorithm 3), Coding Algorithm (Algorithm 4), and Image Encryption Algorithm (Algorithm 5). First of all, the image manager defines the mapping between pixels and authorized classes. Image Map and Authentication Information Generation Algorithm (Algorithm 3) and Coding Algorithm (Algorithm 4) are then performed to compute the number of total authorized classes \(\delta\) to generate the image map \(IM\) and the authentication information \(AI=\{(C_{1}^{\prime},\,Code_{1}),\,(C_{2}^{\prime},\,Code_{2}),\,\ldots,\,(C_{ \delta}^{\prime},\,Code_{\delta})\}\). The image map \(IM\), authentication information \(AI\), and the number of authorized classes \(\delta\) are used to execute Image Encryption Algorithm (Algorithm 5) to obtain the encrypted image \(EI\). Note that simple exclusive-or operation or symmetric encryption can be used for encryption in Image Encryption Algorithm (Algorithm 5). Using symmetric encryption for encryption is better due to the high-level security, however the fixed-length groups of bits are required in block cipher algorithms, such as AES and 3 DES. Figure 2: Flowchart of Image Protection Algorithm (Algorithm 2). ```
Input: An original image and \(SK_{j}\) for \(j=1,2,\ldots,\alpha\)
``` Output: The encrypted image \(EI\), image map \(IM\), authentication information \(AI\), the number \(\delta\) of the involved access rights Step 1. Define the protection pixels of the original image and the corresponding classes; Step 2. Execute Image Map and Authentication Information Generation Algorithm (Algorithm 3) with a protection-pixel-defined image and the corresponding classes as input to get image map \(IM\), authentication information \(AI\), and the number \(\delta\) of the involved access rights, where \(AI=\{(C_{1}\textsuperscript{, Code}_{1}),(C_{2}\textsuperscript{, Code}_{2}),\ldots,(C_{\delta}\textsuperscript{, Code}_{\delta})\}\); Step 3. Execute Image Encryption Algorithm (Algorithm 5) with the original image, \(IM\), \(AI=\{(C_{1}\textsuperscript{, Code}_{1}),(C_{2}\textsuperscript{, Code}_{2}),\ldots,(C_{\delta}\textsuperscript{, Code}_{\delta})\}\), and \(SK_{j}\) of \(C_{j}^{\prime}\) for \(j=1,2,\ldots,\delta\) as input to get the encrypted image \(EI\). ```
Input: A protection-pixel-defined image and the corresponding classes Output: Image map \(IM\), authentication information \(AI\), and the number \(\delta\) of the involved access rights Step 1. Determine the number \(\delta\) of the involved classes \(C_{j}^{\prime}\)'s, where \(C_{j}^{\prime}\in\{C_{1},C_{2},\ldots,C_{\alpha}\}\); Step 2. Compute \(\varphi=\lceil\log_{2}(1+\delta)\rceil\); Step 3. Execute Coding Algorithm (Algorithm 4) to get \((C_{j}^{\prime},\textit{ Code}_{j})\) for \(j=1,2,\ldots,\delta\); Step 4. Set \(AI=\{(C_{1}\textsuperscript{, Code}_{1}),(C_{2}\textsuperscript{, Code}_{2}),\ldots,(C_{\delta}\textsuperscript{, Code}_{\delta})\}\); Step 5. With \(AI\), read the protection-pixel-defined image pixel by pixel from left to right and from top to down, and generate a tile of \(\varphi\) bits in \(IM\) with the code of the related class for each read pixel. If the pixel does not need to be protected, the code for the tile will be \(00...0_{2}\) of \(\varphi\) bits. ```

**Algorithm 4** Coding Algorithm.