A processing method and device for image acquisition synchronous encryption privacy protection
Through the image acquisition synchronous encryption privacy protection method, the problem of insufficient privacy protection during the acquisition, transmission, and storage of image data is solved, and reversible encryption and decryption of sensitive information in the image is achieved, ensuring the security and traceability of the data. , suitable for a variety of application scenarios.
Patent Information
- Application Number
- CN202111621176.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-12-27
AI Technical Summary
The existing technology lacks effective privacy protection measures in the process of image collection, transmission, storage and use, resulting in image data being easily leaked and stolen, and sensitive information cannot be recovered after encryption, making it unable to meet the need for traceability of image data.
Using the image acquisition synchronous encryption privacy protection method, by acquiring the original image, identifying the target encryption area, generating the encryption area metadata and image encryption key, using a reversible encryption algorithm to encrypt sensitive information, and encrypting the metadata to generate an encrypted image and metadata to support subsequent decryption and recovery.
It realizes the protection and reversible decryption of sensitive information in images, ensures the security and traceability of image data, meets the privacy protection needs in different scenarios, while retaining the non-sensitive information of the image.
Smart Images

Figure CN114390316B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technology, and in particular to a method and device for processing image acquisition synchronous encryption and privacy protection. Background Art
[0002] At present, most of the current video and photographic equipment and video surveillance equipment do not have adequate protection measures for image information in all aspects of image acquisition, transmission, storage and use, as well as in most occasions where personal images and video data are used. The following situations exist:
[0003] (1) No protection measures are adopted in the collection, transmission, storage, and use of images. Image data is easy to leak and steal. Once illegally obtained, it can be used illegally without restriction by the acquirer.
[0004] (2) In one or some links of image transmission and storage, the entire image data is encrypted (for example, surveillance video data can be encrypted and stored on a hard disk or in the cloud; surveillance video can be transmitted through TLS encrypted communication, etc.), and the image data has a certain degree of security. However, in the process of using image data (such as real-time preview and playback of surveillance images; checking and verifying photos when manually collecting photos, etc.), the image is not encrypted and can be leaked through copying, screen capture, etc.
[0005] (3) Although some devices or systems, as well as enterprises that legally use personal image information, have implemented encryption protection for the transmission or storage of images, there are still ways and methods for network transmission, operators, administrators, programmers, and other internal personnel to directly access decrypted data intentionally or unintentionally, and the risk of data leakage caused by internal personnel cannot be prevented.
[0006] (4) If sensitive information in an image (including static images or dynamic videos) is mosaicked during or after the image is recorded, the privacy information in the image can be protected and cannot be correctly identified. However, the mosaicked image cannot be restored to the original image, and the sensitive information in it will be permanently lost and cannot be restored when needed. The usability of retrospective tracing is lost, and the need to fully restore the information in the image data in specific scenarios cannot be met.
[0007] Therefore, it is urgent to propose a technology that can effectively protect personal privacy in image data from the source and meet the needs of traceable tracing of image data. Summary of the invention
[0008] In response to the above needs, a technical problem is proposed to effectively protect personal privacy in image data from the source, while meeting the demand for traceable tracing of image data. The present invention aims to provide a processing method and device for synchronous encryption and privacy protection of image acquisition.
[0009] The purpose of the present invention is achieved by the following technical solutions:
[0010] In the first aspect, a method for processing image acquisition synchronous encryption privacy protection is proposed, comprising:
[0011] S1 obtains an original image, where the original image is static image data;
[0012] S2 obtains the target encrypted area in the original image;
[0013] S3 generates encryption area metadata according to the acquired target encryption area, wherein the encryption area metadata includes location information for describing each target encryption area;
[0014] S4 generates a random image encryption key according to the acquired original image;
[0015] S5 uses the image encryption key to encrypt all target encryption areas in the image through a reversible encryption algorithm to generate an encrypted image;
[0016] S6 obtains a metadata encryption key, and uses the metadata encryption key to encrypt the encryption area metadata and the image encryption key to generate metadata of the encrypted image;
[0017] S7 obtains the encrypted image and metadata of the encrypted image.
[0018] In one embodiment, step S1 includes: obtaining a group of static images or dynamic video images acquired by an image or video acquisition device and software, and taking one of the static images or one of the frames of the dynamic video images as the original image; or,
[0019] Acquire a static image in a storage device as an original image, or acquire one frame of an image in video image data in a storage device as an original image; or,
[0020] According to the acquired video stream data, one frame of the image in the video stream is used as the original image.
[0021] In one implementation, step S2 includes:
[0022] Specify the target encryption area in the original image by manual marking; or
[0023] An image recognition algorithm is used to automatically identify sensitive information areas or privacy information areas in an image to obtain a target encryption area; wherein the target encryption area includes the sensitive information area or privacy information area in the original image.
[0024] In one implementation, in step S3, the target encryption area includes a graph represented by a mathematical method.
[0025] In one implementation, the target encryption area is a circular area on the image described by the center point coordinates and the radius length;
[0026] The encryption area metadata is an array consisting of one or more tuples (x, y, r); each tuple corresponds to a target encryption area, where x and y represent the coordinates of the center point of the target encryption area, and r represents the radius length of the target encryption area.
[0027] In one implementation, step S4 includes:
[0028] Perform SHA-256 hash calculation on the original image data A to obtain a first digest value SHA256(A);
[0029] Generate a sequence [SHA256(A), t, k] according to the obtained first digest value SHA256(A), current time information t and a random number k generated by the system;
[0030] Perform SHA-256 hash calculation again based on the obtained sequence [SHA256(A),t,k] to obtain the image encryption key SHA256([SHA256(A),t,k]).
[0031] In one implementation, step S5 includes:
[0032] According to the image encryption key, a random natural number sequence S with a length of N and each value in the left closed and right open interval [0, N) is generated, where N is the total number of pixels in the target encryption area, and the i-th number in the sequence S is represented as S(i);
[0033] For each pixel in the target encryption area, the kth pixel in the target encryption area of the original image is recorded as P(k), and the i-th pixel in the encrypted target encryption area is recorded as P'(i). The relationship between P(k) and P'(i) is:
[0034] P'(i)=P(k),k=S(i),i∈[0..N)
[0035] According to the above relationship, the value P'(i) of each encrypted pixel point from i 0 to N-1 is calculated to obtain the encrypted target encryption area image P'.
[0036] In one implementation, in step S6, obtaining the metadata encryption key includes:
[0037] Send a metadata encryption key request to the KMS (Key Management Service); obtain the metadata encryption key and the corresponding identifier keyid returned by the KMS; or,
[0038] Using the public key in the preset digital certificate as the metadata encryption key, and using the serial number of the preset digital certificate as the identifier keyid of the metadata encryption key; or,
[0039] In point-to-point communication, the public key of the other end is used as the metadata encryption key, where the user ID of the other end is used as the identifier keyid.
[0040] In one implementation, in step S6, the metadata encryption key is used to encrypt the encryption area metadata and the image encryption key to generate metadata of the encrypted image, including:
[0041] Encrypt the encryption area metadata and the image encryption key using the metadata encryption key to generate ciphertext data;
[0042] The generated ciphertext of the encryption area metadata, the ciphertext of the image encryption key, and the keyid of the metadata encryption key are combined into the metadata of the encrypted image.
[0043] In one implementation, step S6 further includes:
[0044] In the case where there is no target encryption area in step S2, for the original image that does not contain any encryption area, a fixed special value is generated as metadata of the encrypted image.
[0045] In one implementation, step S7 further includes: embedding the encrypted image metadata into the encrypted image in the form of a digital watermark, or superimposing it on the encrypted image in the form of a two-dimensional code (barcode) watermark, or saving it separately from the encrypted image in the form of a file.
[0046] In a second aspect, a processing device for image acquisition with synchronous encryption and privacy protection is proposed, wherein the device is used to implement a processing method for image acquisition with synchronous encryption and privacy protection as shown in any one of the implementations in the first aspect.
[0047] The beneficial effects of the present invention are:
[0048] (1) A reversible encryption technology is proposed to encrypt sensitive and private information or designated areas in images and videos. While protecting sensitive and private data in images or videos, non-sensitive information in images and videos is retained; moreover, when necessary, the encrypted areas in images and videos can be decrypted to obtain the original unencrypted images.
[0049] (2) After the encryption, the sensitive, private information or designated areas in the encrypted image cannot be normally identified by humans or computer programs; in addition, other unprotected information in the encrypted image can be normally identified by humans or computer programs. For example, vehicles, objects, people's behaviors, events, etc. in the image or video can be normally identified, but the identity of the person or the license plate number of the vehicle cannot be identified. It can protect sensitive and private information while meeting the basic usage requirements of image data in different scenarios. It can achieve the original purpose of collecting images and videos, such as monitoring the behavior of people in the video, and protect the sensitive information or private information in the image. Even if the encrypted image or video is leaked, the illegal acquirer cannot identify the sensitive or private information in the video.
[0050] (3) When necessary, authorized personnel can decrypt the encrypted images. The decrypted images and videos contain all the information in the original images and videos, and people or computer programs can identify and process the sensitive and private information in them. While protecting the sensitive and private information in the image, all the information in the image is retained, allowing applications such as video surveillance to fully function.
[0051] (4) It can be applied to the synchronous encryption processing of static image and dynamic video data acquisition in real time, and the image data is encrypted before being transmitted or saved through the network. This method can be embedded in the image or video acquisition device or software as a software or hardware module, and has a wide range of applications and strong adaptability. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The present invention is further described using the accompanying drawings, but the embodiments in the accompanying drawings do not constitute any limitation to the present invention. A person skilled in the art can obtain other drawings based on the following drawings without creative work.
[0053] Figure 1 A method flow of an exemplary embodiment of a method for processing image acquisition synchronous encryption and privacy protection proposed by the present invention;
[0054] Figure 2 The present invention proposes Figure 1The method flow of an exemplary embodiment of a method for decrypting an encrypted image that has been encrypted in the manner shown. DETAILED DESCRIPTION
[0055] The present invention is further described in conjunction with the following application scenarios.
[0056] In the application scenarios of image data collection, (1) while personal privacy information in image data needs to be protected, image data containing personal images must be used in many occasions and applications, such as security monitoring of people's movements and behaviors in public places. (2) At the same time, for the needs of public safety, relevant units need to restore image data containing sensitive information (such as personal facial images) when necessary to identify personal identity information. (3) How to coordinate and resolve the contradiction between the widespread use of image data and the privacy protection requirements of personal image data and identity information? It is not possible to rely solely on written statements from various units to truly ensure that personal privacy information will not be leaked. (4) Currently, there is no effective technology and application in technology and industry applications to protect personal privacy in image data from the source.
[0057] In summary, once the collected image data leaves the collection device, it is impossible to technically guarantee that the important sensitive information therein will not be stolen, leaked, or used illegally. There is another situation that requires special explanation, which is the operation of mosaic processing of sensitive information in the image. Although this operation technically erases the sensitive information in the image, this operation is irreversible. Once sensitive information is erased, it is permanently lost. In some special occasions, this sensitive information is very important. Once this sensitive information is irreversibly erased, monitoring loses an important function. Therefore, the present invention protects the sensitive information in the image while ensuring that the protected sensitive information can be completely restored when needed. Of course, the key to restore sensitive information must be properly kept, and the recovery operation must be authorized.
[0058] It is very necessary to protect the privacy of sensitive information in images and has broad application prospects. The present invention proposes a method for protecting sensitive information in images and videos, which can technically encrypt sensitive information in the captured images from the source of image acquisition; when necessary, the protected sensitive information can be decrypted. This can not only safely block the possibility of sensitive information in the image being leaked and abused, but also retain all the information in the image, so that applications such as video surveillance can fully function.
[0059] The present invention designs a method for protecting sensitive information or privacy information in static pictures and dynamic video images, which can not only meet the security requirements of video surveillance in most current environments, but also realize the encryption protection of sensitive personal privacy information in the image, and provide a method for legal decryption and restoration for authorized regulatory units or individuals when necessary. The specific technical scheme is as follows:
[0060] See also Figure 1 The embodiment shows a method for processing image acquisition synchronous encryption and privacy protection, including:
[0061] S1 obtains an original image, where the original image is static image data;
[0062] In one embodiment, the original image includes: a still picture or a frame of a video image captured by an image or video capture device and software, a frame of an existing still picture or video image data, or a frame of an image in data in a video stream.
[0063] In the above implementation, the source of the original image data may be the following: a static image captured by a static image acquisition device or video image acquisition software; an existing static image or video image data; for a video stream, a certain frame of the video.
[0064] Corresponding to the above implementation, in step S1: a group of static images or dynamic video images acquired by an image or video acquisition device and software is acquired, and one of the static images or one of the frames of the dynamic video image is used as the original image;
[0065] Alternatively, a static picture in a storage device is obtained as the original image, or one frame of image in the video image data in the storage device is obtained as the original image.
[0066] Alternatively, according to the acquired video stream data, one frame of image in the video stream is used as the original image.
[0067] S2 obtains the target encrypted area in the original image;
[0068] The target encryption area includes the sensitive information area or the private information area in the original image, wherein the private information includes personal private information (such as telephone number, home address, etc.), and the sensitive information includes face information, etc.
[0069] In one implementation, in step S2, an image recognition algorithm such as face detection, license plate detection, etc. is used to automatically identify sensitive information areas or private information areas in the image to obtain a target encryption area.
[0070] Alternatively, a manual marking method may be used to specify a fixed area in the image that needs to be encrypted and protected as a target encryption area.
[0071] Among them, an image can have one or more target encryption areas, and multiple target encryption areas do not overlap each other. If there is an overlapping area between two target encryption areas, the two target encryption areas are merged into one target encryption area. If an image does not contain sensitive or private information, the image may not have a target encryption area.
[0072] In addition, if an image does not contain sensitive or private information, there may be no target encryption area. In the case where there is no target encryption area, the process directly jumps to step S6.
[0073] S3 generates encryption area metadata according to the acquired target encryption area, wherein the encryption area metadata is used to describe the location information of each target encryption area;
[0074] In one implementation, in step S3, the target encryption area may be any graph that can be represented by a mathematical method.
[0075] Step S3 includes: generating encryption area metadata according to the acquired target encryption area, wherein the encryption area metadata is data describing the position information of all target encryption areas in the original image, and is used to record the position of each target encryption area in the image;
[0076] The encrypted area metadata is data describing the location information of all target encrypted areas in the previous step, and records the exact location of each target encrypted area in the image. The encrypted area metadata can be represented in a variety of ways. For example, in a scenario, the target encrypted area is a circular area on the image described by the center point coordinates (x, y) and the radius length (r); then according to the actual situation of the location of the target encrypted area, the corresponding target encrypted area can be represented by a digital tuple (x, y, r), and the encrypted area metadata is an array composed of one or more tuples (x, y, r); each tuple corresponds to a target encrypted area, where x, y represent the center point coordinates of the target encrypted area, and r represents the radius length of the target encrypted area.
[0077] In addition, the target encryption area can also be represented by any meaningful and convenient shape.
[0078] S4 generates a random image encryption key;
[0079] The generated image encryption key should meet the following requirements: the encryption key cannot be deduced from the encrypted image; the encryption key cannot be deduced from the time information; the encryption key of each image is different; the key pattern cannot be found through multiple encrypted images;
[0080] Among them, the above-mentioned method of generating a random image encryption key can include any method that can meet the conditions of randomness, irreversibility, etc., such as various open source UUID generation algorithms, various random number generation algorithms, etc.
[0081] At the same time, the present application also lists a specific method for generating an image encryption key. In one implementation, step S4 includes:
[0082] Perform SHA-256 hash calculation on the original image data A to obtain a first digest value SHA256(A);
[0083] Generate a sequence [SHA256(A), t, k] according to the obtained first digest value SHA256(A), current time information t and a random number k generated by the system;
[0084] Perform SHA-256 hash calculation again based on the obtained sequence [SHA256(A),t,k] to obtain the image encryption key SHA256([SHA256(A),t,k]).
[0085] The three elements involved in key generation mentioned above: original image data, current time information (accurate to nanoseconds ns) and system random numbers, all have the characteristics of instantaneous, unguessable and untraceable:
[0086] The original image data is destroyed immediately after processing and cannot be stolen from outside the device; the accurate time information of the current processing (system tick) is only known to the program itself and is no longer saved after use, so it cannot be guessed or stolen from outside the device; the random number generated by the system random number generator is the strong random number generator provided by the operating system, which is generally considered to meet the requirements of security encryption.
[0087] The image encryption key generated by the above method has the following characteristics: the encryption key cannot be deduced from the encrypted image; the encryption key cannot be deduced from the time information; the encryption key of each image is different; the key pattern cannot be found through multiple encrypted images, and the security is high.
[0088] S5 uses the image encryption key to encrypt all target encryption areas in the image through a reversible encryption algorithm to generate an encrypted image;
[0089] When designing the encryption algorithm, the present invention takes into account that a digitized image may need to undergo a series of processing in various links such as use, transmission, and storage. These image processing methods can be divided into two categories: reversible (lossless) or irreversible (lossy).
[0090] Reversible image processing methods generally include: rotation, shift, etc. These image processing methods generally have corresponding inverse operations, that is, the processed image data can be completely (when there is no pixel loss in the forward processing) or partially (when there is pixel loss in the forward processing) the original image data through reverse processing.
[0091] Irreversible image operations generally include: lossy compression, format conversion, video encoding, etc. After these image processing processes, the processed image and the original image look almost exactly the same to human vision. However, their digital representation, that is, the corresponding two-dimensional pixel array, may be completely different. Moreover, these image processing processes are irreversible, that is, the processed image data only contains the information in the original image, and the data of the original image cannot be restored 100%.
[0092] Therefore, the encryption algorithm proposed in the present invention requires that the encrypted image can still be decrypted and reversely processed to restore the information contained in the original image even after an irreversible image processing process, that is, the visual effect looks exactly the same as the original image.
[0093] In one implementation, step S5 includes:
[0094] According to the image encryption key, a random natural number sequence S with a length of N and each value in the left closed and right open interval [0, N) is generated, where N represents the total number of pixels in the target encryption area, and the i-th number in the sequence S is represented as S(i);
[0095] For each pixel in the target encryption area, the kth pixel in the target encryption area of the original image is recorded as P(k), and the i-th pixel in the encrypted target encryption area is recorded as P'(i). The relationship between P(k) and P'(i) is:
[0096] P'(i)=P(k),k=S(i),i∈[0..N)
[0097] According to the above relationship, given P, the value P'(i) of each encrypted pixel point from i 0 to N-1 is calculated to obtain the encrypted target encrypted area image P'.
[0098] In one implementation, in step S5, a set of random natural number sequences S with a length of N and each value in the left closed and right open interval [0, N) is generated according to the image encryption key, specifically including:
[0099] a) The algorithm for generating a random natural number sequence of length N=16 includes:
[0100] a1) Using the image encryption key as the initial input value;
[0101] a2) Calculate the SHA256 hash value of the input value;
[0102] a3) The obtained hash value is a set of binary data with a length of 32 bytes;
[0103] a4) Represent each byte with two hexadecimal digits, then the hash value is converted into a set of 64 hexadecimal digits;
[0104] a5) Find 16 different digits from these 64 hexadecimal numbers, that is, sequentially remove the duplicate numbers from these 64 hexadecimal digits. The obtained digital sequence, if the length is 16, is the random natural number sequence to be generated;
[0105] To further illustrate, if SUM represents the 64-bit hexadecimal hash value and SEQ is an array with a length of 16, the above algorithm can be implemented with the following pseudocode:
[0106]
[0107]
[0108] Among them, SUM(i) not in SEQ is to judge whether SUM(i) is already in SEQ; append(SEQ, SUM(i)) is to append SUM(i) to the end of SEQ;
[0109] Among them, the method further includes step a6): If the length of the random number sequence found in step a4) is less than 16, based on the input value and the hash value obtained in the previous step, perform calculation processing (for example: input value + hash value or calculate the DES encryption value of the input value with the hash value as the key, etc.) to obtain a new data. Using this new data as the input value, repeat steps a2)-a4) until all 16 random numbers are obtained.
[0110] Algorithm b): Algorithm for generating a random natural number sequence with a length N < 16:
[0111] b1): According to algorithm a, generate a random natural number sequence SEQ with a length of 16;
[0112] b2): Sequentially take out all the numbers less than N from SEQ to obtain a random natural number sequence with a length of N.
[0113] c) Algorithm for generating a random natural number sequence with a length of 16 * N, 1 < N <= 16, (length <= 256) includes:
[0114] c1): According to algorithm b), generate a set of random number sequences with a length of N, and this random number sequence is denoted as SEQ_R;
[0115] c2) According to algorithm a), generate N sets of random number sequences with a length of 16. Each set of random number sequences is denoted as SEQ_N, where N = [0...16).
[0116] c3) Denote the target random number sequence to be obtained as SEQ, and the i-th digit as SEQ[i], where i = [0...256). Then each digit SEQ[i] in SEQ satisfies the following formula:
[0117] SEQ[i] = SEQ_R[r] * 16 + SEQ_N[m], where r = i / 16, N = r, and m = i % 16.
[0118] Here, % represents the modulo operation of division, that is, the remainder, discarding the integer part of the quotient; / represents the integer division operation, that is, the integer part of the quotient, discarding the remainder.
[0119] d) The algorithm for generating a random natural number sequence with a length of N, where 0 < N <= 256, includes:
[0120] d1) If N is a multiple of 16, then use the algorithm in c) to generate the required natural number sequence;
[0121] d2) If N is not a multiple of 16, calculate M, where M = N / 16 + 1 and M <= 256. Calculate a random natural number sequence SEQ with a length of M * 16 according to the algorithm in c);
[0122] d3) Take the first N numbers less than N (including 0) in SEQ to obtain a random natural number sequence with a length of N.
[0123] e) The algorithm for generating a random natural number sequence with an arbitrary length of N includes:
[0124] e1) If N <= 256, then calculate the relevant sequence according to the algorithm in c) or d);
[0125] e2) If N > 256, calculate K = N / 256;
[0126] e3) If K > 256, then recursively call this algorithm e) to generate a random natural number sequence SEQ_R with a length of K when N = K;
[0127] e4) If K <= 256, call the algorithm in c) or d) to generate a random natural number sequence, SEQ_R, with a length of K;
[0128] e5) Generate K random natural number sequences with a length of 256, SEQ_N;
[0129] e6) The target length is N, and the natural number generation sequence is recorded as SEQ, where the i-th number is recorded as SEQ[i], i=[0...N). Then each number SEQ[i] in SEQ satisfies the following formula:
[0130] SEQ[i]=SEQ_R[r]*256+SEQ_N[m], r=i / 256, m=i%256.
[0131] The random natural number sequence generated by the above method can meet the requirements of different lengths N and each value in the sequence is in the left closed and right open interval [0, N); the characteristics of the hash function can meet all the requirements of the natural number sequence generation algorithm in the encryption and decryption algorithm, so the above implementation method constructs a random natural number sequence that meets the requirements through the hash function. The hash function algorithm selected here is SHA256, and other hash functions that meet the requirements can also be selected as needed.
[0132] In a computer, an image is converted into a two-dimensional array of pixels after being digitized. The two dimensions of this array are the coordinates (x, y) of the pixel in the image; each element of the array is the digital representation of the color of the corresponding pixel, which can be RGBA, YUV, etc. depending on the color space used.
[0133] Image encryption means encrypting the data of such a two-dimensional array so that the value of each element (or a group of adjacent elements) in the encrypted two-dimensional array is significantly different from the value of the corresponding element before encryption. This difference should be visually manifested as the information in the original image being completely unrecognizable in the new image.
[0134] In the present invention, an image encryption algorithm is proposed, which achieves the purpose of encrypting the image by changing the position of each pixel in the image pixel array.
[0135] In addition, in this algorithm, only the coordinate values of the pixels change, while the color values of the pixels do not change during the encryption process. In most irreversible image processing processes (such as lossy compression, format conversion, video encoding, etc.), the color values of the pixels change, and the coordinate values of the pixels generally do not change. Therefore, if the encrypted image has undergone some irreversible image processing, as long as the coordinate positions of the pixels in the new image do not change, it can be restored to a recognizable original image (or the original image after the same image processing process) through the image decryption process of this algorithm.
[0136] For an encrypted image processed by a reversible operation, the original image can be obtained by performing the inverse operation before decryption and then decrypting the image.
[0137] S6 obtains a metadata encryption key, and uses the metadata encryption key to encrypt the encryption area metadata and the image encryption key to generate metadata of the encrypted image;
[0138] In one implementation, in step S6, obtaining the metadata encryption key includes:
[0139] Send a metadata encryption key request to KMS (Key Management Service); obtain the metadata encryption key and the corresponding identifier keyid returned by KMS;
[0140] In the above implementation, KMS is a trusted key management service provided by a security-certified organization or government department. Currently, mainstream cloud service providers all provide reliable KMS services. KMS can return the plaintext and ciphertext of the encryption key (when using symmetric encryption), and can also return the encrypted public key plaintext (when using asymmetric encryption). Each encryption key is marked by its identifier keyid. Through keyid, you can apply to KMS for a decryption key (key plaintext or private key plaintext); KMS is responsible for managing the issued keys, and when a decryption key (key plaintext or encrypted private key) is needed, only authorized personnel or applications can obtain it. All communications with the KMS service are encrypted and cannot be stolen by third parties; all keys are destroyed immediately after use and are not stored in memory.
[0141] In another implementation, in step S6, obtaining the metadata encryption key includes:
[0142] Using the public key in the preset digital certificate as the metadata encryption key, and using the serial number of the preset digital certificate as the identifier keyid of the metadata encryption key;
[0143] In the above implementation, the digital certificate is issued by an authoritative certificate issuing agency. The private key of the digital certificate is stored in a safe and trusted institution or organization, and only authorized personnel can use it. The digital certificate is pre-installed in the device or software. A separate certificate can be issued for each device or software, or multiple devices or software can use the same certificate (such as the certificate of the same institution or organization). The public key in the digital certificate is used for encryption. The serial number of the certificate can be used as the key identifier keyid. Since the certificate has been installed in advance, there is no need to temporarily apply for an encryption key from KMS, so this method is particularly suitable for encryption of real-time images and videos.
[0144] In one implementation, in step S6, obtaining the metadata encryption key includes: for point-to-point communication, using the public key of the other party as the metadata encryption key. During the handshake phase of the communication session, the two parties exchange their respective public keys. When this method is adopted, the keyid can be the user ID of the other party or other mark that can identify the other party.
[0145] In one implementation mode, in step S6, the metadata encryption key is used to encrypt the encryption area metadata and the image encryption key to generate the metadata of the encrypted image, including:
[0146] Encrypt the encryption area metadata and the image encryption key using the metadata encryption key to generate ciphertext data;
[0147] The generated ciphertext (including the ciphertext of the encryption area metadata and the ciphertext of the image encryption key) and the keyid of the metadata encryption key constitute the metadata of the encrypted image.
[0148] When the metadata encryption key is used to encrypt the encryption area metadata and the image encryption key, there is no restriction on the specific encryption algorithm used, as long as it complies with the cryptographic algorithm standard and its application specification. This application does not make any specific restrictions here.
[0149] Wherein, in the case that there is no target encryption area in step S2, step S6 includes:
[0150] For an original image that does not contain any encrypted area, a fixed special value is generated as metadata of the encrypted image.
[0151] In one scenario, for an image that does not contain any encrypted area, its metadata may be a fixed special value, such as a fixed-length all-zero number.
[0152] S7 obtains the encrypted image and metadata of the encrypted image.
[0153] In one implementation, step S7 includes:
[0154] According to the metadata of the encrypted image, the encrypted image can be embedded in the encrypted image as a digital watermark, or superimposed on the encrypted image as a QR code (barcode) watermark, or saved separately from the encrypted image in the form of a file, so as to meet the needs of different scenarios.
[0155] Through the above steps S1 to S6, the original image is encrypted and the following data is obtained: 1) A static image after encryption (encrypted image): The sensitive and private information in the image has been protected and cannot be identified by humans or computer programs. 2) Metadata of the encrypted image, which is used to decrypt the encrypted image. The encryption area metadata and image encryption key in the metadata are stored in ciphertext, and only authorized institutions and personnel can obtain the corresponding decryption key.
[0156] In addition, in step S7, the output encrypted image and metadata of the encrypted image can be further processed, including:
[0157] Save encrypted image metadata.
[0158] In one implementation, in step S7, the metadata of the encrypted image is embedded into the encrypted image in the form of a digital watermark, specifically including:
[0159] Encode metadata into a QR code or barcode graphic; embed the QR code or barcode graphic into the encrypted image through conversion technologies such as DCT / DWT / SVD.
[0160] Among them, digital watermark technology has the characteristics of imperceptibility, robustness, and anti-attack, and is a relatively mature technology at present. The image embedded with the blind watermark is basically consistent with the original image, and it is difficult for the human eye to distinguish the difference between the two; the image embedded with the blind watermark can be converted into a format, compressed or encoded, and the processed image still contains the embedded blind watermark image, and the blind watermark image can be decoded normally to identify the information in the blind watermark image; when using this storage method, the original information in the image will not be destroyed, and the use of encrypted images and videos will not be affected, and viewers will not be aware of the existence of metadata.
[0161] In another implementation, in step S7, the metadata of the encrypted image is embedded into the encrypted image in the form of a common watermark, specifically including:
[0162] Encode metadata into a QR code or barcode; superimpose it in a fixed area on the encrypted image in the form of a common watermark. When using the above saving method, viewers can perceive the existence of the watermark, but it basically does not affect the use of the image or video; however, the processing speed of common watermarks is faster than that of digital watermarks, and it is suitable for occasions with special requirements for processing speed.
[0163] Meanwhile, in step S7, the output metadata may be saved separately from the encrypted image, and the metadata may be separated from the encrypted image and saved separately, such as: saved in a file, a database or an object storage;
[0164] The metadata saved should have a unique index, and the file, database or object storage that saves the metadata can quickly find the corresponding metadata through the index. The metadata index can be generated by the information of the encrypted image, such as using the summary value or unique number of the encrypted image as the index of the metadata; the unique index can also be generated by the metadata itself or a random number can be directly generated and associated with the metadata. For example, the summary value of the encrypted metadata is used as the index. At this time, since the metadata index cannot be obtained based on the encrypted image itself, the metadata index should be embedded in the encrypted image in the form of a digital watermark or a common watermark.
[0165] This method has the fastest saving processing speed and the size of metadata is almost unlimited. It is particularly suitable for situations where there are a large number of encrypted areas in very large images. Security is further improved because metadata and encrypted image files are saved separately.
[0166] Among them, the method also includes: when the image encryption processing is completed (after completing step S7), the original image data is immediately destroyed, and the image, video acquisition equipment and software use the encrypted image as the original acquired image for subsequent processing procedures (such as: beautification, video encoding, output, display, storage, etc.).
[0167] At the same time, based on the above Figure 1 The embodiment proposes a method for processing image acquisition synchronous encryption privacy protection. The present invention also proposes a processing device for image acquisition synchronous encryption privacy protection, which is used to implement the above Figure 1 The processing method for image acquisition synchronous encryption and privacy protection shown in any of the implementation modes will not be repeated in this application.
[0168] The above-mentioned embodiment of the present invention proposes a method and device for processing image acquisition synchronous encryption and privacy protection.
[0169] (1) A reversible encryption technology is proposed to encrypt sensitive and private information or designated areas in images and videos. While protecting sensitive and private data in images or videos, non-sensitive information in images and videos is retained; moreover, when necessary, the encrypted areas in images and videos can be decrypted to obtain the original unencrypted images.
[0170] (2) After the encryption, the sensitive, private information or designated areas in the encrypted image cannot be normally identified by humans or computer programs; in addition, other unprotected information in the encrypted image can be normally identified by humans or computer programs. For example, vehicles, objects, people's behaviors, events, etc. in the image or video can be normally identified, but the identity of the person or the license plate number of the vehicle cannot be identified. It can protect sensitive and private information while meeting the basic usage requirements of image data in different scenarios. It can achieve the original purpose of collecting images and videos, such as monitoring the behavior of people in the video, and protect the sensitive information or private information in the image. Even if the encrypted image or video is leaked, the illegal acquirer cannot identify the sensitive or private information in the video.
[0171] (3) When necessary, authorized personnel can decrypt the encrypted images. The decrypted images and videos contain all the information in the original images and videos, and people or computer programs can identify and process the sensitive and private information in them. While protecting the sensitive and private information in the image, all the information in the image is retained, allowing applications such as video surveillance to fully function.
[0172] (4) It can be applied to the synchronous encryption processing of static image and dynamic video data acquisition in real time, and the image data is encrypted before being transmitted or saved through the network. This method can be embedded in the image or video acquisition device or software as a software or hardware module, and has a wide range of applications and strong adaptability.
[0173] (5) The images or videos that have been taken can be processed and the existing image and video data can be encrypted to protect the privacy information therein. After encryption processing, only the encrypted image and video data need to be retained, and the original unencrypted image and video data can be permanently deleted to eliminate the risk of sensitive and private data leakage.
[0174] (6) The above method can also be used in point-to-point image or video transmission and communication: use the public key of the other end to encrypt the locally collected image or video. After the other end receives the encrypted image, if it is not concerned about the sensitive information in it or is in a public place such as a subway, Internet cafe, etc. where privacy cannot be guaranteed, there is no need to decrypt the video and there is no need to worry about the other party's privacy being peeped by bystanders. If it is necessary to identify the other party's face or other sensitive information, or in a place where privacy can be guaranteed, you can use your own private key to decrypt the image data. This can meet the information protection needs in different scenarios.
[0175] Corresponding to the encryption method proposed in the above embodiment, in a processing method for image acquisition synchronization encryption privacy protection proposed in the present invention, see Figure 2 , which also includes a processing method for decrypting the encrypted image encrypted by the above-mentioned implementation method, including:
[0176] SA1 extracts metadata of encrypted images;
[0177] In one implementation, the following different steps are taken to extract the encrypted image metadata according to the storage form of the metadata:
[0178] When metadata is embedded in an encrypted image as a digital watermark:
[0179] By extracting the digital watermark image from the encrypted image through inverse DCT / DWT / SVD, a watermark-free encrypted image and a watermarked image will be obtained; the QR code or barcode information in the watermarked image will be identified; and the encrypted image metadata will be obtained.
[0180] When metadata is embedded in an encrypted image as a normal watermark:
[0181] A fixed area image on the encrypted image is intercepted to obtain a watermark image; the QR code or barcode information in the watermark image is recognized; and the encrypted image metadata is obtained.
[0182] When metadata is saved separately from the encrypted image:
[0183] Extract metadata index:
[0184] When the metadata index is generated based on the encrypted image, the same algorithm is used to generate the metadata index based on the encrypted image data; if the metadata index is embedded in the encrypted image in the form of a digital watermark or a common watermark, the watermark image is first extracted and then the metadata index therein is identified;
[0185] Read metadata from metadata storage media (such as files, databases, object storage, etc.) based on metadata indexes.
[0186] SA2 applies for the decryption key based on the keyid in the metadata;
[0187] In one implementation, according to the key application method, the decryption key is applied for in the following manner:
[0188] Apply for a decryption key from KMS; or,
[0189] Apply for the certificate private key from the holder of the encrypted digital certificate, or have the certificate holder perform the decryption operation; or,
[0190] Key usage rights must be strictly controlled and audited, and only authorized personnel or applications can apply for the use of decryption keys; or,
[0191] In peer-to-peer communication, use your own encryption private key for decryption.
[0192] SA3 uses the decryption key to decrypt the ciphertext data in the metadata to obtain the decrypted encrypted area metadata plaintext and image encryption key plaintext;
[0193] SA4 obtains the locations of all encrypted areas in the encrypted image based on the decrypted encrypted area metadata, and uses the image encryption key to decrypt the image of each encrypted area to obtain the unencrypted original image.
[0194] In one implementation, corresponding to the encryption method shown in the above S5 embodiment, step SA4, using the image encryption key to decrypt the image of each encrypted area, specifically includes:
[0195] According to the image encryption key, a random natural number sequence S with a length of N and each value in the left closed and right open interval [0, N) is generated, where N represents the total number of pixels in the encryption area, and the i-th number in the sequence S is represented as S(i);
[0196] For each pixel in the encrypted area, the kth pixel in the encrypted area of the original image is recorded as P(k), and the i-th pixel in the encrypted target encrypted area is recorded as P'(i). The relationship between P(k) and P'(i) is:
[0197] P(k)=P'(i),k=S(i),i∈[0..N)
[0198] Where P(k) represents the kth pixel in the encrypted area of the original image after decryption; P'(i) represents the i-th pixel in the encrypted area before decryption; S(i) represents the i-th number in the random natural number sequence S.
[0199] According to the above relationship, P' is known, and the value P(i) of each original pixel point from i 0 to N-1 is calculated to obtain the decrypted original image P of the target area.
[0200] Among them, encryption and decryption use the same random number sequence generation algorithm, and the random number sequence generated by the same encryption key is the same. The random in "random natural number sequence S" mainly refers to the irregularity and disorder of the numbers in this sequence, that is, the subsequent numbers in the sequence cannot be guessed by the known partial numbers in the sequence. A random encryption key is generated during encryption. The random in this "random encryption key" refers to the randomness of key generation, that is, the key generated each time is different and cannot be guessed. This random encryption key is saved in the metadata in ciphertext. During decryption, the encryption key in the metadata is first decrypted, and then this key is used to generate a random natural number sequence consistent with the encryption.
[0201] The corresponding relationship between pixels in encryption and decryption is the same. The difference is that in encryption, the value of P is assigned to P', while in decryption, P' is assigned to P, but the mapping relationship between the two is the same.
[0202] In one implementation, the decryption method further includes:
[0203] SA5 executes the above processing flow of SA1-SA4 for each frame of the video data, and then re-encodes the decrypted image to obtain the decrypted video.
[0204] At the same time, based on the above Figure 2 The embodiment proposes a method for decrypting an encrypted image. The present invention also proposes a device for decrypting an encrypted image. The device is used to implement the above Figure 2 The processing method for decrypting an encrypted image shown in any of the embodiments will not be repeated in this application.
[0205] In one scenario, a legally authorized unit obtains the decryption key and method for image privacy information and can decrypt and restore the protected image when necessary.
[0206] For video surveillance data in public places (including monitoring of the outdoor environment while the vehicle is driving), ordinary people cannot directly decrypt and restore the image privacy information, but this does not affect daily security monitoring operations.
[0207] For the video surveillance system invented by this technology applied in private areas (such as offices, homes, private clubs, etc.), no matter where the image data is stored, only the owner himself or authorized specific personnel can obtain the decryption key and method, and the image privacy information can be decrypted and restored when necessary.
[0208] Apply for the decryption key according to the keyid in the metadata. According to the key application method, apply for the decryption key in the following ways: apply for the decryption key from KMS; apply for the certificate private key from the encrypted digital certificate holder, or have the certificate holder perform the decryption operation; the key usage authority must be strictly controlled and audited, and only authorized personnel or applications can apply for the use of the decryption key.
[0209] The image encryption method provided by the present invention protects sensitive and private data in images or videos while retaining non-sensitive information in the images or videos; moreover, when necessary, the encrypted areas in the images or videos can be decrypted to obtain the unencrypted original images.
[0210] In particular, when the present invention is used for monitoring equipment in public places, after the monitoring equipment is installed with an encryption certificate uniformly issued by the regulatory authority, the personal image privacy data (face, identity and other information) of citizens in all collected pictures and video images will be effectively protected. It can not only meet the original function of video monitoring, but also protect the personal privacy of citizens. Even if the monitoring video is leaked, the personal privacy data of citizens therein will not be leaked. Blocking the leakage channel of such sensitive information helps to reduce infringement caused by leakage and theft of personal portrait privacy data. In order to more strictly protect personal image privacy data from being leaked and stolen, this conceptual invention and technical implementation method of completing privacy data encryption while collecting images at the front end of the camera or image collector takes into account the security requirements of video monitoring in various scenes in the current society, and the image data obtained by the front end of various camera equipment can be safely transmitted and stored in the back-end data center for long-term storage, effectively protecting personal privacy information in the image from being leaked, infringed and abused.
[0211] It should be noted that each functional unit / module in each embodiment of the present invention may be integrated into one processing unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated into one unit / module. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of software functional unit / module.
[0212] Through the description of the above implementation mode, it can be clearly understood by those skilled in the art that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code or any appropriate combination thereof. For hardware implementation, the processor can be implemented in one or more of the following units: application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), processor, controller, microcontroller, microprocessor, other electronic units designed to implement the functions described herein or their combination. For software implementation, part or all of the process of the embodiment can be completed by instructing the relevant hardware through a computer program. When implemented, the above program can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that can be accessed by a computer. Computer-readable media can include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.
[0213] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should analyze that the technical solution of the present invention can be modified or replaced by equivalents without departing from the essence and scope of the technical solution of the present invention.
Claims
1. A method for processing image acquisition synchronous encryption and privacy protection, characterized in that: Including: S1 Obtain the original image, where the original image is static image data; S2 Obtain the target encrypted area in the original image; S3 Generate encrypted area metadata based on the obtained target encrypted area, where the encrypted area metadata is used to describe the location information of each target encrypted area; S4 Generate a random image encryption key; S5 Use the image encryption key to encrypt all target encrypted areas in the image through a reversible encryption algorithm to generate an encrypted image; S6 Obtain a metadata encryption key, and use the metadata encryption key to encrypt the encrypted area metadata and the image encryption key to generate the metadata of the encrypted image; S7 Obtain the encrypted image and the metadata of the encrypted image; Among them, step S5 includes: According to the image encryption key, generate a random natural number sequence S with a length of N, and the values of each item are in the left-closed and right-open interval [0, N), where N is the total number of pixel points in the target encrypted area, and the i-th number in the sequence S is denoted as S(i); For each pixel point in the target encrypted area, denote the k-th pixel point in the target encrypted area of the original image as P(k), and the i-th pixel point in the encrypted target encrypted area as P'(i), then the relationship between P(k) and P'(i) is: P'(i) = P(k), k = S(i), i ∈ [0..N) According to the above relationship, calculate the value P'(i) of each encrypted pixel point when i ranges from 0 to N - 1, and obtain the encrypted target encrypted area image P'; Among them, in step S5, according to the image encryption key, generate a random natural number sequence S with a length of N, and the values of each item are in the left-closed and right-open interval [0, N), specifically including: Algorithm e): The random natural number sequence generation algorithm for any length of N includes: e1) If N <= 256, then call algorithm c) or algorithm d) to calculate the random natural number sequence; e2) If N > 256, calculate K = N / 256; e3) If K > 256, then recursively call algorithm e) to generate a random natural number sequence SEQ_R with a length of K when N = K; e4) If K <= 256, call algorithm c) or algorithm d) to generate a random natural number sequence, SEQ_R; e5) Generate K random natural number sequences with a length of 256, SEQ_N; e6) The target length of the natural number generation sequence is denoted as SEQ, and the i-th number is denoted as SEQ[i], i = [0...N); Each number SEQ[i] in SEQ satisfies the following formula: SEQ[i] = SEQ_R[r] * 256 + SEQ_N[m], r = i / 256, m = i % 256; where / represents the integer division operation; % represents the modulo operation; Among them, algorithm d): The random natural number sequence generation algorithm for a length of N, 0 < N <= 256, includes: d1) If N is a multiple of 16, then use algorithm c) to generate the required natural number sequence; d2) If N is not a multiple of 16, calculate M, where M = N / 16 + 1 and M <= 256; calculate a random natural number sequence SEQ of length M * 16 according to algorithm c); d3) Take the first N numbers less than N in SEQ to obtain a random natural number sequence of length N; Algorithm c): The algorithm for generating a random natural number sequence of length 16 * N, where 1 < N <= 16, includes: c1) According to algorithm b), generate a random number sequence of length N, and this random number sequence is denoted as SEQ_R; c2) According to algorithm a), generate N random number sequences of length 16, and each random number sequence is denoted as SEQ_N, where N = [0...16); c3) Denote the target random number sequence to be obtained as SEQ, and the i-th number as SEQ[i], where i = [0...16 * N). Then each number SEQ[i] in SEQ satisfies the following formula: SEQ[i] = SEQ_R[r] * 16 + SEQ_N[m], where r = i / 16, N = r, and m = i % 16 where SEQ_R[r] represents the r-th number in the sequence SEQ_R; SEQ_N[m] represents the m-th number in the sequence SEQ_N; Algorithm b): The algorithm for generating a random natural number sequence with length N < 16 includes: b1): According to algorithm a), generate a random natural number sequence SEQ of length 16; b2): Sequentially take out all the numbers less than N from SEQ to obtain a random natural number sequence of length N; Algorithm a): The algorithm for generating a random natural number sequence with length N = 16 includes: a1) Use the image encryption key as the initial input value; a2) Calculate the SHA256 hash value of the input value; a3) The obtained hash value is a group of binary data with a length of 32 bytes; a4) Represent each byte with two hexadecimal digits, then the hash value is converted into a group of 64 hexadecimal digits; a5) Sequentially remove the duplicate numbers in this group of 64 hexadecimal digits. The obtained number sequence, if its length is 16, is the random natural number sequence to be generated; if the length of the obtained number sequence is less than 16, based on the input value and the currently obtained hash value, perform calculation processing to obtain a new data, and use this new data as the input value to repeat steps a2) - a4) until all 16 random numbers are obtained.
2. According to claim 1, a method for processing image acquisition synchronous encryption and privacy protection is characterized in that: Step S1 includes: Obtain a set of static pictures or dynamic video images collected by an image, video acquisition device and software, and use one of the static pictures or one frame of the dynamic video image as the original image; or, Obtain a static picture in the storage device as the original image, or obtain one frame of the video image data in the storage device as the original image; or, According to the obtained video stream data, use one frame of the video stream as the original image.
3. The image acquisition synchronous encryption privacy protection processing method according to claim 1 is characterized in that: Step S2 includes: Specify the target encryption area in the original image by manual marking; or, An image recognition algorithm is used to automatically identify sensitive information areas or privacy information areas in an image to obtain a target encryption area; wherein the target encryption area includes the sensitive information area or privacy information area in the original image.
4. The image acquisition synchronous encryption privacy protection processing method according to claim 1 is characterized in that: In step S3, the target encryption area includes a graph represented by a mathematical method.
5. The image acquisition synchronous encryption privacy protection processing method according to claim 1 is characterized in that: Step S4 includes: Perform SHA-256 hash calculation on the original image data A to obtain a first digest value SHA256(A); Generate a sequence [SHA256(A), t, k] according to the obtained first digest value SHA256(A), current time information t and a random number k generated by the system; Perform SHA-256 hash calculation again based on the obtained sequence [SHA256(A),t,k] to obtain the image encryption key SHA256([SHA256(A),t,k]).
6. The image acquisition synchronous encryption privacy protection processing method according to claim 1 is characterized in that: In step S6, obtaining the metadata encryption key includes: Send a metadata encryption key request to KMS; obtain the metadata encryption key and the corresponding identifier keyid returned by KMS; or, Using the public key in the preset digital certificate as the metadata encryption key, and using the serial number of the preset digital certificate as the identifier keyid of the metadata encryption key; or, In point-to-point communication, the public key of the other end is used as the metadata encryption key, where the user ID of the other end is used as the identifier keyid.
7. The image acquisition synchronous encryption privacy protection processing method according to claim 1 is characterized in that: In step S6, the metadata encryption key is used to encrypt the encryption area metadata and the image encryption key to generate metadata of the encrypted image, including: Encrypt the encryption area metadata and the image encryption key using the metadata encryption key to generate ciphertext data; The generated ciphertext of the encryption area metadata, the ciphertext of the image encryption key, and the keyid of the metadata encryption key are combined into the metadata of the encrypted image.
8. The image acquisition synchronous encryption privacy protection processing method according to claim 1 is characterized in that: Step S6 also includes: In the case where there is no target encryption area in step S2, for the original image that does not contain any encryption area, a fixed special value is generated as metadata of the encrypted image.
9. A processing device for image acquisition synchronous encryption and privacy protection, characterized in that: The device is used to implement the image acquisition synchronous encryption privacy protection processing method described in any one of claims 1-8.
