WO2021120831A1 - 流媒体数据加密、解密方法、装置、电子设备及存储介质 - Google Patents

流媒体数据加密、解密方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2021120831A1
WO2021120831A1 PCT/CN2020/122443 CN2020122443W WO2021120831A1 WO 2021120831 A1 WO2021120831 A1 WO 2021120831A1 CN 2020122443 W CN2020122443 W CN 2020122443W WO 2021120831 A1 WO2021120831 A1 WO 2021120831A1
Authority
WO
WIPO (PCT)
Prior art keywords
media data
streaming media
encrypted
encryption
key
Prior art date
Application number
PCT/CN2020/122443
Other languages
English (en)
French (fr)
Inventor
余东
Original Assignee
北京云享智胜科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京云享智胜科技有限公司 filed Critical 北京云享智胜科技有限公司
Publication of WO2021120831A1 publication Critical patent/WO2021120831A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2347Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving video stream encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/65Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/75Media network packet handling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4405Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video stream decryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols
    • H04N21/6437Real-time Transport Protocol [RTP]

Definitions

  • the present disclosure relates to the field of Internet technology, and in particular to a method, device, electronic device, and storage medium for encrypting and decrypting streaming media data.
  • streaming media technology has been widely used in industries such as live video, short videos, and interactive live broadcasts.
  • streaming media data can be transmitted over the Internet based on streaming media protocols, where the foregoing streaming media data includes audio and video data.
  • streaming media data when streaming media data is transmitted based on a streaming media protocol, the streaming media data is transmitted on the channel between the data sending end and the data receiving end in a data packet format defined by the streaming media protocol.
  • the purpose of the embodiments of the present disclosure is to provide a method, device, electronic device, and storage medium for encrypting and decrypting streaming media data, so as to improve the security of streaming media data transmitted based on a streaming media protocol.
  • the specific technical solutions are as follows:
  • an embodiment of the present disclosure provides a method for encrypting streaming media data, the method comprising: obtaining streaming media data to be encrypted, encryption information corresponding to the streaming media data to be encrypted, and a key identifier of an encryption key ,
  • the encryption information includes: an encryption level, which is used to indicate an encryption method of the streaming media data to be encrypted; obtains the encryption key according to the key identifier; and obtains the encryption key according to the encryption key according to the encryption key
  • the encryption information encrypts the to-be-encrypted streaming media data to obtain encrypted streaming media data, where the encrypted streaming media data is encrypted streaming media data encapsulated by a streaming media protocol; the encrypted streaming media data is transmitted Streaming media data.
  • the embodiments of the present disclosure also provide a method for decrypting streaming media data, the method includes: sending a streaming request to a central media server in the CDN; receiving a request sent by the central media server in response to the streaming request The streaming media data to be decrypted; wherein the streaming media data to be decrypted is encrypted streaming media data encapsulated by the streaming media protocol; the metadata of the streaming media data to be decrypted is parsed to obtain the key identification and decryption information, so
  • the decryption information includes: a decryption level, which is used to indicate a decryption method for the streaming media data to be decrypted; obtain the decryption key of the streaming media data to be decrypted through the key identifier; based on the decryption The key decrypts the stream media data to be decrypted according to the decryption information.
  • an embodiment of the present disclosure also provides a streaming media data encryption device, the device includes: a first data acquisition unit configured to acquire the streaming media data to be encrypted and the encryption corresponding to the streaming media data to be encrypted Information and a key identifier of an encryption key, wherein the encryption information includes: an encryption level, the encryption level is used to indicate the encryption method of the stream media data to be encrypted; and the encryption key acquisition unit is set to be based on the The key identifier obtains the encryption key; the data encryption unit is configured to encrypt the streaming media data to be encrypted according to the encryption information based on the encryption key to obtain encrypted streaming media data, wherein the encryption The post-streaming media data is encrypted streaming media data encapsulated by a streaming media protocol; the data transmission unit is configured to transmit the encrypted streaming media data.
  • an embodiment of the present disclosure also provides a streaming media data decryption device, the device includes: a streaming request sending unit configured to send a streaming request to a central media server in the CDN; and a data receiving unit configured to Receiving the streaming media data to be decrypted sent by the central media server in response to the streaming request; wherein the streaming media data to be decrypted is encrypted streaming media data encapsulated by a streaming media protocol; the data analysis unit is set to Parse the metadata of the streaming media data to be decrypted to obtain key identification and decryption information, the decryption information includes: a decryption level, the decryption level is used to indicate a decryption method for the streaming media data to be decrypted; a decryption key The obtaining unit is configured to obtain the decryption key of the streaming media data to be decrypted through the key identifier; the data decryption unit is configured to perform the decryption on the streaming media data to be
  • the embodiments of the present disclosure also provide an electronic device, including a processor, a communication interface, a memory, and a communication bus; wherein the processor, the communication interface, and the memory complete each other through the communication bus.
  • the memory is configured to store a computer program; the processor is configured to implement the data encryption method described in any one of the first aspect when executing the program stored in the memory.
  • the embodiments of the present disclosure also provide an electronic device, including a processor, a communication interface, a memory, and a communication bus; wherein the processor, the communication interface, and the memory complete each other through the communication bus.
  • the memory is configured to store a computer program; the processor is configured to implement the data decryption method described in any one of the second aspect when executing the program stored in the memory.
  • the embodiments of the present disclosure also provide a computer-readable storage medium having a computer program stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the aspects described in the first aspect. Data encryption method.
  • the embodiments of the present disclosure also provide a computer-readable storage medium having a computer program stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the items described in the second aspect Data encryption method.
  • the embodiments of the present disclosure also provide a computer program product containing instructions.
  • the computer program product containing instructions runs on a computer, the computer executes the data encryption method described in any one of the first aspects. step.
  • the embodiments of the present disclosure also provide a computer program product containing instructions that, when the computer program product containing instructions runs on a computer, causes the computer to execute the steps of the data encryption method described in any one of the second aspect .
  • the embodiments of the present disclosure also provide a computer program that, when running on a computer, causes the computer to execute the steps of the data encryption method described in any one of the first aspects.
  • the embodiments of the present disclosure also provide a computer program that, when running on a computer, causes the computer to execute the steps of the data encryption method described in any one of the second aspect.
  • the technical solution provided by the embodiments of the present disclosure obtains the key identifier of the encryption key and the encryption information including the encryption level when encrypting streaming media data, and obtains the encryption key according to the key identifier, where the encryption level is used to indicate
  • the encrypted streaming media data when the streaming media data is encrypted, the encrypted streaming media data may be encrypted based on the encryption key, and after the encrypted streaming media data encapsulated by the streaming media protocol is obtained, it may be transmitted Stream media data after encryption. It can be seen that after the technical solution provided by the embodiments of the present disclosure encrypts the streaming media data to be encrypted, the encrypted streaming media data is transmitted, so that the security of the streaming media data transmitted based on the streaming media protocol can be improved.
  • FIG. 1 is a schematic flowchart of a streaming media data encryption method provided by an embodiment of the disclosure.
  • FIG. 2 is a schematic diagram of another flow chart of a method for encrypting streaming media data provided by an embodiment of the present disclosure.
  • FIG. 3 is a schematic flowchart of a method for decrypting streaming media data provided by an embodiment of the disclosure.
  • FIG. 4 is a schematic diagram of another flow chart of a method for decrypting streaming media data provided by an embodiment of the disclosure.
  • FIG. 5 is a schematic flowchart of a data transmission method provided by an embodiment of the disclosure.
  • FIG. 6 is a schematic flowchart of another data transmission method provided by an embodiment of the disclosure.
  • FIG. 7 is a schematic structural diagram of a streaming media data encryption device provided by an embodiment of the disclosure.
  • FIG. 8 is a schematic structural diagram of a streaming media data decryption device provided by an embodiment of the disclosure.
  • FIG. 9 is a schematic structural diagram of an electronic device provided by an embodiment of the disclosure.
  • FIG. 10 is a schematic diagram of another structure of an electronic device provided by an embodiment of the disclosure.
  • embodiments of the present disclosure provide a streaming media data encryption and decryption method, device, electronic equipment, and storage medium.
  • the provided streaming media data encryption method includes the following steps:
  • the stream media data to be encrypted the encryption information corresponding to the stream media data to be encrypted, and the key identifier of the encryption key, where the encryption information includes: an encryption level, and the encryption level is used to indicate the encryption method of the stream media data to be encrypted;
  • the technical solution provided by the embodiments of the present disclosure obtains the key identifier of the encryption key and the encryption information including the encryption level when encrypting streaming media data, and obtains the encryption key according to the key identifier, where the encryption level is used to indicate The encryption method of the streaming media data to be encrypted.
  • the encrypted streaming media data can be encrypted based on the encryption key.
  • the encrypted streaming media data can be transmitted Streaming media data. It can be seen that after the technical solution provided by the embodiments of the present disclosure encrypts the streaming media data to be encrypted, the encrypted streaming media data is transmitted, so that the security of the streaming media data transmitted based on the streaming media protocol can be improved.
  • the provided streaming media data decryption method includes the following steps:
  • the decryption information includes: decryption level, the decryption level is used to indicate the decryption method of the streaming media data to be decrypted;
  • the stream media data to be decrypted is decrypted according to the decryption information based on the decryption key.
  • the decryption terminal after the decryption terminal sends a streaming request to the central media server in the CDN, it can receive the streaming media data to be decrypted sent by the central media server in response to the streaming request, wherein the streaming media to be decrypted
  • the data is the encrypted streaming media data encapsulated by the streaming media protocol.
  • the key identification and decryption information After parsing the metadata of the streaming media data to be decrypted, the key identification and decryption information can be obtained.
  • the decryption information includes: the decryption level, the streaming media to be decrypted can be obtained through the key identification After the decryption key of the data, the stream media data to be decrypted can be decrypted based on the decryption key according to the decryption information.
  • the encrypted streaming media data is transmitted, which can improve the security of streaming media data transmitted based on the streaming media protocol, and use the present disclosure
  • the solution provided by the embodiment can decrypt the streaming media data to be decrypted to obtain the decrypted streaming media data.
  • streaming media data encryption method provided by the embodiments of the present disclosure can be applied to the streaming media technology industry, for example, applied to the transmission of streaming media data in the Internet.
  • the execution body of the streaming media data encryption method provided by the embodiments of the present disclosure may be the streaming end or the server that forwards the streaming media data sent by the streaming end.
  • the execution subject of the streaming media data encryption method provided by the embodiments of the present disclosure may be the streaming end in the CDN network, or the central media server in the CDN network.
  • the streaming media data encryption method provided by the embodiment of the present disclosure includes the following steps S110-S140.
  • S110 Obtain the stream media data to be encrypted, the encryption information corresponding to the stream media data to be encrypted, and the key identifier of the encryption key.
  • the encryption information includes: encryption level, which is used to indicate the encryption method of the streaming media data to be encrypted.
  • the above-mentioned key identifier may be a randomly determined identifier or a preset identifier.
  • the foregoing encryption level may include at least one of the following:
  • the first encryption level the encryption method of the first encryption level is: the to-be-encrypted bytes of the to-be-encrypted streaming media data segment of the to-be-encrypted streaming media data are encrypted, where the to-be-encrypted streaming media data segment is: the to-be-encrypted streaming media data Except for the first preset number of bytes, each data segment that is a segment of the first preset multiple of the first preset number of bytes, the bytes to be encrypted are: in each stream media data segment to be encrypted When the number of bytes of the stream media data segment to be encrypted is less than the number bytes of the first preset multiple of the first preset number, the stream media data segment to be encrypted is not processed Encryption
  • the second encryption level, the encryption method of the second encryption level is: encrypt all the bytes of the stream media data to be encrypted.
  • the size of the first preset number may be equal to the length of the encryption key.
  • the first preset number may be 16.
  • the above-mentioned first preset multiple may be any multiple of 5-15, and may also be other specific multiples. When the first preset multiple is small, the number of bytes that need to be encrypted is more, and the security of the data is higher. When the first preset multiple is larger, the number of bytes that need to be encrypted is less, and the encryption efficiency is higher.
  • the electronic device may determine the level of the received user input as the encryption level.
  • different encryption levels can be selected according to the needs of the user to encrypt the stream media data to be encrypted, so that the stream media data can be encrypted with different encryption methods more flexibly.
  • the encryption level is the first encryption level, only part of the bytes in the streaming media data can be encrypted. In this way, the security of the streaming media data transmitted based on the streaming media protocol can be improved, and the amount of data that needs to be encrypted can also be reduced. , Improve the efficiency of encryption.
  • the encryption level is the second encryption level, all bytes of the streaming media data can be encrypted, so that the security of the streaming media data transmitted based on the streaming media protocol can be made higher.
  • the streaming media data segment to be encrypted may be: each instantaneous decoding refresh (IDR) frame of the streaming media data to be encrypted Except for the first preset number of bytes, each data segment with a number of bytes that is a first preset multiple of the first preset number as one segment.
  • IDR instantaneous decoding refresh
  • the first preset number is 16, the first preset multiple is 10, and the streaming media data to be encrypted is video data type data. Then, when the encryption level is the first encryption level, Among the data other than the first 16 bytes of each IDR frame of the streaming media data to be encrypted, the first 16 bytes of each data segment with 16*10 bytes as a segment are encrypted.
  • step S120 can be implemented according to the following steps A to B:
  • Step A Send the key identifier to the encryption key server, so that the key server determines the encryption key corresponding to the key identifier.
  • a preset key information table may be stored in the key server, and the key information table may include: the mapping relationship between the key and the key identifier.
  • the electronic device may store A key identification table, the key identification table may include multiple key identifications, and the key identification in the key identification table is the same as the key identification in the key information table.
  • obtaining the key identifier of the encryption key in step S110 can be implemented in the following steps: obtain any key identifier from the key identifier table as the key identifier of the encryption key.
  • the key server The encryption key can be determined in the following manner: the key corresponding to the key identifier is determined from the key information table as the encryption key.
  • the key server may establish the corresponding relationship between the determined encryption key and the key identifier after determining the encryption key corresponding to the key identifier.
  • Step B Obtain the encryption key determined by the key server from the key server.
  • the encryption key is obtained from the key server, and the key can be managed by the key server. In this way, it is more convenient to manage the key, and the security of the key management is also higher.
  • obtaining the key identifier of the encryption key in step S110 can be implemented in the following step C:
  • Step C Select the key identifier from the preset key information table
  • Step S120 can be implemented according to the following step D:
  • Step D Obtain the encryption key corresponding to the selected key identifier from the preset key information table.
  • the above-mentioned key information table includes: the mapping relationship between the key and the key identifier.
  • the above-mentioned preset key information table may be stored in the storage space of the encryption terminal.
  • the key identifier is selected from the key information table and the encryption key is obtained, and the encryption key and the key identifier can also be obtained more quickly.
  • S130 Encrypt the to-be-encrypted streaming media data according to the encrypted information based on the encryption key to obtain encrypted streaming media data.
  • the encrypted streaming media data is encrypted streaming media data encapsulated by a streaming media protocol.
  • the aforementioned streaming media transmission protocol may be a Real Time Messaging Protocol (RTMP for short). It can also be other streaming media transmission protocols.
  • RTMP Real Time Messaging Protocol
  • step S130 can be implemented according to the following steps F to G:
  • Step F Obtain the encryption mode.
  • Step G Encrypt the to-be-encrypted streaming media data based on the encryption key and the encryption mode obtained from the encrypted information.
  • the foregoing encryption mode may be Advanced Encryption Standard (AES for short).
  • AES Advanced Encryption Standard
  • the foregoing encryption mode may be any of the following:
  • the foregoing encryption mode may also be an RSA algorithm or a data encryption algorithm (Data Encryption Algorithm, DEA for short), the foregoing encryption mode may also be other encryption modes, and the embodiments of the present disclosure do not limit specific encryption modes.
  • the electronic device may determine the mode of the received user input as the encryption mode.
  • the preset mode may be determined as the encryption mode.
  • the preset mode can be, for example, any one of AES-ECB, AES-CBC, AES-CTR, AES-CFB, and AES-OFB.
  • the to-be-encrypted streaming media data is encrypted in the encryption mode, which can more conveniently complete the encryption processing of the streaming media data.
  • S140 Transmit the encrypted streaming media data.
  • step S140 may be implemented as follows: streaming the encrypted streaming media data.
  • step S140 can be implemented as follows: in response to the streaming request sent by the decryption terminal, the encrypted streaming media data is sent to the decryption terminal.
  • the encryption method provided by the embodiments of the present disclosure encrypts streaming media data
  • the key identifier of the encryption key and the encryption information including the encryption level are obtained, and the encryption key is obtained according to the key identifier, where the encryption level is used to indicate
  • the encrypted streaming media data may be encrypted based on the encryption key, and after the encrypted streaming media data encapsulated by the streaming media protocol is obtained, it may be transmitted Stream media data after encryption. It can be seen that after the technical solution provided by the embodiments of the present disclosure encrypts the streaming media data to be encrypted, the encrypted streaming media data is transmitted, so that the security of the streaming media data transmitted based on the streaming media protocol can be improved.
  • step S120 the above method may further include the following steps:
  • the key identification, encryption information, and identification information for indicating whether the streaming media data to be encrypted is encrypted are added to the metadata of the encrypted streaming media data.
  • the above-mentioned metadata is data used to describe the attributes of the data.
  • the above-mentioned key identification, encryption information, and identification information for indicating whether the streaming media data to be encrypted is encrypted may be added to the onMetaData field of the encrypted streaming media data.
  • the onMetaData field is a field used to record the attributes of the streaming media data in the streaming media data.
  • field information such as key identification, encryption information, and identification information used to indicate whether the streaming media data to be encrypted is encrypted is added to the onMetaData field to facilitate the decryption end to obtain the key identification, encryption information, and encrypted streaming media. Whether the data is encrypted.
  • the mediaencrypt field of the onMetaData grammar structure can identify the type of encrypted data, such as 0: indicates that the audio and video are not encrypted, 1: indicates that the video is encrypted, 2: indicates that the audio is encrypted, 3: indicates that both audio and video are encrypted;
  • EncryptionMode encryption level
  • EncryptionAlgorithm encryption mode
  • EncryptionKeyLenth key length
  • EncryptionKeyInfo key identification
  • EncryptionIV Initial IV information used for encryption
  • the encryption level can be the first encryption level and the second encryption level.
  • 0 is used to identify the first encryption level, and 1 is used to indicate the second encryption level
  • the encryption mode can be the AES mode, such as AES-ECB, AES-CBC, AES -CTR, AES-CFB, AES-OFB, etc., but not limited to them
  • the length of the key can be 16 strings, etc., and is not limited.
  • the key identifier can be used to identify the encryption password, which can be a number or Letters can also be a combination of numbers or letters, but it is not limited to this.
  • the key identification, encryption information, and identification information for indicating whether the streaming media data to be encrypted is encrypted may also be added to other unencrypted data of the encrypted streaming media data.
  • the encryption information may further include: an encryption mode and a key length of the encryption key.
  • the encrypted information includes an encryption mode
  • the to-be-encrypted streaming media data can be encrypted according to the encryption mode.
  • the above method may further include the following steps S150-S160.
  • the data type of the streaming media data that needs to be encrypted includes at least one of a video data type and an audio data type.
  • the data type of the streaming media data that needs to be encrypted can be determined by identifying the field indicating the data type in the streaming media data.
  • S160 Determine whether to encrypt the to-be-encrypted streaming media data according to the data type of the streaming media data that needs to be encrypted, and if yes, perform step S130.
  • step S160 can be implemented as follows: when the determined data type of the streaming media data to be encrypted includes the data type of the streaming media data to be encrypted, it is determined that the streaming media data to be encrypted is encrypted.
  • step S150 when it is determined in step S150 that the data type of the streaming media data to be encrypted is a video data type, and when the data type of the streaming media data to be encrypted is a video data type, it is determined that the streaming media data to be encrypted is encrypted.
  • the data type of the media data is the audio data type
  • the data type of the streaming media data to be encrypted determined in step S150 is the video data type and the audio data type
  • the streaming media data to be encrypted is
  • the data type of the data is the video data type
  • the data type of the streaming media data to be encrypted is the audio data type
  • the embodiment of the present disclosure also provides a method for decrypting streaming media data. As shown in FIG. 3, the method includes the following steps S310 to S350:
  • S310 Send a streaming request to the central media server in the CDN.
  • the streaming request may carry the data identifier of the requested streaming media data.
  • S320 Receive the to-be-decrypted streaming media data sent by the central media server in response to the streaming request.
  • the streaming media data to be decrypted is encrypted streaming media data encapsulated by a streaming media protocol.
  • the aforementioned streaming media transmission protocol may be RTMP or other streaming media transmission protocols.
  • the decryption information includes: the decryption level, which is used to indicate the decryption method of the streaming media data to be decrypted.
  • the key identification and decryption information can be obtained in the following manner: the key identification and decryption information are obtained from the onMetaData field of the streaming media data to be decrypted.
  • S340 Obtain the decryption key of the streaming media data to be decrypted according to the key identifier.
  • step S340 when the encryption terminal of the streaming media data to be decrypted obtains the encryption key through the above steps A to B, step S340 can be implemented according to the following steps J to K:
  • Step J Send the key identifier to the key server, so that the key server determines the decryption key corresponding to the key identifier;
  • Step K Obtain the determined decryption key from the key server, and use the obtained decryption key as the decryption key of the streaming media data to be decrypted.
  • step S340 when the encryption end of the streaming media data to be decrypted obtains the encryption key through the above step D, step S340 can be implemented as the following step N:
  • Step N Query the key corresponding to the key identifier from the preset key information table as the decryption key of the streaming media data to be decrypted.
  • the above-mentioned preset key information table includes: the mapping relationship between the key and the key identifier.
  • the above-mentioned preset key information table may be stored in the storage space of the decryption terminal.
  • the preset key information table stored in the decryption terminal is the same as the preset key information table stored in the encryption terminal.
  • S350 Decrypt the streaming media data to be decrypted according to the decryption information based on the decryption key.
  • step S350 the above method may further include the following steps:
  • step S350 is executed.
  • the metadata of the streaming media data to be decrypted can be parsed to obtain the stream to be decrypted. Whether the media data is encrypted streaming media data.
  • step S350 can be implemented as the following steps S351 to S352:
  • the data segment to be decrypted is: each data segment in the stream media data to be decrypted, in addition to the first preset number of bytes, the number of bytes of the first preset multiple of the first preset number is a segment,
  • the bytes to be decrypted are: the first preset number of bytes in each data segment to be decrypted.
  • step S350 can be implemented according to the following steps O to P:
  • Step O Parse the metadata of the streaming media data to be decrypted to obtain the encryption mode of the streaming media data to be decrypted;
  • Step P Decrypt the streaming media data to be decrypted in a decryption mode corresponding to the encryption mode based on the decryption key and the decryption information.
  • the decryption terminal may obtain the encryption mode of the streaming media data to be decrypted from the onMetaData field of the streaming media data to be decrypted.
  • the decryption terminal after the decryption terminal sends a streaming request to the central media server in the CDN, it can receive the streaming media data to be decrypted sent by the central media server in response to the streaming request, wherein the streaming media to be decrypted
  • the data is the encrypted streaming media data encapsulated by the streaming media protocol.
  • the key identification and decryption information After parsing the metadata of the streaming media data to be decrypted, the key identification and decryption information can be obtained.
  • the decryption information includes: the decryption level, the streaming media to be decrypted can be obtained through the key identification After the decryption key of the data, the stream media data to be decrypted can be decrypted based on the decryption key according to the decryption information.
  • the streaming media data to be decrypted can be decrypted, and the decrypted streaming media data can be obtained.
  • the process of data transmission in the CDN can be: the push end sends the stream media data to be encrypted to the central media server through the CDN node server based on the RTMP protocol (The process of sending the to-be-encrypted streaming media data by the push end can also be referred to as the process of pushing the clear stream).
  • the central media server encrypts the encrypted streaming media data based on the configuration information according to any one of the above encryption methods, and modifies the corresponding metadata.
  • the central media server When the central media server receives the streaming request sent by the decryption terminal through the CDN node server based on the RTMP protocol, it sends the encrypted streaming media data to the decryption terminal based on the RTMP protocol, and the decryption terminal treats the decrypted streaming media according to any of the above decryption methods.
  • the data is decrypted.
  • configuration information is stored in the central media server.
  • the configuration information describes whether the push end is a customer of the CDN service provider where the central media server is located, and whether the push end has customized special services such as whether the streaming media is required
  • the data is encrypted, and if it needs to be encrypted, encrypted information, key identification, etc.
  • the data transmission process in the CDN can be:
  • the streaming end encrypts the encrypted streaming media data according to any one of the above encryption methods, based on the RTMP protocol Push the encrypted streaming media data, and send the encrypted streaming media data to the central media server through the CDN node server (the process of sending the encrypted streaming media data at the push end can be called the process of pushing the encrypted stream), when the central media
  • the server After receiving the streaming request sent by the decryption terminal through the CDN node server, the server sends the encrypted streaming media data to the decryption terminal, and the decryption terminal decrypts the streaming media data to be decrypted according to any one of the above-mentioned decryption methods.
  • the difference between the data transmission process in the embodiment of FIG. 5 and FIG. 6 is: the push end of the embodiment of FIG. 5 pushes unencrypted streaming media data, and the central media server performs encryption processing on the encrypted streaming media data.
  • the embodiment of FIG. 6 What the push end pushes is the encrypted streaming media data, and the push end performs encryption processing on the encrypted streaming media data.
  • the central media server or the push end can obtain the encryption key from the key server, and the decryption end can also obtain the decryption key from the key server.
  • the embodiment of the present disclosure also provides a streaming media data encryption device. As shown in FIG. 7, the device includes:
  • the first data obtaining unit 710 is configured to obtain the stream media data to be encrypted, the encryption information corresponding to the stream media data to be encrypted, and the key identifier of the encryption key, where the encryption information includes: an encryption level, and the encryption level is used to indicate the Encryption method of encrypted streaming media data;
  • the encryption key obtaining unit 720 is configured to obtain the encryption key according to the key identifier
  • the data encryption unit 730 is configured to encrypt the encrypted streaming media data according to the encryption information based on the encryption key to obtain encrypted streaming media data, where the encrypted streaming media data is encrypted streaming media data encapsulated by a streaming media protocol;
  • the data transmission unit 740 is configured to transmit encrypted streaming media data.
  • the encryption device When the encryption device provided in the embodiments of the present disclosure encrypts streaming media data, it obtains the key identifier of the encryption key and the encryption information including the encryption level, and obtains the encryption key according to the key identifier, where the encryption level is used to indicate The encryption method of the streaming media data to be encrypted.
  • the encrypted streaming media data can be encrypted based on the encryption key.
  • the encrypted streaming media data After the encrypted streaming media data encapsulated by the streaming media protocol is obtained, the encrypted streaming media data can be transmitted Streaming media data. It can be seen that after the technical solution provided by the embodiments of the present disclosure encrypts the streaming media data to be encrypted, the encrypted streaming media data is transmitted, so that the security of the streaming media data transmitted based on the streaming media protocol can be improved.
  • the device may further include:
  • the data adding unit is configured to add the key identification, encryption information, and identification information for indicating whether the streaming media data to be encrypted is encrypted, to the metadata of the encrypted streaming media data.
  • the encryption information may further include: an encryption mode and a key length of the encryption key.
  • the device may further include:
  • the type determining unit is configured to determine the data type of the streaming media data that needs to be encrypted, and the data type of the streaming media data that needs to be encrypted includes: at least one of a video data type and an audio data type;
  • the encryption determining unit is configured to determine whether to encrypt the streaming media data to be encrypted according to the data type, and if it is determined to encrypt the streaming media data to be encrypted, trigger the data encryption unit to perform an operation.
  • the encryption key obtaining unit may include:
  • the first identification sending subunit is configured to send the key identification to the key server, so that the key server determines the encryption key corresponding to the key identification;
  • the first key obtaining subunit is configured to obtain the encryption key from the key server.
  • the encryption level may include at least one of the following:
  • the first encryption level the encryption method of the first encryption level is: the to-be-encrypted bytes of the to-be-encrypted streaming media data segment of the to-be-encrypted streaming media data are encrypted, where the to-be-encrypted streaming media data segment is: the to-be-encrypted streaming media data Except for the first preset number of bytes, each data segment that is a segment of the first preset multiple of the first preset number of bytes, the bytes to be encrypted are: in each stream media data segment to be encrypted The first preset number bytes of the first;
  • the second encryption level, the encryption method of the second encryption level is: encrypt all the bytes of the stream media data to be encrypted.
  • the streaming media data segment to be encrypted is: the instant decoding refresh IDR frame of the streaming media data to be encrypted is divided by the first preset number of words Outside the section, each data segment with a number of bytes that is a first preset multiple of the first preset number as one segment.
  • the embodiment of the present disclosure also provides a device for decrypting streaming media data. As shown in FIG. 8, the device includes:
  • the streaming request sending unit 810 is configured to send a streaming request to the central media server in the CDN;
  • the data receiving unit 820 is configured to receive the streaming media data to be decrypted sent by the central media server in response to the streaming request; wherein the streaming media data to be decrypted is encrypted streaming media data encapsulated by a streaming media protocol;
  • the data analysis unit 830 is configured to parse the metadata of the streaming media data to be decrypted to obtain the key identification and decryption information, the decryption information includes: a decryption level, and the decryption level is used to indicate the decryption method of the streaming media data to be decrypted;
  • the decryption key obtaining unit 840 is configured to obtain the decryption key of the streaming media data to be decrypted through the key identifier;
  • the data decryption unit 850 is configured to decrypt the stream media data to be decrypted according to the decryption information based on the decryption key.
  • the decryption terminal after the decryption terminal sends a streaming request to the central media server in the CDN, it can receive the streaming media data to be decrypted sent by the central media server in response to the streaming request, wherein the streaming media to be decrypted
  • the data is the encrypted streaming media data encapsulated by the streaming media protocol.
  • the key identification and decryption information After parsing the metadata of the streaming media data to be decrypted, the key identification and decryption information can be obtained.
  • the decryption information includes: the decryption level, the streaming media to be decrypted can be obtained through the key identification After the decryption key of the data, the stream media data to be decrypted can be decrypted based on the decryption key according to the decryption information.
  • the streaming media data to be decrypted can be decrypted, and the decrypted streaming media data can be obtained.
  • the device may further include:
  • the encryption or not analysis unit is set to analyze the metadata of the streaming media data to be decrypted to obtain whether the streaming media data to be decrypted is encrypted streaming media data, and if it is encrypted streaming media data, trigger the data decryption unit to operate.
  • the decryption key obtaining unit 840 may include:
  • the second identification sending subunit is configured to send the key identification to the key server, so that the key server determines the decryption key corresponding to the key identification;
  • the second key obtaining subunit is configured to obtain the determined decryption key from the key server as the decryption key of the streaming media data to be decrypted.
  • the data decryption unit 830 may include:
  • the first decryption subunit is set to decrypt the bytes to be decrypted of the data segment to be decrypted of the streaming media data to be decrypted when the decryption level of the streaming media data to be decrypted is the first decryption level, wherein the data segment to be decrypted It is: each data segment of the stream media data to be decrypted except for the first preset number of bytes, the number of bytes that is a first preset multiple of the first preset number, and the bytes to be decrypted are: The first preset number of bytes in each data segment to be decrypted;
  • the second decryption subunit is configured to decrypt all bytes of the streaming media data to be decrypted when it is parsed that the decryption level of the streaming media data to be decrypted is the second decryption level.
  • the embodiment of the present disclosure also provides an electronic device, as shown in FIG. 9, including a processor 901, a communication interface 902, a memory 903, and a communication bus 904.
  • the processor 901, the communication interface 902, and the memory 903 pass through the communication bus 904. Complete the communication between each other,
  • the memory 903 is set to store computer programs
  • the processor 901 is configured to implement the streaming media data encryption method provided by any one of the foregoing when executing the program stored in the memory 903.
  • the embodiment of the present disclosure also provides an electronic device, as shown in FIG. 10, including a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 pass through the communication bus 1004 Complete the communication between each other,
  • the memory 1003 is set to store computer programs
  • the processor 1001 is configured to implement the streaming media data decryption method provided by any one of the foregoing when executing the program stored in the memory 1003.
  • the communication bus 1004 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus or the like.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the communication bus 1004 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
  • the communication interface 1002 is used for communication between the above-mentioned electronic device and other devices.
  • the memory 1003 may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk storage. In an embodiment, the memory 1003 may also be at least one storage device located far away from the foregoing processor.
  • RAM Random Access Memory
  • NVM Non-Volatile Memory
  • the above-mentioned processor 1001 may be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (Digital Signal Processing, DSP), a dedicated Integrated Circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • CPU central processing unit
  • NP Network Processor
  • DSP Digital Signal Processing
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • FPGA Field-Programmable Gate Array
  • the embodiment of the present disclosure provides a computer-readable storage medium in which a computer program is stored, and when the computer program is executed by a processor, the streaming media data encryption method provided by any one of the above is implemented.
  • the embodiments of the present disclosure provide a computer-readable storage medium in which a computer program is stored, and when the computer program is executed by a processor, the method for decrypting streaming media data provided by any one of the above is implemented.
  • the embodiments of the present disclosure also provide a computer program product containing instructions, which when run on a computer, cause the computer to execute the streaming media data encryption method provided by any one of the above.
  • the embodiment of the present disclosure also provides a computer program product containing instructions, which when running on a computer, causes the computer to execute the streaming media data decryption method provided by any one of the above items.
  • the embodiments of the present disclosure also provide a computer program product containing instructions, which when running on a computer, cause the computer to execute the steps of the streaming media data encryption method provided by any one of the above.
  • the embodiments of the present disclosure also provide a computer program product containing instructions, which when running on a computer, cause the computer to execute the steps of the streaming media data decryption method provided by any one of the above.
  • the embodiments of the present disclosure also provide a computer program that, when running on a computer, causes the computer to execute the steps of the method for encrypting streaming media data provided by any one of the above.
  • the embodiments of the present disclosure also provide a computer program that, when running on a computer, causes the computer to execute the steps of the method for decrypting streaming media data provided by any one of the above.
  • the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
  • the streaming media data encryption method, device, electronic device, and storage medium provided by the embodiments of the present disclosure, because when the streaming media data is encrypted, the key identifier of the encryption key and the encryption information including the encryption level are obtained, and the encryption information is based on the encryption key. After the encryption key is obtained, the encryption level is used to indicate the encryption method of the streaming media data to be encrypted. When the streaming media data is encrypted, the encrypted streaming media data can be encrypted based on the encryption key. After the encrypted streaming media data is encapsulated by the media protocol, the encrypted streaming media data can be transmitted. It can be seen that after the technical solution provided by the embodiments of the present disclosure encrypts the streaming media data to be encrypted, the encrypted streaming media data is transmitted, so that the security of the streaming media data transmitted based on the streaming media protocol can be improved.
  • the streaming media data decryption method, device, electronic device, and storage medium provided by the embodiments of the present disclosure, because when the streaming media data is encrypted, the key identifier of the encryption key and the encryption information including the encryption level are obtained and the encryption information is based on the encryption key. After the encryption key is obtained, the encryption level is used to indicate the encryption method of the streaming media data to be encrypted. When the streaming media data is encrypted, the encrypted streaming media data can be encrypted based on the encryption key. After the encrypted streaming media data is encapsulated by the media protocol, the encrypted streaming media data can be transmitted. It can be seen that after the technical solution provided by the embodiments of the present disclosure encrypts the streaming media data to be encrypted, the encrypted streaming media data is transmitted, so that the security of the streaming media data transmitted based on the streaming media protocol can be improved.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

