Video stream encryption method and device based on trusted execution environment

By adopting a video stream encryption method based on a trusted execution environment in the user's privacy camera, and using asymmetric algorithm key pairs and stream cipher parameters to encrypt and decrypt, the problem of insufficient key security in traditional video encryption solutions is solved, and the problem of using insufficient keys is realized. Secure transmission and decryption of video streams.

CN119094818AActive Publication Date: 2024-12-06HE FEI AN YONG XIN XI KE JI YOU XIAN GONG SI
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202311545215.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-20
Publication Date
2024-12-06
Estimated Expiration
2043-11-20

AI Technical Summary

Technical Problem

Traditional video encryption solutions have key security issues in user privacy cameras, and operators and hackers may obtain encryption keys, resulting in the risk of data breaches.

Method used

Using a video stream encryption method based on a trusted execution environment, the acquisition terminal and the playback terminal pre-form asymmetric algorithm key pairs, and randomly generate stream cipher parameters for encryption and decryption to ensure the secure transmission of video stream data.

Benefits of technology

It realizes the secure and reliable transmission of video streams, ensuring that users can decrypt and view videos, reducing the risk of data leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094818A_ABST
    Figure CN119094818A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of video data encryption, in particular to a video stream encryption method and device based on a trusted execution environment, and the method comprises the steps: an acquisition terminal randomly generates a stream password parameter RP based on the trusted execution environment, encrypts the parameter RP through a public key of a corresponding user, and packages the parameter RP into a data packet; the playing terminal generates an encryption key based on a key negotiation algorithm to encrypt frame element information, the frame element information comprises a video frame timestamp and a stream cipher parameter, and the encrypted frame element information is sent to the server module; the acquisition terminal uses a parameter RP as a stream password parameter, generates a corresponding stream password based on the size of a video frame, encrypts a video stream data XOR stream password, and pushes the encrypted video stream data XOR stream password to the server module; according to the invention, the acquisition terminal and the playing terminal carry out asymmetric algorithm encryption and stream encryption on the video stream, thereby ensuring that the video transmission is safer and more reliable, and ensuring that a user and the corresponding playing terminal owning the device can decrypt and view the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video data encryption, and in particular to a video stream encryption method and device based on a trusted execution environment. Background Art

[0002] Cameras are increasingly used and are prone to exposing user privacy data, such as home cameras. Traditional encryption still has the risk of data leakage because the security of the key cannot be guaranteed. Common solutions currently include:

[0003] Currently, common video encryption solutions are TLS encryption or frame-by-frame encryption. However, for cameras that contain user privacy, such as home bedroom cameras, the above encryption solutions still have the following problems:

[0004] 1. The operator has access to the encryption key, and the video is unencrypted to the operator's personnel.

[0005] 2. The camera encryption environment has security risks. Hackers can obtain the encryption key after the camera is hacked.

[0006] Therefore, for cameras that contain user privacy, how users who own the devices can safely decrypt videos is an issue that technical personnel in this field urgently need to solve. Summary of the invention

[0007] The purpose of the present invention is to provide a video stream encryption method and device based on a trusted execution environment to solve the problems raised in the background technology.

[0008] The present invention achieves the above-mentioned purpose through the following technical solutions:

[0009] A video stream encryption method based on a trusted execution environment is applied to a collection terminal, a playback terminal and a server module. The collection terminal and the playback terminal pre-generate an asymmetric algorithm key pair containing a public key and a private key. The encryption method includes:

[0010] S1: The acquisition terminal randomly generates a stream cipher parameter RP based on the trusted execution environment, encrypts the parameter RP through the public key of the corresponding playback terminal user, and packages it into a data packet; the playback terminal generates an encryption key based on a key negotiation algorithm to encrypt frame meta information, the frame meta information includes a video frame timestamp and a stream cipher parameter, and sends the encrypted frame meta information to the server module;

[0011] S2: The acquisition terminal uses the parameter RP as a stream cipher parameter, generates a corresponding stream cipher based on the video frame size, encrypts the video stream data by XORing the stream cipher, and pushes the encrypted data to the server module;

