scieee AI-readable full text Open interactive document viewer

Reference software for JPEG privacy and security

Ramos Garcia, Paula

Abstract

The purpose of this project is to produce a first draft of a partial implementation of the reference software for the new JPEG privacy and security specification (JPEG P&S). Since JPEG P&S is based on the concept of the JPEG Universal Metadata Box Format (JUMBF), also under development (JPEG Systems new part 5), it might be necessary to implement some elements of JUMBF as well. It standardizes some mechanisms for adding privacy and security to standard JPEG images. Most JPEG standards are supplemented by "Reference Software", which implements most of the features of the standard to demonstrate its feasibility and provide clues on how to implement it.

Full text

REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY A Degree Thesis Submitted to the Faculty of the Escola Tècnica d'Enginyeria de Telecomunicació de Barcelona Universitat Politècnica de Catalunya By Paula Ramos García In partial fulfilment of the requirements for the degree in TECHNOLOGY AND TELECOMMUNICATION SERVICES ENGINEERING Advisor: Jaime Delgado Barcelona, January 2022 REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 1 Abstract Nowadays, the lack of privacy in the personal lives of individuals is becoming more and more common. As technologies and social networks advance, our desire to share content increases and, consequently, to publish our images and those of our closest friends. As a result of this, the need arises to protect said photographs and, consequently, take care of our privacy and integrity. For this reason, in this project, software is developed to solve this lack of citizen security. As JPEG is currently the most used standard for images, the project is developed by creating data structures that are encrypted embedded with the images that contain our personal data using the previously mentioned standard. These structures form headers with implicit privacy and security functionalities to be able to offer access (or not) to certain users desired by the owner. To demonstrate the use of the reference software, a simulated application is proposed in the school environment, which has the purpose of protecting the identity of our sons and daughters. The mentioned software is based on a combination of metadata and access rules that allow the image to be encrypted to protect it. In this way, only those who possess the adequate access rules will be able to decrypt the content of the protected image. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 2 Resum En el món actual, està a l'ordre del dia la poca privadesa de la vida íntima dels individus. A mesura que avancen les tecnologies i les xarxes socials, augmenten les nostres ganes de compartir contingut i, en conseqüència, de publicar les nostres imatges i les dels nostres més propers. Arran d'això, sorgeix la necessitat de protegir aquestes fotografies i, per tant, tenir cura de la nostra intimitat i integritat. Per això, en aquest projecte, es desenvolupa un software per donar solució a aquesta mancança en la seguretat dels ciutadans. Com que l'estàndard més utilitzat avui en dia és el JPEG, el projecte es desenvolupa creant unes estructures de dades que s'encripten juntament amb les imatges que contenen les nostres dades personals mitjançant l'estàndard anteriorment comentat. Aquestes estructures formen capçaleres amb funcionalitats de privacitat i seguretat implícites per poder oferir accés (o no) a determinats usuaris desitjats pel propietari. Per demostrar l'ús del programari de referència, es proposa una aplicació simulada a l'entorn escolar, que té la finalitat de protegir la identitat dels nostres fills i filles. Aquesta aplicació es basa en una combinació de metadades i regles d'accés que permeten xifrar la imatge per protegir-la. D'aquesta manera, només qui tingui aquestes regles, podrà desencriptar el contingut de la imatge protegida. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 3 Resumen En el mundo actual, está a la orden del día la poca privacidad de la vida íntima de los individuos. Conforme avanzan las tecnologías y las redes sociales, aumentan nuestras ganas de compartir contenido y, en consecuencia, de publicar nuestras imágenes y las de nuestros más allegados. A raíz de ello, surge la necesidad de proteger dichas fotografías y, por consiguiente, cuidar nuestra intimidad e integridad. Por ello, en este proyecto, se desarrolla un software para dar solución a esta carencia en la seguridad de los ciudadanos. Debido a que el estándar más usado hoy en día es el JPEG, el proyecto se desarrolla creando unas estructuras de datos que se encriptan juntamente con las imágenes que contienen nuestros datos personales mediante el estándar anteriormente comentado. Estas estructuras forman cabeceras con funcionalidades de privacidad y seguridad implícitas para poder ofrecer acceso (o no) a determinados usuarios deseados por el propietario. Para demostrar el uso del software de referencia, se propone una aplicación simulada en el entorno escolar, que tiene la finalidad de proteger la identidad de nuestros hijos e hijas. Dicho software, se basa en una combinación de metadatos y claves de acceso que permiten encriptar la imagen para protegerla. De esta manera, solamente quiénes posean dichas claves, podrán desencriptar el contenido de la imagen protegida. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 4 Acknowledgements I want to thank my advisor and tutor, Professor Jaime Delgado, for all the time dedicated and help received throughout the development of my final degree project, who has had to be very patient and has never given up offering me help and time of dedication. Thank you for so long by my side, for offering me this opportunity and for answering my emails at inhuman hours. On the other hand, thanks to my boss Ramón Llorca at Technica electronics Barcelona SL, for being patient with me during my stressful days and offering me a place to study in the office outside of working hours for all those times when I didn't even have time to move from the office to the library. Also thank all the staff and teachers of the Polytechnic University of Catalonia for all the help received during my studies. To my mum, mi family and friends (not only those in the office as David Serramià, but also my lifelong ones, it will extend too much if I name them all, but they already know my feelings) who have helped me in the most difficult moments of my career, without you this would not have been possible. Thank you for never stopping supporting me. Finally, and especially, to my partner, Sergio González, who has believed in me from the beginning and has endured both the euphoria and the sadness that comes with closing one of the most important stages of my life. Thank you for not only being my life partner, but also for remain side by side with me for all those library hours. Thank you all, I am proud to be able to close this stage with you. Just as all of you told me, I can. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 5 Revision history and approval record Revision Date Purpose 0 31/12/2021 Document creation 1 05/01/2022 Document revision 2 20/01/2022 Document revision 3 21/01/2022 Document revision 4 23/01/2022 Document revision 5 24/01/2022 Document approval DOCUMENT DISTRIBUTION LIST Name e-mail Paula Ramos Jaime Delgado Written by: Reviewed and approved by: Date 31/12/2021 Date 24/01/2022 Name Paula Ramos Name Jaime Delgado Position Project Author Position Project Supervisor REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 6 Table of contents 1. Introduction .............................................................................................................. 12 1.1. Images ............................................................................................................. 13 1.2. JPEG Standard ................................................................................................ 13 2. State of the art of the technology used or applied in this thesis ................................ 15 2.1. Part 5: JPEG Universal Metadata Box Format (JUMBF) ................................... 15 2.2. Part 4: Privacy & Security Functionalities ......................................................... 16 2.2.1. Encryption Method..................................................................................... 16 2.2.2. Privacy & Security Functionalities .............................................................. 17 3. Methodology / project development ......................................................................... 18 3.1. Gantt Diagram .................................................................................................. 18 3.2. Project Design .................................................................................................. 19 3.2.1. Design of JPEG Universal Metadata Box Format (JUMBF) – Part 5 .......... 19 3.2.2. Design of Privacy & Security features - Part 4 ........................................... 21 3.2.3. Design of the Demonstrator ....................................................................... 24 3.3. Project Development ........................................................................................ 26 3.3.1. Version control system .............................................................................. 26 3.3.2. Software development ............................................................................... 27 3.3.2.1. Development of JPEG Universal Metadata Box Format (JUMBF) - Part 5: ‘jumbf_software’ module ...................................................................................... 27 3.3.2.2. Development of Privacy and Security features - Part 4 ............................ 29 3.3.2.3. Development of the Demonstrator ........................................................... 32 3.4. Project Implementation ..................................................................................... 34 3.4.1. Implementation of JUMBF specification and Privacy & Security features ... 34 3.4.2. Implementation of the Demonstrator .......................................................... 36 4. Results .................................................................................................................... 37 5. Budget ..................................................................................................................... 38 6. Environment Impact (Optional) ................................................................................ 39 6.1. Environment impact .......................................................................................... 39 6.2. Social impact .................................................................................................... 40 7. Conclusions and future development: ...................................................................... 41 7.1. Conclusions ...................................................................................................... 41 7.2. Future lines....................................................................................................... 42 8. Bibliography: ............................................................................................................ 43 REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 7 9. Glossary .................................................................................................................. 44 REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 8 List of Figures Figure 1. Statistics of Internet usage in world population………………………….…(Annex)1 Figure 2. Statistics about Internet users at the moment………………………………(Annex)1 Figure 3. Binary structure of a JUMBF Box……………………………………………………15 Figure 4. JUMBF Box embedded into an image………………………………………………17 Figure 5: Gantt diagram of project tasks……………………………………………………….19 Figure 6. Binary data structure of a JUMBF Codestream Box. ………………………(Annex)3 Figure 7. Binary data structure of a JUMBF XML Box. ……………………………….(Annex)3 Figure 8. Binary data structure of a JUMBF JSON Box. ……………………………(Annex)3 Figure 9. Binary data structure of a JUMBF UUID Box………………………………(Annex)3 Figure 10. Binary data structure of a general JUMBF Box…………………………………..20 Figure 11. Binary data structure of a JUMBF Protection Box………………………..(Annex)4 Figure 12. Detailed binary data structure of a JUMBF Protection Box. ……………(Annex)4 Figure 13. Detailed binary data structure of a JUMBF Protection Box with fields…………21 Figure 14. Binary data structure of a JUMBF Replacement Box……………………………22 Figure 15. Detailed binary data structure of a JUMBF Replacement Box…………..(Annex)5 Figure 16. Detailed binary data structure of a JUMBF Replacement Box with fields……..22 Figure 17. Detailed binary data structure of a JUMBF Replacement Box of type BOX with fields………………………………………………………………………………………(Annex)5 Figure 18. Detailed binary data structure of a JUMBF Replacement Box of type APP with fields………………………………………………………………………………………(Annex)6 Figure 19. Detailed binary data structure of a JUMBF Replacement Box of type ROI with fields……………………………………………………………………………………………....23 Figure 20. Detailed binary data structure of a JUMBF Replacement Box of type FILE with fields………………………………………………………………………………………(Annex)7 Figure 21. Current social need………………………………………………………………….24 Figure 22. Possible solution to the necessity…………………………………………………25 Figure 23. Modules created in Gitlab to carry out the control of versions………….(Annex)8 Figure 24. Submodules created in the main repository………………………………(Annex)8 Figure 25. Binary data of a JUMBF superbox………………………………………………....27 Figure 26. Tree structure of Part 5’s module…………………………………………..(Annex)9 Figure 27. Tree structure of JUMBFInterface folder………………………………….(Annex)9 Figure 28. Tree structure of ‘utils’ contents…………………………………………..(Annex)10 Figure 29. Part 5 type database………………………………………………………(Annex)10 Figure 30. Part 5 content database…………………………………………………..(Annex)10 REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 15 2. State of the art of the technology used or applied in this thesis Since this project is mainly based on parts 4 and 5 of the JPEG standard, this section tries to better explain what each part is about. Following the order carried out during the evolution of the project, Part 5, the one based on the data structure boxes, will be dealt with first, and then part 4, which implements these boxes to be able to develop the privacy and security functionalities. 2.1. Part 5: JPEG Universal Metadata Box Format (JUMBF) The key idea of the JPEG Universal Metadata Box Format (JUMBF) is to add universal metadata to JPEG content. This way, it can be introduced several descriptive fields that will be translated into a specific scenario, such as metadata that describes the intention to protect the image, metadata that tries to control access to the protected content that precedes or else metadata indicating where to locate the original content to replace the protected one. All the information explained is extracted from the documents [18] provided by the professor responsible for this project and they contain private information about how to embed data boxes in a specific format. The main idea of this part lies in two concepts: - Each object in the file is encapsulated within a binary structure called a box. - A box containing other boxes is called superbox. Following the mentioned rules, the binary structure to be achieved is represented below: Figure 3. Binary structure of a JUMBF Box It will be recognized this structure as “JUMBF Box”: With this data structure, it will be possible to add all the additional information that we have been talking about. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 16 2.2. Part 4: Privacy & Security Functionalities When changing to part 4, the idea is to give to these structures a specific functionality. By this way, it will be specified a privacy and security functionality to assure that the image under test is being protected not only with the encryption method, but also with the specified fields of our aim. 2.2.1. Encryption Method As the key idea is to protect the content of the image, it is necessary to use some technique that can send the image data without revealing its content. At this point the need of using an encryption method arises [19]. This technique is based on a procedure that translates plain text into an unintelligible sequence of characters using a key. The purpose is that this resulting secret text or cryptogram (ciphertext) remains accessible just for the users who have the key to decrypt it. An encryption method is formed by two components: • A cryptographic algorithm, in charge of making it difficult or impossible (depending on the complexity of the algorithm) to decrypt the content. • One (or more) secret keys: usually sequences of bits. The bit length of the keys results in a good criterion for encryption security, as the logarithmic measure of the number of possible combinations that can be used is quite long. Depending According to this format, there are different types of encryptions depending on the use and management of keys. In case of symmetric encryption, the same key is shared between encryption and decryption procedures. In asymmetric systems, each procedure is carried out with its own keys (normally a pair of keys formed by a public key and a private one). Another implementation of the encryption would be to mix both techniques, obtaining the hybrid cryptography. In conclusion, it has been selected symmetric encryption, concretely the Advanced Encryption Standard (AES) [20]. The AES method subdivides plaintext into blocks, which are encrypted in multiple consecutive rounds with help of a substitution-permutation network (SPN), which is a series of linked mathematical operations used in block cipher algorithms. It supports not only 128-bit digital key, but also 192-bit and 256-bit keys and uses larger than 128-bit blocks. With all this information, it has been decided to implement a symmetric encryption method with a 256 bits digital key. The better method found, the most common and currently used by the USA government is the AES 256 CBC (Cipher Block Chaining). REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 17 2.2.2. Privacy & Security Functionalities In this specification of the standard, two functionalities will be treated. • Access Rules: On the one hand, it deals with the issue of privacy. For this reason, a JUMBF Protection box is created to insert information related to its protection into the image itself. This is why it contains information about how to encrypt the image (the encryption method used) and also the presence of access rules. • Replacement content: On the other hand, once protected the image (in our case it will be covered the face of the kids with a sticker), the original face remains hidden. This means that once the image is decrypted, we should have the original face of the child to be able to replace the stick with that content and this way obtain the initial photograph. Thus appears the need to create the JUMBF Replacement Box. Which will contain not only the type of replacement to perform, but also the original content with which to replace the protected image. The following figure shows the main idea when incorporating the JUMBF Boxes: LBox TBox Type=’jumb’ (XLBox) Payload Box PROTECTED IMAGE Figure 4. JUMBF Box embedded into an image JUMBF Box Metadata Boxes JUMBF FIELDS JUMBF content with information about how to encrypt this content itself, and also how to replace the protected image with the original content. Original content REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 18 3. Methodology / project development This section explains not only the Gantt diagram with the distribution of tasks, but also structures the basis from which the project is developed. It is divided into three different phases. • The first phase is related to the project design. After a previous study and recognition of the standard, the key ideas to develop the project are defined. This issue evolves not only the data structure, but also some schematics. • The second phase refers to the project development. In this section, there will be displayed the library structure and the purpose of each class. • The last phase belongs to the project implementation and its testing. As this project is based on both parts of the JPEG standard, Part 5 and Part 4, it will also be divided as follows: • Part 5, referring to the JUMBF Boxes of the standard. • Part 4, related to the Privacy and Security functionalities that can be applied to the data structures. • Demonstrator, in charge of testing all the features implemented by the project. With the aim of explaining everything mentioned above, each part of the project will be treated following the three phases, meaning, for the design phase, it will be explained part 5, followed by part 4 and finally the application. And the same will be done for the development and implementation phase. 3.1. Gantt Diagram Due to some challenges in the interpretations of the standard and the development of the privacy and security features, there have been some tasks that have occupied more than expected, resulting in the following time distribution of tasks: Table 2: Tasks distribution. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 19 Figure 5: Gantt diagram of project tasks. 3.2. Project Design Next, details on the design of the project will be given, considering its phases and the different parts of the standard. 3.2.1. Design of JPEG Universal Metadata Box Format (JUMBF) – Part 5 As explained in the previous section, these structures are called JUMBF boxes. Concretely, the JUMBF boxes are formed by several boxes with specific content. These boxes are displayed next: • The LBox is a databox containing the value of the total length of the superbox. • The TBox is a databox which content indicates the type of the box. With the 'type' field, is intended to define each box for a purpose. There are different types of boxes. It can be found: o “jumd”: if referring to a unique box. o “jumb”: if referring to a box of boxes, meaning, a superbox. o “jp2c”: if referring to a Contiguous Codestream box. o “xml\\040”: if referring to a box with XML content. o “json”: if referring to a box with JSON content. o “uuid”: if referring to a box with identificatory content. • The XLBox is a databox that allow to represent the Length of the total box in case the LBox is smaller than necessary to be able to indicate that length. Its presence depends on LBox capacitance. • Finally, the Payload databox will be a box with several boxes inside. At first, an interpretation was made in which the boxes LBox, TBox and XLBox were only present once in each embedded structure. However, with a last-minute interpretation, it has been concluded that for each Payload Box, there will be its REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 20 LBox, TBox and XLBox (if necessary) in order to improve the field extraction technique. Following this rule, this box will be formed by: o A JUMBF Description Box, in charge of giving information about the next content of the box. o Several Content boxes, which will be defined by different fields depending on the type indicated in the previous JUMBF Description Box. This content boxes, can be: ▪ A CodestreamBox: containing a codestream of the same type than the parent image in which the JUMBF box is embedded. ▪ An XMLBox: containing a well-formed XML document as defined by W3C, Extensible Markup Language (XML 1.0). ▪ A JSONBox: containing a well-formed JSON document as defined by ISO/IEC 21778. ▪ An UUIDContent Box: containing a unique universal identifier inside. In order to clarify what has been displayed above, a set of schematics will be shown to make it easy to understand (They can be found in Annex 2.1.1). As a sum up, depending on the functionality to implement, the fields of the box will vary, restricting each box to a specific scenario. But, when we talk about JUMBF Description Box, what is meant? Specifically, it is referred to a box made up of specific fields. These fields are shown below: LBox TBox Type=’jumb’ (XLBox) Type Toggle Label ID Signature The content box of type specified in the previous JUMBF Description box. Figure 10. Binary data structure of a general JUMBF Box. What is defined by this box? The fields are displayed next: • Type: this field refers to a 16-Byte UUID as specified in ISO/IEC 11578 that is called JUMBF Type. This field describes de JUMBF type of content of the next box. • Toggle: this field is a 1-Byte parameter that will describe the structure of the JUMBF Description box indeed. Will indicates if there is a Label/Id/Signature field present on this box, as these 3 fields are optional. Payload Data Box JUMBF Description Box Type=?? REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 21 • Label: refers to a variable null-terminated stored as ISO/IED 10646 characters in the UTF- 8 encoding. Will have restrictions, as [U+000, U+001F] and [U+07F, U+009F] ranges and characters [‘/’ ’;’ ’?’ ’:’ ’#’], which are not permitted. • ID: this field refers to a user assigned 4-Byte ID. • Signature: corresponds to a SHA-256 (FIPS PUB 180-4) checksum of the JUMBF content. Depending on the values chosen for these fields, a box is defined for a specific case. Thus, we will place it in front of a content box to indicate that the content of the following box will be of the type specified in this field. In this way, when the box is parsed, the structure found will be previously known. 3.2.2. Design of Privacy & Security features - Part 4 As mentioned in the state-of-the-art, the functionality to be squeezed is to protect the content by means of content encryption so that can only be viewed if there are specific access rules that will be defined by the JUMBF Protection box. Once accessed the content (meaning decrypted), the original face will be found in a JUMBF box with replacement type that includes the original content. Thus, the stick of the protected image will be replaced with the original content found in the JUMBF Replacement Box. Talking about these two types of JUMBF box it may not be clear how are they formed, so it is better to see its structure by means of several schemes (shown in Annex 2.1.2.): In case of a JUMBF Protection Box: Figure 13. Detailed binary data structure of a JUMBF Protection Box with fields. The fields of the Protection Description box are displayed next: • Method: this field refers to a 1-Byte parameter that indicates the Encryption method used in the procedure, indicating a possible scenario out of a total of 256 possibilities (2^8 =256). • ENC: this field is an optional label referencing to a JUMBF box that signals the used encryption method of the data in the binary data box. It is called Encryption Label. • AR: this field is an optional label referencing to a JUMBF box that signals the access policy rules of the data in the binary data box. It is called Access Rules Label. • IV: this field refers to the initialization vector used (in case) to encrypt the data in the binary data box. LBox TBox Type=’jumb’ (XLBox) JUMBF Description Box Type=Protection Method ENC AR IV Binary Data Payload Data Box JUMBF BOX Protection Description Box REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 22 As the project progresses, more and more boxes are defined. This is the reason why each one of them has an implicit type that identifies itself in the software. Despite not appearing in the data structure, this field is used to establish conditions and thus validate them. These types mentioned will be added to the types mentioned in Part 5, forming a type data base that will be described next: o “pspd”: if referring to a Protection Description box. o “bidb”: if referring to a Binary Data box. o “psrd”: if referring to a Replacement Data box. o “jumd”: if referring to a unique box. o “jumb”: if referring to a box of boxes, meaning, a superbox. o “jp2c”: if referring to a Contiguous Codestream box. o “xml\\040”: if referring to a box with XML content. o “json”: if referring to a box with JSON content. o “uuid”: if referring to a box with identificatory content. In case of a JUMBF Replacement Box (explained in Annex 2.1.3. with more details): Figure 16. Detailed binary data structure of a JUMBF Replacement Box with fields. The fields of the Replacement Description box are displayed next: • Type: this field refers to a 1-Byte parameter that indicates the type of replacement that will be performed. It can be one of: o TYPE BOX: Box replacement type. Replaces the referenced box with all Replacement Data Boxes. o TYPE APP: App marker segment replacement type. Replaces the protected content box with exactly the specified binary data box. o TYPE ROI: Region of interest replacement type. Replaces a region of interest in the parent image. The replacement data box contains exactly one contiguous codestream box. o TYPE FILE: File replacement type. Replaces the entire file. The replacement data box contains exactly one contiguous codestream box that contains the replacing image. • Toggle: this field is also a 1-Byte field that signals if the replacement should be applied by default or ignored. • PARAM: this field is variable parameter that depends on the specified type of replacement. The binary data structure of the different type of PARAM Box will be displayed (in Annex 2.1.3.1.) LBox TBox Type=’jumb’ (XLBox) JUMBF Description Box Type=Replacement Type Toggle PARAM Replacement Content Box Payload Data Box JUMBF BOX Replacement Description Box REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 23 o In case of Type Box replacement (00): the parameter box will be formed by: ▪ Offset: it is an 8-Byte (64 bits) field that indicates the offset of the position of the replacement target box counting from the beginning of the file. ▪ Label: it is a label of the replacement target JUMBF box. o In case of Type APP replacement (01): the parameter box will be formed by: ▪ Offset: it is an 8-Byte (64 bits) field that indicates the offset of the position of the replacement target box counting from the beginning of the file. o In case of Type ROI replacement (10): the parameter box will be formed by: ▪ OffsetX: it is a 4-Byte (32 bits) field that indicates the vertical offset from the top in pixels. ▪ OffsetY: it is a 4-Byte (32 bits) field that indicates the horizontal offset from the left in pixels. The figure below defines this structure. Its structure will be displayed below, as is the one that fits the project the most: LBox TBox Type=’jumb’ (XLBox) JUMBF Description Box Type=Replacement Type Toggle OFFSETX OFFSETY Replacement Data Boxes => Contiguous codestream box Figure 19. Detailed binary data structure of a JUMBF Replacement Box of type ROI with fields. o In case of Type FILE replacement (11): there is no more fields. Replacement Description Box Replacement Data Box Replacement Content Box JUMBF BOX REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 24 3.2.3. Design of the Demonstrator Due to the abstraction that programming entails, it is necessary to define an implementation of the reference software in order to demonstrate the usage that can be given to it. Some requirements were established before defining what the demonstrator would be about. - It should be a solution to cover a real need. - Its implementation in case the project was considered such a valid one should be credible, nothing disproportionate or far from reality. - It should be an application that could not cause any harm to others, just help. - It should implement a clear need to protect images. - And obviously a clear need to be able to restrict access to selected users. Several options have been considered, since privacy and security are aspects that many citizens require in their day-to-day activities. The possibility of being able to cover car license plates appeared, also the idea of protecting financial documents, of covering the resolutions of an exam... But it ended up concluding that the best proposed idea was to implement an application in a school that could offer such protection and security functionality. As mentioned in the introduction to the project, the respect for posting images is currently being lost. The issue is that we no longer only publish content of our own person, but also of those closest to us, our friends, our children. It is impossible to know who can see the photo of our children and that is a concern that currently exists for parents of the society. What stronger need exists than that of parents concerned about the integrity of their children? This is why it was the option that suited the best the project. Figure 21. Current social need. Family Daily routine Normal activities that do not seem to cause danger Distribution of images to people we do not know Who is looking at my child’s photograph? CURRENT NEED REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 31 This figure combines exactly what is done in this project. A JUMBF Replacement box with the original face, encrypted inside the Binary data of a JUMBF Protection box by means of the encryption method specified in the Encryption Label field of its Protection Description box. Certainly, as explained before, both JUMBF Protection Box and JUMBF Replacement Box will have several types decoding procedure (detailed in Annex 2.2.3.4.), so it must be treated carefully. The truth is that at this point, regarding the creation of boxes, it only remains to create the JSON box that contains the access rules. The access rules will be displayed in a json file with the following structure (explained with more detail in Annex 2.2.3.5.): Figure 44. Json File document. • The “Members” will refer to the School’ students, each one of them will have his/her own policy. How will it be specified? The access policy will be defined by different concepts. If referring to Lucia, a new student of the School, their parents will be asked for filling in the next gaps: ▪ “Family”: referring to the users that could access to the application. ▪ “Privacy”: referring to a Boolean that will define if the parents want to apply this privacy and security functionality to their children (“True”) or not (“False”). ▪ “User”: referring to the users that parents want to have access to the pictures. ▪ “Condition”: referring to if they want to be visible “Always” or just “ifRequested”. • The “Resources” will refer to all the photos that School decides to upload to the application so that parents could access. Once all the data structures have been created, the images are going to be prepared. First of all, a photograph is chosen, it is indicated in the json’s Resources what photograph it is and who appears in it. Next, the child's face is covered, storing the offset required to place the sticker on top of the face. In this way, using the same size as the sticker and at the same offset, the original face of the child is extracted and stored as well. This procedure is shown below: ORIGINAL IMAGE PROTECTED IMAGE REPLACEMENT CONTENT Table 4. Image Protection procedure. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 32 Now it is possible to proceed with the implementation of the system. 3.3.2.3. Development of the Demonstrator The idea was to develop an application that could allow restricted access to certain users and that could allow viewing of images. As the program had been done entirely in Python, it was decided to continue looking for a library to create applications that would allow linking all the submodules into one. ‘tkinter’ turned out to be the best option, since the opinions in blogs were very favourable and it had the necessary widgets to carry out the desired application. As has been done with the previous parts, a new independent library was created, called ‘PrivSec_API’, explained with more detail, as the previous libraries, in Annex 2.2.4.1. This library was uploaded to a new repository to create then a new submodule in the main repository. Its structure consists of: • The ‘API_Image_Database’ folder to recollect all the images used for the application design, for instance background images or the icons and logos. • The ‘ProtectedImages’ folder, which contains all the photos with the sticker covering the face. • The ‘test’ folder, which will contain all the test scripts performed to validate the functions. • The ‘utils’ folder, which will be in charge of dividing the tools into several features, as explained below. o ‘Commands.py’: containing the Menu bar options and its features. o ‘Frames.py’: containing the different frames or windows available in the application. o ‘tools.py’: containing tools needed to interact with the project. o ‘UserOriented.py’: containing all the actions that the user can carry out when joining the application. • The ‘API.py’ script, which is the controller of all the application, meaning it is the beginning of the performance. • The ‘import_modules.py’, in charge of importing all the modules needed to interact with the rest of parts of the project. • The ‘School.json’ file, containing all the students’ Access Rules. Related to the design of the application (explained in detail in Annex 2.2.4.2.), a schoolcaliber background image was selected, to contextualize the app a bit. In addition, the university logo was added to be able to distinguish the origin of the project. Finally, a simple logo was created to give more personality to the school. A wolf was chosen as the icon, because these animals are protective of their pups, and it was decided to play with the words privacy and security to define the catchword. Initially, the user must enter a username and a password. By this way, on the one hand, the user who is trying to access can be stored and, on the other hand, it is verified that this REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 33 person belongs to the family of one of the children. An exceptions treatment is carried out, not only to verify that it belongs to the school environment, but also to validate its password. As carrying out a more complex login does not belong to the scope of interest of this project, a simple login has been implemented in which the password must be the name entered by the user followed by "1234". • If not valid, the user is asked to retry. • If valid, it is indicated that it has been a successful login and a text box is displayed indicating the family of which student it belongs to. When accessed to the application, it will be found the MainWindow frame, which will contain not only the access to the different image data bases of the parties, but also a simple menu bar to interact with the School information and carry out the different features declared in the “Actions” json file. Figure 53. Application Login and Main frame. Depending on which database the user wants to see, the background will change to make it easy for the user to know where he/she is. • When clicking on Last day party appears a schoolyard as the background. • When clicking on End of summer party appears a beach as the background. • When clicking on Christmas party appears a Christmas tree as the background. When clicking, as an example, in the Last day party, the application will redirect the user to a new frame, where several protected images will be displayed. When the user decides which photo want to visualize, he or she just has to click on the desired photo and the application will redirect to the next frame. If unknown the procedure, it will be displayed a warning box with some useful information about how to proceed. At this point, it will be displayed a ‘SHOW’ button to be able to see the picture and also a warning box if unknown the procedure. The user will click on the button, and the program will carry out several orders. The first order will be to revise who is the user. Once known the user, the application will look for the relative, meaning the student related to this user. Then, it will be looked for who appears in the photograph. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 34 After that procedure, the application will revise if the image has access rules, and just in case it has, will go to the Json box, will look for the policy of the student and finally will compare the users allowed to see the face of the kid, and will end up matching the allowed users with the user who is accessing. In case of having permission, the application will show the image as follows: Figure 59. Application Visualization. If the user does not have permission, a warning box will be displayed. As a small detail, the several windows have been provided with a return button to be able to interact between them, so that if it is pressed, the application redirects the user to the main window. 3.4. Project Implementation In this section, the real case to be carried out, the fields finally defined, the boxes created and the real case to be reconstructed by the application will be explained. In this part, the different fields that have been assigned to the pits will be explained. In the implementation, we will explain part 4 and 5 conjoins, since part 5 is included in part 4. 3.4.1. Implementation of JUMBF specification and Privacy & Security features This part will be detailed schematically, since all the details to take into account have been previously explained and if it is analysed with these representations, it will be much clearer. Finally, the procedure to carry out by the final program is described next: 1. Get the original image. 2. Crop the kid’s face and store it. 3. Protect the face in the image with a sticker, obtaining the protected image. 4. Include the cropped original face in the content of a JUMBF Replacement Box of type ROI with the offset where locate the sticker. a. Construct the Payload Box depending on the length of the cropped face. 5. Encrypt all this content with (in this case) AES_256_CBC method. 6. Include the encrypted content in a JUMBF Protection Box with Access Rules field present (as parents want to protect kid’s face). REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 35 7. Embed this structure into the protected image (the one with the sticker). 8. Run the application. a. Log in → get the user. b. With user → get ‘School Member’ and get ‘Policy Rules’. c. Store them. d. Choose the photo to be visualized → Store it. e. Revise the Resources → Check who is in the photo → Store it. f. If “Access Rules” present → Got to ‘User’s Policy’, check if this photo can be visualized by the user. g. If “visible” → SHOW! → HOW? i. Parse the image .jmb file. ii. Check Access Rules field. iii. If “Access Rules” → Revise JUMBF JSON Box. iv. If “has permission” → Decrypt Replacement content. v. Take the offset of JUMBF Replacement Box and paste the original cropped face into the protected image, obtaining the unprotected image as a result. In case of multiple face in the image, each face will be identified with one JUMBF Replacement Box. Each JUMBF Replacement Box will have its own offset parameter to locate the replacement content into the desired face. When checking the Access Rules, it will be decrypted just the JUMBF Replacement Box whose face is allowed to see. This is how the final box crafting of the JUMBF Superbox results in this project (shown in detail in Annex 2.3.1.). REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 36 3.4.2. Implementation of the Demonstrator Following everything explained above, a school scenario has been created to simulate a real situation. To do that, social circles have been simulated (completely shown in Annex 2.3.2.), creating friendship between some families in order to play with the access rules. If focusing in one of those circles: Figure 62. School scenario. As it is not necessary to simulate the entire school to be able to demonstrate the final use of the standard, we will focus on the circle formed by Luna, Asier and Leo. As you can see: • Luna will be visible to Asier's family and Leo's family. • Asier's photographs will be visible to Luna's family, but not to Leo’s family. • Finally, Leo's photos will not be accessible to Luna's family neither Asier's family. In order to demonstrate it, the application will be accessed several times, each time being a different relative, once it will be accessed being a relative of Luna, on another occasion being a relative of Asier and on another of Leo. Thus, the different photographs will be accessed in order to obtain a clear answer as to whether the access rules are available or not. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 37 4. Results The result of the project ends up being a small simulation. The idea, as mentioned above, is to access as different users so that the program detects: • Who are you? The answer will indicate the user, meaning the person who is accessing the application. • To which child's family do you belong? The answer will determine the School Member. • What photograph do you want to see? The answer will indicate the resource to visualize, meaning the picture to see. • Do you have access rules? The answer will be interpreted as who is visible for the user. Various simulations (displayed the four of them in Annex 3.1.) have been carried out, thus responding to the questions just formulated: FIRST SIMALATION SECOND SIMULATION Accessing as Zoe Accessing as Rafael. Who are you? Zoe To which child's family do you belong? Luna What photograph do you want to see? Photo6 Do you have access rules? Luna, Asier Who are you? Zoe To which child's family do you belong? Luna What photograph do you want to see? Photo6 Do you have access rules? Luna, Asier Figure 63. Simulation 1 result. Figure 64. Simulation 2 result. Table 5: Results table The result obtained is an application with restricted access rules through a privacy policy that allows access to users previously chosen by the student's relative or tutor. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 38 5. Budget In this section, it will be calculated the total cost of the project, considering that the student is carrying out the project once got the degree in telecommunication systems engineering. First of all, it will be broken down the values obtained with the spent time and the costs derived from the realization of the project, just considering the following terms: • The project is formed by 24 ECTs. Each ECT credit corresponds to 30 hours of personal study. Nevertheless, more hours than indicated have been invested, with which we add about 90 hours of additional work. • Due to the little knowledge on the subject, many hours of study have been used prior to the development of the project that will not be reflected in the breakdown. • The hours reflected will be divided according to their purpose. o On the one hand we will have the hours of software design and development: 𝑆𝑝𝑒𝑛𝑡 𝑇𝑖𝑚𝑒 = 𝑡𝑜𝑡𝑎𝑙𝐸𝐶𝑇𝑠 ×(30ℎ 𝐸𝐶𝑇)+𝑎𝑑𝑑𝑖𝑡𝑖𝑜𝑛𝑎𝑙ℎ𝑜𝑢𝑟𝑠 =24 𝐸𝐶𝑇𝑠×(30ℎ 𝐸𝐶𝑇)+90h = 810 h o On the other hand, the consulting hours, used to clarify ideas about the project 𝑆𝑝𝑒𝑛𝑡 𝑇𝑖𝑚𝑒 = 𝑁𝑢𝑚𝑏𝑒𝑟𝑜𝑓𝑀𝑒𝑒𝑡𝑖𝑛𝑔𝑠 ×𝑇𝑖𝑚𝑒𝑀𝑒𝑒𝑡𝑖𝑛𝑔 +𝑃𝑒𝑟𝑠𝑜𝑛𝑎𝑙𝑇𝑖𝑚𝑒 =(18×1ℎ)+(2ℎ×18𝑤𝑒𝑒𝑘𝑠)=54ℎ • A good practice might be to make a comparison with a project carried out by a junior engineer in his 8-hour working day. It can be concluded that it results in a 4-months- and-a-half project, which makes a lot of sense, due to its similarity with a possible real-life case. All the terms specified above can be outlined in the following rate table: TOTAL PROJECT BUDGET Concept Inverted Hours €/hour Cost Equipment PC depreciation - - 70€ Electricity Expense 810h+54h=864h 0,65 kWh x 0,20 €/kWh 112,32€ Office License Pack - - 40€ Staff SW Developer 810h 15€/h 12.150€ Engineering consulting 54h 12€/h 648€ TOTAL - 864h - 13.020,32€ Table 6. Total project budget calculations. As can be shown, the current budget of the project, carried out by a junior engineer, would be around 13.020,32 €. REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 39 6. Environment Impact (Optional) 6.1. Environment impact This section is destined to identify the environmental impact that would suppose this project in case of being performed. We can divide this issue into two well-differentiated terms: environmental impact and social one. On the one hand, as the entire project has been carried out without generating or promoting any type of damage to the environment, it can be said that the impact that the project may have to the environment is minimal. Concretely, it would be related to the CO2 emissions caused by the electricity consumed not only during the development of the project, but also during the average use of the application by each individual who use the product once published on the market. Despite this, a damage report will also be made considering the energy expenditure that it may entail in case of carrying it out. In this case, the only factor that can have a negative impact on the environment is the computer usage and its corresponding electrical cost. In the following formula, it is displayed the total electricity consumption consumed by the hours of project completion and of the computer usage: 𝐸𝑛𝑒𝑟𝑔y 𝑐𝑜𝑛𝑠𝑢𝑚ed by computer = (200𝑊 ∗ 864ℎ )/1000 = 172,8 𝑘𝑊ℎ As explained in literature [14], the following table displays data about CO2 emissions per kWh of electricity. Energy Primary energy Emission Electricity 1kWh 2,603 kWh 0’649 kg CO2 Table 7. CO2 Emissions calculation. Total 𝐶𝑂2 Emissions = 0,649 kg 𝐶𝑂2 kWh ∗ 172,8 kWh = 112,15 kg 𝐶𝑂2 Once this product has been published, another aspect to consider would be the average time that each user would spend consulting the application to view the images. Considering an average of about 20 minutes per user who accesses, we could establish the following statement: 20 min = 1/3 h = 0,33h 𝐸𝑛𝑒𝑟𝑔y 𝑐𝑜𝑛𝑠𝑢𝑚ed by computer = (200𝑊 ∗ 0,33ℎ)/1000 = 0,066 𝑘𝑊 Total 𝐶𝑂2 Emissions = 0,649 kg 𝐶𝑂2 kWh ∗ 0,066kWh = 0,043 kg 𝐶𝑂2 REFERENCE SOFTWARE FOR JPEG PRIVACY AND SECURITY 40 As can be shown, the final environmental impact ends up being minimal to be a measure taken during 4-month range emissions, so it would not be necessary or even considered when deciding to carry out the project, even less if referring to the future use of the product. 6.2. Social impact On the other hand, it would be found the social impact, related to the advantages that the project could incorporate in society and how it could contribute to the security of citizens, since privacy has been the main need throughout the development of the project. As can be seen above, one of my purposes was to be able to offer a valid solution with my project to improve some of the concerns of society. With the intention of being able to increase people's feeling of peace of mind regarding their integrity, it seems to me of great social impact to have developed data structures that, for this project in particular, protect the images of the smallest, providing a higher degree of security to the feeling of confidence of the parents. Obviously, this is not going to solve the problem of the abuse suffered by the Children, but any grain of sand represents progress towards becoming a better world. I believe that this social impact can be extrapolated to any group. Ladies and gentlemen, our images define us, just like our NID (National Identity Document), our address or our telephone number. Let's be responsible, let's protect our images.