一种流媒体数据加密、解密方法、装置及电子设备。加密方法包括:获取待加密流媒体数据、与待加密流媒体数据对应的加密信息和加密密钥的密钥标识,其中,加密信息包括:加密级别,加密级别用于表示待加密流媒体数据的加密方式;根据密钥标识获取加密密钥;基于加密密钥按照加密信息对待加密流媒体数进行加密,得到加密后流媒体数据,其中,加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据,传输加密后流媒体数据。采用本公开提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性。

Description

流媒体数据加密、解密方法、装置、电子设备及存储介质
本公开要求于2019年12月20日提交中国专利局、申请号为201911326520.0发明名称为“流媒体数据加密、解密方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。
技术领域
本公开涉及互联网技术领域,特别是涉及一种流媒体数据加密、解密方法、装置、电子设备及存储介质。
背景技术
近年来,流媒体技术已经广泛应用于视频直播、短视频、互动直播等行业中。在流媒体技术中,可以基于流媒体协议在互联网中传输流媒体数据,其中,上述流媒体数据包括音、视频数据。
相关技术中,基于流媒体协议传输流媒体数据时,流媒体数据以流媒体协议所定义的数据包格式、在数据发送端和数据接收端之间的通道上传输。
然而,由于现有的流媒体协议通常只定义了流媒体数据传输时的数据包格式,因此,基于现有的流媒体协议传输流媒体数据时,所传输的流媒体数据一旦被第三方获取,很容易被解析出来。可见,相关技术中基于流媒体协议传输的流媒体数据安全性较低。
发明内容
本公开实施例的目的在于提供一种流媒体数据加密、解密方法、装置、电子设备及存储介质,以提高基于流媒体协议传输的流媒体数据的安全性。具体技术方案如下:
第一方面,本公开实施例提供了一种流媒体数据加密方法,所述方法包括:获取待加密流媒体数据、与所述待加密流媒体数据对应的加密信息和加密密钥的密钥标识,其中,所述加密信息包括:加密级别,所述加密级别用于表示所述待加密流媒体数据的加密方式;根据所述密钥标识获取所述加密密钥;基于所述加密密钥按照所述加密信息对所述待加密流媒体数据进行加密,得到加密后流媒体数据,其中,所述加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据;传输所述加密后流媒体数据。
第二方面,本公开实施例还提供了一种流媒体数据解密方法,所述方法包括:向CDN中的中心媒体服务器发送拉流请求;接收所述中心媒体服务器响应所述拉流请求所发送的待解密流媒体数据;其中,所述待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据;解析所述待解密流媒体数据的元数据得到密钥标识和解密信息,所述解密信息包括:解密级别,所述解密级别用于表示对所述待解密流媒体数据的解密方式;通过所述密钥标识获取所述待解密流媒体数据的解密密钥;基于所述解密密钥按照所述解密信息对所述待解密流媒体数据进行解密。
第三方面,本公开实施例还提供了一种流媒体数据加密装置,所述装置包括:第一数 据获取单元,设置为获取待加密流媒体数据、与所述待加密流媒体数据对应的加密信息和加密密钥的密钥标识,其中,所述加密信息包括:加密级别,所述加密级别用于表示所述待加密流媒体数据的加密方式;加密密钥获取单元,设置为根据所述密钥标识获取所述加密密钥;数据加密单元,设置为基于所述加密密钥按照所述加密信息对所述待加密流媒体数据进行加密,得到加密后流媒体数据,其中,所述加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据;数据传输单元,设置为传输所述加密后流媒体数据。
第四方面,本公开实施例还提供了一种流媒体数据解密装置,所述装置包括:拉流请求发送单元,设置为向CDN中的中心媒体服务器发送拉流请求;数据接收单元,设置为接收所述中心媒体服务器响应所述拉流请求所发送的待解密流媒体数据;其中,所述待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据;数据解析单元,设置为解析所述待解密流媒体数据的元数据得到密钥标识和解密信息,所述解密信息包括:解密级别,所述解密级别用于表示对所述待解密流媒体数据的解密方式;解密密钥获取单元,设置为通过所述密钥标识获取所述待解密流媒体数据的解密密钥;数据解密单元,设置为基于所述解密密钥按照所述解密信息对所述待解密流媒体数据进行解密。
第五方面,本公开实施例还提供了一种电子设备,包括处理器、通信接口、存储器和通信总线;其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信,所述存储器,设置为存放计算机程序;所述处理器,设置为执行所述存储器上所存放的程序时,实现第一方面任一项所述的数据加密方法。
第六方面,本公开实施例还提供了一种电子设备,包括处理器、通信接口、存储器和通信总线;其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信,所述存储器,设置为存放计算机程序;所述处理器,设置为执行所述存储器上所存放的程序时,实现第二方面任一项所述的数据解密方法。
第七方面,本公开实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现第一方面任一项所述的数据加密方法。
第八方面,本公开实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现第二方面任一项所述的数据加密方法。
第九方面,本公开实施例还提供了一种包含指令的计算机程序产品,所述包含指令的计算机程序产品在计算机上运行时,使得计算机执行实现第一方面任一项所述的数据加密方法步骤。
第十方面,本公开实施例还提供了一种包含指令的计算机程序产品,所述包含指令的计算机程序产品在计算机上运行时,使得计算机执行第二方面任一项所述的数据加密方法步骤。
第十一方面,本公开实施例还提供了一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行实现第一方面任一项所述的数据加密方法步骤。
第十二方面,本公开实施例还提供了一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行第二方面任一项所述的数据加密方法步骤。
本公开实施例提供的技术方案在对流媒体数据进行加密时,获取了加密密钥的密钥标识和包括加密级别的加密信息以及根据密钥标识获取加密密钥后,其中,加密级别用于表示所述待加密流媒体数据的加密方式,在对流媒体数据进行加密时,可以基于加密密钥对待加密流媒体数据进行加密,在得到经过流媒体协议封装后的加密的流媒体数据后,可以传输加密后流媒体数据。可见,本公开实施例提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性。
附图说明
为了更清楚地说明本公开实施例和相关技术的技术方案,下面对实施例和相关技术中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本公开实施例提供的流媒体数据加密方法的一种流程示意图。
图2为本公开实施例提供的流媒体数据加密方法的另一种流程示意图。
图3为本公开实施例提供的流媒体数据解密方法的一种流程示意图。
图4为本公开实施例提供的流媒体数据解密方法的另一种流程示意图。
图5为本公开实施例提供的数据传输方法的一种流程示意图。
图6为本公开实施例提供的数据传输方法的另一种流程示意图。
图7为本公开实施例提供的流媒体数据加密装置的一种结构示意图。
图8为本公开实施例提供的流媒体数据解密装置的一种结构示意图。
图9为本公开实施例提供的电子设备的一种结构示意图。
图10为本公开实施例提供的电子设备的另一种结构示意图。
具体实施方式
为了提高基于流媒体协议传输的流媒体数据的安全性,本公开实施例提供了一种流媒体数据加密、解密方法、装置、电子设备及存储介质。
本公开的一个实施例中,提供的流媒体数据加密方法包括以下步骤:
获取待加密流媒体数据、与待加密流媒体数据对应的加密信息和加密密钥的密钥标识,其中,加密信息包括:加密级别,加密级别用于表示待加密流媒体数据的加密方式;
根据上述密钥标识获取上述加密密钥;
基于上述加密密钥按照上述加密信息对上述待加密流媒体数据进行加密,得到加密后 流媒体数据,其中,上述加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
传输上述加密后流媒体数据。
本公开实施例提供的技术方案在对流媒体数据进行加密时,获取了加密密钥的密钥标识和包括加密级别的加密信息以及根据密钥标识获取加密密钥后,其中,加密级别用于表示待加密流媒体数据的加密方式,在对流媒体数据进行加密时,可以基于加密密钥对待加密流媒体数据进行加密,在得到经过流媒体协议封装后的加密的流媒体数据后,可以传输加密后流媒体数据。可见,本公开实施例提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性。
与上述流媒体数据加密方法相对应,本公开的一个实施例中,提供的流媒体数据解密方法包括以下步骤:
向内容分发网络(Content Delivery Network,简称CDN)中的中心媒体服务器发送拉流请求;
接收中心媒体服务器响应拉流请求所发送的待解密流媒体数据;其中,待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
解析待解密流媒体数据的元数据得到密钥标识和解密信息,解密信息包括:解密级别,解密级别用于表示对待解密流媒体数据的解密方式;
通过密钥标识获取待解密流媒体数据的解密密钥;
基于解密密钥按照解密信息对待解密流媒体数据进行解密。
本公开实施例提供的技术方案,解密端向CDN中的中心媒体服务器发送拉流请求后,可以接收到中心媒体服务器响应该拉流请求所发送的待解密流媒体数据,其中,待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据,解析待解密流媒体数据的元数据后可以得到密钥标识和解密信息,解密信息包括:解密级别,通过密钥标识获取待解密流媒体数据的解密密钥后,可以基于解密密钥按照解密信息对待解密流媒体数据进行解密。
可见,本公开实施例提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性,且使用本公开实施例提供的方案可以对待解密流媒体数据进行解密,得到解密后的流媒体数据。
下面首先对本公开实施例所提供的流媒体数据加密方法进行介绍。
需要说明的是,本公开实施例所提供的流媒体数据加密方法可以应用于流媒体技术行业,例如,应用于互联网中流媒体数据的传输。
本公开实施例提供的流媒体数据加密方法的执行主体可以是推流端,也可以是转发推流端发送的流媒体数据的服务器。例如,本公开实施例提供的流媒体数据加密方法的执行主体可以是CDN网络中的推流端,也可以是CDN网络中的中心媒体服务器。
如图1所示,本公开实施例提供的流媒体数据加密方法包括以下步骤S110~S140。
S110:获取待加密流媒体数据、与待加密流媒体数据对应的加密信息和加密密钥的密钥标识。
其中,加密信息包括:加密级别,加密级别用于表示待加密流媒体数据的加密方式。
上述密钥标识可以为随机确定的标识,也可以为预设的标识。
在一种实施方式中,上述加密级别可以包括以下至少一项:
第一加密级别,第一加密级别的加密方式为:对待加密流媒体数据的待加密流媒体数据段的待加密字节进行加密,其中,待加密流媒体数据段为:待加密流媒体数据中除前第一预设数量个字节外、以第一预设数量的第一预设倍数的数量个字节为一段的各数据段,待加密字节为:各待加密流媒体数据段中的前第一预设数量个字节;当待加密流媒体数据段的字节数少于第一预设数量的第一预设倍数的数量个字节时,不对待加密流媒体数据段进行加密处理;
第二加密级别,第二加密级别的加密方式为:对待加密流媒体数据的全部字节进行加密。
为了便于编码,上述第一预设数量的大小可以等于上述加密密钥的长度大小。例如,当加密密钥长度为16个字节时,第一预设数量可以为16。上述第一预设倍数可以为5~15中的任一倍数,也可以为其他具体倍数。当第一预设倍数较小时,需要加密的字节数较多,数据的安全性更高,当第一预设倍数较大时,需要加密的字节数较少,加密效率更高。
电子设备可以将接收到的用户输入的级别确定为加密级别。
本实施方式中,可以根据用户的需要选择不同的加密级别对待加密流媒体数据进行加密,从而可以更灵活地用不同的加密方式对流媒体数据进行加密。当加密级别为第一加密级别时,可以仅对流媒体数据中的部分字节进行加密,这样,既可以提高基于流媒体协议传输的流媒体数据的安全性,也可以减少需要加密的数据的数量,提高了加密的效率。当加密级别为第二加密级别时,可以对流媒体数据的全部字节进行加密,这样,可以使得基于流媒体协议传输的流媒体数据的安全性更高。
在一种具体实施方式中,当待加密流媒体数据为视频数据类型的数据时,待加密流媒体数据段可以为:待加密流媒体数据的各即时解码刷新(Instantaneous Decoding Refresh,简称IDR)帧中除前第一预设数量个字节外、以第一预设数量的第一预设倍数的数量个字节为一段的各数据段。通过本具体实施方式,可以通过仅对各IDR帧中的部分字节进行加密来实现对流媒体数据的加密,加密效率更高。且由于IDR帧为视频数据类型的数据的关键帧,当将IDR帧加密后,视频数据类型的流媒体数据通常无法正常播放,因此,仅对各IDR帧中的部分字节进行加密,也可以保证基于流媒体协议传输的流媒体数据的安全性。
在一个具体实施例中,例如,第一预设数量为16,第一预设倍数为10,待加密流媒体数据为视频数据类型的数据,那么,当加密级别为第一加密级别时,可以对待加密流媒体数据的各IDR帧的除前16个字节外的数据中,以16*10个字节为一段的各数据段的前16个字 节进行加密。
S120:根据上述密钥标识获取加密密钥。
在一种实施方式中,步骤S120,可以按以下步骤A~B实现:
步骤A:将密钥标识发送给加密密钥服务器,以使密钥服务器确定与密钥标识对应的加密密钥。
在一种具体实施方式中,密钥服务器中可以存储有预设的密钥信息表,该密钥信息表可以包括:密钥和密钥标识的映射关系,相应的,电子设备中可以存储有密钥标识表,该密钥标识表中可以包括多个密钥标识,密钥标识表中的密钥标识与密钥信息表中的密钥标识相同。这种情况下,步骤S110中获取加密密钥的密钥标识可以按以下步骤实现:从密钥标识表中获取任一个密钥标识作为加密密钥的密钥标识,步骤A中,密钥服务器可以按以下方式确定加密密钥:从密钥信息表中确定与密钥标识对应的密钥,作为加密密钥。
在另一种具体实施方式中,密钥服务器可以在确定了与密钥标识对应的加密密钥以后,建立所确定的加密密钥与密钥标识的对应关系。
步骤B:从密钥服务器获取密钥服务器所确定的加密密钥。
本实施方式从密钥服务器获取加密密钥,可以通过密钥服务器来对密钥进行管理,这样,更便于对密钥进行管理,密钥管理的安全性也较高。
在另一种实施方式中,步骤S110中获取加密密钥的密钥标识可以按以下步骤C实现:
步骤C:从预设的密钥信息表中选择密钥标识;
步骤S120,可以按以下步骤D实现:
步骤D:从预设的密钥信息表中获取与所选择密钥标识相对应的加密密钥。
其中,上述密钥信息表包括:密钥和密钥标识的映射关系。上述预设的密钥信息表可以存储在加密端的存储空间中。
本实施方式从密钥信息表中选择密钥标识并获取加密密钥,也可以更快地获取到加密密钥和密钥标识。
S130:基于加密密钥按照加密信息对待加密流媒体数据进行加密,得到加密后流媒体数据。
其中,加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据。
上述流媒体传输协议可以是实时消息传输协议(Real Time Messaging Protocol,简称RTMP)。也可以是其他流媒体传输协议。
在一种实施方式中,步骤S130,可以按以下步骤F~G实现:
步骤F:获得加密模式。
步骤G:基于加密密钥、按照加密信息以获得的加密模式对待加密流媒体数据进行加密。
在一个具体实施例中,上述加密模式可以为高级加密标准(Advanced Encryption  Standard,简称AES),当上述加密模式为AES时,上述加密模式可以为以下任一项:
高级加密标准-电码本模式AES-ECB;
高级加密标准-密码分组链接模式AES-CBC;
高级加密标准-计算器模式AES-CTR
高级加密标准-密码反馈模式AES-CFB;
高级加密标准-输出反馈模式AES-OFB。
在其他具体实施例中,上述加密模式也可以为RSA算法或数据加密算法(Data Encryption Algorithm,简称DEA),上述加密模式还可以是其他加密模式,本公开实施例不限定具体的加密模式。
在本实施方式中,电子设备可以将接收到的用户输入的模式确定为加密模式。当电子设备未接收到用户输入的模式时,可以将预设的模式确定为加密模式。预设的模式例如可以为AES-ECB、AES-CBC、AES-CTR、AES-CFB、AES-OFB中的任一种。
本实施方式以加密模式对待加密流媒体数据进行加密,可以更便捷地完成对流媒体数据的加密处理。
S140:传输加密后流媒体数据。
在一种实施方式中,当本公开实施例提供的加密方法的执行主体是推流端时,步骤S140可以按以下步骤实现:对加密后流媒体数据进行推流。当执行主体是中心媒体服务器时,步骤S140可以按以下步骤实现:响应于解密端发送的拉流请求,将加密后流媒体数据发送给解密端。
本公开实施例提供的加密方法在对流媒体数据进行加密时,获取了加密密钥的密钥标识和包括加密级别的加密信息以及根据密钥标识获取加密密钥后,其中,加密级别用于表示所述待加密流媒体数据的加密方式,在对流媒体数据进行加密时,可以基于加密密钥对待加密流媒体数据进行加密,在得到经过流媒体协议封装后的加密的流媒体数据后,可以传输加密后流媒体数据。可见,本公开实施例提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性。
在一种实施方式中,在步骤S120之后,上述方法还可以包括以下步骤:
将密钥标识、加密信息和用于指示待加密流媒体数据是否进行了加密的标识信息添加在加密后流媒体数据的元数据中。
上述元数据是用于描述数据属性的数据。例如,可以在加密后的流媒体数据的onMetaData字段中添加上述密钥标识、加密信息和用于指示待加密流媒体数据是否进行了加密的标识信息。其中,onMetaData字段为流媒体数据中用于记录流媒体数据属性的字段。本实施方式通过在onMetaData字段中增加密钥标识、加密信息和用于指示待加密流媒体数据是否进行了加密的标识信息等字段信息,便于解密端获取该密钥标识、加密信息和加密 流媒体数据是否进行了加密。
需要说明的是,onMetaData语法结构的mediaencrypt字段可以标识加密的数据类型,比如0:标识音视频未加密,1:表示视频加密,2:表示音频加密,3:表示音视频均加密;
onMetaData语法结构的encryptconfig字段可以标识加密方式和加密参数:
encryptconfig字段结构如下:
{
EncryptionMode:加密级别;
EncryptionAlgorithm:加密模式;
EncryptionKeyLenth:密钥长度;
EncryptionKeyInfo:密钥标识;
EncryptionIV:加密使用的初始化IV信息;
}
比如,加密级别可以是第一加密级别,第二加密级别,比如用0标识第一加密级别,用1表示第二加密级别;加密模式可以AES的模式,比如AES-ECB、AES-CBC、AES-CTR、AES-CFB、AES-OFB等,但并不限于此;密钥长度可以是16字符串等并不限定,密钥标识可以是用于标识加密密码的,其可以是数字,可以是字母,也可以是数字或字母的组合等等,但并不限于此。
在其他实施方式中,也可以将密钥标识、加密信息和用于指示待加密流媒体数据是否进行了加密的标识信息添加在加密后的流媒体数据的其他未加密过的数据中。
在一种实施方式中,加密信息还可以包括:加密模式和加密密钥的密钥长度。当加密信息包括加密模式时,可以按照该加密模式对待加密流媒体数据进行加密。
在一种实施方式中,如图2所示,在步骤S130之前,上述方法还可以包括以下步骤S150~S160。
S150:确定需要加密的流媒体数据的数据类型,需要加密的流媒体数据的数据类型包括:视频数据类型与音频数据类型中的至少一种。
在一个具体实施例中,可以通过识别流媒体数据中表示数据类型的字段,确定需要加密的流媒体数据的数据类型。
S160:根据需要加密的流媒体数据的数据类型确定是否对待加密流媒体数据进行加密,若为是,则执行步骤S130。
在一个具体实施例中,步骤S160可以按以下步骤实现:当所确定的需要加密的流媒体数据的数据类型包括待加密流媒体数据的数据类型时,确定对待加密流媒体数据进行加密。
例如,当步骤S150确定的需要加密的流媒体数据的数据类型为视频数据类型时,当待加密流媒体数据的数据类型为视频数据类型时,确定对待加密流媒体数据进行加密,当待 加密流媒体数据的数据类型为音频数据类型时,确定不对待加密流媒体数据进行加密;当步骤S150确定的需要加密的流媒体数据的数据类型为视频数据类型和音频数据类型时,当待加密流媒体数据的数据类型为视频数据类型时,确定对待加密流媒体数据进行加密,当待加密流媒体数据的数据类型为音频数据类型时,确定对待加密流媒体数据进行加密。
本公开实施例还提供了一种流媒体数据解密方法,如图3所示,该方法包括以下步骤S310~S350:
S310:向CDN中的中心媒体服务器发送拉流请求。
其中,拉流请求可以携带所请求流媒体数据的数据标识。
S320:接收中心媒体服务器响应拉流请求所发送的待解密流媒体数据。
其中,待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据。
上述流媒体传输协议可以是RTMP,也可以是其他流媒体传输协议。
S330:解析待解密流媒体数据的元数据得到密钥标识和解密信息。
解密信息包括:解密级别,解密级别用于表示对待解密流媒体数据的解密方式。
在一种实施方式中,可以通过以下方式得到密钥标识和解密信息:从待解密流媒体数据的onMetaData字段中获取密钥标识和解密信息。
S340:通过上述密钥标识获取上述待解密流媒体数据的解密密钥。
在一种实施方式中,当待解密流媒体数据的加密端是通过上述步骤A~B来获取加密密钥时,步骤S340可以按以下步骤J~K实现:
步骤J:将密钥标识发送给密钥服务器,以使得密钥服务器确定与该密钥标识相对应的解密密钥;
步骤K:从密钥服务器获取所确定的解密密钥,将获取到的解密密钥作为待解密流媒体数据的解密密钥。
在另一种实施方式中,当待解密流媒体数据的加密端是通过上述步骤D来获取加密密钥时,步骤S340可以按以下步骤N实现:
步骤N:从预设的密钥信息表中查询与密钥标识相对应的密钥作为待解密流媒体数据的解密密钥。
其中,上述预设的密钥信息表包括:密钥和密钥标识的映射关系。
上述预设的密钥信息表可以存储在解密端的存储空间中。解密端存储的预设的密钥信息表与加密端存储的预设的密钥信息表相同。
S350:基于上述解密密钥按照上述解密信息对上述待解密流媒体数据进行解密。
在一种实施方式中,在步骤S350之前,上述方法还可以包括以下步骤:
解析待解密流媒体数据的元数据得到待解密流媒体数据是否为加密的流媒体数据,若为是,则执行步骤S350。
在本实施方式中,当将用于指示待加密流媒体数据是否进行了加密的标识信息添加在 加密后流媒体数据的元数据中后,可以解析待解密流媒体数据的元数据得到待解密流媒体数据是否为加密的流媒体数据。
在一种实施方式中,如图4所示,步骤S350,可以按以下步骤S351~S352实现:
S351:当解析出待解密流媒体数据的解密级别为第一解密级别时,对待解密流媒体数据的待解密数据段的待解密字节进行解密。
其中,待解密数据段为:待解密流媒体数据中除前第一预设数量个字节外、以第一预设数量的第一预设倍数的数量个字节为一段的各数据段,待解密字节为:各待解密数据段中的前第一预设数量个字节。
S352:当解析出待解密流媒体数据的解密级别为第二解密级别时,对待解密流媒体数据的全部字节进行解密。
在一种实施方式中,步骤S350可以按以下步骤O~P实现:
步骤O:解析待解密流媒体数据的元数据得到待解密流媒体数据的加密模式;
步骤P:基于上述解密密钥按照上述解密信息以与上述加密模式相对应的解密模式对上述待解密流媒体数据进行解密。
步骤O中,解密端可以从待解密流媒体数据的onMetaData字段中获取待解密流媒体数据的加密模式。
本公开实施例提供的解密方法,解密端向CDN中的中心媒体服务器发送拉流请求后,可以接收到中心媒体服务器响应该拉流请求所发送的待解密流媒体数据,其中,待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据,解析待解密流媒体数据的元数据后可以得到密钥标识和解密信息,解密信息包括:解密级别,通过密钥标识获取待解密流媒体数据的解密密钥后,可以基于解密密钥按照解密信息对待解密流媒体数据进行解密。使用本公开实施例提供的方案可以对待解密流媒体数据进行解密,得到解密后的流媒体数据。
如图5所示,当上述加密方法的执行主体是中心媒体服务器时,CDN中数据传输的过程可以为:推流端将待加密流媒体数据通过CDN节点服务器基于RTMP协议发送给中心媒体服务器(推流端发送待加密流媒体数据的过程也可以称为推送清流的过程),中心媒体服务器基于配置信息根据上述任一项加密方法对待加密流媒体数据进行加密处理,并修改对应的元数据,当中心媒体服务器接收到解密端通过CDN节点服务器基于RTMP协议发送的拉流请求后,基于RTMP协议将加密后流媒体数据发送给解密端,解密端再根据上述任一项解密方法对待解密流媒体数据进行解密。
需要说明的是,中心媒体服务器中存储有配置信息,该配置信息中描述了推流端是否是该中心媒体服务器所在的CDN服务商的客户,推流端是否定制了特殊服务比如是否需要对流媒体数据进行加密,以及如果需要加密的话,加密信息、密钥标识等等。
如图6所示,当上述加密方法的执行主体是推流端时,CDN中数据传输的过程可以为: 推流端根据上述任一项加密方法对待加密流媒体数据进行加密处理,基于RTMP协议将加密后流媒体数据进行推流,通过CDN节点服务器将加密后流媒体数据发送给中心媒体服务器(推流端发送加密后流媒体数据的过程可以称为推送加密流的过程),当中心媒体服务器接收到解密端通过CDN节点服务器发送的拉流请求后,将加密后流媒体数据发送给解密端,解密端再根据上述任一项解密方法对待解密流媒体数据进行解密。
图5和图6实施例中数据传输过程中的区别是:图5实施例推流端推送的是未加密的流媒体数据,由中心媒体服务器对待加密流媒体数据进行加密处理,图6实施例推流端推送的是已加密的流媒体数据,由推流端对待加密流媒体数据进行加密处理。
如图5和图6所示,数据传输的过程中,中心媒体服务器或推流端可以从密钥服务器获取加密密钥,解密端也可以从密钥服务器获取解密密钥。
本公开实施例还提供了一种流媒体数据加密装置,如图7所示,装置包括:
第一数据获取单元710,设置为获取待加密流媒体数据、与待加密流媒体数据对应的加密信息和加密密钥的密钥标识,其中,加密信息包括:加密级别,加密级别用于表示待加密流媒体数据的加密方式;
加密密钥获取单元720,设置为根据密钥标识获取加密密钥;
数据加密单元730,设置为基于加密密钥按照加密信息对待加密流媒体数据进行加密,得到加密后流媒体数据,其中,加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
数据传输单元740,设置为传输加密后流媒体数据。
本公开实施例提供的加密装置在对流媒体数据进行加密时,获取了加密密钥的密钥标识和包括加密级别的加密信息以及根据密钥标识获取加密密钥后,其中,加密级别用于表示待加密流媒体数据的加密方式,在对流媒体数据进行加密时,可以基于加密密钥对待加密流媒体数据进行加密,在得到经过流媒体协议封装后的加密的流媒体数据后,可以传输加密后流媒体数据。可见,本公开实施例提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性。
在一种实施方式中,装置还可以包括:
数据添加单元,设置为将密钥标识、加密信息和用于指示待加密流媒体数据是否进行了加密的标识信息添加在加密后流媒体数据的元数据中。
在一种实施方式中,加密信息还可以包括:加密模式和加密密钥的密钥长度。
在一种实施方式中,装置还可以包括:
类型确定单元,设置为确定需要加密的流媒体数据的数据类型,需要加密的流媒体数据的数据类型包括:视频数据类型与音频数据类型中的至少一种;
加密确定单元,设置为根据数据类型确定是否对待加密流媒体数据进行加密,若确定 对待加密流媒体数据进行加密,则触发数据加密单元进行进行操作。
在一种实施方式中,加密密钥获取单元,可以包括:
第一标识发送子单元,设置为将密钥标识发送给密钥服务器,以使得密钥服务器确定与密钥标识对应的加密密钥;
第一密钥获取子单元,设置为从密钥服务器获取加密密钥。
在一种实施方式中,加密级别可以包括以下至少一项:
第一加密级别,第一加密级别的加密方式为:对待加密流媒体数据的待加密流媒体数据段的待加密字节进行加密,其中,待加密流媒体数据段为:待加密流媒体数据中除前第一预设数量个字节外、以第一预设数量的第一预设倍数的数量个字节为一段的各数据段,待加密字节为:各待加密流媒体数据段中的前第一预设数量个字节;
第二加密级别,第二加密级别的加密方式为:对待加密流媒体数据的全部字节进行加密。
在一种实施方式中,当待加密流媒体数据为视频数据类型的数据时,待加密流媒体数据段为:待加密流媒体数据的即时解码刷新IDR帧中除前第一预设数量个字节外、以第一预设数量的第一预设倍数的数量个字节为一段的各数据段。
本公开实施例还提供了一种流媒体数据解密装置,如图8所示,装置包括:
拉流请求发送单元810,设置为向CDN中的中心媒体服务器发送拉流请求;
数据接收单元820,设置为接收中心媒体服务器响应拉流请求所发送的待解密流媒体数据;其中,待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
数据解析单元830,设置为解析待解密流媒体数据的元数据得到密钥标识和解密信息,解密信息包括:解密级别,解密级别用于表示对待解密流媒体数据的解密方式;
解密密钥获取单元840,设置为通过密钥标识获取待解密流媒体数据的解密密钥;
数据解密单元850,设置为基于解密密钥按照解密信息对待解密流媒体数据进行解密。
本公开实施例提供的解密方法,解密端向CDN中的中心媒体服务器发送拉流请求后,可以接收到中心媒体服务器响应该拉流请求所发送的待解密流媒体数据,其中,待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据,解析待解密流媒体数据的元数据后可以得到密钥标识和解密信息,解密信息包括:解密级别,通过密钥标识获取待解密流媒体数据的解密密钥后,可以基于解密密钥按照解密信息对待解密流媒体数据进行解密。使用本公开实施例提供的方案可以对待解密流媒体数据进行解密,得到解密后的流媒体数据。
在一种实施方式中,装置还可以包括:
是否加密解析单元,设置为解析待解密流媒体数据的元数据得到待解密流媒体数据是否为加密的流媒体数据,若为加密的流媒体数据,则触发数据解密单元进行操作。
在一种实施方式中,解密密钥获取单元840,可以包括:
第二标识发送子单元,设置为将密钥标识发送给密钥服务器,以使得密钥服务器确定与密钥标识相对应的解密密钥;
第二密钥获取子单元,设置为从密钥服务器获取所确定的解密密钥,作为待解密流媒体数据的解密密钥。
在一种实施方式中,数据解密单元830,可以包括:
第一解密子单元,设置为当解析出待解密流媒体数据的解密级别为第一解密级别时,对待解密流媒体数据的待解密数据段的待解密字节进行解密,其中,待解密数据段为:待解密流媒体数据中除前第一预设数量个字节外、以第一预设数量的第一预设倍数的数量个字节为一段的各数据段,待解密字节为:各待解密数据段中的前第一预设数量个字节;
第二解密子单元,设置为当解析出待解密流媒体数据的解密级别为第二解密级别时,对待解密流媒体数据的全部字节进行解密。
本公开实施例还提供了一种电子设备,如图9所示,包括处理器901、通信接口902、存储器903和通信总线904,其中,处理器901、通信接口902、存储器903通过通信总线904完成相互间的通信,
存储器903,设置为存放计算机程序;
处理器901,设置为执行存储器903上所存放的程序时,实现上述任一项提供的流媒体数据加密方法。
本公开实施例还提供了一种电子设备,如图10所示,包括处理器1001、通信接口1002、存储器1003和通信总线1004,其中,处理器1001、通信接口1002、存储器1003通过通信总线1004完成相互间的通信,
存储器1003,设置为存放计算机程序;
处理器1001,设置为执行存储器1003上所存放的程序时,实现上述任一项提供的流媒体数据解密方法。
上述电子设备中提到的通信总线1004可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线1004可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
通信接口1002用于上述电子设备与其他设备之间的通信。
存储器1003可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。在一实施方式中,存储器1003还可以是至少一个位于远离前述处理器的存储装置。
上述的处理器1001可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可 编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
本公开实施例提供了一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项提供的流媒体数据加密方法。
本公开实施例提供了一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项提供的流媒体数据解密方法。
本公开实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一项提供的流媒体数据加密方法。
本公开实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一项提供的流媒体数据解密方法。
本公开实施例还提供了一种包含指令的计算机程序产品,所述包含指令的计算机程序产品在计算机上运行时,使得计算机执行实现上述任一项提供的流媒体数据加密方法步骤。
本公开实施例还提供了一种包含指令的计算机程序产品,所述包含指令的计算机程序产品在计算机上运行时,使得计算机执行上述任一项提供的流媒体数据解密方法步骤。
本公开实施例还提供了一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行实现上述任一项提供的流媒体数据加密方法步骤。
本公开实施例还提供了一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行上述任一项提供的流媒体数据解密方法步骤。
对于解密方法/装置/电子设备/存储介质/程序产品实施例而言,由于其基本相似于加密方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本公开的较佳实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。
工业实用性
本公开实施例所提供的流媒体数据加密方法、装置、电子设备及存储介质,由于在对流媒体数据进行加密时,获取了加密密钥的密钥标识和包括加密级别的加密信息以及根据密钥标识获取加密密钥后,其中,加密级别用于表示所述待加密流媒体数据的加密方式,在对流媒体数据进行加密时,可以基于加密密钥对待加密流媒体数据进行加密,在得到经过流媒体协议封装后的加密的流媒体数据后,可以传输加密后流媒体数据。可见,本公开实施例提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性。
本公开实施例所提供的流媒体数据解密方法、装置、电子设备及存储介质,由于在对流媒体数据进行加密时,获取了加密密钥的密钥标识和包括加密级别的加密信息以及根据密钥标识获取加密密钥后,其中,加密级别用于表示所述待加密流媒体数据的加密方式, 在对流媒体数据进行加密时,可以基于加密密钥对待加密流媒体数据进行加密,在得到经过流媒体协议封装后的加密的流媒体数据后,可以传输加密后流媒体数据。可见,本公开实施例提供的技术方案对待加密流媒体数据进行加密后,所传输的是加密后的流媒体数据,从而可以提高基于流媒体协议传输的流媒体数据的安全性。