[0012] S3: The playback terminal obtains the updated frame meta information from the server module. After the playback terminal pulls the stream to the video server, the playback terminal decrypts the frame meta information with the private key and obtains the stream cipher encryption parameter RP, and generates the corresponding stream cipher based on the parameter RP and the video frame size; the video stream data is XORed with the stream cipher and then decrypted.

[0013] As a further optimization solution of the present invention, the acquisition terminal includes a video acquisition module running on Linux and a video encryption module running in a trusted execution environment.

[0014] As a further optimization scheme of the present invention, the playback terminal includes a video playback module and a video decryption module. The video playback module runs in Windows, Android, and Linux systems, and the video decryption module runs in a trusted execution environment or Windows, Android, and Linux systems.

[0015] As a further optimization solution of the present invention, the server module includes a video server and a business system. The video server is used to receive the video stream pushed by the acquisition terminal and forward it to the playback terminal. The business system is used to control the playback logic of the playback terminal.

[0016] As a further optimization solution of the present invention, the acquisition terminal updates the frame element information at a set time or picture group interval.

[0017] As a further optimization scheme of the present invention, the asymmetric algorithm key pair is generated based on a key management system, and the key management system issues identity authentication certificates to the acquisition terminal and the playback terminal, and records the public keys of the acquisition terminal and playback terminal certificates.

[0018] As a further optimization scheme of the present invention, during the encryption or decryption process, if the video frame size is not a multiple of the stream cipher block size, the number of rounds for generating the stream cipher is rounded up according to the video frame size or the stream cipher block size.

[0019] As a further optimization scheme of the present invention, when the acquisition terminal is continuously streaming and there is no playback terminal watching, the acquisition terminal updates the frame meta information based on a set method and pushes it to the server module, encrypts the video stream data based on the updated frame meta information, and pushes the encrypted video stream data to the server module.

[0020] As a further optimization scheme of the present invention, when the playback terminal plays a historical video, the playback terminal obtains a list of historical videos and frame meta-information through the server module, and accumulates all the video data therein through the video frame difference between the current position of the progress bar after dragging and the frame meta-information in the list, and uses a stream cipher to generate a key of corresponding size and discard it. Each frame of video uses the above-mentioned rounding-up algorithm. After discarding, a random number is generated according to the current frame size of the dragged progress bar, and the data is XOR-decrypted with the frame data to start playback.

[0021] A video encryption device based on a trusted execution environment includes at least one processor module and a memory module, and a logic operation program stored on the memory module and executable on the processor module. When the processor module executes the logic operation program, any one of the above methods is implemented.

[0022] The beneficial effects of the present invention are:

[0023] The encryption method and device proposed in the present invention realize asymmetric algorithm encryption and stream encryption of video streams by the acquisition terminal and the playback terminal, which can ensure that video transmission is more secure and reliable, and ensure that users who own the device and the corresponding playback terminal can decrypt and view the video. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a system schematic diagram of the encryption method implemented in the present invention. DETAILED DESCRIPTION

[0025] The present application is further described in detail below in conjunction with the accompanying drawings. It is necessary to point out here that the following specific implementation methods are only used to further illustrate the present application and cannot be understood as limiting the scope of protection of the present application. Technical personnel in this field can make some non-essential improvements and adjustments to the present application based on the above application content.

[0026] Example 1

[0027] like Figure 1 As shown, this embodiment provides a video stream encryption method based on a trusted execution environment, which is applied to a collection terminal, a playback terminal and a server module. The collection terminal and the playback terminal pre-generate an asymmetric algorithm key pair including a public key and a private key;

[0028] The acquisition terminal includes a video acquisition module running on Linux and a video encryption module running on a trusted execution environment. The playback terminal includes a video playback module and a video decryption module. The video playback module runs on Windows, Android, and Linux systems, and the video decryption module runs on a trusted execution environment or Windows, Android, and Linux systems, or can also rely on a TPM module.

