CN117939203A - Method, device, equipment and medium for encrypting and decrypting multimedia file - Google Patents

Method, device, equipment and medium for encrypting and decrypting multimedia file Download PDF

Info

Publication number
CN117939203A
CN117939203A CN202410091308.5A CN202410091308A CN117939203A CN 117939203 A CN117939203 A CN 117939203A CN 202410091308 A CN202410091308 A CN 202410091308A CN 117939203 A CN117939203 A CN 117939203A
Authority
CN
China
Prior art keywords
multimedia file
multimedia
encryption
box
candidate
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202410091308.5A
Other languages
Chinese (zh)
Inventor
李学军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Super Digital Tv Technology Co ltd
Original Assignee
Beijing Super Digital Tv Technology Co ltd
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 Beijing Super Digital Tv Technology Co ltd filed Critical Beijing Super Digital Tv Technology Co ltd
Priority to CN202410091308.5A priority Critical patent/CN117939203A/en
Publication of CN117939203A publication Critical patent/CN117939203A/en
Pending legal-status Critical Current

Links

Landscapes

  • Storage Device Security (AREA)

Abstract

The invention discloses a method, a device, equipment and a medium for encrypting and decrypting a multimedia file, and relates to the technical field of data processing. The method comprises the following steps: determining whether to encrypt the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file; if the original multimedia file is encrypted, encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain a candidate multimedia file, and generating an encryption state identifier; generating an encryption state box according to the encryption state identifier, the encryption parameters and the encryption multimedia types, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file; and sending the target multimedia file to the decryption device so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file. According to the technical scheme provided by the embodiment of the invention, the safety of the multimedia file is improved.

Description