Claims (21)

  1. 一种流媒体数据加密方法,所述方法包括:
    获取待加密流媒体数据、与所述待加密流媒体数据对应的加密信息和加密密钥的密钥标识,其中,所述加密信息包括:加密级别,所述加密级别用于表示所述待加密流媒体数据的加密方式;
    根据所述密钥标识获取所述加密密钥;
    基于所述加密密钥按照所述加密信息对所述待加密流媒体数据进行加密,得到加密后流媒体数据,其中,所述加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
    传输所述加密后流媒体数据。
  2. 根据权利要求1所述的方法,其中,在所述根据所述密钥标识获取所述加密密钥之后,所述方法还包括:
    将所述密钥标识、所述加密信息和用于指示所述待加密流媒体数据是否进行了加密的标识信息添加在所述加密后流媒体数据的元数据中。
  3. 根据权利要求1或2所述的方法,其中,所述加密信息还包括:加密模式和所述加密密钥的密钥长度。
  4. 根据权利要求1-3任一项所述的方法,其中,在所述基于所述加密密钥按照所述加密信息对所述待加密流媒体数据进行加密,得到加密后流媒体数据之前,所述方法还包括:
    确定需要加密的流媒体数据的数据类型,所述需要加密的流媒体数据的数据类型包括:视频数据类型与音频数据类型中的至少一种;
    根据所述数据类型确定是否对所述待加密流媒体数据进行加密;
    若为是,则执行所述基于所述加密密钥按照所述加密信息对所述待加密流媒体数据进行加密的步骤。
  5. 根据权利要求1-4任一项所述的方法,其中,所述根据所述密钥标识获取所述加密密钥包括:
    将所述密钥标识发送给密钥服务器,以使得所述密钥服务器确定与所述密钥标识对应的加密密钥;
    从所述密钥服务器获取所述加密密钥。
  6. 根据权利要求1-5任一项所述的方法,其中,所述加密级别包括以下至少一项:
    第一加密级别,所述第一加密级别的加密方式为:对待加密流媒体数据的待加密流媒体数据段的待加密字节进行加密,其中,所述待加密流媒体数据段为:待加密流媒体数据中除前第一预设数量个字节外、以所述第一预设数量的第一预设倍数的数量个字节为一段的各数据段,待加密字节为:各所述待加密流媒体数据段中的前所述第一预设数量个字节;
    第二加密级别,所述第二加密级别的加密方式为:对待加密流媒体数据的全部字节进行加密。
  7. 根据权利要求6所述的方法,其中,当所述待加密流媒体数据为视频数据类型的数据时,所述待加密流媒体数据段为:待加密流媒体数据的各即时解码刷新IDR帧中除前第一预设数量个字节外、以所述第一预设数量的第一预设倍数的数量个字节为一段的各数据段。
  8. 一种流媒体数据解密方法,所述方法包括:
    向CDN中的中心媒体服务器发送拉流请求;
    接收所述中心媒体服务器响应所述拉流请求所发送的待解密流媒体数据;其中,所述待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
    解析所述待解密流媒体数据的元数据得到密钥标识和解密信息,所述解密信息包括:解密级别,所述解密级别用于表示对所述待解密流媒体数据的解密方式;
    通过所述密钥标识获取所述待解密流媒体数据的解密密钥;
    基于所述解密密钥按照所述解密信息对所述待解密流媒体数据进行解密。
  9. 根据权利要求8所述的方法,其中,在所述基于所述解密密钥按照所述解密信息对所述待解密流媒体数据进行解密之前,所述方法还包括:
    解析所述待解密流媒体数据的元数据得到所述待解密流媒体数据是否为加密的流媒体数据;
    若为是,则执行所述基于所述解密密钥按照所述解密信息对所述待解密流媒体数据进行解密的步骤。
  10. 根据权利要求8或9所述的方法,其中,所述通过所述密钥标识获取所述待解密流媒体数据的解密密钥,包括:
    将所述密钥标识发送给所述密钥服务器,以使得所述密钥服务器确定与所述密钥标识相对应的解密密钥;
    从所述密钥服务器获取所确定的解密密钥,作为所述待解密流媒体数据的解密密钥。
  11. 根据权利要求8-10任一项所述的方法,其中,所述基于所述解密密钥按照所述解密信息对所述待解密流媒体数据进行解密,包括:
    当解析出所述待解密流媒体数据的解密级别为第一解密级别时,对待解密流媒体数据的待解密数据段的待解密字节进行解密,其中,所述待解密数据段为:待解密流媒体数据中除前第一预设数量个字节外、以所述第一预设数量的第一预设倍数的数量个字节为一段的各数据段,待解密字节为:各所述待解密数据段中的前所述第一预设数量个字节;
    当解析出所述待解密流媒体数据的解密级别为第二解密级别时,对待解密流媒体数据的全部字节进行解密。
  12. 一种流媒体数据加密装置,所述装置包括:
    第一数据获取单元,设置为获取待加密流媒体数据、与所述待加密流媒体数据对应的加密信息和加密密钥的密钥标识,其中,所述加密信息包括:加密级别,所述加密级别用 于表示所述待加密流媒体数据的加密方式;
    加密密钥获取单元,设置为根据所述密钥标识获取所述加密密钥;
    数据加密单元,设置为基于所述加密密钥按照所述加密信息对所述待加密流媒体数据进行加密,得到加密后流媒体数据,其中,所述加密后流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
    数据传输单元,设置为传输所述加密后流媒体数据。
  13. 一种流媒体数据解密装置,所述装置包括:
    拉流请求发送单元,设置为向CDN中的中心媒体服务器发送拉流请求;
    数据接收单元,设置为接收所述中心媒体服务器响应所述拉流请求所发送的待解密流媒体数据;其中,所述待解密流媒体数据为经过流媒体协议封装后的加密的流媒体数据;
    数据解析单元,设置为解析所述待解密流媒体数据的元数据得到密钥标识和解密信息,所述解密信息包括:解密级别,所述解密级别用于表示对所述待解密流媒体数据的解密方式;
    解密密钥获取单元,设置为通过所述密钥标识获取所述待解密流媒体数据的解密密钥;
    数据解密单元,设置为基于所述解密密钥按照所述解密信息对所述待解密流媒体数据进行解密。
  14. 一种电子设备,包括处理器、通信接口、存储器和通信总线;
    其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信,
    所述存储器,设置为存放计算机程序;
    所述处理器,设置为执行所述存储器上所存放的程序时,实现权利要求1-7任一项所述的数据加密方法。
  15. 一种电子设备,包括处理器、通信接口、存储器和通信总线;
    其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信,
    所述存储器,设置为存放计算机程序;
    所述处理器,设置为执行所述存储器上所存放的程序时,实现权利要求8-11任一项所述的数据解密方法。
  16. 一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-7任一项所述的数据加密方法。
  17. 一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求8-11任一项所述的数据解密方法。
  18. 一种包含指令的计算机程序产品,所述包含指令的计算机程序产品在计算机上运行时,使得计算机执行权利要求1-7任一所述的方法步骤。
  19. 一种包含指令的计算机程序产品,所述包含指令的计算机程序产品在计算机上运 行时,使得计算机执行权利要求8-11任一所述的方法步骤。
  20. 一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行权利要求1-7任一所述的方法步骤。
  21. 一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行权利要求8-11任一所述的方法步骤。