[0029] The server module includes a video server and a business system. The video server is used to receive the video stream pushed by the acquisition terminal and forward it to the playback terminal. The business system is used to control the playback logic of the playback terminal.

[0030] In this embodiment, the asymmetric algorithm key pair is generated based on the key management system. The key management system issues identity authentication certificates to the acquisition terminal and the playback terminal, and records the public keys of the acquisition terminal and the playback terminal certificates.

[0031] 1. Before the encryption method in this embodiment is implemented, the system for implementing the encryption method is initialized, specifically:

[0032] The acquisition terminal completes the initialization process on the equipment production line:

[0033] (1) Burning device serial number s1.

[0034] (2) Generate a key pair (SK1, PK1) based on an asymmetric algorithm. SK1 is burned into the device efuse, and PK1 is recorded in the Flash.

[0035] (3) (S1, PK1) is registered in the key management system.

[0036] The playback terminal is opened by the user to complete the initialization. The initialization process is as follows:

[0037] (1) The playback terminal generates a user uid.

[0038] (2) The playback terminal generates a key pair (SK2, PK2) based on a non-recognition algorithm. SK2 can be stored using TEE or TCM technology. PK2 is stored in the configuration.

[0039] (3) (uid,PK2) is registered in the key management system.

[0040] 2. Binding of acquisition terminal and playback terminal:

[0041] (1) The playback terminal sends the device serial number s1 and uid to the business system.

[0042] (2) The business system queries the key management system for the public key PK1 corresponding to s1, and sends PK1 to the playback terminal. The playback terminal records PK1.

[0043] The business system queries the key management system for the public key PK1 corresponding to the uid, and sends PK2 to the collection terminal, which records PK2.

[0044] Encryption methods include:

[0045] S1: The acquisition terminal randomly generates a stream cipher parameter RP based on the trusted execution environment, encrypts the parameter RP through the public key of the corresponding playback terminal user, and packages it into a data packet; the playback terminal generates an encryption key based on the key negotiation algorithm to encrypt the frame meta information, the frame meta information includes the video frame timestamp and the stream cipher parameter, and sends the encrypted frame meta information to the server module;

[0046] S2: The acquisition terminal uses the parameter RP as the stream cipher parameter, generates the corresponding stream cipher based on the video frame size, encrypts the video stream data with the XOR stream cipher, and pushes it to the server module after encryption is completed;

[0047] S3: The playback terminal obtains the updated frame meta information from the server module. After the playback terminal pulls the stream to the video server, the playback terminal decrypts the frame meta information with the private key and obtains the stream cipher encryption parameter RP. The corresponding stream cipher is generated based on the parameter RP and the video frame size; the video stream data is XORed with the stream cipher and then decrypted.

[0048] In this embodiment, the acquisition terminal updates the frame element information according to a set time or picture group interval.

[0049] In this embodiment, during the encryption or decryption process, if the video frame size is not a multiple of the stream cipher block size, the number of rounds for generating the stream cipher is rounded up according to the video frame size or the stream cipher block size.

[0050] Preferably, the encryption method also includes: when the acquisition terminal is continuously streaming and there is no playback terminal watching, the acquisition terminal updates the frame meta information based on a set method and pushes it to the server module, encrypts the video stream data based on the updated frame meta information, and pushes the encrypted video stream data to the server module.

[0051] Preferably, the encryption method also includes: when the playback terminal plays a historical video, the playback terminal obtains a list of historical videos and frame meta-information through the server module, accumulates all the video data therein through the video frame difference between the current position of the progress bar after dragging and the frame meta-information in the list, uses a stream cipher to generate a key of corresponding size, and discards it, uses the above-mentioned rounding-up algorithm for each frame of video, and after discarding it, generates a random number according to the current frame size of the dragged progress bar, and XORs the decrypted data with the frame data to start playback.

[0052] Based on the above encryption method, implementation scenario one is specifically as follows: the playback terminal plays the real-time video.

