Digital rights management DRM method, apparatus, and system
Embodiments of this application provide a digital rights management DRM method, apparatus, and system, to implement a DRM interworking operation between DRM servers and clients of different vendors. The method includes: A DRM server encrypts a first media file by using a first encryption method to obtain a first encrypted media file; the DRM server generates content protection description information of the first encrypted media file, where the content protection description information includes a content identifier and encryption method information, the content identifier identifies the first encrypted media file, and the encryption method information identifies the first encryption method; the DRM server performs first formatting on the content protection description information to generate formatted content protection data; the DRM server encapsulates the formatted content protection data to generate a content protection data packet.
1 . A method, comprising:
encrypting, by a digital rights management (DRM) server, a first media file using a first encryption method, to obtain a first encrypted media file;
generating, by the DRM server, content protection description information of the first encrypted media file, wherein the content protection description information comprises a content identifier and encryption method information, the content identifier identifies the first encrypted media file, the encryption method information identifies the first encryption method, wherein the first encryption method comprises sm4c or sm4s, and wherein the sm4c represents SM4-CBC sample encryption, and the sm4s represents SM4-CBC subsample encryption;
performing, by the DRM server, first formatting on the content protection description information to generate formatted content protection data, wherein the first formatting is javascript object notation (JSON) formatting, the content protection description information is in a first format that is other than a JSON format, and a data content of the formatted content protection data and a data content of the content protection description information is the same data content, wherein the formatted content protection data comprises a content identifier field and an encrypted schema field, the content identifier field carries the content identifier, and the encrypted schema field carries the encryption method information, and wherein the formatted content protection data further comprises a version number field, an extension field, a key identifier field, and a current playing location index field, wherein the version number field indicates a version number of the formatted content protection data, the extension field carries extension data, the key identifier field indicates an identifier of a first key, the first key is a key for encrypting the first media file, and the current playing location index field indicates a current playing location of the first encrypted media file;
encapsulating, by the DRM server, the formatted content protection data to generate a content protection data packet, wherein the content protection data packet comprises a formatted data field and a data size field, the formatted data field carries the formatted content protection data, and the data size field indicates a size of the formatted data field;
packaging, by the DRM server, the content protection data packet and the first encrypted media file, and sending to a client, and
receiving, by the DRM server, a license request sent by the client, wherein the license request requests permission to play the first encrypted media file, and the license request carries the content protection data packet.
2 . The method according to claim 1 , further comprising:
determining, by the DRM server, key information of the first encrypted media file based on the content protection data packet and a pre-stored mapping relationship, wherein the key information comprises the first key and the identifier of the first key, and the mapping relationship indicates a correspondence among the content identifier, the first encryption method, and the key information; and
sending, by the DRM server, a license to the client, wherein the license is usable to grant permission to play the first encrypted media file, and the license carries the key information of the first encrypted media file.
3 . The method according to claim 2 , further comprising:
parsing, by the DRM server, the content protection data packet to obtain the current playing location;
determining, by the DRM server based on the current playing location, key information of at least one adjacent encrypted media file whose location is continuous with the current playing location of the first encrypted media file, wherein the key information of the at least one adjacent encrypted media file comprises a key of each encrypted media file of the at least one adjacent encrypted media file and a key identifier of each adjacent encrypted media file; and
sending, by the DRM server, the license to the client, wherein the license further carries key information of each encrypted media file of the at least one adjacent encrypted media file, and the license is further usable to grant permission to play the at least one adjacent encrypted media file.
4 . The method according to claim 2 , wherein the license request further comprises a permission type information field, the permission type information field carries permission type information, and the permission type information indicates at least one of online playing permission or offline playing permission.
5 . The method according to claim 1 , wherein packaging, by the DRM server, the content protection data packet and the first encrypted media file, and sending to the client comprises:
adding, by the DRM server, the content protection data packet to a media description file of the first encrypted media file; or
adding, by the DRM server, the content protection data packet to an unencrypted field, wherein the first encrypted media file comprises the unencrypted field.
6 . The method according to claim 1 , wherein packaging, by the DRM server, the content protection data packet and the first encrypted media file, and sending to the client comprises:
adding, by the DRM server, the content protection data packet to a media presentation description (MPD) file of the first encrypted media file when the first encrypted media file meets a dynamic adaptive streaming over HTTP (DASH) standard;
adding, by the DRM server, the content protection data packet to an M3U8 file of the first encrypted media file when the first encrypted media file meets an HTTP live streaming (HLS) standard or a common media application format (CMAF) standard; or
adding, by the DRM server, the content protection data packet to an unencrypted field of the first encrypted media file when a format of the first encrypted media file is a moving picture experts group (MP4) format or a fragmented moving picture experts group (FMP4) format.
7 . The method according to claim 1 , wherein the formatted content protection data is protection system specific header data having the JSON format.
8 . The method according to claim 1 , wherein the content protection data packet is a protection system specific header data box.
9 . The method according to claim 1 , wherein in the formatted content protection data the content identifier is a first JSON key/value and the encryption method information is a second JSON key/value.
10 . The method according to claim 1 , wherein packaging, by the DRM server, the content protection data packet and the first encrypted media file, and sending to the client comprises:
adding, by the DRM server, the content protection data packet to a media description file of the first encrypted media file.
11 . The method according to claim 1 , wherein packaging, by the DRM server, the content protection data packet and the first encrypted media file, and sending to the client comprises:
adding, by the DRM server, the content protection data packet to a media presentation description (MPD) file of the first encrypted media file when the first encrypted media file meets a dynamic adaptive streaming over HTTP (DASH) standard.
12 . A method, comprising:
receiving, by a client, packaged data sent by a digital rights management (DRM) server, wherein the packaged data comprises a content protection data packet and a first encrypted media file, formatted content protection data is encapsulated in the content protection data packet, the formatted content protection data is obtained by performing first formatting on content protection description information of the first encrypted media file, wherein the first formatting is javascript object notation (JSON) formatting, the content protection description information comprises a content identifier and encryption method information, the content identifier identifies the first encrypted media file, and the encryption method information identifies a first encryption method used to encrypt a first media file corresponding to the first encrypted media file, and wherein the first encryption method comprises sm4c or sm4s, wherein the sm4c represents SM4-CBC sample encryption, and the sm4s represents SM4-CBC subsample encryption, wherein the formatted content protection data comprises a content identifier field and an encrypted schema field, the content identifier field carries the content identifier, and the encrypted schema field carries the encryption method information, and wherein the formatted content protection data further comprises a version number field, an extension field, a key identifier field, and a current playing location index field, wherein the version number field indicates a version number of the formatted content protection data, the extension field carries extension data, the key identifier field indicates an identifier of a first key, the first key is a key for encrypting the first media file, and the current playing location index field indicates a current playing location of the first encrypted media file;
obtaining, by the client, the content protection data packet from the packaged data, wherein the content protection data packet comprises a formatted data field and a data size field, the formatted data field carries the formatted content protection data, and the data size field indicates a size of the formatted data field;
decrypting, by the client, the first encrypted media file based on the content protection data packet, to obtain the first media file; and
sending, by the client, a license request to the DRM server, wherein the license request requests permission to play the first encrypted media file, and the license request carries the content protection data packet.
13 . The method according to claim 12 , further comprising:
receiving, from the DRM server, a license granting permission to play the first encrypted media file, wherein the license carries key information of the first encrypted media file, the key information of the first encrypted media file is determined based on the content protection data packet and a pre-stored mapping relationship, wherein the key information of the first encrypted media file comprises the first key and the identifier of the first key, and the mapping relationship indicates a correspondence among the content identifier, the first encryption method, and the key information of the first encrypted media file, and wherein the license further carries key information of each encrypted media file of at least one adjacent encrypted media file whose location is continuous with the current playing location of the first encrypted media file, and the license further grants permission to play the at least one adjacent encrypted media file, and wherein the key information of the at least one adjacent encrypted media file comprises a key of each encrypted media file of the at least one adjacent encrypted media file and a key identifier of each adjacent encrypted media file.
14 . A digital rights management (DRM) server, comprising:
at least one processor; and
a non-transitory computer readable storage medium storing a program that is executable by the at least one processor, the program including instructions for:
encrypting a first media file using a first encryption method, to obtain a first encrypted media file;
generating content protection description information of the first encrypted media file, wherein the content protection description information comprises a content identifier and encryption method information, the content identifier identifies the first encrypted media file, the encryption method information identifies the first encryption method, and wherein the first encryption method comprises sm4c or sm4s, wherein the sm4c represents SM4-CBC sample encryption, and the sm4s represents SM4-CBC subsample encryption;
performing first formatting on the content protection description information to generate formatted content protection data, wherein the first formatting is javascript object notation (JSON) formatting, the content protection description information is in a first format that is other than a JSON format, and a data content of the formatted content protection data and a data content of the content protection description information is the same data content, and wherein the formatted content protection data comprises a content identifier field and an encrypted schema field, the content identifier field carries the content identifier, and the encrypted schema field carries the encryption method information, and wherein the formatted content protection data further comprises a version number field, an extension field, a key identifier field, and a current playing location index field, wherein the version number field indicates a version number of the formatted content protection data, the extension field carries extension data, the key identifier field indicates an identifier of a first key, the first key is a key for encrypting the first media file, and the current playing location index field indicates a current playing location of the first encrypted media file;
encapsulating the formatted content protection data to generate a content protection data packet, wherein the content protection data packet comprises a formatted data field and a data size field, the formatted data field carries the formatted content protection data, and the data size field indicates a size of the formatted data field;
packaging the content protection data packet and the first encrypted media file, and sending to a client, and
receiving a license request sent by the client, wherein the license request requests permission to play the first encrypted media file, and the license request carries the content protection data packet.
15 . The DRM server according to claim 14 , wherein the program further includes instructions for:
determining key information of the first encrypted media file based on the content protection data packet and a pre-stored mapping relationship, wherein the key information of the first encrypted media file comprises the first key and the identifier of the first key, and the mapping relationship indicates a correspondence among the content identifier, the first encryption method, and the key information of the first encrypted media file;
parsing the content protection data packet to obtain the current playing location; and
determining, based on the current playing location, key information of at least one adjacent encrypted media file whose location is continuous with the current playing location of the first encrypted media file, wherein the key information of the at least one adjacent encrypted media file comprises a key of each encrypted media file of the at least one adjacent encrypted media file and a key identifier of each adjacent encrypted media file; and
sending a license to the client, wherein the license is usable to grant permission to play the first encrypted media file, and the license carries the key information of the first encrypted media file, and wherein the license further carries key information of each encrypted media file of the at least one adjacent encrypted media file, and the license is further usable to grant permission to play the at least one adjacent encrypted media file.
16 . The DRM server according to claim 14 , wherein the formatted content protection data is protection system specific header data having the JSON format.
17 . The DRM server according to claim 14 , wherein the content protection data packet is a protection system specific header data box.
18 . The DRM server according to claim 14 , wherein in the formatted content protection data the content identifier is a first JSON key/value and the encryption method information is a second JSON key/value.
19 . The DRM server according to claim 14 , wherein the license request further comprises a permission type information field, the permission type information field carries permission type information, and the permission type information indicates at least one of online playing permission or offline playing permission.