# Secure Delivery Method for Preserving Data Integrity of a Video Frame with Sensitive Objects
## 3 Methods
### Multi-Thread Logger  
To ensure data integrity and authenticity, the logger creates digital fingerprints and signatures using hash functions. These are transmitted to a Video Management System (VMS) that is composed of a repository and a verifier. By collaborating with an object detection server, the logger extracts features from video data to construct a unique digital fingerprint. This fingerprint, along with the original data, is used for integrity verification in the VMS.  
Thread safety is crucial when multiple threads access and modify shared resources concurrently. The threads of a logger that operates with multiple threads use a queue for inter-thread data communication, thereby supporting the parallel processing of the threads. To ensure thread safety, the shared resource, the queue, is locked using a **mutex**, and after the thread performs its designated function, the lock is released.  
The functions of the logger list are as follows:  
* **Capturing an image:** Video data are captured through a camera. The camera is connected via USB, and after reading the shape file, video capture is performed according to the shape information. The captured video data in this paper are in BGR format. BGR (Blue, Green, Red) is a color format where the color values are stored in the order of blue, green, and red.
* **Encoding sensitive objects:** The BGR image is passed to the encoder with object detection. Encoded videos are stored in a separate folder. The file name for video storage is assigned a sequential number using the MAC address of the logger as a prefix for logger identification. Since the currently operating edge device of the logger does not have a real-time clock (RTC), sequential numbers representing logical time are used for information to determine the chronological order of file creation.
* **Extracting a feature vector:** The BGR data of the captured video is converted to grayscale. Canny edge detection is used for constructing the feature vector of the video. A feature vector is a numerical representation of a video frame. The grayscale conversion is performed by calling the OpenCV library.
* **Making a hash value:** Hashes are generated for the feature vectors. \(SHA-256\) is a cryptographic hash function that generates a fixed-size 256-bit (64-character) unique hexadecimal. The hash value generated by \(SHA-256\) is represented as a digital fingerprint, ensuring the integrity of the data.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Phase** & **Description** & **Remarks** \\ \hline
1 &
\begin{tabular}{c} Generate a key pair, pk \\ and sk \\ \end{tabular} \\ \hline
2 &
\begin{tabular}{c} Transfer pk to verifier \\ \end{tabular} \\ \hline
3 &
\begin{tabular}{c} Generate a feature of \\ given image \\ \end{tabular} & Canny edge detection \\ \hline
4 &
\begin{tabular}{c} Generate a hash value \\ \end{tabular} & SHA-256 \\ \hline
5 &
\begin{tabular}{c} Sign the hash value \\ \end{tabular} & \\ \hline
6 & Build a hash tree & Merkle tree \\ \hline \hline \end{tabular}
\end{table}
Table 2: Fingerprint generation procedure.  
* **Signing the hash value**: A digital signature, generated by signing the hash with a private key, confirms its origin from a specific logger.
* **Sending image and its metadata**: Video data and metadata are transmitted to the VMS. The HTTP-based REST (Representational State Transfer) protocol is used for data transmission.