[0053] (1) The playback terminal notifies the business system that the playback terminal needs to watch real-time video. The message contains the playback terminal user uid.

[0054] (2) The business system notifies the collection terminal uid that it needs to watch real-time video.

[0055] (3) The acquisition terminal randomly generates the parameters RP required for the stream cipher in the trusted execution environment, and uses the public key of the uid to negotiate the key and package it into a message MKey. (For example, assuming that the stream cipher is the chacha20 algorithm, the randomly generated parameters include a 256-bit random key RK, a 64-bit random counter RC, and a 64-bit random Nonce RN.) The playback terminal uses the key negotiation algorithm to generate a random encryption key MK (the public key of the playback terminal). For example, if the ECC algorithm is used, ECDH is used to negotiate the key. Then MK is used to encrypt the frame encryption information MP, where the frame encryption information includes the video frame timestamp and the stream cipher parameters. Finally, MP is sent to the service server.

[0056] (4) The acquisition terminal uses the parameter RP generated in the above steps as the stream cipher parameter and generates a stream cipher of the corresponding size according to the video frame size. If the video frame size is not a multiple of the stream cipher block size, the number of rounds to generate the stream cipher is rounded up according to (video frame size / stream cipher block size). The encryption method is the video stream data XOR stream cipher. After rounding up, the extra bits are discarded. The acquisition terminal encrypts the video stream and pushes it to the video server.

[0057] (5) The playback terminal queries the service terminal for the latest MP information and obtains the latest MP.

[0058] (6) The acquisition terminal pulls the stream to the video server. After decrypting the MP information, the stream cipher encryption parameter RP is obtained. Then RP is used as a parameter to generate a stream cipher of the corresponding size according to the video frame size. If the video frame size is not a multiple of the stream cipher block size, the number of rounds to generate the stream cipher is rounded up according to (video frame size / stream cipher block size). The decryption method is the video stream data XOR stream cipher.

[0059] (7) The acquisition terminal and the playback terminal update the MP information according to the negotiated strategy, for example, updating the MP after playing every N frames. At the same time, the MP information cannot be updated in the middle of a GOP (group of picture).

[0060] Implementation scenario two is specifically as follows: the playback terminal plays historical videos.

[0061] If there is no playback terminal, the streaming solution for the collection terminal is as follows (the collection terminal is continuously streaming, and no playback terminal is watching in the current time period):

[0062] (1) Query the business system for a list of legal video playback devices (uid, PK2) for the current terminal.

[0063] (2) The acquisition terminal updates the MP information according to a fixed strategy, for example, updating the MP after playing every N frames. At the same time, the MP information cannot be updated in the middle of a GOP (group of picture).

[0064] (3) Update MP information to the business system.

[0065] (4) After the MP is updated, the video is encrypted using the latest MP and pushed to the video server, which saves the video.

[0066] (5) When the playback terminal plays the historical record, it first queries the MP list, selects the appropriate MP according to the timestamp of the video historical record, and plays it after decryption.

[0067] Implementation scenario three: The playback terminal plays the historical video and drags the progress bar.

[0068] (1) The playback terminal obtains historical videos.

[0069] (2) The playback terminal obtains the MP list.

[0070] (3) According to the dragged progress bar, select the MP information on the progress bar.

[0071] (4) According to the video frame gap between the current position of the progress bar and the previous MP information, all video data sizes are accumulated. A key of corresponding size is generated using a stream cipher and discarded. Each frame of video must use the above rounding up algorithm.

[0072] (5) After discarding, a random number is generated according to the current frame size of the drag progress bar, and the data is XOR-decrypted with the frame data to start playing.

[0073] A video encryption device based on a trusted execution environment includes at least one processor module and a memory module, and a logic operation program stored in the memory module and executable on the processor module. The processor module implements the above method when executing the logic operation program.

