Video stream transmission method and device, electronic equipment and storage medium
By generating encryption and decryption keys when registering the video collection device in the video surveillance system and transmitting them using the SIP protocol, the problem of independent key management and video stream transmission during the video stream transmission process is solved, and efficient and safe transmission of the video stream is achieved. , reducing system maintenance difficulty and network overhead.
Patent Information
- Application Number
- CN202410693451.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-10
AI Technical Summary
There are network security threats in the existing video surveillance system during the video stream transmission process. The GB28181 protocol fails to effectively solve the security protection problem of video streams, resulting in independent key management and video stream transmission, which increases the difficulty of system maintenance and brings network overhead and time delay.
By generating an encryption and decryption key when the video capture device registers, and using the SIP protocol to transmit the key, the client and the video capture device use the same key for encryption and decryption in each streaming request, avoiding key negotiation and transmission. , directly using the GB28181 protocol to transmit video streams.
It reduces the maintenance difficulty and network overhead of the video surveillance system, improves the real-time performance of video stream transmission, and ensures the security of the video stream.
Smart Images

Figure CN118632051A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of video transmission technology, and in particular to a video stream transmission method, device, electronic device and storage medium. Background Art
[0002] In order to meet the public security needs of social governance, people's livelihood services, etc., the construction scale of video surveillance systems in various places is getting larger and larger, and their status is becoming more and more prominent. Since the design of video surveillance systems often focuses on functional realization, there is a lack of complete security protection planning. The openness of the Internet has caused video surveillance information to be exposed in the public environment, and it is very easy to be eavesdropped and intercepted during data transmission, storage, and use. As the network security threats faced by video surveillance systems continue to increase, how to solve the network security problems they face has attracted more and more attention.
[0003] As a national standard, GB28181 is currently widely used in the field of video surveillance. Its signaling layer protocol uses SIP (Session initialization Protocol) to implement processes such as device registration, keep-alive, connection, and control. The streaming media transport layer uses RTP (Real-Time Transport Protocol) to package and transmit video streams. However, as a network transmission protocol, GB28181 itself has no relevant requirements and definitions for the security protection of video streams. Audio and video are transmitted in plain text on the network.
[0004] The commonly used video security protection solution currently uses video stream encryption technology to encrypt the audio and video streams transmitted in the network. The encryption method includes encrypting all video frames, video key frames, video parameter sets, etc. The general process is that after the device encodes the video, it obtains the encryption key from the platform through the application layer HTTPS and other protocols for encryption processing, and transmits the encrypted video stream to the client through the network through the GB28181 protocol. The client obtains the decryption key from the platform through the application layer HTTPS and other protocols, decrypts the encrypted video stream, and then decodes and plays the video stream.
[0005] It can be seen that key management and video stream transmission are two independent processes. Each time the device is pulled and played, two independent operations are required. One set of operations is to negotiate and transmit the key through the application layer HTTPS and other protocols, and the other set is to achieve pure encrypted video stream data transmission through GB28181. The two sets of processes require two different sets of business logic to be maintained between the device, platform, and client, which increases the difficulty of developing and maintaining the video surveillance system. At the same time, for video surveillance applications with large amounts of real-time data transmission, separate key negotiation and transmission processes will increase network overhead and latency. Summary of the invention
[0006] The embodiments of the present application provide a video stream transmission method, device, electronic device and storage medium, which are helpful to reduce the delay of video stream transmission and reduce network overhead.
[0007] In order to solve the above problems, in a first aspect, an embodiment of the present application provides a video stream transmission method, which is applied to a video monitoring platform, comprising:
[0008] When a video acquisition device is registered to the video monitoring platform, a first key for encrypting and decrypting a video stream of the video acquisition device is generated according to the registration information, wherein the first key includes a first encryption key and a first decryption key;
[0009] When receiving a video stream acquisition request sent by a client for the first time, sending a first SDP message to the client through the SIP protocol, wherein the first SDP message includes the first decryption key, and the first decryption key is used to decrypt the encrypted video stream sent by the video acquisition device each time;
[0010] The second SDP information is sent to the video acquisition device through the SIP protocol, wherein the second SDP information includes the first encryption key, and the first encryption key is used to encrypt the video stream acquired by the video acquisition device each time and then send it to the client.
[0011] In a second aspect, an embodiment of the present application provides a video stream transmission method, which is applied to a client, including:
[0012] After sending a video stream acquisition request to the video monitoring platform for the first time, receiving first SDP information sent by the video monitoring platform through the SIP protocol, wherein the first SDP information includes a first decryption key;
[0013] Each time an encrypted video stream sent by a video acquisition device is received based on a stream pull request, the encrypted video stream is decrypted according to the first decryption key to obtain decrypted video data.
[0014] In a third aspect, an embodiment of the present application provides a video stream transmission method, which is applied to a video acquisition device, including:
[0015] Register with the video surveillance platform through the SIP protocol;
[0016] Receiving second SDP information sent by the video surveillance platform through the SIP protocol, where the second SDP information includes a first encryption key;
[0017] Based on each stream pulling request from the client, the collected video stream is encrypted according to the first encryption key to obtain an encrypted video stream, and the encrypted video stream is sent to the client.
[0018] In a fourth aspect, an embodiment of the present application provides a video surveillance system, including:
[0019] A video monitoring platform, used to execute the video stream transmission method described in the first aspect;
[0020] A client, used to execute the video stream transmission method described in the second aspect;
[0021] The video acquisition device is used to execute the video stream transmission method described in the third aspect.
[0022] In a fifth aspect, an embodiment of the present application provides a video stream transmission device, which is applied to a video monitoring platform, including:
[0023] A first key generation module, used to generate a first key for encrypting and decrypting a video stream of the video acquisition device according to registration information when the video acquisition device is registered to the video monitoring platform, wherein the first key includes a first encryption key and a first decryption key;
[0024] A first SDP information sending module is used to send first SDP information to the client through the SIP protocol when receiving a video stream acquisition request sent by the client for the first time, wherein the first SDP information includes the first decryption key, and the first decryption key is used to decrypt the encrypted video stream sent by the video acquisition device each time;
[0025] The second SDP information sending module is used to send the second SDP information to the video acquisition device through the SIP protocol. The second SDP information includes the first encryption key. The first encryption key is used to encrypt the video stream acquired by the video acquisition device each time and then send it to the client.
[0026] In a sixth aspect, an embodiment of the present application provides a video stream transmission device, applied to a client, including:
[0027] A first SDP information receiving module, configured to receive first SDP information sent by the video surveillance platform through the SIP protocol after sending a video stream acquisition request to the video surveillance platform for the first time, wherein the first SDP information includes a first decryption key;
[0028] The video stream decryption module is used to decrypt the encrypted video stream according to the first decryption key to obtain decrypted video data each time the encrypted video stream sent by the video acquisition device is received based on a stream pull request.
[0029] In a seventh aspect, an embodiment of the present application provides a video stream transmission device, which is applied to a video acquisition device, including:
[0030] Device registration module, used to register with the video surveillance platform through the SIP protocol;
[0031] A second SDP information receiving module is used to receive second SDP information sent by the video surveillance platform through the SIP protocol, where the second SDP information includes a first encryption key;
[0032] The video stream encryption module is used to encrypt the collected video stream according to the first encryption key based on each stream pulling request of the client, obtain an encrypted video stream, and send the encrypted video stream to the client.
[0033] In an eighth aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the video stream transmission method described in the first aspect, the second aspect, or the third aspect is implemented.
[0034] In a ninth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the video stream transmission method described in the first aspect, the second aspect, or the third aspect.
[0035] The video stream transmission method, device, electronic device and storage medium provided in the embodiments of the present application generate a first key for encrypting and decrypting the video stream collected by the video capture device according to the registration information when the video capture device registers to the video monitoring platform, and when receiving the video stream acquisition request sent by the client for the first time, send the first SDP information to the client through the SIP protocol, the first SDP information includes the first decryption key, and send the second SDP information to the video capture device through the SIP protocol, the second SDP information includes the first encryption key, so as to realize the transmission of the first key for encrypting and decrypting the video stream through the SIP protocol, that is, the same GB28181 protocol as the transmission of the video stream is adopted, and there is no need to use the TCP protocol or the HTTPS protocol separately to transmit the first key, thereby reducing the maintenance difficulty of the video monitoring system, and the first key can be used directly after being transmitted once, and there is no need to negotiate the key separately each time the video stream is transmitted, thereby reducing the network overhead and delay caused by the key negotiation, and ensuring the real-time performance of the video stream transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0037] Figure 1 is a flow chart of a video stream transmission method provided by an embodiment of the present application;
[0038] Figure 2 is a flowchart of another video stream transmission method provided by an embodiment of the present application;
[0039] Figure 3 is a flow chart of a video stream transmission method provided by an embodiment of the present application;
[0040] Figure 4 is a flowchart of another video stream transmission method provided by an embodiment of the present application;
[0041] Figure 5 is a flow chart of a video stream transmission method provided by an embodiment of the present application;
[0042] Figure 6 is a flowchart of another video stream transmission method provided by an embodiment of the present application;
[0043] Figure 7 It is a structural diagram of a video surveillance system provided in an embodiment of the present application;
[0044] Figure 8 It is a structural schematic diagram of a video stream transmission device provided in an embodiment of the present application;
[0045] Fig. 9 It is a structural schematic diagram of a video stream transmission device provided in an embodiment of the present application;
[0046] Fig.10 It is a structural schematic diagram of a video stream transmission device provided in an embodiment of the present application;
[0047] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] Figure 1This is a flow chart of a video stream transmission method provided by an embodiment of the present application, which is applied to a video monitoring platform. The video monitoring platform is an intermediate layer between the video acquisition device and the client, and may include a national standard service and a key management service. The national standard service has functions such as device registration, device deregistration, device online status check, real-time preview, video query, video on demand, and video on demand control; the key management service has key generation and key modification functions.
[0050] like Figure 1 As shown, the video stream transmission method includes: steps 110 to 130.
[0051] Step 110: When the video acquisition device is registered to the video monitoring platform, a first key for encrypting and decrypting the video stream of the video acquisition device is generated according to the registration information, wherein the first key includes a first encryption key and a first decryption key.
[0052] The video acquisition device is a device for acquiring surveillance videos, including but not limited to cameras, and can be any device that can generate video data in the GB28181 protocol format. The registration information may include at least one of the registration time and device information.
[0053] The video acquisition device is registered to the national standard service of the video monitoring platform through the SIP protocol in the GB28181 protocol. The key management service of the video monitoring platform generates a first key for encrypting and decrypting the video stream collected by the video acquisition device according to the registration information of the video acquisition device, that is, generates a first encryption key for encrypting the video stream collected by the video acquisition device and a first decryption key for decrypting the video stream transmitted by the video acquisition device. The first encryption key and the first decryption key can be the same or different.
[0054] Exemplarily, when generating the first key according to the registration information, a character set containing numbers and uppercase and lowercase letters can be preconfigured, and a key generation logic for generating a preset number of bytes (such as 16 bytes) can be implemented. The key generation logic is specifically: using the registration information (such as the registration time) as the seed of the random number generator (a function that generates a random string), cyclically calling the function that generates the random string, randomly selecting a character from the character set through the function each time the function is called, and generating a random string of a preset number of bytes by calling the function a preset number of times, and the random string of the preset number of bytes is used as the first key. When the first encryption key and the first decryption key are different, two keys can be generated according to the above logic respectively, as the first decryption key and the first decryption key respectively, for example, the first encryption key is "5v@W$J3Z6b9a2!Df", and the first decryption key is "A#7e9Gm*rK1tFq%X".
[0055] Step 120, when receiving the first video stream acquisition request sent by the client, sending the first SDP information to the client through the SIP protocol, the first SDP information includes the first decryption key, and the first decryption key is used to decrypt the encrypted video stream sent by the video acquisition device each time.
[0056] The client interacts with the national standard service of the video surveillance platform through the SIP protocol to initiate a real-time video stream acquisition request. Among them, the client is a software application used to view the real-time or recorded video of the video surveillance system on a computer or mobile device. SDP (Session Description Protocol) is used for media negotiation before the start of two sessions and is used to establish a session.
[0057] A decryption key field can be added to the extension field of the SDP information. The video monitoring platform writes the first decryption key into the decryption key field of the SDP information to obtain the first SDP information. When the national standard service of the video monitoring platform receives the first video stream acquisition request sent by the client, it sends the first SDP information to the client through the SIP protocol. The client can decrypt the encrypted video stream obtained from the video acquisition device each time based on the first decryption key in the first SDP information. Among them, the format of the text line in the SDP information is <type> = <value> (i.e. <type> = <value>), the format of the first decryption key field in the first SDP information also adopts this format.
[0058] It should be noted that the first video stream acquisition request sent by the client is the first video stream acquisition request sent by the client received after the first key is generated. If the first key is subsequently updated, it is the first video stream acquisition request sent by the client received after the first key is updated.
[0059] Step 130: Send a second SDP message to the video acquisition device through the SIP protocol. The second SDP message includes the first encryption key. The first encryption key is used to encrypt the video stream acquired by the video acquisition device each time and then send it to the client.
[0060] An encryption key field can be added to the extension field of the SDP information. The video monitoring platform writes the first encryption key into the encryption key field of the SDP information to obtain the second SDP information. The national standard service of the video monitoring platform sends the second SDP information to the video acquisition device through the SIP protocol. The video acquisition device can encrypt each collected video stream based on the first encryption key in the second SDP information and send the encrypted video stream to the client. The format of the text line in the SDP information is <type> = <value> (i.e. <type> = <value>), the format of the first encryption key field in the second SDP information also adopts the format of the text line in the above SDP information.
[0061] The embodiment of the present application directly uses the SIP protocol to send the first encryption key and the first decryption key, rather than using the TCP protocol or the HTTPS protocol to send the encryption key and the decryption key, thereby achieving the transmission of the encryption and decryption keys and the transmission of the video stream using the same protocol.
[0062] The video stream transmission method provided in this embodiment generates a first key for encrypting and decrypting the video stream collected by the video capture device according to the registration information when the video capture device registers to the video monitoring platform. When receiving the video stream acquisition request sent by the client for the first time, the method sends the first SDP information to the client through the SIP protocol, and the first SDP information includes the first decryption key. The method sends the second SDP information to the video capture device through the SIP protocol, and the second SDP information includes the first encryption key. The method realizes the transmission of the first key for encrypting and decrypting the video stream through the SIP protocol, that is, the same GB28181 protocol as the transmission of the video stream is adopted, and there is no need to use the TCP protocol or the HTTPS protocol separately to transmit the first key, thereby reducing the maintenance difficulty of the video monitoring system. Moreover, the first key can be used directly after being transmitted once, and there is no need to negotiate the key separately each time the video stream is transmitted, thereby reducing the network overhead and delay caused by the key negotiation, and ensuring the real-time performance of the video stream transmission.
[0063] Figure 2 FIG. 1 is a flowchart of another video stream transmission method provided in an embodiment of the present application, and the method is applied to a video monitoring platform. Figure 2 As shown, the video stream transmission method includes: steps 210 to 250.
[0064] Step 210: When the video acquisition device is registered to the video monitoring platform, a first key for encrypting and decrypting the video stream of the video acquisition device is generated according to the registration information, wherein the first key includes a first encryption key and a first decryption key.
[0065] Step 220: Generate a second key for encrypting and decrypting the first key according to the MAC address and synchronization timestamp of the video acquisition device, wherein the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform.
[0066] The time when the video acquisition device is first synchronized with the video monitoring platform is the time when the video acquisition device is first synchronized with the national standard service in the video monitoring platform, that is, the time when the video acquisition device is connected to the network. The synchronization timestamp can be directly the time of the first synchronization, or it can also be the time information after processing the time of the first synchronization.
[0067] The key management service of the video surveillance platform saves the MAC address and synchronization timestamp of the video acquisition device, and the saved MAC address and synchronization timestamp are used to generate a second key for encrypting and decrypting the first key. The first key can be encrypted and decrypted using a preset encryption algorithm. The preset encryption algorithm can be, for example, an AES (Advanced Encryption Standard) symmetric encryption algorithm.
[0068] Exemplarily, when the key management service of the video surveillance platform generates a second key for encrypting and decrypting a first key based on the MAC address and synchronization timestamp of the video acquisition device, the MAC address and synchronization timestamp can be concatenated into a string and the string can be used as the second key, or the string can be mapped to a string of a preset length and used as the second key.
[0069] In one embodiment of the present application, generating a second key for encrypting and decrypting the first key based on the MAC address and synchronization timestamp of the video acquisition device includes: concatenating the MAC address and the synchronization timestamp into a string; mapping the string to a hash value of a target number of bits through a target hash function; and generating the second key based on the hash value.
[0070] The target hash function is a properly selected hash function, such as SHA-256. SHA-256 is an irreversible hash algorithm with a fixed output length of 256 bits, used for data integrity verification and cryptographic applications, with strong anti-collision and high computational efficiency.
[0071] The MAC address and the synchronization timestamp are combined to connect the MAC address and the synchronization timestamp of the video acquisition device into a string. For example, if the MAC address is "XAWU121XA" and the synchronization timestamp is 1278312, the MAC address and the synchronization timestamp can be connected into a string, and the connected string is "XAWU121XA-1278312".
[0072] The target hash function is used to map the string formed by concatenating the MAC address and the synchronization timestamp into a hash value of the target number of bits, that is, the above string is input into the target hash function to obtain the hash value of the target number of bits. For example, when the target hash function is SHA-256, a hash value with a target number of bits (32 bytes) will be generated by the target hash function, and this hash value is usually expressed in hexadecimal.
[0073] The hash value may be used as the second key, or the hash value may be processed in a certain manner and used as the second key.
[0074] By concatenating the MAC address and the synchronization timestamp into a string, mapping the string into a hash value of a target number of bits through a target hash function, and generating a second key based on the hash value, the generation process of the second key is relatively complicated. The generated second key is used to encrypt and decrypt the first key, thereby improving the security of the first key transmission.
[0075] In one embodiment of the present application, generating the second key according to the hash value includes: converting the hash value into a large integer, performing a modular operation on the large integer and a target prime number, and using the modular operation result as the second key.
[0076] Among them, large integers are also called high-precision integers, which are integers whose precision cannot be stored using basic data types. The target prime number must be large enough and is also a large integer. The target prime number is smaller than the large integer converted by the hash value. Modular operation, also known as modulo operation, is a mathematical operation that returns the remainder of division. In modular operation, there are two main parameters: dividend and divisor. The result of modular operation is the remainder of the dividend divided by the divisor. Usually, modular operation is expressed as "dividend mod divisor", where "mod" represents the operator of modular operation.
[0077] Convert the hash value mapped to the string into a large integer, use the target prime number to perform a modulo operation on the large integer, and use the modulo operation result as the second key. For example, when the target hash function is SHA-256, convert the obtained hexadecimal hash value into a large integer. Each hexadecimal digit can represent 4 bits of binary, so a 256-bit hash value can be represented as a large integer; select a sufficiently large target prime number (also a large integer), such as a 2048-bit prime number, and perform a modulo operation on the large integer obtained in the previous step with this prime number. The result of the modulo operation is the generated second key. The second key can be used to encrypt and decrypt the first key.
[0078] By converting the hash value into a large integer and taking the result of a modulo operation between the large integer and the target prime number as the second key, it can be ensured that the generated second key has sufficient security.
[0079] Step 230: encrypt the first encryption key according to the second key to obtain a first encryption key ciphertext, and encrypt the first decryption key according to the second key to obtain a first decryption key ciphertext.
[0080] A preset encryption algorithm is adopted, and the first encryption key is encrypted with the second key to obtain the first encryption key ciphertext, and the first decryption key is encrypted with the second key to obtain the first decryption key ciphertext.
[0081] Step 240: upon receiving the video stream acquisition request sent by the client for the first time, sending first SDP information to the client through the SIP protocol.
[0082] Among them, the first decryption key in the first SDP information is the first decryption key ciphertext, and the first SDP information also includes the MAC address and the synchronization timestamp, and the MAC address and the synchronization timestamp are used to decrypt the first decryption key ciphertext to obtain the first decryption key.
[0083] The first SDP information transmits the first decryption key in the form of ciphertext, which can improve the transmission security of the first decryption key.
[0084] In the embodiment of the present application, a new field is added to the national standard SDP so that the encrypted key (the first decryption key and the first encryption key) is transmitted through the SDP of the GB28181 protocol, and four lines of key-related description are added to the original SDP. <type> = <value>The format is:
[0085] 1. The first encryption key ciphertext (i.e., the first encryption key encrypted by the second key). The first encryption key ciphertext can be expressed as <encodekey>=<51c7e3657f8c739bf47f8e90b0ce720d>, the first encryption key ciphertext (EnCodeKey) is generated by the key management service as a fixed-length random encryption key, and then the second key is generated by using the MAC address and the synchronization timestamp. The first encryption key is encrypted using the second key. After decrypting the first encryption key ciphertext, the first encryption key of the video stream can be obtained. The first encryption key is used to encrypt the pushed video stream in real time.
[0086] 2. The first decryption key ciphertext (i.e., the first decryption key encrypted by the second key). The first decryption key ciphertext can be expressed as <decodekey>=<38e01i857f8c739bf47f8e90b0ce720d>, the first decryption key ciphertext (DeCodeKey) is generated by the key management service as a fixed-length random decryption key, and then the second key is generated using the MAC address and the synchronization timestamp. The first decryption key is encrypted using the second key. After decrypting the first decryption key ciphertext, the first decryption key of the video stream can be obtained. The first decryption key is used to decrypt the encrypted video stream in real time.
[0087] 3. The MAC address of the video acquisition device, which can be expressed as <devicemac>=XAWU121XA, the MAC address of the video acquisition device is the unique identity information of the video acquisition device. The video acquisition device is uniformly reported when registering the national standard service of the video surveillance platform. The second key can be calculated with the synchronization timestamp to encrypt and decrypt the first key.
[0088] 4. Synchronization timestamp, which can be expressed as <timestamp>=1278312, the synchronization timestamp is the timestamp when the video acquisition device is synchronized with the national standard service for the first time, which can be obtained by the time(NULL) function. The second key can be calculated with the MAC address of the video acquisition device to obtain the second key, which is used to encrypt and decrypt the first key.
[0089] The first SDP information and the second SDP information use the above fields to carry the information corresponding to each field. An example of the first SDP information or the second SDP information is as follows:
[0090] OPTIONS sip:server@domain SIP / 2.0
[0091] Via:SIP / 2.0 / UDP 192.168.1.100:5060; branch=z9hG4bK123456789
[0092] From:<sip:device@domain> ;tag=987654321
[0093] To:<sip:server@domain>
[0094] Call-ID:12345678901234567890@192.168.1.100
[0095] CSeq:1OPTIONS
[0096] Max-Forwards:70
[0097] User-Agent:YourDevice / 1.0
[0098] EncryptedEnCodeKey:rG$5m2H@8p! Qn%Xv
[0099] EncryptedDeCodeKey:d#9v7K$rG&5s2x8z
[0100] DeviceMac:3459237639572A7052715878
[0101] TimeStamp:1679811458
[0102] Content-Length:0
[0103] From the example of the above SDP information, it can be seen that the SDP information adds four fields: the first encryption key ciphertext (EnCodeKey), the first decryption key ciphertext (DeCodeKey), the MAC address of the video acquisition device (DeviceMac) and the synchronization timestamp (TimeStamp) on the basis of the original SDP.
[0104] Step 250: Send a second SDP message to the video acquisition device through the SIP protocol. The second SDP message includes the first encryption key. The first encryption key is used to encrypt the video stream acquired by the video acquisition device each time and then send it to the client.
[0105] Among them, the first encryption key in the second SDP information is the first encryption key ciphertext, and the second SDP information also includes the MAC address and the synchronization timestamp, and the MAC address and the synchronization timestamp are used to decrypt the first encryption key ciphertext to obtain the first encryption key.
[0106] The second SDP information transmits the first encryption key in the form of ciphertext, which can improve the transmission security of the first encryption key.
[0107] The video stream transmission method provided in this embodiment generates a second key for encrypting and decrypting a first key according to the MAC address and synchronization timestamp of a video acquisition device, encrypts the first encryption key according to the second key to obtain a first encryption key ciphertext, encrypts the first decryption key according to the second key to obtain a first decryption key ciphertext, and sends a first SDP message to the client including the first decryption key ciphertext, the MAC address and synchronization timestamp of the video acquisition device, and sends a second SDP message to the video acquisition device including the first encryption key ciphertext, the MAC address and synchronization timestamp of the video acquisition device, thereby realizing the transmission of the first key in the form of ciphertext, thereby improving the security of the transmission of the first key.
[0108] On the basis of the above technical solution, before generating the second key for encrypting and decrypting the first key according to the MAC address and synchronization timestamp of the video acquisition device, it also includes: determining the time interval between the time of the first synchronization and the preset time, and determining the time interval as the synchronization timestamp.
[0109] The time zone of the first synchronization time and the preset time is adjusted to express the first synchronization time and the preset time as the time in the same time zone. For example, UTC (Universal Time Coordinated) time can be used. Then the time interval between the first synchronization time and the preset time is calculated, and the time interval is determined as the synchronization timestamp. Exemplarily, the year, month, day and time in the time interval can be concatenated into a string as a synchronization timestamp; or, the time interval can be expressed as seconds, and the seconds can be used as the synchronization timestamp to further improve security. For example, the preset time is 00:00:00 UTC on January 1, 1970, and the time of the first synchronization is 13:44:18 (UTC time) on March 20, 2023 (Monday). The synchronization timestamp corresponding to the first synchronization time is 1679811458.
[0110] By determining the time interval between the first synchronization time and the preset time as the synchronization timestamp, the security of the second key can be further improved.
[0111] Figure 3 1 is a flow chart of a video streaming transmission method provided in an embodiment of the present application, and the method is applied to a client. The client is a software application for viewing real-time or recorded video of a video surveillance system on a computer or mobile device. Figure 3 As shown, the video stream transmission method includes: step 310 to step 320.
[0112] Step 310: After sending a video stream acquisition request to a video monitoring platform for the first time, receiving first SDP information sent by the video monitoring platform through the SIP protocol, wherein the first SDP information includes a first decryption key.
[0113] Among them, the video surveillance platform is the middle layer between the video acquisition device and the client, which can include national standard services and key management services. National standard services have functions such as device registration, device deregistration, checking device online status, real-time preview, video query, video on demand, and video on demand control; key management services have key generation and key modification functions. Video acquisition devices are devices that collect surveillance videos, including but not limited to cameras, and can be any device that can generate video data in GB28181 protocol format.
[0114] The client interacts with the national standard service of the video surveillance platform through the SIP protocol to initiate a real-time video stream acquisition request.
[0115] A decryption key field can be added to the extension field of the SDP information. The video monitoring platform writes the first decryption key into the decryption key field of the SDP information to obtain the first SDP information. When the national standard service of the video monitoring platform receives the first video stream acquisition request sent by the client, it sends the first SDP information to the client through the SIP protocol, and the client receives the first SDP information sent by the video monitoring platform. Among them, the format of the text line in the SDP information is <type> = <value> (i.e. <type> = <value>), the format of the first decryption key field in the first SDP information also adopts this format.
[0116] It should be noted that the first video stream acquisition request sent by the client is the first video stream acquisition request sent by the client after the video surveillance platform generates the first key. If the video surveillance platform subsequently updates the first key, it is the first video stream acquisition request sent by the client after the video surveillance platform updates the first key.
[0117] Step 320: Each time an encrypted video stream is received from a video acquisition device based on a stream pull request, the encrypted video stream is decrypted according to the first decryption key to obtain decrypted video data.
[0118] Each time the client pulls the stream, it sends a stream pull request to the video capture device and receives the encrypted video stream sent by the video capture device. Based on the first decryption key in the first SDP information, the client decrypts the encrypted video stream obtained from the video capture device each time to obtain the decrypted video data, and can play the decrypted video data.
[0119] When decrypting the encrypted video stream, the encrypted video stream (compliant with the H.264 / H.265 encoding standard) can be processed accordingly according to different encoding standards, non-sensitive data can be removed, and sensitive data IDR (Insight for Discovery and Risk) (0x05 for H.264 / 0x13 for H.265) can be found. The encryption interface such as AES128_CBC_decrypt_buffer of the preset encryption algorithm (such as the AES algorithm) is used to decrypt the encrypted video stream based on the first decryption key. The first 32 bytes of NALU (Network Abstraction Layer Unit) are not decrypted. After the pointer is offset by 32 bytes, the subsequent fields are decrypted using the preset encryption algorithm; the above steps are repeated until the encrypted video stream is decrypted, and the decrypted H.264 / H.265 video data is output. Among them, NALU is both the output data of the encoder and the input data of the decoder.
[0120] The video stream transmission method provided in this embodiment receives the first SDP information sent by the video stream monitoring platform through the SIP protocol after sending a video stream acquisition request to the video monitoring platform for the first time. The first SDP information includes a first decryption key. Each time an encrypted video stream sent by a video acquisition device is received based on a stream pull request, the encrypted video stream is decrypted according to the first decryption key to obtain decrypted video data, thereby realizing the transmission of the first decryption key for decrypting the encrypted video stream through the SIP protocol, that is, the transmission of the key and the transmission of the video stream adopt the same GB28181 protocol, and there is no need to use the TCP protocol or the HTTPS protocol separately to transmit the first decryption key, thereby reducing the difficulty of maintaining the video monitoring system, and the first key can be used directly after being transmitted once, and there is no need to negotiate the key separately each time the video stream is transmitted, thereby reducing the network overhead and delay caused by the key negotiation, and ensuring the real-time performance of the video stream transmission.
[0121] Figure 4 FIG. 1 is a flowchart of another video stream transmission method provided in an embodiment of the present application, and the method is applied to a client. Figure 4 As shown, the video stream transmission method includes: steps 410 to 440.
[0122] Step 410: After sending a video stream acquisition request to the video monitoring platform for the first time, receiving first SDP information sent by the video monitoring platform through the SIP protocol, wherein the first SDP information includes a first decryption key.
[0123] Among them, the first decryption key in the first SDP information is a first decryption key ciphertext, and the first SDP information also includes a MAC address and a synchronization timestamp of a video acquisition device, and the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform.
[0124] The time when the video acquisition device is first synchronized with the video monitoring platform is the time when the video acquisition device is first synchronized with the national standard service in the video monitoring platform, that is, the time when the video acquisition device is connected to the network. The synchronization timestamp can be directly the time of the first synchronization, or it can also be the time information after processing the time of the first synchronization.
[0125] In an exemplary embodiment, the synchronization timestamp is the time interval between the time of the first synchronization and the preset time. When determining the synchronization timestamp, the video surveillance platform adjusts the time of the first synchronization and the preset time to represent the time of the first synchronization and the preset time as the time in the same time zone, for example, UTC time can be used, and then the time interval between the time of the first synchronization and the preset time is calculated, and the time interval is determined as the synchronization timestamp. Exemplarily, the year, month, day and time in the time interval can be spliced into a string as a synchronization timestamp; or, the time interval can be expressed as seconds, and the seconds are used as the synchronization timestamp, which can further improve security. For example, the preset time is 00:00:00 UTC on January 1, 1970, and the time of the first synchronization is 13:44:18 (UTC time) on March 20, 2023 (Monday), and the synchronization timestamp corresponding to the time of the first synchronization is 1679811458. By determining the time interval between the time of the first synchronization and the preset time as the synchronization timestamp, the security of the second key can be further improved.
[0126] Step 420: Generate a second key for decrypting the first decryption key ciphertext according to the MAC address and the synchronization timestamp.
[0127] Exemplarily, when the client generates a second key for decrypting the first decryption key ciphertext based on the MAC address and synchronization timestamp of the video capture device, the MAC address and synchronization timestamp can be concatenated into a string and used as the second key, or the string can be mapped to a string of a preset length and used as the second key.
[0128] In one embodiment of the present application, generating a second key for decrypting the first decryption key ciphertext based on the MAC address and the synchronization timestamp includes: concatenating the MAC address and the synchronization timestamp into a string; mapping the string to a hash value of a target number of bits through a target hash function; and generating the second key based on the hash value.
[0129] The target hash function is a properly selected hash function, such as SHA-256. SHA-256 is an irreversible hash algorithm with a fixed output length of 256 bits, used for data integrity verification and cryptographic applications, with strong anti-collision and high computational efficiency.
[0130] The MAC address and the synchronization timestamp are combined to connect the MAC address and the synchronization timestamp of the video acquisition device into a string. For example, if the MAC address is "XAWU121XA" and the synchronization timestamp is 1278312, the MAC address and the synchronization timestamp can be connected into a string, and the connected string is "XAWU121XA-1278312".
[0131] The target hash function is used to map the string formed by concatenating the MAC address and the synchronization timestamp into a hash value of the target number of bits, that is, the above string is input into the target hash function to obtain the hash value of the target number of bits. For example, when the target hash function is SHA-256, a hash value with a target number of bits (32 bytes) will be generated by the target hash function, and this hash value is usually expressed in hexadecimal.
[0132] The hash value can be used as the second key, or the hash value can be processed to be used as the second key. The specific second key is generated in the same way as the video surveillance platform generates the second key, thereby ensuring that the second key obtained can correctly decrypt the first decryption key ciphertext.
[0133] By concatenating the MAC address and the synchronization timestamp into a string, mapping the string to a hash value of a target number of bits through a target hash function, and generating a second key based on the hash value, the generation process of the second key is relatively complicated. The generated second key is used to encrypt and decrypt the first decryption key ciphertext, thereby improving the security of the first key transmission.
[0134] In one embodiment of the present application, generating the second key according to the hash value includes: converting the hash value into a large integer, performing a modular operation on the large integer and a target prime number, and using the modular operation result as the second key.
[0135] Among them, large integers are also called high-precision integers, which are integers whose precision cannot be stored using basic data types. The target prime number must be large enough and is also a large integer. The target prime number is smaller than the large integer converted by the hash value. Modular operation, also known as modulo operation, is a mathematical operation that returns the remainder of division. In modular operation, there are two main parameters: dividend and divisor. The result of modular operation is the remainder of the dividend divided by the divisor. Usually, modular operation is expressed as "dividend mod divisor", where "mod" represents the operator of modular operation.
[0136] Convert the hash value mapped to the string into a large integer, use the target prime number to perform a modulo operation on the large integer, and use the result of the modulo operation as the second key. For example, when the target hash function is SHA-256, convert the obtained hexadecimal hash value into a large integer. Each hexadecimal digit can represent 4 bits of binary, so a 256-bit hash value can be represented as a large integer; select a sufficiently large target prime number (also a large integer), such as a 2048-bit prime number, and perform a modulo operation on the large integer obtained in the previous step with this prime number. The result of the modulo operation is the generated second key. The second key can be used to decrypt the first decryption key ciphertext.
[0137] By converting the hash value into a large integer and taking the result of a modulo operation between the large integer and the target prime number as the second key, it can be ensured that the generated second key has sufficient security.
[0138] Step 430: decrypt the first decryption key ciphertext according to the second key to obtain a first decryption key.
[0139] The first decryption key ciphertext is decrypted based on the second key using a preset encryption algorithm to obtain a first decryption key, which is used to decrypt the encrypted video stream. The preset encryption algorithm may be, for example, an Advanced Encryption Standard (AES) symmetric encryption algorithm.
[0140] Step 440: Each time an encrypted video stream is received from a video acquisition device based on a stream pull request, the encrypted video stream is decrypted according to the first decryption key to obtain decrypted video data.
[0141] The video stream transmission method provided in this embodiment generates a second key for decrypting a first decryption key ciphertext according to the MAC address and synchronization timestamp of the video acquisition device, and decrypts the first decryption key ciphertext according to the second key to obtain a first decryption key, thereby using the first decryption key to decrypt the encrypted video stream to obtain decrypted video data, thereby realizing the decryption of the first decryption key ciphertext transmitted in the form of ciphertext. By transmitting the first decryption key in the form of ciphertext, the security of the transmission of the first decryption key can be improved.
[0142] Figure 5 1 is a flow chart of a video stream transmission method provided by an embodiment of the present application, and the method is applied to a video acquisition device. The video acquisition device is a device for acquiring surveillance videos, including but not limited to a camera, and can be any device that can generate video data in the GB28181 protocol format. Figure 5 As shown, the video stream transmission method includes: step 510 to step 530.
[0143] Step 510: Register with the video surveillance platform via the SIP protocol.
[0144] Among them, the video surveillance platform is the middle layer between the video acquisition device and the client, which can include national standard services and key management services. National standard services have functions such as device registration, device deregistration, device online status check, real-time preview, video query, video on demand, and video on demand control; key management services have key generation and key modification functions.
[0145] The video acquisition device registers with the national standard service of the video monitoring platform through the SIP protocol to register the device information of the video acquisition device in the video monitoring platform.
[0146] Step 520: Receive second SDP information sent by the video surveillance platform through the SIP protocol, where the second SDP information includes a first encryption key.
[0147] An encryption key field can be added to the extension field of the SDP information. The video monitoring platform writes the first encryption key into the encryption key field of the SDP information to obtain the second SDP information. The national standard service of the video monitoring platform sends the second SDP information to the video acquisition device through the SIP protocol. The video acquisition device receives the second SDP information sent by the video monitoring platform through the SIP protocol. Among them, the format of the text line in the SDP information is <type> = <value> (i.e. <type> = <value>), the format of the first encryption key field in the second SDP information also adopts the format of the text line in the above SDP information.
[0148] The embodiment of the present application directly uses the SIP protocol to send the first encryption key and the first decryption key, rather than using the TCP protocol or the HTTPS protocol to send the encryption key and the decryption key, thereby achieving the transmission of the encryption and decryption keys and the transmission of the video stream using the same protocol.
[0149] Step 530: based on each stream pulling request from the client, encrypt the collected video stream according to the first encryption key to obtain an encrypted video stream, and send the encrypted video stream to the client.
[0150] Based on each stream pulling request from the client, the video capture device can encrypt the video stream captured each time based on the first encryption key in the second SDP information and send the encrypted video stream to the client.
[0151] When the video acquisition device encrypts the collected video stream, it processes the input audio and video data (in accordance with the H.264 / H.265 encoding standard) according to different encoding standards, removes non-sensitive data, finds sensitive data IDR (0x05 for H.264 / 0x13 for H.265), and uses the encryption interface of the preset encryption algorithm (such as AES algorithm) such as AES128_CBC_encrypt_buffer to encrypt the audio and video data based on the first encryption key. The first 32 bytes of NALU are not encrypted to ensure the integrity of the data header. After the pointer is offset by 32 bytes, the subsequent fields are encrypted using the preset encryption algorithm; repeat the above steps until the audio and video data encryption is completed, and the encrypted H.264 / H.265 video data is output to obtain the encrypted video stream.
[0152] The video stream transmission method provided in this embodiment registers with the video monitoring platform through the SIP protocol, receives the second SDP information sent by the video monitoring platform through the SIP protocol, the second SDP information includes a first encryption key, and based on each stream pulling request of the client, the collected video stream is encrypted according to the first encryption key, and the encrypted video stream is sent to the client, thereby realizing the transmission of the first encryption key for encrypting the video stream through the SIP protocol, that is, the transmission of the key and the transmission of the video stream adopt the same GB28181 protocol, and there is no need to use the TCP protocol or the HTTPS protocol separately to transmit the first encryption key, thereby reducing the maintenance difficulty of the video monitoring system, and the first encryption key can be used directly after being transmitted once, and there is no need to negotiate the key separately each time the video stream is transmitted, thereby reducing the network overhead and delay caused by the key negotiation, and ensuring the real-time performance of the video stream transmission.
[0153] Figure 6 FIG. 1 is a flowchart of another video stream transmission method provided by an embodiment of the present application, and the method is applied to a video acquisition device. Figure 6 As shown, the video stream transmission method includes: steps 610 to 650.
[0154] Step 610: Register with the video surveillance platform via the SIP protocol.
[0155] Step 620: Receive second SDP information sent by the video surveillance platform through the SIP protocol, where the second SDP information includes a first encryption key.
[0156] Among them, the first encryption key in the second SDP information is the ciphertext of the first encryption key, and the second SDP information also includes the MAC address and synchronization timestamp of the video acquisition device, and the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform.
[0157] The time when the video acquisition device is first synchronized with the video monitoring platform is the time when the video acquisition device is first synchronized with the national standard service in the video monitoring platform, that is, the time when the video acquisition device is connected to the network. The synchronization timestamp can be directly the time of the first synchronization, or it can also be the time information after processing the time of the first synchronization.
[0158] In an exemplary embodiment, the synchronization timestamp is the time interval between the time of the first synchronization and the preset time. When determining the synchronization timestamp, the video surveillance platform adjusts the time of the first synchronization and the preset time to represent the time of the first synchronization and the preset time as the time in the same time zone, for example, UTC time can be used, and then the time interval between the time of the first synchronization and the preset time is calculated, and the time interval is determined as the synchronization timestamp. Exemplarily, the year, month, day and time in the time interval can be spliced into a string as a synchronization timestamp; or, the time interval can be expressed as seconds, and the seconds are used as the synchronization timestamp, which can further improve security. For example, the preset time is 00:00:00 UTC on January 1, 1970, and the time of the first synchronization is 13:44:18 (UTC time) on March 20, 2023 (Monday), and the synchronization timestamp corresponding to the time of the first synchronization is 1679811458. By determining the time interval between the time of the first synchronization and the preset time as the synchronization timestamp, the security of the second key can be further improved.
[0159] Step 630: Generate a second key for decrypting the first encryption key ciphertext according to the MAC address and the synchronization timestamp.
[0160] Exemplarily, when the video capture device generates a second key for decrypting the first encryption key ciphertext based on the MAC address and synchronization timestamp of the video capture device, the MAC address and synchronization timestamp can be concatenated into a string and the string can be used as the second key, or the string can be mapped to a string of a preset length and used as the second key.
[0161] In one embodiment of the present application, generating a second key for decrypting the first encryption key ciphertext based on the MAC address and the synchronization timestamp includes: concatenating the MAC address and the synchronization timestamp into a string; mapping the string to a hash value of a target number of bits through a target hash function; and generating the second key based on the hash value.
[0162] The target hash function is a properly selected hash function, such as SHA-256. SHA-256 is an irreversible hash algorithm with a fixed output length of 256 bits, used for data integrity verification and cryptographic applications, with strong anti-collision and high computational efficiency.
[0163] The MAC address and the synchronization timestamp are combined to connect the MAC address and the synchronization timestamp of the video acquisition device into a string. For example, if the MAC address is "XAWU121XA" and the synchronization timestamp is 1278312, the MAC address and the synchronization timestamp can be connected into a string, and the connected string is "XAWU121XA-1278312".
[0164] The target hash function is used to map the string formed by concatenating the MAC address and the synchronization timestamp into a hash value of the target number of bits, that is, the above string is input into the target hash function to obtain the hash value of the target number of bits. For example, when the target hash function is SHA-256, a hash value with a target number of bits (32 bytes) will be generated by the target hash function, and this hash value is usually expressed in hexadecimal.
[0165] The hash value can be used as the second key, or the hash value can be processed to be used as the second key. The specific second key is generated in the same way as the video surveillance platform generates the second key, thereby ensuring that the second key obtained can correctly decrypt the first encryption key ciphertext.
[0166] By concatenating the MAC address and the synchronization timestamp into a string, mapping the string to a hash value of a target number of bits through a target hash function, and generating a second key based on the hash value, the generation process of the second key is relatively complicated. The generated second key is used to encrypt and decrypt the first encryption key ciphertext, thereby improving the security of the first key transmission.
[0167] In one embodiment of the present application, generating the second key according to the hash value includes: converting the hash value into a large integer, performing a modular operation on the large integer and a target prime number, and using the modular operation result as the second key.
[0168] Among them, large integers are also called high-precision integers, which are integers whose precision cannot be stored using basic data types. The target prime number must be large enough and is also a large integer. The target prime number is smaller than the large integer converted by the hash value. Modular operation, also known as modulo operation, is a mathematical operation that returns the remainder of division. In modular operation, there are two main parameters: dividend and divisor. The result of modular operation is the remainder of the dividend divided by the divisor. Usually, modular operation is expressed as "dividend mod divisor", where "mod" represents the operator of modular operation.
[0169] Convert the hash value mapped to the string into a large integer, use the target prime number to perform a modulo operation on the large integer, and use the result of the modulo operation as the second key. For example, when the target hash function is SHA-256, convert the obtained hexadecimal hash value into a large integer. Each hexadecimal digit can represent 4 bits of binary, so a 256-bit hash value can be represented as a large integer; select a sufficiently large target prime number (also a large integer), such as a 2048-bit prime number, and perform a modulo operation on the large integer obtained in the previous step with this prime number. The result of the modulo operation is the generated second key. The second key can be used to decrypt the first encryption key ciphertext.
[0170] By converting the hash value into a large integer and taking the result of a modulo operation between the large integer and the target prime number as the second key, it can be ensured that the generated second key has sufficient security.
[0171] Step 640: decrypt the first encryption key ciphertext according to the second key to obtain the first encryption key.
[0172] The preset encryption algorithm is used to decrypt the first encryption key ciphertext based on the second key to obtain the first encryption key, which is used to encrypt the video stream sent to the client. The preset encryption algorithm may be, for example, an AES symmetric encryption algorithm.
[0173] Step 650: based on each stream pulling request from the client, encrypt the collected video stream according to the first encryption key to obtain an encrypted video stream, and send the encrypted video stream to the client.
[0174] The video stream transmission method provided in this embodiment generates a second key for decrypting a first encryption key ciphertext according to the MAC address and synchronization timestamp of the video acquisition device, decrypts the first encryption key ciphertext according to the second key to obtain the first encryption key, and then uses the first encryption key to encrypt the acquired video stream and transmit it to the client, thereby realizing the transmission of the first encryption key ciphertext in the form of ciphertext. By transmitting the first encryption key in the form of ciphertext, the security of the transmission of the first encryption key can be improved.
[0175] Figure 7 is a schematic diagram of the structure of a video surveillance system provided in an embodiment of the present application, such as Figure 7 As shown, the video surveillance system includes:
[0176] The video monitoring platform 710 is used to execute the video stream transmission method described in the above video monitoring platform embodiment;
[0177] The client 720 is used to execute the video stream transmission method described in the above client embodiment;
[0178] The video acquisition device 730 is used to execute the video stream transmission method described in the above video acquisition device embodiment.
[0179] The process of the video monitoring platform, the client and the video acquisition device specifically executing the video stream transmission method can refer to the above corresponding embodiments, which will not be repeated here.
[0180] Figure 7 The steps of video streaming transmission are also shown in FIG. Figure 7 As shown, the video surveillance system performs video stream transmission according to the following steps:
[0181] Step 1: Register the video acquisition device to the national standard service of the video surveillance platform.
[0182] Step ②, the key management service of the video monitoring platform generates a first key based on the registration information and saves the MAC address and synchronization timestamp of the video acquisition device, and generates a second key based on the MAC address and the timestamp of the synchronization time.
[0183] Step ③, the client interacts with the national standard service of the video surveillance platform through the SIP protocol to initiate a video stream acquisition request, and sends the first SDP information carrying the first decryption key ciphertext, the MAC address of the video acquisition device and the synchronization timestamp to the client through the SIP protocol.
[0184] Step ④, the national standard service of the video monitoring platform sends the second SDP information carrying the first encryption key ciphertext, the MAC address of the video acquisition device and the synchronization timestamp to the video acquisition device through the SIP protocol.
[0185] Step ⑤, the video acquisition device parses the first encryption key from the first encryption key ciphertext according to the device MAC address and synchronization timestamp, and then uses the first encryption key to encrypt the video stream using an encryption and decryption algorithm (such as an AES encryption algorithm, etc.); the video acquisition device pushes the encrypted video stream to the client through the RTP protocol; the client receives the first decryption key ciphertext and the encrypted video stream, and parses the first decryption key from the first decryption key ciphertext according to the MAC address and synchronization timestamp of the video acquisition device, and then uses the first decryption key in combination with a data encryption and decryption algorithm (such as an AES encryption algorithm, etc.) to decrypt the encrypted video stream.
[0186] In order to improve the security of video stream transmission, if a key management process is added on the basis of the signaling interaction and video stream transmission process such as device registration, keep-alive, connection, etc. required by the GB28181 protocol, the entire video streaming playback process will become complicated and lengthy, which will affect the real-time performance of the video surveillance service. In order to avoid the impact of the secure transmission of the video stream on the real-time performance of the video surveillance service and to meet the high real-time requirements and security protection requirements of the video surveillance system, the embodiment of this application transforms the original GB28181 protocol and merges key management and data transmission into one process. This means that the video acquisition device, the client and the video surveillance platform only need to go through a set of processes to obtain the video data stream and encryption and decryption keys at the same time. Since video streaming playback is a frequent action, the merged process can minimize the network overhead and delay caused by key negotiation and transmission.
[0187] For the security protection of the key itself, the embodiment of the present application considers generating a second key from the MAC address and synchronization timestamp of the video acquisition device to perform secondary encryption on the first key. The device MAC address and synchronization timestamp are generated by the video monitoring platform when the device is registered, and they themselves can be transmitted via the GB28181 protocol. This method of secondary encryption of the first key used to encrypt and decrypt the video stream based on the system business attributes introduces security protection for the key without affecting the original video streaming and playback process, and at the same time does not cause the problem of additional network overhead and latency due to secondary encryption.
[0188] Figure 8 is a schematic diagram of the structure of a video stream transmission device provided in an embodiment of the present application, and the video stream transmission device is applied to a video monitoring platform, such as Figure 8 As shown, the device comprises:
[0189] A first key generation module 810 is used to generate a first key for encrypting and decrypting a video stream of the video acquisition device according to registration information when the video acquisition device is registered to the video monitoring platform, wherein the first key includes a first encryption key and a first decryption key;
[0190] A first SDP information sending module 820 is used to send first SDP information to the client through the SIP protocol when receiving a video stream acquisition request sent by the client for the first time, wherein the first SDP information includes the first decryption key, and the first decryption key is used to decrypt the encrypted video stream sent by the video acquisition device each time;
[0191] The second SDP information sending module 830 is used to send the second SDP information to the video acquisition device through the SIP protocol. The second SDP information includes the first encryption key. The first encryption key is used to encrypt the video stream acquired by the video acquisition device each time and then send it to the client.
[0192] Optionally, the device further comprises:
[0193] A second key generation module, used to generate a second key for encrypting and decrypting the first key according to the MAC address and synchronization timestamp of the video acquisition device, wherein the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform;
[0194] a key encryption module, configured to encrypt the first encryption key according to the second key to obtain a first encryption key ciphertext, and to encrypt the first decryption key according to the second key to obtain a first decryption key ciphertext;
[0195] Among them, the first decryption key in the first SDP information is the first decryption key ciphertext, and the first SDP information also includes the MAC address and the synchronization timestamp, and the MAC address and the synchronization timestamp are used to decrypt the first decryption key ciphertext to obtain the first decryption key; the first encryption key in the second SDP information is the first encryption key ciphertext, and the second SDP information also includes the MAC address and the synchronization timestamp, and the MAC address and the synchronization timestamp are used to decrypt the first encryption key ciphertext to obtain the first encryption key.
[0196] Optionally, the second key generation module includes:
[0197] A connection unit, used for connecting the MAC address and the synchronization timestamp into a character string;
[0198] A hash mapping unit, used for mapping the string into a hash value of a target number of bits through a target hash function;
[0199] The second key generating unit is used to generate the second key according to the hash value.
[0200] Optionally, the second key generating unit is specifically used for:
[0201] The hash value is converted into a large integer, and a modulus operation is performed on the large integer and a target prime number, and the modulus operation result is used as the second key.
[0202] Optionally, the device further comprises:
[0203] The synchronization timestamp determination module is used to determine the time interval between the time of the first synchronization and a preset time, and determine the time interval as the synchronization timestamp.
[0204] The video stream transmission device provided in the embodiment of the present application is used to implement the various steps of the video stream transmission method described in the embodiment of the present application. The specific implementation methods of each module of the device refer to the corresponding steps and will not be repeated here.
[0205] The video stream transmission device provided in the embodiment of the present application generates a first key for encrypting and decrypting the video stream collected by the video acquisition device according to the registration information when the video acquisition device registers to the video monitoring platform. When receiving the video stream acquisition request sent by the client for the first time, the first SDP information is sent to the client through the SIP protocol, and the first SDP information includes the first decryption key. The second SDP information is sent to the video acquisition device through the SIP protocol, and the second SDP information includes the first encryption key. The first key for encrypting and decrypting the video stream is transmitted through the SIP protocol, that is, the same GB28181 protocol as the transmission of the video stream is adopted, and there is no need to use the TCP protocol or the HTTPS protocol separately to transmit the first key, thereby reducing the difficulty of maintaining the video monitoring system, and the first key can be used directly after being transmitted once, and there is no need to negotiate the key separately each time the video stream is transmitted, thereby reducing the network overhead and delay caused by the key negotiation, and ensuring the real-time performance of the video stream transmission.
[0206] Fig. 9 is a schematic diagram of the structure of a video stream transmission device provided in an embodiment of the present application, wherein the video stream transmission device is applied to a client, such as Fig. 9 As shown, the device comprises:
[0207] A first SDP information receiving module 910 is used to receive first SDP information sent by the video surveillance platform through the SIP protocol after sending a video stream acquisition request to the video surveillance platform for the first time, wherein the first SDP information includes a first decryption key;
[0208] The video stream decryption module 920 is used to decrypt the encrypted video stream according to the first decryption key to obtain decrypted video data each time the encrypted video stream sent by the video acquisition device is received based on a stream pull request.
[0209] Optionally, the first decryption key in the first SDP information is a first decryption key ciphertext, and the first SDP information further includes a MAC address and a synchronization timestamp of a video acquisition device, where the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform;
[0210] The device also includes:
[0211] A second key generation module, configured to generate a second key for decrypting the first decryption key ciphertext according to the MAC address and the synchronization timestamp;
[0212] The decryption key decryption module is used to decrypt the first decryption key ciphertext according to the second key to obtain a first decryption key.
[0213] Optionally, the second key generation module includes:
[0214] A connection unit, used for connecting the MAC address and the synchronization timestamp into a character string;
[0215] A hash mapping unit, used for mapping the string into a hash value of a target number of bits through a target hash function;
[0216] The second key generating unit is used to generate the second key according to the hash value.
[0217] Optionally, the second key generating unit is specifically used for:
[0218] The hash value is converted into a large integer, and a modulus operation is performed on the large integer and a target prime number, and the modulus operation result is used as the second key.
[0219] The video stream transmission device provided in the embodiment of the present application is used to implement the various steps of the video stream transmission method described in the embodiment of the present application. The specific implementation methods of each module of the device refer to the corresponding steps and will not be repeated here.
[0220] The video stream transmission device provided in the embodiment of the present application receives the first SDP information sent by the video stream monitoring platform through the SIP protocol after sending a video stream acquisition request to the video monitoring platform for the first time. The first SDP information includes a first decryption key. Each time an encrypted video stream sent by a video acquisition device is received based on a stream pull request, the encrypted video stream is decrypted according to the first decryption key to obtain decrypted video data, thereby realizing the transmission of the first decryption key for decrypting the encrypted video stream through the SIP protocol, that is, the transmission of the key and the transmission of the video stream adopt the same GB28181 protocol, and there is no need to use the TCP protocol or the HTTPS protocol separately to transmit the first decryption key, thereby reducing the difficulty of maintaining the video monitoring system, and the first key can be used directly after being transmitted once, and there is no need to negotiate the key separately each time the video stream is transmitted, thereby reducing the network overhead and delay caused by the key negotiation, and ensuring the real-time performance of the video stream transmission.
[0221] Fig.10 is a structural diagram of a video stream transmission device provided in an embodiment of the present application, and the video stream transmission device is applied to a video acquisition device, such as Fig.10 As shown, the device comprises:
[0222] The device registration module 1010 is used to register with the video monitoring platform through the SIP protocol;
[0223] A second SDP information receiving module 1020 is used to receive second SDP information sent by the video surveillance platform through the SIP protocol, where the second SDP information includes a first encryption key;
[0224] The video stream encryption module 1030 is used to encrypt the collected video stream according to the first encryption key based on each stream pulling request from the client to obtain an encrypted video stream, and send the encrypted video stream to the client.
[0225] Optionally, the first encryption key in the second SDP information is the first encryption key ciphertext, and the second SDP information further includes a MAC address and a synchronization timestamp of the video acquisition device, where the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform;
[0226] The device also includes:
[0227] A second key generation module, configured to generate a second key for decrypting the first encryption key ciphertext according to the MAC address and the synchronization timestamp;
[0228] The encryption key decryption module is used to decrypt the first encryption key ciphertext according to the second key to obtain the first encryption key.
[0229] Optionally, the second key generation module includes:
[0230] A connection unit, used for connecting the MAC address and the synchronization timestamp into a character string;
[0231] A hash mapping unit, used for mapping the string into a hash value of a target number of bits through a target hash function;
[0232] The second key generating unit is used to generate the second key according to the hash value.
[0233] Optionally, the second key generating unit is specifically used to:
[0234] The hash value is converted into a large integer, and a modular operation is performed on the large integer and a target prime number, and the modular operation result is used as the second key.
[0235] The video stream transmission device provided in the embodiment of the present application is used to implement the various steps of the video stream transmission method described in the embodiment of the present application. The specific implementation methods of each module of the device refer to the corresponding steps and will not be repeated here.
[0236] The video stream transmission device provided in the embodiment of the present application registers with the video monitoring platform through the SIP protocol, receives the second SDP information sent by the video monitoring platform through the SIP protocol, the second SDP information includes a first encryption key, and encrypts the collected video stream according to the first encryption key based on each stream pulling request of the client, and sends the encrypted video stream to the client, thereby realizing the transmission of the first encryption key for encrypting the video stream through the SIP protocol, that is, the transmission of the key and the transmission of the video stream adopt the same GB28181 protocol, and there is no need to use the TCP protocol or the HTTPS protocol separately to transmit the first encryption key, thereby reducing the maintenance difficulty of the video monitoring system, and the first encryption key can be used directly after being transmitted once, and there is no need to negotiate the key separately each time the video stream is transmitted, thereby reducing the network overhead and delay caused by the key negotiation, and ensuring the real-time performance of the video stream transmission.
[0237] Fig.11 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.11 As shown, the electronic device 1100 may include one or more processors 1110 and one or more memories 1120 connected to the processors 1110. The electronic device 1100 may also include an input interface 1130 and an output interface 1140 for communicating with another device or system. The program code executed by the processor 1110 may be stored in the memory 1120.
[0238] The processor 1110 in the electronic device 1100 calls the program code stored in the memory 1120 to execute the video stream transmission method in the above embodiment.
[0239] The embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the video stream transmission method as described in the embodiment of the present application are implemented.
[0240] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0241] The above is a detailed introduction to a video stream transmission method, device, electronic device and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.
[0242] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.< / value> < / type> < / value> < / type> < / timestamp> < / devicemac> < / decodekey> < / encodekey> < / value> < / type> < / value> < / type> < / value> < / type>
Claims
1. A video stream transmission method, characterized in that: Applied to video surveillance platforms, including: When a video acquisition device is registered to the video monitoring platform, a first key for encrypting and decrypting a video stream of the video acquisition device is generated according to the registration information, wherein the first key includes a first encryption key and a first decryption key; When receiving a video stream acquisition request sent by a client for the first time, sending a first SDP message to the client through the SIP protocol, wherein the first SDP message includes the first decryption key, and the first decryption key is used to decrypt the encrypted video stream sent by the video acquisition device each time; The second SDP information is sent to the video acquisition device through the SIP protocol, wherein the second SDP information includes the first encryption key, and the first encryption key is used to encrypt the video stream acquired by the video acquisition device each time and then send it to the client.
2. The method according to claim 1, characterized in that: When receiving the video stream acquisition request sent by the client for the first time, before sending the first SDP information to the client through the SIP protocol, the method further includes: Generate a second key for encrypting and decrypting the first key according to the MAC address and synchronization timestamp of the video acquisition device, wherein the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform; Encrypting the first encryption key according to the second key to obtain a first encryption key ciphertext, and encrypting the first decryption key according to the second key to obtain a first decryption key ciphertext; Among them, the first decryption key in the first SDP information is the first decryption key ciphertext, and the first SDP information also includes the MAC address and the synchronization timestamp, and the MAC address and the synchronization timestamp are used to decrypt the first decryption key ciphertext to obtain the first decryption key; the first encryption key in the second SDP information is the first encryption key ciphertext, and the second SDP information also includes the MAC address and the synchronization timestamp, and the MAC address and the synchronization timestamp are used to decrypt the first encryption key ciphertext to obtain the first encryption key.
3. The method according to claim 2, characterized in that The step of generating a second key for encrypting and decrypting the first key according to the MAC address and synchronization timestamp of the video acquisition device includes: Concatenate the MAC address and the synchronization timestamp into a string; Mapping the string to a hash value of a target number of bits by a target hash function; The second key is generated according to the hash value.
4. The method according to claim 3, characterized in that The step of generating the second key according to the hash value includes: The hash value is converted into a large integer, and a modulus operation is performed on the large integer and a target prime number, and the modulus operation result is used as the second key.
5. The method according to claim 2, characterized in that: Before generating a second key for encrypting and decrypting the first key according to the MAC address and synchronization timestamp of the video acquisition device, the method further includes: Determine a time interval between the time of the first synchronization and a preset time, and determine the time interval as the synchronization timestamp.
6. A video stream transmission method, characterized in that: Applied to the client, including: After sending a video stream acquisition request to the video monitoring platform for the first time, receiving first SDP information sent by the video monitoring platform through the SIP protocol, wherein the first SDP information includes a first decryption key; Each time an encrypted video stream sent by a video acquisition device is received based on a stream pull request, the encrypted video stream is decrypted according to the first decryption key to obtain decrypted video data.
7. The method according to claim 6, characterized in that The first decryption key in the first SDP information is a first decryption key ciphertext, and the first SDP information further includes a MAC address and a synchronization timestamp of a video acquisition device, where the synchronization timestamp indicates the time when the video acquisition device is first synchronized with the video monitoring platform; Before decrypting the encrypted video stream according to the first decryption key each time the encrypted video stream sent by the video acquisition device is received based on the pull stream request, the method further includes: Generate a second key for decrypting the first decryption key ciphertext according to the MAC address and the synchronization timestamp; The first decryption key ciphertext is decrypted according to the second key to obtain a first decryption key.
8. The method according to claim 7, characterized in that The step of generating a second key for decrypting the first decryption key ciphertext according to the MAC address and the synchronization timestamp includes: Concatenate the MAC address and the synchronization timestamp into a string; Mapping the string to a hash value of a target number of bits by a target hash function; The second key is generated according to the hash value.
9. The method according to claim 8, characterized in that The step of generating the second key according to the hash value includes: The hash value is converted into a large integer, and a modulus operation is performed on the large integer and a target prime number, and the modulus operation result is used as the second key.
10. A video stream transmission method, characterized in that: Applied to video acquisition equipment, including: Register with the video surveillance platform through the SIP protocol; Receiving second SDP information sent by the video surveillance platform through the SIP protocol, where the second SDP information includes a first encryption key; Based on each stream pulling request from the client, the collected video stream is encrypted according to the first encryption key to obtain an encrypted video stream, and the encrypted video stream is sent to the client.
11. The method according to claim 10, characterized in that The first encryption key in the second SDP information is the first encryption key ciphertext, and the second SDP information further includes a MAC address and a synchronization timestamp of the video acquisition device, where the synchronization timestamp represents the time when the video acquisition device is first synchronized with the video monitoring platform; Before encrypting the collected video stream according to the first encryption key to obtain the encrypted video stream in each stream pulling request based on the client, the method further includes: generating, according to the MAC address and the synchronization timestamp, a second key for decrypting the first encryption key ciphertext; The first encryption key ciphertext is decrypted according to the second key to obtain the first encryption key.
12. The method according to claim 11, characterized in that The step of generating, according to the MAC address and the synchronization timestamp, a second key for decrypting the first encryption key ciphertext comprises: Concatenate the MAC address and the synchronization timestamp into a string; Mapping the string to a hash value of a target number of bits by a target hash function; The second key is generated according to the hash value.
13. The method according to claim 12, characterized in that The step of generating the second key according to the hash value includes: The hash value is converted into a large integer, and a modular operation is performed on the large integer and a target prime number, and the modular operation result is used as the second key.
14. A video surveillance system, characterized in that: include: A video monitoring platform, used to execute the video stream transmission method according to any one of claims 1 to 5; A client, configured to execute the video stream transmission method according to any one of claims 6 to 9; A video acquisition device, used to execute the video stream transmission method described in any one of claims 10-13.
15. A video stream transmission device, characterized in that: Applied to video surveillance platforms, including: A first key generation module, used to generate a first key for encrypting and decrypting a video stream of the video acquisition device according to registration information when the video acquisition device is registered to the video monitoring platform, wherein the first key includes a first encryption key and a first decryption key; A first SDP information sending module is used to send first SDP information to the client through the SIP protocol when receiving a video stream acquisition request sent by the client for the first time, wherein the first SDP information includes the first decryption key, and the first decryption key is used to decrypt the encrypted video stream sent by the video acquisition device each time; The second SDP information sending module is used to send the second SDP information to the video acquisition device through the SIP protocol. The second SDP information includes the first encryption key. The first encryption key is used to encrypt the video stream acquired by the video acquisition device each time and then send it to the client.
16. A video stream transmission device, characterized in that: Applied to the client, including: A first SDP information receiving module, configured to receive first SDP information sent by the video surveillance platform through the SIP protocol after sending a video stream acquisition request to the video surveillance platform for the first time, wherein the first SDP information includes a first decryption key; The video stream decryption module is used to decrypt the encrypted video stream according to the first decryption key to obtain decrypted video data each time the encrypted video stream sent by the video acquisition device is received based on a stream pull request.
17. A video stream transmission device, characterized in that: Applied to video acquisition equipment, including: Device registration module, used to register with the video surveillance platform through the SIP protocol; A second SDP information receiving module is used to receive second SDP information sent by the video surveillance platform through the SIP protocol, where the second SDP information includes a first encryption key; The video stream encryption module is used to encrypt the collected video stream according to the first encryption key based on each stream pulling request of the client, obtain an encrypted video stream, and send the encrypted video stream to the client.
18. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the video stream transmission method described in any one of claims 1 to 5 is implemented, or the video stream transmission method described in any one of claims 6 to 9 is implemented, or the video stream transmission method described in any one of claims 10 to 13 is implemented.
19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, it implements the steps of the video stream transmission method described in any one of claims 1 to 5, or implements the steps of the video stream transmission method described in any one of claims 6 to 9, or implements the steps of the video stream transmission method described in any one of claims 10 to 13.