Method, device, equipment and medium for encrypting and decrypting multimedia file
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a medium for encrypting and decrypting a multimedia file.
Background
MP4 (MPEG-4 part 14) is a common digital multimedia format for storing audio, video, text and other related data, and is widely used in the Internet, mobile devices and broadcasting systems.
Currently, users can directly play the mp4 file through a player after downloading the mp4 file. Whereas for mp4 files requiring copyright protection, their random play may result in impaired rights of the copyright party.
Disclosure of Invention
The invention provides a multimedia file encryption method, a multimedia file encryption device, a multimedia file encryption equipment and a multimedia file encryption medium so as to improve the security of multimedia files.
In a first aspect, the present invention provides a multimedia file encryption method, performed by an encryption device, comprising:
Acquiring at least one candidate structure box in an original multimedia file, and an identification to be encrypted and encryption parameters of the original multimedia file;
determining whether to encrypt the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file;
if the original multimedia file is encrypted, encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain a candidate multimedia file, and generating an encryption state identifier;
Generating an encryption state box according to the encryption state identifier, the encryption parameters and the encryption multimedia types, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file;
And sending the target multimedia file to the decryption device so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file.
In a second aspect, an embodiment of the present invention provides a multimedia file decryption method, which is performed by a decryption device, including:
Acquiring a target multimedia file sent by encryption equipment, and acquiring at least one candidate structure box in the target multimedia file; wherein the candidate structure boxes include an encryption status box;
If the encryption state box comprises the encryption state identification, determining a decrypted multimedia type according to the box name and the encrypted data type of each candidate structure box;
And decrypting the target multimedia file according to the encryption parameters and the decryption multimedia types in the encryption state box to obtain candidate multimedia files.
In a third aspect, an embodiment of the present invention provides an encryption apparatus for a multimedia file, where the encryption apparatus is configured to encrypt a device, including:
the parameter acquisition module is used for acquiring at least one candidate structure box in the original multimedia file, and the identification to be encrypted and the encryption parameter of the original multimedia file;
The type determining module is used for determining whether the original multimedia file is encrypted or not according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file;
the encryption module is used for encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain a candidate multimedia file and generating an encryption state identifier if the original multimedia file is encrypted;
The target file determining module is used for generating an encryption state box according to the encryption state identification, the encryption parameters and the encryption multimedia types, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file;
and the file sending module is used for sending the target multimedia file to the decryption equipment so that the decryption equipment decrypts the target multimedia file to obtain the candidate multimedia file.
In a fourth aspect, an embodiment of the present invention provides a multimedia data decryption apparatus, which is configured in a decryption device, including:
the file acquisition module is used for acquiring the target multimedia file sent by the encryption equipment and acquiring at least one candidate structure box in the target multimedia file; wherein the candidate structure boxes include an encryption status box;
The decryption type determining module is used for determining the decryption multimedia type according to the box name and the encryption data type of each candidate structure box if the encryption state box comprises the encryption state identifier;
And the decryption module is used for decrypting the target multimedia file according to the encryption parameters and the decryption multimedia types in the encryption state box to obtain candidate multimedia files.
In a fifth aspect, an embodiment of the present invention provides an electronic device, including:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein the method comprises the steps of
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the multimedia file encryption method or the multimedia decryption method provided by any one of the embodiments of the present invention.
In a sixth aspect, an embodiment of the present invention further provides a computer readable storage medium, where computer instructions are stored, where the computer instructions are configured to cause a processor to implement the multimedia file encryption method or the multimedia decryption method according to any embodiment of the present invention when executed.
The embodiment of the invention acquires at least one candidate structure box in the original multimedia file, and the identification to be encrypted and encryption parameters of the original multimedia file; determining whether to encrypt the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file; if the original multimedia file is encrypted, encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain a candidate multimedia file, and generating an encryption state identifier; generating an encryption state box according to the encryption state identifier, the encryption parameters and the encryption multimedia types, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file; and sending the target multimedia file to the decryption device so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file. The technical scheme of the embodiment of the invention realizes the encryption processing of the multimedia file and improves the safety of the multimedia file; and the encryption state box is generated and added to the candidate multimedia files, the decryption equipment does not need to agree with encryption parameters with the encryption equipment, the flexibility of the encryption parameters is improved, the risk of cracking the multimedia files caused by the leakage of the agreed encryption parameters can be avoided, and the safety of the multimedia files is further improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a multimedia file encryption method according to a first embodiment of the present invention;
fig. 2 is a flowchart of a multimedia file encryption method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a multimedia file encryption method according to a third embodiment of the present invention;
fig. 4 is a flowchart of a method for decrypting a multimedia file according to a fourth embodiment of the present invention;
Fig. 5 is a schematic structural diagram of a multimedia file encryption device according to a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a multimedia file decrypting apparatus according to a sixth embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device implementing a multimedia file encryption method or a multimedia file decryption method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It is noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of the present invention and in the foregoing figures, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
In the technical scheme of the embodiment of the invention, the acquisition, storage, application and the like of the related original multimedia files and the like all meet the requirements of related laws and regulations, and the public sequence is not violated.
Example 1
Fig. 1 is a flowchart of a multimedia file encryption method according to a first embodiment of the present invention, where the method may be implemented by a multimedia file encryption device, and the multimedia file encryption device may be implemented in hardware and/or software, and specifically configured in an electronic device, such as a server.
Referring to the multimedia file encryption method shown in fig. 1, the method is performed by an encryption device, and includes:
S101, at least one candidate structure box in the original multimedia file and an identification to be encrypted and encryption parameters of the original multimedia file are obtained.
In this embodiment, the encryption device may be a device that encrypts the original multimedia file. The original multimedia file may be a multimedia file to be encrypted. The format of the multimedia file may be MP4 format. The identification to be encrypted may be used to uniquely identify the type of multimedia data to be encrypted in the original multimedia file. Wherein the multimedia types may include video types, audio types, and audio-video types; an audio-video type may be understood to include both a video type and an audio type. The encryption parameter may be a parameter for encrypting the original multimedia file, and for example, the encryption parameter may include at least one of an encryption key, an identification number corresponding to the encryption key, an encryption vector, an encryption mode, and the like.
In this embodiment, the multimedia file may be formed by nesting a plurality of hierarchical boxes (boxes) layer by layer. For each fabric box, the fabric box may store data or nested fabric boxes. For example, a file type box (ftyp box), a metadata box (moov box), and a multimedia data box (mdat box) may be included in the multimedia file. The file type box is used for storing data such as type and version information of the multimedia file. The multimedia data box comprises a box size field, a box type field and a data field, wherein the box size field is used for storing data volume information of the multimedia data box; the box type field is used for storing type information of the multimedia data box; the data field is used to store the actual multimedia data, i.e. video data and/or audio data. Other structure boxes may be nested in the metadata box, such as a metadata header box (mvhd box) and a track information box (trak box), etc.; other structure boxes nested in the metadata box are used for storing information such as duration and track of the multimedia file. It should be noted that, the file type box, the metadata box, etc. are only used to introduce the file structure of the multimedia file, and other structure boxes are also included in the multimedia file, which is not repeated herein.
The candidate structure boxes in this embodiment may be structure boxes parsed from the original multimedia file. Specifically, the file structure of the original multimedia file is analyzed to obtain at least one candidate structure box in the original multimedia file.
S102, determining whether to encrypt the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file.
In this embodiment, the encrypted multimedia type may refer to the type of the finally encrypted multimedia data in the original multimedia file. Specifically, a certain algorithm is adopted, whether the original multimedia file is encrypted or not is determined according to the identification to be encrypted and the box names of the candidate structure boxes, and the encrypted multimedia type of the original multimedia file is determined.
And S103, if the original multimedia file is encrypted, the original multimedia file is encrypted according to the encrypted multimedia type and the encryption parameter to obtain candidate multimedia files, and an encryption state identifier is generated.
In this embodiment, the candidate multimedia file may refer to an original multimedia file that has been encrypted; the encryption status identification may be used to characterize that the original multimedia file has been encrypted. Specifically, if the original multimedia file is encrypted, a certain algorithm is adopted, the original multimedia file is encrypted according to the encrypted multimedia type and the encryption parameter, a candidate multimedia file is obtained, and an encryption state identifier is generated.
S104, generating an encryption state box according to the encryption state identification, the encryption parameters and the encryption multimedia types, and adding the encryption state box to a preset position of the candidate multimedia file to obtain the target multimedia file.
In this embodiment, the encryption status box may refer to a structural box for characterizing the encryption status of the target multimedia file; the target multimedia file may be a multimedia file to be sent to the decryption device. The preset location may refer to a byte location of a preset candidate multimedia file.
Specifically, an initial structure box comprising an encryption status field with a null field value, an encryption parameter field with a null field value and an encryption type field with a null field value is created; the encryption state identifier is used as a field value of an encryption state field, the encryption parameter is used as a field value of an encryption parameter field, and the encrypted multimedia type is used as a field value of an encryption type field, so that an encryption state box is obtained; and adding the encryption state box into a preset position of the candidate multimedia file to obtain the target multimedia file. It should be noted that the preset position may be set by a technician according to an actual requirement or practical experience, which is not limited in the present invention. In one embodiment, the encryption status box further includes a box size field and a box type field.
And S105, sending the target multimedia file to the decryption device so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file.
In this embodiment, the decryption device may be a device that decrypts the target multimedia file; the decryption device is communicatively coupled to the encryption device. In a specific embodiment, the encryption device sends the target multimedia file to the decryption device, so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file; the decryption device may play the candidate multimedia file obtained by decryption or store the candidate multimedia file obtained by decryption, so that the candidate multimedia file can be directly played when the candidate multimedia file needs to be played, without decrypting the target multimedia file again.
Optionally, if the original multimedia file is not encrypted, generating an unencrypted state identifier, and generating an encrypted state box according to the unencrypted state identifier; and adding the encryption state box into a preset position of the original multimedia file to obtain the target multimedia file.
Wherein the unencrypted state identification may be used to characterize the original multimedia file as unencrypted. Specifically, an initial structure box comprising an encryption status field with a field value of null is created; taking the unencrypted state identifier as a field value of the encrypted state field to obtain an encrypted state box; and adding the encryption state box into a preset position of the original multimedia file to obtain the target multimedia file.
It can be appreciated that by adopting the above technical scheme, the encryption status box can be generated without encrypting the original multimedia file, and the generated encryption status box is added to the original multimedia file to obtain the target multimedia file, so that the structure of the unencrypted target multimedia file and the structure of the encrypted target multimedia file are kept consistent, further, the playing device can identify the unencrypted target multimedia file, the situation that the playing device cannot identify the unencrypted target multimedia file, and further, the unencrypted target multimedia file is subjected to error processing, so that the target multimedia file is damaged is avoided, and the security of the target multimedia file is improved.
The embodiment of the invention acquires at least one candidate structure box in the original multimedia file, and the identification to be encrypted and encryption parameters of the original multimedia file; determining whether to encrypt the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file; if the original multimedia file is encrypted, encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain a candidate multimedia file, and generating an encryption state identifier; generating an encryption state box according to the encryption state identifier, the encryption parameters and the encryption multimedia types, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file; and sending the target multimedia file to the decryption device so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file. The technical scheme of the embodiment of the invention realizes the encryption processing of the multimedia file and improves the safety of the multimedia file; and the encryption state box is generated and added to the candidate multimedia files, the decryption equipment does not need to agree with encryption parameters with the encryption equipment, the flexibility of the encryption parameters is improved, the risk of cracking the multimedia files caused by the leakage of the agreed encryption parameters can be avoided, and the safety of the multimedia files is further improved.
Example two
Fig. 2 is a flowchart of a multimedia file encryption method according to a second embodiment of the present invention, where the operation of determining whether to encrypt an original multimedia file is optimized and improved based on the technical solution of the foregoing embodiment.
Further, determining whether to encrypt the original multimedia file according to the to-be-encrypted identifier and the box names of the candidate structure boxes, and determining that the encrypted multimedia type of the original multimedia file is thinned to be the original multimedia type of the original multimedia file according to the box names of the candidate structure boxes; inquiring candidate multimedia types corresponding to the identification to be encrypted, and determining a matching result between the original multimedia types and the candidate multimedia types; if the matching result is matching, determining the matched candidate multimedia type as the encrypted multimedia type of the original multimedia file; if the matching result is not matched, generating prompt information of the identification error to be encrypted so as to perfect the operation of determining whether to encrypt the original multimedia file.
In the embodiments of the present invention, the details are not described, and reference may be made to the description of the foregoing embodiments.
Referring to fig. 2, the multimedia file encryption method includes:
S201, at least one candidate structure box in the original multimedia file and the identification to be encrypted and encryption parameters of the original multimedia file are obtained.
S202, determining the original multimedia type of the original multimedia file according to the box names of the candidate structure boxes.
In this embodiment, the original multimedia type may be a multimedia type existing in the original multimedia file. Specifically, searching multimedia types corresponding to the box names of the candidate structure boxes in configuration information between preset box names and the multimedia types; and taking the searched multimedia type as the original multimedia type. In an alternative embodiment, if the corresponding multimedia type cannot be found, determining that the original multimedia file is abnormal, and generating a prompt message of the abnormality of the original multimedia file.
S203, inquiring the candidate multimedia types corresponding to the identification to be encrypted, and determining a matching result between the original multimedia types and the candidate multimedia types.
In this embodiment, the candidate multimedia types may be multimedia types corresponding to the identifier to be encrypted. Specifically, in the configuration information between the preset identifier to be encrypted and the multimedia type, searching the candidate multimedia type corresponding to the identifier to be encrypted, and determining a matching result between the original multimedia type and the candidate multimedia type.
In an alternative embodiment, if the original multimedia type is a video type and the candidate multimedia type is a video type, the original multimedia type is matched with the candidate multimedia type; if the original multimedia type is a video type and the candidate multimedia type is an audio type or an audio-video type, the original multimedia type is not matched with the candidate multimedia type; if the original multimedia type is an audio type and the candidate multimedia type is an audio type, the original multimedia type is matched with the candidate multimedia type; if the original multimedia type is an audio type and the candidate multimedia type is a video type or an audio-video type, the original multimedia type is matched with the candidate multimedia type; if the original multimedia type is an audio/video type, the original multimedia type is matched with the candidate multimedia type.
S204, if the matching result is matching, the original multimedia file is determined to be encrypted, and the matched candidate multimedia type is determined to be the encrypted multimedia type of the original multimedia file.
And S205, if the matching result is not matching, determining that the original multimedia file is not encrypted, and generating prompt information of the identification error to be encrypted.
S206, if the original multimedia file is encrypted, the original multimedia file is encrypted according to the encrypted multimedia type and the encryption parameter to obtain candidate multimedia files, and an encryption state identifier is generated.
Specifically, if the original multimedia file is encrypted, a certain algorithm is adopted, the original multimedia file is encrypted according to the encrypted multimedia type and the encryption parameter, a candidate multimedia file is obtained, and an encryption state identifier is generated.
Optionally, the candidate structure box comprises a multimedia data box; encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain candidate multimedia files, and generating an encryption state identifier, wherein the method comprises the following steps: if the encrypted multimedia type is the same as the original multimedia type, encrypting the multimedia data stored in the multimedia data box of the original multimedia file according to the encryption parameter to obtain a candidate multimedia file, and generating an encryption state identifier; if the encrypted multimedia type is different from the original multimedia type, searching multimedia data corresponding to the encrypted multimedia type in the multimedia data box, encrypting the corresponding multimedia data to obtain a candidate multimedia file, and generating an encryption state identifier.
Specifically, if the encrypted multimedia type is the same as the original multimedia type, encrypting the multimedia data stored in the multimedia data box of the original multimedia file by adopting a set encryption algorithm and encryption parameters to obtain a candidate multimedia file, and generating an encryption state identifier; if the original multimedia type is an audio/video type and the encrypted multimedia type is a video type or an audio type, the encrypted multimedia type is different from the original multimedia type, multimedia data corresponding to the encrypted multimedia type are searched in a multimedia data box, the searched corresponding multimedia data are encrypted, candidate multimedia files are obtained, and an encryption state identifier is generated.
In an alternative embodiment, if the encryption parameter includes an identifier number corresponding to the encryption key, the corresponding encryption key is queried according to the identifier number corresponding to the encryption key, and the set encryption algorithm and encryption key are adopted to encrypt the original multimedia file, so as to obtain the candidate multimedia file.
It can be appreciated that by adopting the technical scheme, under the condition that the encrypted multimedia type is different from the original multimedia type, the multimedia data corresponding to the encrypted multimedia type can be searched in the full multimedia data, and the searched corresponding multimedia data is encrypted, so that the accuracy of encrypting the original multimedia file is improved; under the condition that the encrypted multimedia type is the same as the original multimedia type, the full multimedia data stored in the multimedia data box is encrypted, so that the efficiency of encrypting the original multimedia file is improved.
In an alternative embodiment, the candidate structure boxes include a sample block information box (stbl box); the multimedia data may be composed of at least one data block; the data block may be comprised of at least one block of samples; the sample block may include multimedia data of at least one frame; searching multimedia data corresponding to the encrypted multimedia type in the multimedia data box comprises the following steps: acquiring a sampling block information box corresponding to the encrypted multimedia type; the method comprises the steps that an offset address of at least one sampling block and the data quantity of each sampling block are stored in a sampling block information box corresponding to the encrypted multimedia type; for each sampling block in the sampling block information box corresponding to the encrypted multimedia type, determining multimedia data corresponding to the sampling block from the full multimedia data stored in the multimedia data box according to the offset address of the sampling block and the data volume of the sampling block; and taking the multimedia data corresponding to each sampling block as the multimedia data corresponding to the encrypted multimedia type. Specifically, the multimedia data with the byte at the offset address of the sampling block as the initial byte and the data amount as the data amount of the sampling block is used as the multimedia data corresponding to the sampling block.
S207, generating an encryption state box according to the encryption state identification, the encryption parameters and the encryption multimedia types, and adding the encryption state box to a preset position of the candidate multimedia file to obtain the target multimedia file.
And S208, sending the target multimedia file to the decryption device so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file.
According to the technical scheme of the embodiment of the invention, the original multimedia type of the original multimedia file is determined according to the box names of the candidate structure boxes; inquiring candidate multimedia types corresponding to the identification to be encrypted, and determining a matching result between the original multimedia types and the candidate multimedia types; if the matching result is that the original multimedia file is matched, the original multimedia file is determined to be encrypted, and the matched candidate multimedia type is determined to be the encrypted multimedia type of the original multimedia file; if the matching result is not matched, the original multimedia file is determined not to be encrypted, and prompt information of identification errors to be encrypted is generated, whether the original multimedia file is encrypted or not can be determined according to the matching result of the original multimedia type and the candidate multimedia type, and the candidate multimedia type is determined to be the encrypted multimedia type under the condition that the original multimedia file is determined to be encrypted, so that the original multimedia file is prevented from being erroneously encrypted when multimedia data corresponding to the candidate multimedia type does not exist in the original multimedia file, the original multimedia file is prevented from being damaged, and the safety of the original multimedia file is improved.
Example III
Fig. 3 is a flowchart of a multimedia file encryption method according to a third embodiment of the present invention, where the determining operation of the target multimedia file is optimized and improved based on the technical solution of the foregoing embodiment.
Further, adding the encryption state box to the preset position of the candidate multimedia file to obtain the target multimedia file, and if the preset position is the end position, adding the encryption state box to the end position of the candidate multimedia file to obtain the target multimedia file; if the preset position is not the end position, acquiring offset addresses of the candidate structure boxes in the original multimedia file, and determining a first structure box with the offset address behind the preset position; and adjusting the offset address of the first structural box according to the data quantity of the encryption state box, and adding the encryption state box into the preset position of the candidate multimedia file to obtain a target multimedia file so as to perfect the determining operation of determining the target multimedia file.
In the embodiments of the present invention, the details are not described, and reference may be made to the description of the foregoing embodiments.
Referring to the multimedia file encryption method shown in fig. 3, the method is performed by an encryption device, and includes:
S301, at least one candidate structure box in the original multimedia file and the identification to be encrypted and encryption parameters of the original multimedia file are obtained.
S302, determining whether to encrypt the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file.
S303, if the original multimedia file is encrypted, the original multimedia file is encrypted according to the encrypted multimedia type and the encryption parameter to obtain candidate multimedia files, and an encryption state identifier is generated.
S304, generating an encryption state box according to the encryption state identification, the encryption parameters and the encryption multimedia types.
And S305, if the preset position is the end position, adding the encryption status box to the end position of the candidate multimedia file to obtain the target multimedia file.
In this embodiment, the end position may be a position after the last byte of the candidate multimedia file. Specifically, if the preset position is the end position, adding the encryption state box to the end position of the candidate multimedia file; and determining the candidate multimedia file added with the encryption status box as a target multimedia file.
S306, if the preset position is not the end position, obtaining the offset address of each candidate structure box in the original multimedia file, and determining the first structure box with the offset address behind the preset position.
In this embodiment, the offset address may be used to characterize the byte start position of the candidate structure box in the original multimedia file. Specifically, the offset address of each candidate structure box in the original multimedia file is obtained, and the candidate structure box with the byte starting position represented by the offset address behind the preset position is determined as the first structure box.
S307, the offset address of the first structure box is adjusted according to the data quantity of the encryption state box, and the encryption state box is added to the preset position of the candidate multimedia file, so that the target multimedia file is obtained.
In this embodiment, the data amount of the encryption status box can be understood as the byte number of the encryption status box. Specifically, for each first structure box, adding the offset address of the first structure box and the data volume of the encryption state box to obtain an auxiliary offset address; updating the offset address of the first structure box to an auxiliary offset address; after updating the offset address of each first structure box, adding the encryption state box into the preset position of the candidate multimedia file to obtain a target multimedia file; when the offset address of the first box is updated, the offset address of each data stored in the first box is updated to be the result of adding the offset address to the data amount of the encryption box.
And S308, sending the target multimedia file to the decryption device so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file.
In the embodiment of the invention, if the preset position is the end position, the encryption state box is added to the end position of the candidate multimedia file to obtain the target multimedia file; if the preset position is not the end position, acquiring offset addresses of the candidate structure boxes in the original multimedia file, and determining a first structure box with the offset address behind the preset position; the method comprises the steps of adjusting the offset address of a first structure box according to the data quantity of an encryption state box, adding the encryption state box into a preset position of a candidate multimedia file to obtain a target multimedia file, adjusting the first structure box in the candidate structure box according to the preset position, and avoiding conflict between the offset address of the candidate structure box and the offset address of the encryption state box, so that the target multimedia file cannot be decrypted or played correctly, and the accuracy of the target multimedia file is improved.
Example IV
Fig. 4 is a flowchart of a multimedia file decrypting method according to a fourth embodiment of the present invention, where the method may be performed by a multimedia file encrypting apparatus, and the multimedia file decrypting apparatus may be implemented in hardware and/or software, and specifically configured in an electronic device, such as a server.
Referring to the multimedia file decryption method shown in fig. 4, performed by a decryption device, includes:
s401, acquiring a target multimedia file sent by encryption equipment, and acquiring at least one candidate structure box in the target multimedia file; wherein the candidate structure boxes include an encryption status box.
In this embodiment, the target multimedia file may be a multimedia file transmitted from the received encryption device. The encryption device may be a device that encrypts the original multimedia file. The original multimedia file may be an unencrypted multimedia file.
In this embodiment, the candidate structure box may be a structure box parsed from the original multimedia file. The encryption status box may characterize a structural box of the encryption status of the target multimedia file. The multimedia file may be composed of a plurality of hierarchical structure boxes (boxes) nested one above the other. For each fabric box, the fabric box may store data or nested fabric boxes. For example, a file type box (ftyp box), a metadata box (moov box), and a multimedia data box (mdat box) may be included in the multimedia file. The file type box is used for storing data such as type and version information of the multimedia file. The multimedia data box comprises a box size field, a box type field and a data field, wherein the box size field is used for storing data volume information of the multimedia data box; the box type field is used for storing type information of the multimedia data box; the data field is used to store the actual multimedia data, i.e. video data and/or audio data. Other structure boxes may be nested in the metadata box, such as a metadata header box (mvhd box) and a track information box (trak box), etc.; other structure boxes nested in the metadata box are used for storing information such as duration and track of the multimedia file. It should be noted that, the file type box, the metadata box, etc. are only used to introduce the file structure of the multimedia file, and other structure boxes are also included in the multimedia file, which is not repeated herein.
Specifically, a target multimedia file sent by an encryption device is obtained, and structural analysis is performed on the target multimedia file to obtain at least one candidate structure box.
S402, if the encryption state box comprises the encryption state identification, determining the decryption multimedia type according to the box name of each candidate structure box and the encryption multimedia type in the encryption state box.
In this embodiment, the encryption status flag may be used to characterize that the target multimedia file is an encrypted multimedia file. The encrypted multimedia type may refer to a type of multimedia data encrypted in the original multimedia file. The encrypted multimedia types include video type, audio-video type, etc.; the audio/video type may include both a video type and an audio type. The decrypted multimedia type may refer to a type of multimedia data to be decrypted in the target multimedia file.
Specifically, a set algorithm is adopted, and the decrypted multimedia type is determined according to the box name of each candidate structure box and the encrypted multimedia type in the encryption state box.
Optionally, determining the decrypted multimedia type according to the box name of each candidate structure box and the encrypted multimedia type in the encrypted state box includes: determining the original multimedia type of the target multimedia file according to the box names of the candidate structure boxes; determining a matching result between the original multimedia type and the encrypted multimedia type; if the matching result is matching, determining that the encrypted multimedia type is the decrypted multimedia type; if the matching result is not matched, generating a prompting message of the target multimedia file error.
Specifically, searching multimedia types corresponding to the box names of the candidate structure boxes in configuration information between preset box names and the multimedia types; and taking the searched multimedia type as the original multimedia type. In an alternative embodiment, if the corresponding multimedia type cannot be found, determining that the target multimedia file is abnormal, and generating a prompt message of the abnormality of the target multimedia file.
In an alternative embodiment, the target multimedia file is taken as the original multimedia file if the unencrypted status flag is included in the encrypted status box.
S403, decrypting the target multimedia file according to the encryption parameters and the decryption multimedia types in the encryption state box to obtain candidate multimedia files.
In this embodiment, the candidate multimedia file may be a multimedia file obtained by decrypting the target multimedia file.
Specifically, a certain algorithm is adopted, and the target multimedia file is decrypted according to the encryption parameters and the decrypted multimedia type in the encryption state box, so that the candidate multimedia file is obtained.
Optionally, the candidate structure boxes include multimedia structure boxes; decrypting the target multimedia file according to the encryption parameters and the decryption multimedia types in the encryption state box to obtain candidate multimedia files, wherein the method comprises the following steps: if the decrypted multimedia type is the same as the original multimedia type, decrypting the target multimedia file according to the encryption parameters in the encryption state box and the decrypted multimedia type to obtain a candidate multimedia file; if the decrypted multimedia type is not communicated with the original multimedia type, searching multimedia data corresponding to the decrypted multimedia type in the multimedia data box, and decrypting the corresponding multimedia data to obtain a candidate multimedia file.
Specifically, if the original multimedia type is an audio/video type and the decrypted multimedia type is a video type or an audio type, the encrypted multimedia type is different from the original multimedia type, multimedia data corresponding to the decrypted multimedia type is searched in the multimedia data box, and the searched corresponding multimedia data is decrypted to obtain a candidate multimedia file.
In an alternative embodiment, if the encryption parameter includes an identifier number corresponding to the encryption key, the corresponding encryption key is queried according to the identifier number corresponding to the encryption key, and the target multimedia file is decrypted by adopting a set algorithm and the encryption key, so as to obtain the candidate multimedia file.
In an alternative embodiment, the candidate structure boxes include a sample block information box (stbl box); the multimedia data may be composed of at least one data block; the data block may be comprised of at least one block of samples; the sample block may include multimedia data of at least one frame; searching the multimedia data corresponding to the decrypted multimedia type in the multimedia data box comprises the following steps: acquiring a sampling block information box corresponding to the decrypted multimedia type; wherein, the offset address of at least one sampling block and the data quantity of each sampling block are stored in the sampling block information box corresponding to the decrypted multimedia type; for each sampling block in the sampling block information box corresponding to the decrypted multimedia type, determining the multimedia data corresponding to the sampling block from the full multimedia data stored in the multimedia data box according to the offset address of the sampling block and the data volume of the sampling block; and taking the multimedia data corresponding to each sampling block as the multimedia data corresponding to the decrypted multimedia type. Specifically, the multimedia data with the byte at the offset address of the sampling block as the initial byte and the data amount as the data amount of the sampling block is used as the multimedia data corresponding to the sampling block.
In an alternative embodiment, after obtaining the candidate multimedia file, the method further comprises: generating an unencrypted state identifier; wherein the unencrypted state identification may be used to characterize the multimedia file as unencrypted; the encryption state identification in the encryption state box in the candidate multimedia file is replaced by the unencrypted state identification, so that the candidate multimedia file with the unencrypted state identification can be stored after the candidate multimedia file is identified by the unencrypted state, and the target multimedia file does not need to be decrypted again to obtain the candidate multimedia file when the candidate multimedia file needs to be played.
According to the technical scheme, the decryption processing of the multimedia file is realized, and the safety of the multimedia file is improved; and the encryption state box is generated and added to the candidate multimedia files, the decryption equipment does not need to agree with encryption parameters with the encryption equipment, the flexibility of the encryption parameters is improved, the risk of cracking the multimedia files caused by the leakage of the agreed encryption parameters can be avoided, and the safety of the multimedia files is further improved.
Example five
Fig. 5 is a schematic structural diagram of a multimedia file encryption device according to a fifth embodiment of the present invention. The embodiment of the invention is applicable to the situation of encrypting the multimedia file, the device can execute the multimedia file encryption method, the multimedia file encryption device can be realized in the form of hardware and/or software, and the device can be configured in electronic equipment, such as a server.
Referring to fig. 5, the multimedia file encrypting apparatus, configured to an encrypting device, includes a parameter acquiring module 501, a type determining module 502, an encrypting module 503, a target file determining module 504 and a file transmitting module 505, wherein,
The parameter obtaining module 501 is configured to obtain at least one candidate structure box in the original multimedia file, and an identifier to be encrypted and an encryption parameter of the original multimedia file;
The type determining module 502 is configured to determine whether to encrypt the original multimedia file according to the identifier to be encrypted and the box names of the candidate structure boxes, and determine an encrypted multimedia type of the original multimedia file;
an encryption module 503, configured to encrypt, if the original multimedia file is encrypted, the original multimedia file according to the encrypted multimedia type and the encryption parameter, obtain a candidate multimedia file, and generate an encryption status identifier;
The target file determining module 504 is configured to generate an encryption status box according to the encryption status identifier, the encryption parameter and the encrypted multimedia type, and add the encryption status box to a preset position of the candidate multimedia file to obtain a target multimedia file;
The file sending module 505 is configured to send the target multimedia file to the decryption device, so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file.
According to the technical scheme, at least one candidate structure box in the original multimedia file, and the identification to be encrypted and the encryption parameters of the original multimedia file are acquired through a parameter acquisition module; determining whether to encrypt the original multimedia file or not and determining the encrypted multimedia type of the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes through a type determining module; if the original multimedia file is encrypted through the encryption module, the original multimedia file is encrypted according to the encrypted multimedia type and the encryption parameter to obtain a candidate multimedia file, and an encryption state identifier is generated; generating an encryption state box according to the encryption state identification, the encryption parameters and the encryption multimedia types through a target file determining module, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file; and transmitting the target multimedia file to the decryption device through the file transmitting module so that the decryption device decrypts the target multimedia file to obtain the candidate multimedia file. The technical scheme of the embodiment of the invention realizes the encryption processing of the multimedia file and improves the safety of the multimedia file; and the encryption state box is generated and added to the candidate multimedia files, the decryption equipment does not need to agree with encryption parameters with the encryption equipment, the flexibility of the encryption parameters is improved, the risk of cracking the multimedia files caused by the leakage of the agreed encryption parameters can be avoided, and the safety of the multimedia files is further improved.
Optionally, the type determining module 502 includes:
the original type determining unit is used for determining the original multimedia type of the original multimedia file according to the box names of the candidate structure boxes;
the matching result determining unit is used for inquiring the candidate multimedia type corresponding to the identification to be encrypted and determining a matching result between the original multimedia type and the candidate multimedia type;
the encryption type determining unit is used for determining to encrypt the original multimedia file if the matching result is matching, and determining the matched candidate multimedia type as the encrypted multimedia type of the original multimedia file;
And the information generating unit is used for determining not to encrypt the original multimedia file if the matching result is not matching, and generating prompt information of the identification error to be encrypted.
Optionally, the candidate structure box comprises a multimedia data box; an encryption module 503, comprising:
The first encryption unit is used for encrypting the multimedia data stored in the multimedia data box of the original multimedia file according to the encryption parameters if the encrypted multimedia type is the same as the original multimedia type, so as to obtain a candidate multimedia file and generate an encryption state identifier;
And the second encryption unit is used for searching multimedia data corresponding to the encrypted multimedia type in the multimedia data box if the encrypted multimedia type is different from the original multimedia type, encrypting the corresponding multimedia data to obtain a candidate multimedia file, and generating an encryption state identifier.
Optionally, the target file determining module 504 includes:
the first file determining unit is used for adding the encryption state box to the tail position of the candidate multimedia file if the preset position is the tail position, so as to obtain a target multimedia file;
The offset address acquisition module is used for acquiring the offset address of each candidate structure box in the original multimedia file if the preset position is not the end position, and determining a first structure box with the offset address behind the preset position;
And the second file determining unit is used for adjusting the offset address of the first structure box according to the data quantity of the encryption state box, and adding the encryption state box to the preset position of the candidate multimedia file to obtain the target multimedia file.
Optionally, the apparatus further comprises:
The identification generation module is used for generating an unencrypted state identification if the original multimedia file is not encrypted, and generating an encrypted state box according to the unencrypted state identification;
And the offset address adjustment module is used for adding the encryption state box into a preset position of the original multimedia file, and adjusting the offset address of the first structure box according to the size of the encryption state box to obtain the target multimedia file.
The multimedia file encryption device provided by the embodiment of the invention can execute the multimedia file encryption method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the multimedia file encryption method.
Example six
Fig. 6 is a schematic structural diagram of a multimedia file decrypting apparatus according to a sixth embodiment of the present invention. The embodiment of the invention can be applied to the condition of decrypting the multimedia file, the device can execute the multimedia file decrypting method, the multimedia file decrypting device can be realized in the form of hardware and/or software, and the device can be configured in electronic equipment, such as a server.
Referring to fig. 6, the multimedia file decrypting apparatus, configured in a decrypting device, includes a file obtaining module 601, a decryption type determining module 602 and a decrypting module 603, wherein,
A file obtaining module 601, configured to obtain a target multimedia file sent by an encryption device, and obtain at least one candidate structure box in the target multimedia file; wherein the candidate structure boxes include an encryption status box;
A decryption type determining module 602, configured to determine a decrypted multimedia type according to the box name and the encrypted data type of each candidate structure box if the encrypted state box includes the encrypted state identifier;
and the decryption module 603 is configured to decrypt the target multimedia file according to the encryption parameter and the decrypted multimedia type in the encryption status box, so as to obtain a candidate multimedia file.
The technical scheme of the embodiment of the invention realizes the decryption processing of the encrypted multimedia file and improves the safety of the multimedia file; and the decryption is carried out according to the encryption parameters in the encryption state box in the candidate multimedia file, the decryption equipment does not need to agree with the encryption parameters, the flexibility of the encryption parameters is improved, the risk of cracking the multimedia file caused by the revealing of the agreed encryption parameters can be avoided, and the safety of the multimedia file is further improved.
The multimedia file decryption device provided by the embodiment of the invention can execute the multimedia file decryption method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the multimedia file decryption method.
Example seven
Fig. 7 shows a schematic diagram of an electronic device 700 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 7, the electronic device 700 includes at least one processor 701, and a memory, such as a Read Only Memory (ROM) 702, a Random Access Memory (RAM) 703, etc., communicatively connected to the at least one processor 701, in which the memory stores a computer program executable by the at least one processor, and the processor 701 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 702 or the computer program loaded from the storage unit 708 into the Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 may also be stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Various components in the electronic device 700 are connected to the I/O interface 705, including: an input unit 706 such as a keyboard, a mouse, etc.; an output unit 707 such as various types of displays, speakers, and the like; a storage unit 708 such as a magnetic disk, an optical disk, or the like; and a communication unit 709 such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows the electronic device 700 to exchange information/data with other devices through a computer network, such as the internet, and/or various telecommunication networks.
The processor 701 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 701 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 701 performs the respective methods and processes described above, such as a multimedia file encryption method or a multimedia file decryption method.
In some embodiments, the multimedia file encryption method or the multimedia file decryption method may be implemented as a computer program, which is tangibly embodied on a computer-readable storage medium, such as the storage unit 708. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 700 via the ROM 702 and/or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the processor 701, one or more steps of the multimedia file encryption method or the multimedia file decryption method described above may be performed. Alternatively, in other embodiments, the processor 701 may be configured to perform the multimedia file encryption method or the multimedia file decryption method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above can be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable multimedia file encrypting apparatus, such that the computer programs, when executed by the processor, cause the functions/operations specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and Virtual private server (VPS PRIVATE SERVER) service.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of encrypting a multimedia file, the method being performed by an encryption device, the method comprising:
Acquiring at least one candidate structure box in an original multimedia file, and an identification to be encrypted and encryption parameters of the original multimedia file;
Determining whether to encrypt the original multimedia file according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file;
If the original multimedia file is encrypted, encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain a candidate multimedia file, and generating an encryption state identifier;
Generating an encryption state box according to the encryption state identifier, the encryption parameters and the encryption multimedia type, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file;
and sending the target multimedia file to decryption equipment so that the decryption equipment decrypts the target multimedia file to obtain candidate multimedia files.
2. The method of claim 1, wherein the determining whether to encrypt the original multimedia file and determining the encrypted multimedia type of the original multimedia file based on the identification to be encrypted and the box name of each candidate structure box comprises:
determining the original multimedia type of the original multimedia file according to the box name of each candidate structure box;
Inquiring the candidate multimedia type corresponding to the identification to be encrypted, and determining a matching result between the original multimedia type and the candidate multimedia type;
if the matching result is that the original multimedia file is matched, the original multimedia file is determined to be encrypted, and the matched candidate multimedia type is determined to be the encrypted multimedia type of the original multimedia file;
If the matching result is not matched, the original multimedia file is determined not to be encrypted, and the prompt information of the identification error to be encrypted is generated.
3. The method of claim 2, wherein the candidate structure boxes comprise multimedia data boxes; encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain candidate multimedia files, and generating an encryption state identifier, wherein the encryption state identifier comprises the following steps:
If the encrypted multimedia type is the same as the original multimedia type, encrypting the multimedia data stored in the multimedia data box of the original multimedia file according to the encryption parameter to obtain a candidate multimedia file, and generating an encryption state identifier;
If the encrypted multimedia type is different from the original multimedia type, searching multimedia data corresponding to the encrypted multimedia type in the multimedia data box, encrypting the corresponding multimedia data to obtain candidate multimedia files, and generating an encryption state identifier.
4. The method according to claim 1, wherein adding the encryption status box to the candidate multimedia file in the preset location to obtain the target multimedia file comprises:
If the preset position is the end position, adding the encryption state box to the end position of the candidate multimedia file to obtain a target multimedia file;
If the preset position is not the end position, acquiring offset addresses of the candidate structure boxes in the original multimedia file, and determining a first structure box with the offset address behind the preset position;
And adjusting the offset address of the first structure box according to the data quantity of the encryption state box, and adding the encryption state box into the preset position of the candidate multimedia file to obtain the target multimedia file.
5. The method according to claim 1, wherein the method further comprises:
if the original multimedia file is not encrypted, generating an unencrypted state identifier, and generating an encrypted state box according to the unencrypted state identifier;
and adding the encryption state box into a preset position of the original multimedia file to obtain a target multimedia file.
6. A method of decrypting multimedia data, performed by a decryption device, the method comprising:
Acquiring a target multimedia file sent by encryption equipment, and acquiring at least one candidate structure box in the target multimedia file; wherein the candidate structure boxes include an encryption status box;
If the encryption state box comprises the encryption state identification, determining a decryption multimedia type according to the box name of each candidate structure box and the encryption multimedia type in the encryption state box;
And decrypting the target multimedia file according to the encryption parameters in the encryption state box and the decryption multimedia type to obtain candidate multimedia files.
7. An encryption apparatus for a multimedia file, the apparatus being configured to encrypt a device, the apparatus comprising:
the parameter acquisition module is used for acquiring at least one candidate structure box in the original multimedia file, and an identifier to be encrypted and an encryption parameter of the original multimedia file;
The type determining module is used for determining whether the original multimedia file is encrypted or not according to the identification to be encrypted and the box names of the candidate structure boxes, and determining the encrypted multimedia type of the original multimedia file;
the encryption module is used for encrypting the original multimedia file according to the encrypted multimedia type and the encryption parameter to obtain candidate multimedia files and generating an encryption state identifier if the original multimedia file is encrypted;
The target file determining module is used for generating an encryption state box according to the encryption state identifier, the encryption parameters and the encryption multimedia type, and adding the encryption state box into a preset position of the candidate multimedia file to obtain a target multimedia file;
And the file sending module is used for sending the target multimedia file to decryption equipment so that the decryption equipment decrypts the target multimedia file to obtain a candidate multimedia file.
8. A multimedia data decryption apparatus, configured for a decryption device, the apparatus comprising:
The file acquisition module is used for acquiring a target multimedia file sent by the encryption equipment and acquiring at least one candidate structure box in the target multimedia file; wherein the candidate structure boxes include an encryption status box;
The decryption type determining module is used for determining a decryption multimedia type according to the box name and the encryption data type of each candidate structure box if the encryption state box comprises the encryption state identifier;
And the decryption module is used for decrypting the target multimedia file according to the encryption parameters in the encryption state box and the decryption multimedia type to obtain candidate multimedia files.
9. An electronic device, the electronic device comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the multimedia file encryption method or the multimedia file decryption method of any one of claims 1-6.
10. A computer readable storage medium storing computer instructions for causing a processor to implement the multimedia file encryption method or the multimedia file decryption method of any one of claims 1-6 when executed.
CN202410091308.5A 2024-01-23 2024-01-23 Method, device, equipment and medium for encrypting and decrypting multimedia file Pending CN117939203A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410091308.5A CN117939203A (en) 2024-01-23 2024-01-23 Method, device, equipment and medium for encrypting and decrypting multimedia file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410091308.5A CN117939203A (en) 2024-01-23 2024-01-23 Method, device, equipment and medium for encrypting and decrypting multimedia file