[0074] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A video stream encryption method based on a trusted execution environment, It is characterized in that Applied to the acquisition terminal, playback terminal and server module, the acquisition terminal and playback terminal pre-generate an asymmetric algorithm key pair containing a public key and a private key. The encryption method includes: S1: The acquisition terminal randomly generates a stream cipher parameter RP based on the trusted execution environment, encrypts the parameter RP through the public key of the corresponding playback terminal user, and packages it into a data packet; the playback terminal generates an encryption key based on a key negotiation algorithm to encrypt frame meta information, the frame meta information includes a video frame timestamp and a stream cipher parameter, and sends the encrypted frame meta information to the server module; S2: The acquisition terminal uses the parameter RP as a stream cipher parameter, generates a corresponding stream cipher based on the video frame size, encrypts the video stream data by XORing the stream cipher, and pushes the encrypted data to the server module; S3: The playback terminal obtains the updated frame meta information from the server module. After the playback terminal pulls the stream to the video server, the playback terminal decrypts the frame meta information with the private key and obtains the stream cipher encryption parameter RP, and generates the corresponding stream cipher based on the parameter RP and the video frame size; the video stream data is XORed with the stream cipher and then decrypted.

2. The video stream encryption method based on a trusted execution environment according to claim 1, Features: The acquisition terminal includes a video acquisition module running on Linux and a video encryption module running on a trusted execution environment.

3. The video stream encryption method based on a trusted execution environment according to claim 1, Features: The playback terminal includes a video playback module and a video decryption module. The video playback module runs in Windows, Android, or Linux systems, and the video decryption module runs in a trusted execution environment or Windows, Android, or Linux systems.

4. The video stream encryption method based on a trusted execution environment according to claim 1, Features: The server module includes a video server and a business system. The video server is used to receive the video stream pushed by the acquisition terminal and forward it to the playback terminal. The business system is used to control the playback logic of the playback terminal.

5. The video stream encryption method based on a trusted execution environment according to claim 4, Features: The acquisition terminal updates the frame element information at a set time or picture group interval.

6. The video stream encryption method based on a trusted execution environment according to claim 1, Features: The asymmetric algorithm key pair is generated based on a key management system. The key management system issues identity authentication certificates to the acquisition terminal and the playback terminal, and records the public keys of the acquisition terminal and the playback terminal certificates.

7. The video stream encryption method based on a trusted execution environment according to claim 1, Features: In the encryption or decryption process, if the video frame size is not a multiple of the stream cipher block size, the number of rounds for generating the stream cipher is rounded up according to the video frame size or the stream cipher block size.

8. The video stream encryption method based on a trusted execution environment according to claim 5, Features: When the acquisition terminal is continuously streaming and there is no playback terminal watching, the acquisition terminal updates the frame meta information based on a set method and pushes it to the server module, encrypts the video stream data based on the updated frame meta information, and pushes the encrypted video stream data to the server module.

9. The video stream encryption method based on a trusted execution environment according to claim 8, Features: When the playback terminal plays a historical video, the playback terminal obtains a list of historical videos and frame meta-information through the server module, accumulates all the video data through the video frame difference between the current position of the progress bar after dragging and the frame meta-information in the list, uses a stream cipher to generate a key of the corresponding size, and discards it. Each frame of the video uses the above-mentioned rounding-up algorithm. After discarding it, a random number is generated according to the current frame size of the dragged progress bar, and the data is XOR-decrypted with the frame data to start playback.

10. A video encryption device based on a trusted execution environment, It is characterized in that The system comprises at least one processor module and a memory module, and a logic operation program stored in the memory module and executable on the processor module, wherein the processor module implements the method according to any one of claims 1 to 9 when executing the logic operation program.

Citation Information

Patent Citations

  • Network video collecting device, network video monitoring system and method

    CN101420587A

  • Secure video surveillance system based on Android device

    CN107277456A

  • Encryption method and device, decryption method and device and electronic equipment

    CN110446075A

  • Real-time face encryption and decryption method for videos based on authorization and authentication

    CN111726345B

  • Video data encryption method and device, storage medium and electronic equipment

    CN112491532A