PCT/CN2020/122443 2019-12-20 2020-10-21 流媒体数据加密、解密方法、装置、电子设备及存储介质 WO2021120831A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911326520.0 2019-12-20
CN201911326520.0A CN111093097A (zh) 2019-12-20 2019-12-20 流媒体数据加密、解密方法、装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2021120831A1 true WO2021120831A1 (zh) 2021-06-24

Family

ID=70396226

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/122443 WO2021120831A1 (zh) 2019-12-20 2020-10-21 流媒体数据加密、解密方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN111093097A (zh)
WO (1) WO2021120831A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114390317A (zh) * 2022-01-18 2022-04-22 山东点盾云网络科技有限公司 面向流式传输视频的加密方法及系统
CN114827671A (zh) * 2022-03-21 2022-07-29 慧之安信息技术股份有限公司 一种基于硬件指纹的流媒体加密传输方法
CN115002089A (zh) * 2022-06-30 2022-09-02 兰州乐智教育科技有限责任公司 流媒体传输方法、装置、电子设备及存储介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111093097A (zh) * 2019-12-20 2020-05-01 北京云享智胜科技有限公司 流媒体数据加密、解密方法、装置、电子设备及存储介质
CN111756767A (zh) * 2020-07-06 2020-10-09 成都卫士通信息产业股份有限公司 流媒体数据传输方法、装置、电子设备及计算机存储介质
CN112910891B (zh) * 2021-01-29 2021-12-14 南京十方网络科技有限公司 一种基于fpga高速加解密的网络安全互联系统
CN113438242B (zh) * 2021-06-25 2023-08-29 广西三方大供应链技术服务有限公司 服务鉴权方法、装置与存储介质
CN113542135B (zh) * 2021-08-04 2023-04-07 湖南快乐阳光互动娱乐传媒有限公司 一种cdn通信方法、系统、客户端和服务器
CN114142998B (zh) * 2021-11-26 2024-03-15 北京神经元网络技术有限公司 一种数据加密处理方法、装置、电子设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2446620B1 (en) * 2009-06-22 2014-07-16 NDS Limited Partial encryption using variable block-size parameters
CN108965302A (zh) * 2018-07-24 2018-12-07 苏州科达科技股份有限公司 媒体数据传输系统、方法、装置及存储介质
CN109067814A (zh) * 2018-10-31 2018-12-21 苏州科达科技股份有限公司 媒体数据加密方法、系统、设备及存储介质
CN109120998A (zh) * 2018-08-28 2019-01-01 苏州科达科技股份有限公司 媒体数据传输方法、装置及存储介质
CN109495459A (zh) * 2018-10-31 2019-03-19 苏州科达科技股份有限公司 媒体数据加密方法、系统、设备及存储介质
CN111093097A (zh) * 2019-12-20 2020-05-01 北京云享智胜科技有限公司 流媒体数据加密、解密方法、装置、电子设备及存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102281261A (zh) * 2010-06-10 2011-12-14 杭州华三通信技术有限公司 一种数据传输方法、系统和装置
CN105471831B (zh) * 2014-09-15 2019-05-10 杭州海康威视数字技术股份有限公司 一种对实时传输协议数据包进行加密的方法和装置
CN105791243A (zh) * 2014-12-24 2016-07-20 北京奇虎科技有限公司 多媒体文件加密传输、解密播放方法和装置
CN105847238B (zh) * 2016-03-16 2018-07-17 杭州狮说教育科技有限公司 一种基于rtmp连接的数据安全传输方法
CN106209896B (zh) * 2016-07-29 2020-02-18 网宿科技股份有限公司 基于音视频格式的流媒体加密方法和模块
CN107222759B (zh) * 2017-06-28 2021-02-02 网易(杭州)网络有限公司 媒体文件加解密的方法、系统、设备和介质
CN110557680B (zh) * 2019-07-30 2020-11-27 视联动力信息技术股份有限公司 一种音视频数据帧传输方法和系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2446620B1 (en) * 2009-06-22 2014-07-16 NDS Limited Partial encryption using variable block-size parameters
CN108965302A (zh) * 2018-07-24 2018-12-07 苏州科达科技股份有限公司 媒体数据传输系统、方法、装置及存储介质
CN109120998A (zh) * 2018-08-28 2019-01-01 苏州科达科技股份有限公司 媒体数据传输方法、装置及存储介质
CN109067814A (zh) * 2018-10-31 2018-12-21 苏州科达科技股份有限公司 媒体数据加密方法、系统、设备及存储介质
CN109495459A (zh) * 2018-10-31 2019-03-19 苏州科达科技股份有限公司 媒体数据加密方法、系统、设备及存储介质
CN111093097A (zh) * 2019-12-20 2020-05-01 北京云享智胜科技有限公司 流媒体数据加密、解密方法、装置、电子设备及存储介质

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114390317A (zh) * 2022-01-18 2022-04-22 山东点盾云网络科技有限公司 面向流式传输视频的加密方法及系统
CN114390317B (zh) * 2022-01-18 2024-03-19 山东点盾云网络科技有限公司 面向流式传输视频的加密方法及系统
CN114827671A (zh) * 2022-03-21 2022-07-29 慧之安信息技术股份有限公司 一种基于硬件指纹的流媒体加密传输方法
CN115002089A (zh) * 2022-06-30 2022-09-02 兰州乐智教育科技有限责任公司 流媒体传输方法、装置、电子设备及存储介质
CN115002089B (zh) * 2022-06-30 2023-09-19 兰州乐智教育科技有限责任公司 流媒体传输方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN111093097A (zh) 2020-05-01