Publications (1)

Publication Number Publication Date
CN117939203A true CN117939203A (en) 2024-04-26

Family

ID=90751769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410091308.5A Pending CN117939203A (en) 2024-01-23 2024-01-23 Method, device, equipment and medium for encrypting and decrypting multimedia file

Country Status (1)

Country Link
CN (1) CN117939203A (en)

Similar Documents

Publication Publication Date Title
US9767300B2 (en) Managing restricted tagged content elements within a published message
EP4191430A1 (en) Data processing method and apparatus applied to blockchain system
US9342666B2 (en) Providing security support for digital rights management in different formats
CN110401677B (en) Method and device for acquiring digital copyright key, storage medium and electronic equipment
US20170364691A1 (en) Method and System for Controlling Encryption of Information and Analyzing Information as well as Terminal
US10601590B1 (en) Secure secrets in hardware security module for use by protected function in trusted execution environment
CN108848413B (en) System, method and device for preventing video from replay attack and storage medium
CN112016113A (en) Data encryption and decryption method, device and system
CN114785524B (en) Electronic seal generation method, device, equipment and medium
CN116383867A (en) Data query method, device, electronic equipment and computer readable medium
CN109711178B (en) Key value pair storage method, device, equipment and storage medium
CN113794706B (en) Data processing method and device, electronic equipment and readable storage medium
CN112560003A (en) User authority management method and device
WO2024032289A1 (en) Video playback method and system, video security platform, and communication device
CN116781425A (en) Service data acquisition method, device, equipment and storage medium
CN111783140A (en) Request response method and device, electronic equipment and computer readable storage medium
CN116633582A (en) Secure communication method, apparatus, electronic device and storage medium
CN116405199A (en) Encryption method, device, equipment and medium based on NTRU algorithm and SM2 algorithm
CN117939203A (en) Method, device, equipment and medium for encrypting and decrypting multimedia file
CN115883199A (en) File transmission method and device, electronic equipment and storage medium
CN115909560A (en) Data encryption method, data decryption method and door lock system
CN114117388A (en) Device registration method, device registration apparatus, electronic device, and storage medium
CN111030930B (en) Decentralized network data fragment transmission method, device, equipment and medium
CN109218009A (en) It is a kind of to improve the method for device id safety, client and server
CN113542224A (en) Training data processing method, device, server and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination