Algorithm 3: ECC with AES |
Input: The image of size 256 × 256 to be encrypted or decrypted. |
Elliptic curve parameters: . |
AES symmetric key and initialization vector (IV). |
Output: The corresponding cipher image or original image of size 256 × 256. |
1. Key Generation for ECC |
(The ECC keys are generated as shown in Section 3.1); |
2. Key Generation for AES |
(a) Sender randomly generates 16 bytes long AES symmetric key and the |
Initialization Vector; |
(b) These parameters must be securely transmitted to receiver; |
3. AES Encryption |
(a) Read the image to be encrypted and collect the image pixels separately for the |
channels R, G, and B. |
(b) Convert the pixels in each channel to bytes using the function (PL) where PL
|
denotes the list of pixels. The function returns an immutable array of bytes. |
(c) Perform AES encryption for each of the channel bytes. This generates bytes in the |
encrypted form. |
4. ECC Encryption |
(a) Choose a base of representing the numbers. We have chosen 256 to represent the |
range of 8-bit pixel values; |
(b) Represent the prime number p in base 256 as a list of integers from 0 to 255. |
Measure the length of this representation as L. Initialize group size as
|
(c) Group the cipher bytes from each channel separately with group size initialized |
as above. For each of the channels, convert each group of cipher bytes to big |
integers treating base of representation as 256. If numbers of big integers are odd, |
append with a random value (possibly less than 256); |
(d) Pair up the big integers to represent it as a point on the XY-plane. If the |
X co-ordinate of the pair and that of the shared secret key are identical, then we |
apply point doubling formula over the pair co-ordinates. Otherwise apply point |
addition formula with SSK co-ordinates. |
(e) From Step 4, we get a point on XY plane not at all necessary to be on the |
curve chosen. Represent its co-ordinates in base 256 digits. Each of these. |
representations must be of size equal to . Append 0 zeros |
otherwise to make the required length. |
(f) The base 256 representations of cipher points are treated as image pixels and cipher |
image is constructed correspondingly. The width of cipher image is kept same as |
width of input image and height is computed based on the total number of cipher |
pixels collected. We observe that size of cipher image is generally more than the |
input image. |
(g) Send the cipher image, original image size and ECC public key to receiver. |
5. ECC Decryption |
(a) Compute the shared secret key from the public key of sender as: |
SSK = nBPA = nBnAG + nAnBG = (x, y); |
(b) Represent the prime number p in base 256 as a list of integers from 0 to 255. |
Measure he length of this representation as L. Initialize group size as: |
|
(c) Collect the cipher pixels for each channel and group them with each group size |
equal to groupsize + 1; |
(d) Convert each group in respective channels to corresponding big integers taking |
base to be 256. Pair up the big integers treating them as points on the XY-plane. |
(e) Perform reflection of point with respect x-axis: ; |
(f) Perform point doubling with reflected co-ordinates if the x co-ordinates are |
same or perform point addition formula otherwise. The point obtained for each |
pair lies on XY-plane but need not be a point the elliptic curve |
(g) Represent each of the points obtained in base 256 with each representation of |
length equal to groupsize. Append zeros if required. |
(h) Obtained values are bytes obtained from AES encryption. |
6. AES Decryption |
(a) Obtain the AES key and IV from secure communication. |
(b) Perform AES decryption for the bytes obtained from above for each of the respective |
image channels. |
(c) Represent the bytes as the plain text image of size as mentioned by the sender. |