Similar Documents

Publication Publication Date Title
WO2021120831A1 (zh) 流媒体数据加密、解密方法、装置、电子设备及存储介质
US8949592B2 (en) System and methods for providing live streaming content using digital rights management-based key management
US20230214459A1 (en) Digital rights management for http-based media streaming
US11601409B2 (en) Establishing a secure communication session with an external security processor
US8813246B2 (en) Method for playing digital contents protected with a DRM (digital right management) scheme and corresponding system
KR101611848B1 (ko) 콘텐츠 전송 및 전달 시에 콘텐츠 암호화 및 권한 관리의 시그널링 및 취급
US9213809B2 (en) System and method for protecting digital contents with digital rights management (DRM)
US9202024B2 (en) Method for playing digital contents projected with a DRM (digital rights management) scheme and corresponding system
KR101603136B1 (ko) 템플릿 모드에서의 짧은 암호 사용기간의 지원
EP2705457B1 (en) Method for playing digital contents protected with a drm (digital right management) scheme and corresponding system
JP5923661B2 (ja) 適応ストリーミングのためのセグメント暗号化及びキー導出を信号伝達するシステム及び方法
US20080063195A1 (en) Method and system for encrypting or decrypting wmv streaming media
US9385998B2 (en) Signaling and carriage of protection and usage information for dynamic adaptive streaming
US20120284370A1 (en) Method, system, or user device for adaptive bandwidth control of proxy multimedia server
US20150074393A1 (en) Method, Apparatus, and System for Implementing Media Data Processing
JP2014500655A (ja) ライブ適応型ストリーミング内のキー回転
CN110401677B (zh) 数字版权密钥的获取方法、装置、存储介质及电子设备
WO2017096887A1 (zh) 防盗链的方法及装置
US11438660B2 (en) Inserting secondary content in primary content in IPTV
CN110620762A (zh) 基于rdma的数据传输方法、网卡、服务器及介质
CN110912941A (zh) 组播数据的传输处理方法及装置
CN114938273A (zh) 一种秘钥协商方法、系统、发送端及接收端
US9485095B2 (en) Client control through content key format
Darshana Hooda et al. Remote Reference Passing Framework for Video Encryption

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20901303

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20901303

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 08.02.2023)