WO2015154285A1 - 设备文件的加解密方法及装置 - Google Patents

设备文件的加解密方法及装置 Download PDF

Info

Publication number
WO2015154285A1
WO2015154285A1 PCT/CN2014/075102 CN2014075102W WO2015154285A1 WO 2015154285 A1 WO2015154285 A1 WO 2015154285A1 CN 2014075102 W CN2014075102 W CN 2014075102W WO 2015154285 A1 WO2015154285 A1 WO 2015154285A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
encryption algorithm
blocks
encrypted
information table
Prior art date
Application number
PCT/CN2014/075102
Other languages
English (en)
French (fr)
Inventor
宋卓
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201480000612.9A priority Critical patent/CN104205117B/zh
Priority to PCT/CN2014/075102 priority patent/WO2015154285A1/zh
Publication of WO2015154285A1 publication Critical patent/WO2015154285A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption

Definitions

  • the embodiments of the present invention relate to the field of computer technologies, and in particular, to a method and device for encrypting and decrypting device files. Background technique
  • various communication, electronic, and mechanical manufacturing equipment generally use software to control various functions of the device, and software that implements various functions in the device is collectively referred to as device software.
  • the device software is part of the equipment manufacturer's intellectual property.
  • the device software needs to be encrypted and stored. Decryption is only done.
  • the software package file of the device software is large, and the system for encrypting or decrypting large files in the device software is relatively expensive and takes a long time.
  • the package files in the device software need to be decrypted first, so the decryption time becomes a key factor affecting the startup time of the device.
  • the device software is upgraded, the software package of the downloaded device software is encrypted and stored. Encrypting the software package consumes processor overhead. If the cost is too large, the normal service will be affected.
  • the prior art generally includes two methods for encrypting large files in the device software.
  • the first method uses a weak encryption algorithm to encrypt large files in the device software, and usually only encrypts software and configuration files in the device software. Large files (such as software packages) in the software are not encrypted.
  • the encryption time and decryption time of the weak encryption algorithm are short, the security is low. When the weak encryption algorithm is cracked, the decompilation can lead to the key information assets of the device manufacturer. The leak is also vulnerable to attacks by hackers by analyzing code vulnerabilities.
  • the other is to encrypt the software, configuration files and large files in the device software by using a strong encryption algorithm. Although this method has high security, the encryption and decryption takes a long time, and the device processor resources are high and expensive. Will increase equipment costs.
  • the invention provides a method and a device for encrypting and decrypting a device file, which can simultaneously consider the security and the processing speed when encrypting and decrypting a device file.
  • the first aspect provides a method for encrypting a device file, including:
  • the splitting the device file into the first part and the second part includes:
  • the at least two file blocks are combined into the first portion and the second portion, wherein the first portion and the second portion each include at least one file block.
  • the device file is divided into at least two file blocks, including:
  • Combining the at least two file blocks into the first portion and the second portion comprising: combining the at least two file blocks into the first portion and the second portion, wherein The positions and numbers of the file blocks included in the first part and the second part are respectively determined according to the policy;
  • the method further includes: determining, according to the policy, a first encryption algorithm corresponding to the file block in the first part and a file block in the second part Corresponding to the second encryption algorithm.
  • the policy includes: starting address and length of a file block when performing segmentation on the device file, the first part and the The location and number of file blocks in the second part, and the encryption algorithm corresponding to the file blocks in the first part and the second part.
  • the first part includes a file block
  • the importance of the data is greater than the importance of the data in the file blocks included in the second portion; the security of the first encryption algorithm is higher than the security of the second encryption algorithm.
  • the splitting the device file into the first part and the second part includes:
  • a file block whose importance in the at least two file blocks does not exceed a preset threshold is combined into the second portion.
  • the ratio of the capacity of the file block in the first part to the total capacity of the device file is a first ratio.
  • the splitting the device file into the first part and the second part includes:
  • the ratio of the capacity of the part of the file blocks to the total capacity of the device file is the first ratio
  • Another partial file block other than the portion of the at least two file blocks is combined into the second portion.
  • the security of the first encryption algorithm is higher than the security of the second encryption algorithm; A ratio is less than 50%.
  • the method may further include: in a ninth possible implementation, the method further includes:
  • Generating an information table including a starting address and length of each of the at least two file blocks, a location and a number of file blocks included in the first portion and the second portion, a correspondence between the file block in the first part and the first encryption algorithm, and a correspondence between the file block in the second part and the second encryption algorithm;
  • the information table is stored in a preset area of the encrypted device file, or the information table is stored as a first file independent of the encrypted device file.
  • the information table After generating the information table, it also includes:
  • the storing the information table in a preset area of the encrypted device file, or storing the information table as a first file independent of the encrypted device file includes:
  • the encrypted information table is stored in a preset area of the encrypted device file, or the encrypted information table is stored as a first file independent of the encrypted device file.
  • the second aspect provides a method for decrypting a device file, including:
  • the encrypted device file Separating the encrypted device file into a first portion and a second portion, wherein the first portion and the second portion respectively comprise at least one file block;
  • the splitting the encrypted device file into the first part and the second part includes:
  • the method further includes: determining, according to the policy, the first decryption algorithm corresponding to the file block in the first part and the second part in the second part The second decryption algorithm corresponding to the file block.
  • the policy includes: a starting address and a length of the file block in the first part and the second part, the foregoing a portion and a location of the file block in the second portion, a decryption algorithm corresponding to the file block in the first portion and the second portion.
  • the method before the splitting the encrypted device file into the first part and the second part, the method further includes:
  • the encrypted device file Obtained from the encrypted device file or in the first file independent of the encrypted device file And taking the information table of the encrypted device file, where the information table includes a start address and a length of the file block in the first part and the second part, and files included in the first part and the second part a location and number of blocks, the first encryption algorithm corresponding to the file block in the first portion, and the second encryption algorithm corresponding to the file block in the second portion;
  • the dividing the encrypted device file into the first part and the second part including:
  • the device file is divided into the first part and the second part;
  • the method further includes: according to the first encryption algorithm corresponding to the file block in the first part in the information table, and the second part The second encryption algorithm corresponding to the file block, determining the first decryption algorithm corresponding to the file block in the first part and the second decryption algorithm corresponding to the file block in the second part,
  • the first decryption algorithm is reciprocal to the first encryption algorithm
  • the second decryption algorithm is reciprocal to the second encryption algorithm.
  • the method further includes: decrypting the encrypted information table.
  • the third aspect provides an encryption device for a device file, including:
  • a dividing unit configured to divide the device file into a first part and a second part, where the first part and the second part respectively comprise at least one file block;
  • An encryption unit configured to encrypt the first part and the second part respectively, where an encryption algorithm corresponding to the file block in the first part is a first encryption algorithm, and a file block in the second part corresponds to
  • the encryption algorithm is a second encryption algorithm, and the first encryption algorithm is different from the second encryption algorithm;
  • a storage unit for storing encrypted device files.
  • the dividing unit includes:
  • a dividing subunit configured to divide the device file into at least two file blocks
  • the splitting subunit is specifically configured to divide the device file into at least two file blocks, where each file block The starting address and length are determined according to a preset policy;
  • the combining subunit is specifically configured to combine the at least two file blocks into the first part and the second part, wherein a location of a file block included in the first part and the second part is The quantity is determined according to the policy;
  • the device for encrypting the device file further includes:
  • a determining unit configured to determine, according to the policy, a first encryption algorithm corresponding to the file block in the first part and the second encryption algorithm corresponding to the file block in the second part.
  • the policy includes: starting address and length of a file block when performing segmentation on the device file, the first part and the The location and number of file blocks in the second part, and the encryption algorithm corresponding to the file blocks in the first part and the second part.
  • the data in the file block included in the first part is greater than the data in the file block included in the second part; the first encryption algorithm The security is higher than the security of the second encryption algorithm.
  • the segmentation subunit is specifically configured to divide the device file into at least two file blocks
  • the combining subunit is further configured to combine file blocks whose importance in the at least two file blocks exceeds a preset threshold into the first part; and importance of data in the at least two file blocks A file block whose sex does not exceed a preset threshold is combined into the second part.
  • a ratio of a capacity of the file block in the first part to a total capacity of the device file is a first ratio.
  • the segmentation subunit is further configured to divide the device file into at least two file blocks;
  • the combining subunit is further configured to combine a part of the at least two file blocks into the first part, where a ratio of a capacity of the part of the file block to a total capacity of the device file is the first part a ratio; combining another partial file block other than the portion of the at least two file blocks into the second portion.
  • the device may further include: in the ninth possible implementation, the device for encrypting the device file further includes:
  • a generating unit configured to generate an information table, where the information table includes a starting address and a length of each of the at least two file blocks, and a location of the file block included in the first portion and the second portion And a quantity, a correspondence between the file block in the first part and the first encryption algorithm, and a correspondence between the file block in the second part and the second encryption algorithm;
  • the storage unit is further configured to store the information table in a preset area of the encrypted device file, or store the information table as a first file independent of the encrypted device file.
  • the encryption unit is further configured to perform encryption on the information table, where an encryption algorithm corresponding to the information table is An encryption algorithm;
  • the storage unit is further configured to store the encrypted information table in a preset area of the encrypted device file, or store the encrypted information table as a first file independent of the encrypted device file.
  • a fourth aspect provides a device file decryption apparatus, including:
  • a dividing unit configured to divide the encrypted device file into a first part and a second part, where the first part and the second part respectively comprise at least one file block;
  • a decryption unit configured to decrypt the first part and the second part respectively, wherein a decryption algorithm corresponding to the file block in the first part is a first decryption algorithm, and a file block in the second part corresponds to
  • the decryption algorithm is a second decryption algorithm, and the first decryption algorithm is different from the second decryption algorithm;
  • a storage unit for storing the decrypted device file.
  • the dividing unit is specifically configured to divide the encrypted device file into the first part and the second part, where the first part and the first part The location and the number of the file blocks included in the second part are respectively determined according to a preset policy, and the start addresses and lengths of the file blocks included in the first part and the second part are respectively determined according to the policy;
  • the device for decrypting the device file further includes:
  • a determining unit configured to determine, according to the policy, the corresponding file block in the first part a first decryption algorithm and the second decryption algorithm corresponding to the file block in the second portion.
  • the policy includes: a start address and a length of the file block in the first part and the second part, the foregoing a portion and a location of the file block in the second portion, a decryption algorithm corresponding to the file block in the first portion and the second portion.
  • the device for decrypting the device file further includes: an acquiring unit, configured to be used in the first file of the encrypted device file or from the encrypted device file Obtaining an information table of the encrypted device file, where the information table includes a start address and a length of the file block in the first part and the second part, and a file included in the first part and the second part a location and number of blocks, the first encryption algorithm corresponding to the file block in the first portion, and the second encryption algorithm corresponding to the file block in the second portion;
  • the dividing unit is further configured to: according to the starting address and length of the file block in the first part and the second part in the information table, the file block included in the first part and the second part a location and quantity, the encrypted device file is divided into the first part and the second part; the determining unit is further configured to: according to the file block corresponding to the file part in the first part in the information table Determining, by the first encryption algorithm and the second encryption algorithm corresponding to the file block in the second part, the first decryption algorithm corresponding to the file block in the first part and the file block in the second part Corresponding to the second decryption algorithm, the first decryption algorithm is reciprocal with the first encryption algorithm, and the second decryption algorithm and the second encryption algorithm are mutually reciprocal.
  • the decrypting unit is further configured to: if the information table is an encrypted information table, the encrypted information table Decrypt.
  • the method and apparatus for encrypting and decrypting device files provided by the embodiments of the present invention, by dividing the device file into the first part and the second part, and using different first encryption algorithms and second encryption algorithms in the first part and the second part
  • the file block is encrypted, and then the encrypted device file is stored, so that the encrypted device file balances the security and processing speed of encryption and decryption.
  • FIG. 1 is a flowchart of Embodiment 1 of a device file encryption method according to an embodiment of the present invention
  • FIG. 2 is a flowchart of Embodiment 2 of a device file encryption method according to an embodiment of the present invention
  • FIG. 4 is a flowchart of Embodiment 4 of a method for encrypting a device file according to an embodiment of the present invention
  • FIG. 5 is a flowchart of a method for decrypting a device file according to an embodiment of the present invention
  • FIG. 6 is a flowchart of Embodiment 2 of a method for decrypting a device file according to an embodiment of the present invention
  • FIG. 7 is a flowchart of Embodiment 3 of a method for decrypting a device file according to an embodiment of the present invention
  • FIG. 9 is a schematic structural diagram of Embodiment 2 of an apparatus for encrypting a device file according to an embodiment of the present disclosure
  • FIG. 10 is a schematic structural diagram of Embodiment 3 of an apparatus for encrypting a device file according to an embodiment of the present disclosure
  • FIG. 11 is a schematic structural diagram of Embodiment 4 of an apparatus for encrypting a device file according to an embodiment of the present disclosure
  • FIG. 12 is a schematic structural diagram of Embodiment 1 of a device file decryption apparatus according to an embodiment of the present disclosure
  • FIG. 13 is a schematic structural diagram of Embodiment 2 of a device file decryption apparatus according to an embodiment of the present disclosure
  • FIG. 14 is a schematic structural diagram of Embodiment 3 of a device file decryption apparatus according to an embodiment of the present disclosure
  • FIG. 15 is a schematic structural diagram of Embodiment 5 of an apparatus for encrypting a device file according to an embodiment of the present disclosure
  • FIG. 16 is a schematic structural diagram of Embodiment 4 of a device file decryption apparatus according to an embodiment of the present invention. detailed description
  • a strong encryption algorithm or a weak encryption algorithm may be selected, wherein the security of the strong encryption algorithm is higher than the security of the weak encryption algorithm.
  • the file in the device software is called a device file.
  • the computational complexity of the strong encryption algorithm is higher than that of the weak encryption algorithm. Therefore, the processing speed of encrypting and decrypting device files using a strong encryption algorithm is faster than using a weak encryption algorithm. The processing and decryption of device files is slow.
  • a strong encryption algorithm is selected to encrypt the device file to ensure the security of the device file, but the processing speed of encrypting and decrypting the device file is sacrificed; or the weak encryption algorithm is selected to encrypt the device file, and the device file is improved.
  • the processing speed of encryption and decryption is performed, but the security of the device file is sacrificed.
  • the prior art method of encrypting and decrypting device files does not take into account both security and processing speed.
  • K ( KLIIKR)
  • AES is the 21st century by the National Institute of Standards and Technology (NIST) to replace DES.
  • Encryption standard; RSA public key cryptosystem is an algorithm that uses different encryption keys and decryption keys, which can be used for both encryption and digital signatures.
  • AES 256-SHA RC4-MD5 AES-256: Advanced Encryption Standard (AES) SHA-1 with a key length of 256 bits: a kind of secure hash Algorithm (Secure Hash Algorithm).
  • an embodiment of the present invention provides a method and apparatus for encrypting and decrypting a device file, by dividing a device file to be encrypted into at least two parts, and encrypting each part by using a different encryption algorithm, thereby obtaining A device file that is encrypted using different encryption algorithms.
  • the encrypted device file is also divided into at least two parts, and the parts using different encryption algorithms are respectively decrypted by using a corresponding decryption algorithm to obtain the original device file.
  • the encryption and decryption algorithm of the device file provided by the embodiment of the present invention is used for the device file. At least two different encryption algorithms are used for encryption, which increases the complexity of encrypting device files.
  • the encryption and decryption method of the device file takes into consideration the security and processing speed when encrypting and decrypting the device file, and saves system resources under the premise of ensuring the security of the device file.
  • the encrypted device file is simply referred to as an encrypted file.
  • FIG. 1 is a flowchart of Embodiment 1 of a method for encrypting a device file according to an embodiment of the present invention. As shown in FIG. 1, the method in this embodiment includes:
  • Step S101 The device file is divided into a first part and a second part, wherein the first part and the second part respectively comprise at least one file block.
  • the device file is divided into a first part and a second part, wherein each part is encrypted by using a different encryption algorithm. Since the device file is divided into the first part and the second part, the first part and the second part generally do not contain continuous data, so each piece of continuous data included in the first part and the second part is called a file.
  • the block when determining the encryption algorithm corresponding to the first part and the second part respectively, is encrypted by using an encryption algorithm for each file block, that is, after the device file is divided, the encryption granularity of the encryption algorithm is a file block.
  • Step S102 encrypting the first part and the second part respectively, wherein the encryption algorithm corresponding to the file block in the first part is the first encryption algorithm, and the encryption algorithm corresponding to the file block in the second part is the second encryption algorithm, An encryption algorithm is different from the second encryption algorithm.
  • the first portion and the second portion are separately encrypted, wherein the file blocks in the first portion and the second portion are encrypted using different encryption algorithms.
  • the encryption algorithm corresponding to the file block in the first part is referred to as a first encryption algorithm
  • the encryption algorithm corresponding to the file block in the second part is referred to as a second encryption algorithm, wherein the first encryption algorithm is different from the second encryption algorithm.
  • the first encryption algorithm is different from the second encryption algorithm, which means that the security of the first encryption algorithm and the second encryption algorithm are different, and the processing speeds of the first encryption algorithm and the second encryption algorithm are also different, and the first encryption algorithm is used.
  • the processing speed of decrypting the file encrypted by the second encryption algorithm is also different.
  • the device file encrypted using this step has a second encryption algorithm or a second encryption than using only the first encryption algorithm.
  • Algorithm-encrypted device files are more secure or faster. Therefore, by using the device file encryption method provided by the embodiment of the present invention, by adjusting the size of the first part and the second part of the device file segmentation, and the first encryption algorithm and the second encryption algorithm, security can be considered when encrypting the device file. Processing speed, so that the encrypted device file not only ensures a certain security but also has a faster processing speed.
  • Step S103 storing the encrypted device file.
  • the device file is stored to the corresponding location.
  • the encrypted device file is first read, and then encrypted.
  • the unencrypted raw device file can be read after the device file is decrypted.
  • the method for encrypting the device file provided in this embodiment is described by taking the device file into two parts as an example, but the encryption method of the device file provided by the present invention is not limit. As long as the device file is divided into at least two parts, each part includes at least one file block, and the file blocks in each part are respectively encrypted by different encryption algorithms, and the technical solutions for obtaining the encrypted device file are all in the present invention. Within the scope of protection.
  • the device file is divided into the first part and the second part, and the file blocks in the first part and the second part are encrypted by using different first encryption algorithms and second encryption algorithms, and then the encrypted device file is stored, Encrypted device files take into account the security and processing speed of encryption and decryption.
  • step S101 specifically includes: dividing the device file into at least two file blocks; combining the at least two file blocks into the first portion and the first The two parts, wherein the first part and the second part respectively comprise at least one file block.
  • the encryption granularity of the device file is a file block
  • the device file when the device file is actually divided into the first part and the second part, the device file can be first divided into at least two file blocks.
  • Each file block here is a piece of data that can be encrypted using an encryption algorithm. Then, according to the encryption algorithm corresponding to each file block, the file blocks that need to use the same encryption algorithm are combined into the same part, and the first part and the second part of the device file are generated.
  • the first part and the second part include at least one file block.
  • the device file can be directly divided into the first part and the first part according to the method of step S101.
  • the first part and the second part respectively include at least one File blocks. If the file blocks in the first part and the second part that need to be segmented are not continuously stored, then the device file needs to be first divided into at least one file block, and then at least one file block is combined into the first part and the second part.
  • the file blocks in the first part and the second part there are also two specific methods, which may first encrypt the file blocks in the first part and the second part by using a corresponding encryption algorithm, and then encrypt the file blocks.
  • the file blocks are again combined into the encrypted first part and the second part; or the file blocks in the first part and the second part are first combined, and then the first part or the second part is uniformly encrypted using a corresponding encryption algorithm.
  • FIG. 2 is a flowchart of Embodiment 2 of a method for encrypting a device file according to an embodiment of the present invention. As shown in FIG. 2, the method in this embodiment includes:
  • Step S201 The device file is divided into at least two file blocks, where a starting address and a length of each file block are determined according to a preset policy.
  • the present embodiment further provides a specific device file encryption method based on the embodiment shown in FIG.
  • the basis for dividing the device file into at least two file blocks is a preset policy, and the preset policy is pre-configured in the system.
  • a device file can be thought of as data stored in a contiguous address in memory. When dividing a device file, you only need to determine the starting address and length of a file block to determine a file block. Therefore, in this step, the device file can be divided into at least two file blocks according to the starting address and length of each file block in the preset policy.
  • Step S202 Combine the at least two file blocks into a first part and a second part, wherein positions and numbers of file blocks included in the first part and the second part are respectively determined according to the policy.
  • the device file is divided into at least two file blocks according to the preset policy
  • at least two file blocks are still combined into the first part and the second part of the device file according to the preset policy. Since the length of each file block has been determined, when the at least two file blocks are combined into the first part and the second part, only the position and the number of the file blocks included in each part need to be determined, and the first part can be determined. And the specific data included in the second part.
  • Step S203 determining, according to the policy, a first encryption algorithm corresponding to the file block in the first part And a second encryption algorithm corresponding to the file block in the second part, the first encryption algorithm being different from the second encryption algorithm.
  • the encryption algorithm corresponding to the file blocks in the first part and the second part is determined according to a preset policy. That is to say, in this embodiment, how to divide the device file, and which encryption algorithm is used to encrypt each part of the divided device file is determined according to a preset policy.
  • Step S204 Encrypt the first part and the second part respectively, wherein the encryption algorithm corresponding to the file block in the first part is the first encryption algorithm, and the encryption algorithm corresponding to the file block in the second part is the second encryption algorithm.
  • this step is the same as step S102.
  • the encryption algorithm corresponding to each part after the device file is divided and divided is determined according to a preset policy, so when decrypting the encrypted device file, The preset policy decrypts the encrypted device file to obtain the original device file.
  • Step S205 Store the encrypted device file.
  • the device file is segmented and encrypted according to a preset policy, so that when the encrypted device file is decrypted, the device may also be decrypted according to a preset policy, and a pair of devices is provided.
  • the specific method of encrypting files is provided.
  • the preset policy includes: a start address and a length of the file block when the device file is divided, and a file block in the first part and the second part The location and number of encryption algorithms corresponding to the file blocks in the first portion and the second portion.
  • the preset policy may be determined based on empirical values or historical data, or the preset policy may be set by the user.
  • the strategy includes dividing the device file and determining the content of the encryption algorithm used, specifically including starting address and length of each file block when the device file is divided into at least two file blocks, and at least two file blocks The position and number of file blocks in each part when merging into the first part and the second part can be divided into the first part and the second part according to the above two parts.
  • the strategy further includes an encryption algorithm corresponding to the file block in the first part and the second part, so that the device file can be encrypted according to a preset policy.
  • the method for encrypting the device file provided by this embodiment is described by taking the device file into two parts as an example, but the encryption method of the device file provided by the present invention is not This is limited to this. For example, you can first split the device file into at least two files.
  • a block where a starting address and a size of each file block are determined according to a preset policy; and then the at least two file blocks are combined into at least two parts of the device file, wherein each part of the file block included The location and the number are respectively determined according to the policy, and each part includes at least one file block; and then determining, according to the policy, an encryption algorithm corresponding to the file block in each of at least two parts of the device file, where each part The encryption algorithm corresponding to the file block is different. Finally, at least two parts of the device file are encrypted to obtain an encrypted device file.
  • the third embodiment of the device file encryption method provides another specific device file encryption method.
  • the first part includes the file block.
  • the importance of the data is greater than the importance of the data in the file blocks included in the second part; the security of the first encryption algorithm is higher than the security of the second encryption algorithm. That is to say, in this embodiment, the device file is segmented according to the importance of the stored data, and the corresponding encryption algorithm is determined, wherein the portion of the stored data having a high importance corresponds to a highly secure encryption algorithm.
  • FIG. 3 is a flowchart of Embodiment 3 of a method for encrypting a device file according to an embodiment of the present invention. As shown in FIG. 3, the method in this embodiment includes:
  • Step S301 dividing the device file into at least two file blocks.
  • the device file may be randomly divided into at least two file blocks, or the device file may be divided into at least two file blocks according to the importance of the stored data in the device file.
  • important data such as key algorithms, key processing strategies, etc.
  • the entire device file is not available without the support of key algorithms and processing strategies.
  • Data such as general algorithms and general processing policies of device files can be set to medium priority. For data such as databases that have no impact on security, they can be set to low priority.
  • the importance level of the device file can be further divided, for example, into 5 levels, 7 levels, and the like.
  • the portion whose importance exceeds the preset threshold and the portion that does not exceed the preset threshold may be segmented according to the importance of the stored data, so that after the segmentation The importance of data stored in certain file blocks in a file block exceeds a preset threshold, while the importance of data stored in another file block does not exceed a preset threshold.
  • the importance threshold as the partitioning basis may be preset according to the empirical value or the system processing capability. For example, the importance level is divided into 5 levels, wherein the level 1 indicates the highest importance, and the level 5 indicates the importance.
  • the minimum value of the preset importance threshold may be 3.
  • Step S302 combining file blocks whose importance in the at least two file blocks exceeds a preset threshold into the first part.
  • Step S303 Combine the file blocks whose importance in the at least two file blocks does not exceed a preset threshold into the second part.
  • steps S302 and S303 based on the segmentation of the device file in step S301, the file blocks whose importance of the stored data exceeds a preset threshold are combined together as the first part of the device file, and File blocks storing data that do not exceed a preset threshold are grouped together as a second part of the device file. This divides the device file into the first part and the second part according to the importance of the stored data.
  • Step S304 encrypting the first part and the second part respectively, wherein the encryption algorithm corresponding to the file block in the first part is the first encryption algorithm, and the encryption algorithm corresponding to the file block in the second part is the second encryption algorithm,
  • the security of an encryption algorithm is higher than the security of the second encryption algorithm.
  • the first block used to encrypt the file block in the first part is used.
  • the security of an encryption algorithm can also be higher; the security of the second encryption algorithm used to encrypt the file blocks in the second part can be lower than the security of the first encryption algorithm.
  • the security of the important data stored in the device file is guaranteed, which is equivalent to ensuring the security of the entire device file; and the second encryption algorithm with relatively low security is used to encrypt the less important data, and the processing speed of encryption and decryption It will be faster. Therefore, the device file encryption method provided in this embodiment can ensure the security of the device file and improve the processing speed of encryption and decryption.
  • Step S305 storing the encrypted device file.
  • the device file is divided and encrypted according to the importance of the stored data, thereby providing a specific method for encrypting the device file more reasonably.
  • the method before storing the encrypted device file in step S305, the method further includes: generating an information table, where the information table includes a start of each of the at least two file blocks An address and a length, a position and a number of the file blocks included in the first portion and the second portion, a correspondence between the file block in the first portion and the first encryption algorithm, and a file block in the second portion Corresponding relationship with the second encryption algorithm; storing the information table in a preset area of the encrypted device file, or storing the information table as a first file independent of the device file.
  • the device file may be segmented according to the importance of the data stored in the device file, or the device file may be randomly divided, and the corresponding encryption algorithm may be allocated to the divided device file.
  • an information table may be generated, where the information table includes various information for dividing and encrypting the device file, for example, the information table includes each of the at least two file blocks.
  • the generated information table may be stored in an encrypted device file, for example, a storage area of a preset size is reserved in the encrypted device file, and the generated information table is stored in the area, when the encrypted device file is needed.
  • the information table When decrypting, the information table is first read from the preset area; or the information table can be stored as the first file independent of the device file, that is, the information table can be stored as a separate file, and the first is established.
  • the method further includes: encrypting the information table, and the encryption algorithm corresponding to the information table is the first encryption algorithm. Storing the information table in a preset area of the encrypted device file, or storing the information table as the first file independent of the encrypted device file, including: storing the encrypted information table in a preset area of the encrypted device file, or The information table is stored as a first file that is independent of the encrypted device file. Since the data stored in the information table has a great influence on the security of the encrypted device file, it can be regarded as data whose importance exceeds a preset threshold. Therefore, the encryption algorithm used for encrypting the information table is the first encryption algorithm. .
  • the device file may be first divided into at least two file blocks, wherein the importance of the data in the at least one file block exceeds a preset threshold; at least two file blocks are combined into at least two parts of the device file, wherein, at least The importance of the data stored in the file block included in one portion exceeds a preset threshold; at least two portions of the device file are separately encrypted, wherein the data stored in the included file block is more important than
  • the part of the preset threshold corresponds to the first encryption algorithm group, and the part of the included file block that does not exceed the preset threshold corresponds to the second encryption algorithm group, the first encryption algorithm group and the second encryption algorithm group.
  • Each of the at least one encryption algorithm is included, and the security of the encryption algorithm in the first encryption algorithm group is higher than the security of the encryption algorithm in the second encryption algorithm group. That is to say, regardless of dividing the device file into several parts, the security of the encryption algorithm corresponding to the part of the stored data whose importance exceeds the preset threshold is higher than the part of the stored data whose importance does not exceed the preset threshold.
  • the corresponding encryption algorithm can be used. If an information table is also generated before storing the encrypted device file, encrypting the information table may use any encryption algorithm in the first encryption algorithm group, or use the most secure encryption algorithm in the first encryption algorithm group.
  • the fourth embodiment of the device file encryption method provides another specific device file encryption method.
  • the device file when the device file is segmented, the device file is determined according to a preset split ratio.
  • the method is divided into a first part and a second part, wherein a ratio of a capacity of the file block included in the first part and the second part to a total capacity of the device file is determined according to a preset ratio.
  • a higher security encryption algorithm is configured for the file blocks in the smaller proportion
  • a less secure encryption algorithm is configured for the file blocks in the larger proportion.
  • FIG. 4 is a flowchart of Embodiment 4 of a method for encrypting a device file according to an embodiment of the present invention. As shown in FIG. 4, the method in this embodiment includes:
  • Step S401 dividing the device file into at least two file blocks.
  • the general idea is to randomly divide the device file into at least two file blocks, and when combining at least two file blocks into the first part and the second part, control the first part according to a preset ratio.
  • the proportion of data in the file blocks included in the second part in the device file is also possible to reduce the encryption and decryption based on the security of the encrypted device file. Processing speed. Therefore, in this step, the device file can first be randomly divided into at least two file blocks.
  • Step S402 Combine a part of the file blocks of the at least two file blocks into a first part, where a ratio of a capacity of the part of the file blocks to a total capacity of the device file is a first ratio, and the first ratio is less than 50%.
  • the combination when at least two file blocks are combined into the first part, the combination may also be randomly performed, as long as the ratio of the total capacity of the file blocks included in the combined first part to the total capacity of the device file is the first ratio. can.
  • the first ratio may be less than 50% if it is determined that the first part needs to be encrypted using a more secure encryption algorithm.
  • Step S403 Combine another partial file block of the at least two file blocks except the part into a second part.
  • the remaining file blocks are combined into the second part of the device file.
  • Step S404 encrypting the first part and the second part respectively, wherein the encryption algorithm corresponding to the file block in the first part is the first encryption algorithm, and the encryption algorithm corresponding to the file block in the second part is the second encryption algorithm,
  • the security of an encryption algorithm is higher than the security of the second encryption algorithm.
  • the security of the first encryption algorithm used for encrypting the file block in one part may also be higher; and the second encryption algorithm used for encrypting the file block in the second part The security can be lower than the security of the first encryption algorithm.
  • Step S405 Store the encrypted device file.
  • the device file is segmented according to a preset ratio, and a part of the smaller proportion is encrypted by using a strong encryption algorithm, thereby providing another reasonably encrypting the device file. specific method.
  • the method further includes: generating an information table, where the information table includes a start of each of the at least two file blocks An address and a length, a position and a number of the file blocks included in the first portion and the second portion, a correspondence between the file block in the first portion and the first encryption algorithm, and a file block in the second portion Corresponding relationship with the second encryption algorithm; storing the information table in a preset area of the encrypted device file, or storing the information table as a first file independent of the encrypted device file.
  • the device file is segmented according to a preset ratio, and a corresponding encryption algorithm is allocated for the divided device file.
  • a corresponding encryption algorithm is allocated for the divided device file.
  • an information table may be generated, which includes various information for dividing and encrypting the device file, for example, the information table includes each of the at least two file blocks.
  • the generated information table may be stored in an encrypted device file, for example, a storage area of a preset size is reserved in the encrypted device file, and the generated information table is stored in the area, when the encrypted device file is needed.
  • the information table When decrypting, the information table is first read from the preset area; or the information table can be stored as a first file independent of the encrypted device file, that is, the information table can be stored as a separate file, and established.
  • the method further includes: encrypting the information table, and the encryption algorithm corresponding to the information table is the first encryption algorithm. Storing the information table in a preset area of the encrypted device file, or storing the information table as the first file independent of the encrypted device file, including: storing the encrypted information table in a preset area of the encrypted device file, or The information table is stored as a first file that is independent of the encrypted device file.
  • the encryption algorithm used by the table for encryption is the first encryption algorithm.
  • the method for encrypting the device file provided by this embodiment is described by taking the device file into two parts as an example, but the encryption method of the device file provided by the present invention is not This is limited to this.
  • the device file may be first divided into at least two file blocks; then at least two file blocks are combined into at least two parts of the device file, wherein the ratio of the file block capacity in each portion to the total capacity of the device file is Setting a ratio; encrypting at least two parts of the device file respectively, wherein the smaller the ratio of the capacity of the included file block to the total capacity of the device file, the higher the security of the encryption algorithm corresponding to the part.
  • the device file is divided and encrypted according to a preset policy.
  • the device is decrypted according to the preset policy.
  • the method for encrypting the device file provided by the embodiment of the present invention is not limited thereto.
  • the device file may be divided and encrypted according to a preset policy, but when the encrypted device file is decrypted, the method is not based on a preset policy. Decrypted. Rather, similar to the embodiment shown in FIG. 3 and FIG. 4, after the device file is segmented and encrypted according to a preset policy, an information table of the device file is generated, and the information table is stored in the pre-encrypted device file.
  • FIG. 5 is a flowchart of Embodiment 1 of a device file decryption method according to an embodiment of the present invention. As shown in FIG. 5, the method in this embodiment includes: Step S501, the encrypted device file is divided into a first part and a second part, wherein the first part and the second part respectively comprise at least one file block.
  • the embodiment provides a method for decrypting a device file, which is used to decrypt a device file encrypted by using an encryption method of a device file provided by an embodiment of the present invention.
  • the encryption method of the device file provided by the embodiment of the present invention is to divide the device file into two parts, and then use different encryption algorithms for encryption processing on different parts. Therefore, in this embodiment, the encrypted device file is first divided into a first part and a second part, wherein the first part and the second part are divided into file blocks, and the first part and the second part respectively include At least one file block.
  • the division of the first part and the second part may correspond to the encryption of the device file.
  • the encrypted device file may be segmented according to a preset policy, or the device file may be segmented according to the information table.
  • Step S502 decrypting the first part and the second part respectively, wherein the decryption algorithm corresponding to the file block in the first part is the first decryption algorithm, and the decryption algorithm corresponding to the file block in the second part is the second decryption algorithm, A decryption algorithm is different from the second decryption algorithm.
  • the file block in the first part corresponds to the first decryption algorithm
  • the file block in the second part corresponds to the first encryption algorithm. Since encrypting and decrypting a file is a reciprocal process, in the process of decrypting the file block in the first part, the first decryption algorithm used needs to use the first encryption used when encrypting the file block. The algorithm is reciprocal; likewise, in the process of decrypting the file block in the second part, the second decryption algorithm used needs to be reciprocal to the second encryption algorithm used when encrypting the file block.
  • the first decryption algorithm and the second decryption algorithm corresponding to the first part and the second part may be determined according to a preset policy, or may be based on the information.
  • the table is determined.
  • Step S503 storing the decrypted device file.
  • the method for decrypting the device file provided by this embodiment is described by taking the device file into two parts as an example, but the encryption method of the device file provided by the present invention is not limit. As long as the device file is divided into at least two parts, each part includes at least one file block, and different file decryption algorithms are used for each file block in each part.
  • the technical solutions for decrypting the decrypted device files are all within the scope of the present invention.
  • the encrypted device file is divided into the first part and the second part, and the file blocks in the first part and the second part are decrypted using different first decryption algorithms and second decryption algorithms, and then the decrypted A device file that provides a way to decrypt an encrypted device file.
  • FIG. 6 is a flowchart of Embodiment 2 of a method for decrypting a device file according to an embodiment of the present invention. As shown in FIG. 6, the method in this embodiment includes:
  • Step S601 the encrypted device file is divided into a first part and a second part, wherein the positions and the number of the file blocks included in the first part and the second part are respectively determined according to a preset policy, and the first part and the second part are included The starting address and length of the file block are determined according to the policy, respectively.
  • the decryption method of the device file provided by this embodiment is proposed for the method of dividing and encrypting a device file by using a preset policy. Therefore, if the encrypted device file is to be decrypted, the encrypted device file can be first divided into the first part and the second part according to a preset policy. Since the granularity of encrypting and decrypting device files is a file block, when dividing the encrypted device file into the first part and the second part, it is necessary to determine which file blocks are included in each part.
  • the position and quantity of the file block in the preset policy it can be determined which file blocks are included in the first part and the second part, and according to the starting address and length of the file block in the policy, the file included in each file block can be determined. precise data.
  • the decryption algorithm used by each piece of data can be specifically determined.
  • Step S602 Determine, according to the policy, a first decryption algorithm corresponding to the file block in the first part and a second decryption algorithm corresponding to the file block in the second part.
  • the decryption algorithm corresponding to the file block in each part is still determined by a preset policy.
  • the encryption algorithm corresponding to the file block in each part is included in the preset policy, and since the encryption algorithm and the decryption algorithm are reciprocal algorithms, Therefore, according to the encryption algorithm determined by the preset policy, the decryption algorithm corresponding to the file block in the first part and the second part of the encrypted device file divided according to the preset policy may be determined.
  • Step S603 decrypting the first part and the second part respectively, wherein the decryption algorithm corresponding to the file block in the first part is the first decryption algorithm, and the decryption algorithm corresponding to the file block in the second part is the second decryption algorithm, A decryption algorithm is different from the second decryption algorithm.
  • the file block in the first part corresponds to the first decryption algorithm
  • the file block in the second part corresponds to the first encryption algorithm. Since encrypting and decrypting a file is a reciprocal process, in the process of decrypting the file block in the first part, the first decryption algorithm used needs to use the first encryption used when encrypting the file block. The algorithm is reciprocal; likewise, in the process of decrypting the file block in the second part, the second decryption algorithm used needs to be reciprocal to the second encryption algorithm used when encrypting the file block.
  • Step S604 storing the decrypted device file.
  • the device file is segmented and decrypted according to a preset policy, and a specific method for decrypting the device file encrypted according to the preset policy is provided.
  • the policy includes: a start address and a length of a file block in the first part and the second part, and a file in the first part and the second part The location and number of blocks, the decryption algorithm corresponding to the file blocks in the first portion and the second portion.
  • the preset policy may be determined based on empirical values or historical data, or the preset policy may be set by the user.
  • the device file is encrypted, it is also encrypted according to the policy, and the encrypted device file can be decrypted using the policy.
  • the strategy includes segmenting the encrypted device file and determining the content of the encryption algorithm used, specifically including the location of the file block in the first part and the second part when the encrypted device file is divided into the first part and the second part. The number, and the starting address and length of the file block, can be divided into the first part and the second part according to the above two parts.
  • the strategy also includes a decryption algorithm corresponding to the file blocks in the first part and the second part.
  • the strategy may further include an encryption algorithm corresponding to the file block in the first part and the second part when encrypting the device file, and the decryption algorithm corresponding to each file block may also be determined according to the principle of reciprocal of the encryption algorithm and the decryption algorithm. .
  • the method for decrypting the device file provided by this embodiment is described by taking the device file into two parts as an example, but the device provided by the present invention is provided.
  • the decryption method of the file is not limited to this.
  • the encrypted device file may be first divided into at least two parts, wherein the location and the number of file blocks included in each part are respectively determined according to a preset policy; determining at least two parts of the encrypted device file according to the policy The decryption algorithm corresponding to the file block in each part.
  • the file blocks in each of the sections have different decryption algorithms.
  • at least two parts of the encrypted device file are decrypted to obtain the original device file.
  • FIG. 7 is a flowchart of Embodiment 3 of a method for decrypting a device file according to an embodiment of the present invention. As shown in FIG. 7, the method in this embodiment includes:
  • Step S701 Obtain an information table of the encrypted device file from the encrypted device file or the first file independent of the encrypted device file, where the information table includes a start address of the file block in the first part and the second part. The length, the position and number of the file blocks included in the first portion and the second portion, the first encryption algorithm corresponding to the file block in the first portion, and the second encryption algorithm corresponding to the file block in the second portion.
  • the decryption method of the device file provided in this embodiment is a corresponding decryption method proposed by an encryption method that generates an information table when encrypting a device file.
  • an information table of the encrypted device file can be obtained first.
  • the information table is stored in a preset area of the encrypted device file, or the information table is stored in a first file independent of the encrypted device file, and the specific location stored in the information table is generally pre-agreed.
  • the information table includes an encryption algorithm corresponding to each part of the device file that is divided and divided when the device file is encrypted.
  • the information table includes a starting address and a length of a file block in the first part and the second part of the encrypted device file, a position and a number of the file block included in the first part and the second part, and a file block corresponding to the first part.
  • Step S702 dividing the encrypted device file into the first part according to the starting address and length of the file block in the first part and the second part of the information table, the position and the number of the file blocks included in the first part and the second part, and the second part.
  • the granularity of encrypting and decrypting a device file is a file block
  • the files included in each file block can be determined according to the starting address and length of the file block in the information table. precise data.
  • the decryption algorithm used by each piece of data can be specifically determined.
  • Step S703 determining, according to the first encryption algorithm corresponding to the file block in the first part of the information table and the second encryption algorithm corresponding to the file block in the second part, determining the first decryption algorithm corresponding to the file block in the first part and the first The second decryption algorithm corresponding to the file block in the two parts, the first decryption algorithm is reciprocal to the first encryption algorithm, and the second decryption algorithm is reciprocal to the second encryption algorithm.
  • the information table obtained in step S701 includes a first encryption algorithm corresponding to the file block in the first part and a second encryption algorithm corresponding to the file block in the second part, because the encryption algorithm and the decryption algorithm are mutually The inverse algorithm, so that the first decryption algorithm corresponding to the file block in the first part can be determined according to the first encryption algorithm corresponding to the file block in the first part of the information table and the second encryption algorithm corresponding to the file block in the second part A second decryption algorithm corresponding to the file block in the second part.
  • Step S704 decrypting the first part and the second part respectively, wherein the decryption algorithm corresponding to the file block in the first part is the first decryption algorithm, and the decryption algorithm corresponding to the file block in the second part is the second decryption algorithm, A decryption algorithm is different from the second decryption algorithm.
  • the file block in the first part corresponds to the first decryption algorithm
  • the file block in the second part corresponds to the first encryption algorithm. Since encrypting and decrypting a file is a reciprocal process, in the process of decrypting the file block in the first part, the first decryption algorithm used needs to use the first encryption used when encrypting the file block. The algorithm is reciprocal; likewise, in the process of decrypting the file block in the second part, the second decryption algorithm used needs to be reciprocal to the second encryption algorithm used when encrypting the file block.
  • Step S705 Store the decrypted device file.
  • an information table of an encrypted device file is first obtained, and a device file is segmented and decrypted according to the information table, and a device file for generating an information table during encryption is provided.
  • the specific method of decryption is first obtained, and a device file is segmented and decrypted according to the information table, and a device file for generating an information table during encryption.
  • step S701 obtains the information table of the encrypted device file from the encrypted device file or the first file independent of the encrypted device file
  • the method further includes: The information table is decrypted.
  • the information table is generated, and further, the information table can be encrypted. Therefore, in the embodiment shown in FIG. 7, if the information table is encrypted at the same time when the device file is encrypted, when the device file is decrypted, the obtained information table is an encrypted information table, and the obtained information table is obtained. After the encrypted information table, the encrypted information table needs to be decrypted to obtain the information in the information table, thereby decrypting the encrypted device file. Before decrypting the encrypted information table, it is also necessary to determine the encryption algorithm used to encrypt the encrypted information table. Since the most secure encryption algorithm is generally used when encrypting the information table, the decryption algorithm corresponding to the most secure encryption algorithm can still be used when decrypting the encrypted information table.
  • the method for decrypting the device file provided by this embodiment is described by taking the device file into two parts as an example, but the decryption method of the device file provided by the present invention is not This is limited to this.
  • the encrypted device file may be first divided into at least two parts, wherein each part is The position and number of the included file blocks are respectively determined according to the information table; the decryption algorithm corresponding to the file blocks in each of the at least two portions of the encrypted device file is determined according to the information table.
  • the file blocks in each of them have different decryption algorithms.
  • at least two parts of the encrypted device file are decrypted to obtain the original device file.
  • FIG. 8 is a schematic structural diagram of Embodiment 1 of a device file encryption device according to an embodiment of the present invention. As shown in FIG. 8, the device file encryption device of this embodiment includes:
  • the dividing unit 81 is configured to divide the device file into a first part and a second part, where the first part and the second part respectively comprise at least one file block.
  • the encryption unit 82 is configured to separately encrypt the first part and the second part, where an encryption algorithm corresponding to the file block in the first part is a first encryption algorithm, and a file block in the second part corresponds to The encryption algorithm is a second encryption algorithm, and the first encryption algorithm is different from the second encryption algorithm.
  • the storage unit 83 is configured to store the encrypted device file.
  • the encryption device of the device file in this embodiment is used to implement the technical solution of the method embodiment shown in FIG. 1.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 9 is a schematic structural diagram of Embodiment 2 of a device file encryption device according to an embodiment of the present invention. As shown in FIG. 9, the device file encryption device in this embodiment is based on FIG. Element 81, including:
  • the dividing subunit 91 is configured to divide the device file into at least two file blocks.
  • the combining subunit 92 is configured to combine the at least two file blocks into the first part and the second part, wherein the first part and the second part respectively comprise at least one file block.
  • FIG. 10 is a schematic structural diagram of Embodiment 3 of a device file encryption apparatus according to an embodiment of the present invention.
  • the device file encryption apparatus of this embodiment further includes: a determining unit 84, And determining, by the policy, a first encryption algorithm corresponding to the file block in the first part and the second encryption algorithm corresponding to the file block in the second part.
  • the segmentation sub-unit 91 is specifically configured to divide the device file into at least two file blocks, wherein a starting address and a length of each file block are determined according to a preset policy.
  • the combining subunit 92 is specifically configured to combine the at least two file blocks into the first part and the second part, where the location and the number of file blocks included in the first part and the second part Determined according to the policy, respectively.
  • the encryption device of the device file of this embodiment is used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects thereof are similar, and details are not described herein again.
  • the policy includes: a start address and a length of a file block when splitting the device file, and a location of a file block in the first part and the second part A number, an encryption algorithm corresponding to the file block in the first portion and the second portion.
  • the importance of the data in the file block included in the first portion is greater than the importance of the data in the file block included in the second portion; the first encryption algorithm The security is higher than the security of the second encryption algorithm.
  • the segmentation sub-unit 91 is specifically configured to divide the device file into at least two file blocks; the combination sub-unit 92 is further configured to use a file block whose importance in the at least two file blocks exceeds a preset threshold. Combining into the first portion; combining file blocks whose importance in the at least two file blocks does not exceed a preset threshold is the second portion.
  • the ratio of the capacity of the file block in the first portion to the total capacity of the device file is a first ratio.
  • the splitting subunit 91 is further configured to divide the device file into at least two file blocks, and the combining subunit 92 is further configured to combine a part of the at least two file blocks into the first part, where The ratio of the capacity of a part of the file block to the total capacity of the device file is the first ratio; and the part of the at least two file blocks is divided Another portion of the file block other than the combination is the second portion.
  • the security of the first encryption algorithm is higher than the security of the second encryption algorithm; the first ratio is less than 50%.
  • FIG. 11 is a schematic structural diagram of Embodiment 4 of a device file encryption apparatus according to an embodiment of the present invention.
  • the device file encryption apparatus of this embodiment further includes: a generating unit 85, And an information table, where the information table includes a start address and a length of each of the at least two file blocks, a location and a quantity of the file blocks included in the first part and the second part, a correspondence between the file block in the first part and the first encryption algorithm, and a correspondence between the file block in the second part and the second encryption algorithm.
  • the storage unit 83 is further configured to store the information table in a preset area of the encrypted device file, or store the information table as a first file independent of the encrypted device file.
  • the generating unit 85 may also be included.
  • the encryption unit 82 is further configured to encrypt the information table, and the encryption algorithm corresponding to the information table is the first encryption algorithm; the storage unit 83 is further used.
  • the encrypted information table is stored in a preset area of the encrypted device file, or the encrypted information table is stored as a first file independent of the encrypted device file.
  • FIG. 12 is a schematic structural diagram of Embodiment 1 of a device file decryption apparatus according to an embodiment of the present invention. As shown in FIG. 12, the device file decryption apparatus of this embodiment includes:
  • the dividing unit 121 is configured to divide the encrypted device file into a first part and a second part, wherein the first part and the second part respectively comprise at least one file block.
  • the decryption unit 122 is configured to decrypt the first part and the second part respectively, wherein the decryption algorithm corresponding to the file block in the first part is a first decryption algorithm, and the file block in the second part corresponds to The decryption algorithm is a second decryption algorithm, and the first decryption algorithm is different from the second decryption algorithm.
  • the storage unit 123 is configured to store the decrypted device file.
  • the decryption device of the device file of this embodiment is used to execute the technical solution of the method embodiment shown in FIG. 5, and the implementation principle and technical effects thereof are similar, and details are not described herein again.
  • FIG. 13 is a schematic structural diagram of Embodiment 2 of a device file decryption apparatus according to an embodiment of the present invention. As shown in FIG. 13, the device file decryption apparatus of this embodiment further includes:
  • a determining unit 124 configured to determine, according to the policy, a file block corresponding to the first part The first decryption algorithm and the second decryption algorithm corresponding to the file block in the second portion.
  • the dividing unit 121 is specifically configured to divide the encrypted device file into the first part and the second part, where the positions and the number of file blocks included in the first part and the second part are respectively determined according to The preset policy determines that the starting address and the length of the file block included in the first part and the second part are respectively determined according to the policy.
  • the decryption device of the device file of this embodiment is used to execute the technical solution of the method embodiment shown in FIG. 6.
  • the implementation principle and the technical effect are similar, and details are not described herein again.
  • the policy includes: a start address and a length of a file block in the first part and the second part, and a file block in the first part and the second part The location and number of decryption algorithms corresponding to the file blocks in the first portion and the second portion.
  • FIG. 14 is a schematic structural diagram of Embodiment 3 of a device file decryption apparatus according to an embodiment of the present invention. As shown in FIG. 14, the device file decryption apparatus of this embodiment further includes:
  • the obtaining unit 125 is configured to obtain, from the encrypted device file or the first file that is independent of the encrypted device file, an information table of the encrypted device file, where the information table includes the first part and the The starting address and length of the file block in the second part, the position and number of the file blocks included in the first part and the second part, and the first encryption algorithm corresponding to the file block in the first part The second encryption algorithm corresponding to the file block in the second portion.
  • the dividing unit 121 is further configured to: according to the starting address and length of the file block in the first part and the second part in the information table, the location of the file block included in the first part and the second part And the number, the encrypted device file is segmented into the first portion and the second portion.
  • the determining unit 124 is further configured to determine, according to the first encryption algorithm corresponding to the file block in the first part in the information part and the second encryption algorithm corresponding to the file block in the second part, The first decryption algorithm corresponding to the file block in the first part and the second decryption algorithm corresponding to the file block in the second part, the first decryption algorithm and the first encryption algorithm are mutually reciprocal, The second decryption algorithm is reciprocal to the second encryption algorithm.
  • the decryption device of the device file of this embodiment is used to execute the technical solution of the method embodiment shown in FIG. 7.
  • the implementation principle and the technical effect are similar, and details are not described herein again.
  • FIG. 15 is a schematic structural diagram of Embodiment 5 of a device file encryption apparatus according to an embodiment of the present invention.
  • the device file encryption apparatus of this embodiment includes: a processor 151 and a memory 152.
  • the processor 151 and the memory 152 may be connected through a system bus or other manners, and the system bus connection is taken as an example in FIG. 15; the system bus may be an Industrial Standard Architecture (ISA) bus, and an external device interconnection (Peripheral Component Interconnect). , PCI) bus or extended Industrial Standard Architecture (ESA) bus.
  • ISA Industrial Standard Architecture
  • PCI Peripheral Component Interconnect
  • ESA extended Industrial Standard Architecture
  • the system bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one line is shown in Figure 15, but it does not mean that there is only one bus or one type of bus.
  • the processor 151 is configured to divide the device file into a first part and a second part, where the first part and the second part respectively comprise at least one file block; and the first part and the second part Encryption is performed separately, wherein the encryption algorithm corresponding to the file block in the first part is a first encryption algorithm, and the encryption algorithm corresponding to the file block in the second part is a second encryption algorithm, the first encryption algorithm and the The second encryption algorithm is different.
  • the memory 152 is configured to store the encrypted device file.
  • the encryption device of the device file in this embodiment is used to implement the technical solution of the method embodiment shown in FIG. 1.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • the processor 151 is specifically configured to divide the device file into at least two file blocks; and combine the at least two file blocks into the first portion and the first The two parts, wherein the first part and the second part respectively comprise at least one file block.
  • the processor 151 is specifically configured to divide the device file into at least two file blocks, where a starting address and a length of each file block are determined according to a preset policy; Combining the at least two file blocks into the first portion and the second portion, wherein a location and a number of file blocks included in the first portion and the second portion are respectively determined according to the policy; The policy determines a first encryption algorithm corresponding to the file block in the first portion and the second encryption algorithm corresponding to the file block in the second portion.
  • the policy includes: a start address and a length of a file block when splitting the device file, and a location of a file block in the first part and the second part A number, an encryption algorithm corresponding to the file block in the first portion and the second portion.
  • the first part includes data in the file block.
  • the importance is greater than the importance of the data in the file block included in the second portion; the security of the first encryption algorithm is higher than the security of the second encryption algorithm.
  • the processor 151 is specifically configured to divide the device file into at least two file blocks; and the importance of the data in the at least two file blocks exceeds a preset threshold. Combining file blocks into the first portion; combining file blocks whose importance in the at least two file blocks does not exceed a preset threshold into the second portion.
  • the ratio of the capacity of the file block in the first portion to the total capacity of the device file is the first ratio.
  • the processor 151 is further configured to divide the device file into at least two file blocks; and combine some of the at least two file blocks into the first a part, the ratio of the capacity of the part of the file block to the total capacity of the device file is the first ratio; and another part of the at least two file blocks except the part is combined into the second section.
  • the security of the first encryption algorithm is higher than the security of the second encryption algorithm; the first ratio is less than 50%.
  • the processor 151 is further configured to generate an information table, where the information table includes a start address and a length of each of the at least two file blocks, and the a portion and a position and a quantity of the file block included in the second part, a correspondence between the file block in the first part and a first encryption algorithm, a file block in the second part, and the second encryption algorithm Correspondence.
  • the memory 152 is further configured to store the information table in a preset area of the encrypted device file, or store the information table as a first file independent of the encrypted device file.
  • the processor 151 is further configured to encrypt the information table, where an encryption algorithm corresponding to the information table is the first encryption algorithm, and a memory 152 is further used to The encrypted information table is stored in a preset area of the encrypted device file, or the encrypted information table is stored as a first file independent of the encrypted device file.
  • FIG. 16 is a schematic structural diagram of Embodiment 4 of a device file decryption apparatus according to an embodiment of the present invention.
  • the device file decryption apparatus of this embodiment includes: a processor 161 and a memory 162.
  • the processor 161 and the memory 162 may be connected by a system bus or other means, and the system bus is connected as an example in FIG. 16; the system bus may be an ISA bus, a PCI bus or an EISA. Bus, etc.
  • the system bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one line is shown in Figure 16, but it does not mean that there is only one bus or one type of bus.
  • the processor 161 is configured to divide the encrypted device file into the first part and the second part, where the first part and the second part respectively comprise at least one file block; respectively, the first part and the second part are respectively Decrypting, wherein the decryption algorithm corresponding to the file block in the first part is a first decryption algorithm, and the decryption algorithm corresponding to the file block in the second part is a second decryption algorithm, the first decryption algorithm and the The second decryption algorithm is different;
  • the memory 162 is configured to store the decrypted device file.
  • the decryption device of the device file of this embodiment is used to implement the technical solution of the method embodiment shown in FIG. 5, and the implementation principle and technical effects thereof are similar, and details are not described herein again.
  • the processor 161 is specifically configured to divide the encrypted device file into the first part and the second part, where the first part and the second part
  • the location and the number of the file blocks included in the part are respectively determined according to a preset policy, and the start address and the length of the file block included in the first part and the second part are respectively determined according to the policy;
  • the policy includes: a start address and a length of a file block in the first part and the second part, and a file block in the first part and the second part The location and number of decryption algorithms corresponding to the file blocks in the first portion and the second portion.
  • the processor 161 is further configured to obtain information about the encrypted device file from the encrypted device file or from the first file that is independent of the encrypted device file.
  • a table the information table includes a start address and a length of a file block in the first portion and the second portion, a location and a number of file blocks included in the first portion and the second portion, and the The first encryption algorithm corresponding to the file block in the part and the second encryption algorithm corresponding to the file block in the second part according to the first part and the file part in the second part in the information table a starting address and length, a location and a number of file blocks included in the first portion and the second portion, dividing the encrypted device file into the first portion and the second portion; Determining, by the first encryption algorithm corresponding to the file block in the first part of the information table and the second encryption algorithm corresponding to the file block in the second part, determining a file block corresponding to the first part And the first decryption algorithm to the file blocks corresponding to the second portion of the second
  • the processor 161 is further configured to decrypt the encrypted information table if the information table is an encrypted information table.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • General Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明实施例提供一种设备文件的加解密方法及装置,一种设备文件的加密方法包括:将所述设备文件分割为第一部分和第二部分,其中,所述第一部分和所述第二部分分别包括至少一个文件块;对所述第一部分和所述第二部分分别进行加密,其中所述第一部分中的文件块对应的加密算法为第一加密算法,所述第二部分中的文件块对应的加密算法为第二加密算法,所述第一加密算法与所述第二加密算法不同;存储加密的设备文件。本发明实施例提供的设备文件的加解密方法及装置,能够在对设备文件进行加解密时,同时兼顾安全性和处理速度。

Description

设备文件的加解密方法及装置
技术领域
本发明实施例涉及计算机技术领域, 尤其涉及一种设备文件的加解密方 法及装置。 背景技术
目前各种通信、 电子、 机械制造设备中一般都采用软件方式对设备的各 种功能进行控制, 设备中实现各项功能的软件统称为设备软件。 设备软件作 为设备的一部分, 是设备制造商知识产权的一部分, 为了保证设备软件不被 反汇编等方式破解泄露, 并同时增加设备软件被篡改的复杂度, 需要对设备 软件进行加密存储, 在运行时才进行解密。
一般地, 设备软件的软件包文件较大, 对设备软件中的大文件进行加密 或解密的系统开销比较大, 耗时比较长。 当设备启动时, 需要先对设备软件 中的软件包文件进行解密, 因此解密时间成为影响设备启动时间的一个关键 因素。 当设备软件进行版本升级时, 则需要对下载的设备软件的软件包进行 加密后存储, 对软件包进行加密会占用设备的处理器开销, 若开销过大则会 影响正常业务的运行。
现有技术对设备软件中大文件的加密方法通常包括两种, 第一种是采用 弱加密算法对设备软件中大文件进行加密, 通常只对设备软件中的软件、 配 置文件进行加密, 对设备软件中的大文件 (例如软件包) 不加密, 虽然弱加 密算法的加密时间和解密时间较短, 但是安全性较低, 当弱加密算法被破解 后, 通过反编译可以导致设备厂商关键信息资产的泄漏, 同时还容易遭受黑 客通过分析代码漏洞的方式进行的攻击。 另一种是采用强加密算法对设备软 件中的软件、 配置文件和大文件进行加密, 这种方法虽然安全性高, 但加密 和解密的时间较长, 对设备处理器资源要求高、 开销大, 会增加设备成本。
综上所述, 现有技术对设备软件中大文件的加解密方法没有同时兼顾到 安全性和处理速度。 发明内容 本发明提供一种设备文件的加解密方法及装置, 能够在对设备文件进行 加解密时, 同时兼顾安全性和处理速度。
第一方面提供一种设备文件的加密方法, 包括:
将所述设备文件分割为第一部分和第二部分, 其中, 所述第一部分和所 述第二部分分别包括至少一个文件块;
对所述第一部分和所述第二部分分别进行加密, 其中所述第一部分中的 文件块对应的加密算法为第一加密算法, 所述第二部分中的文件块对应的加 密算法为第二加密算法, 所述第一加密算法与所述第二加密算法不同;
存储加密的设备文件。
在第一方面第一种可能的实现方式中, 所述将所述设备文件分割为第一 部分和第二部分包括:
将所述设备文件分割为至少两个文件块;
将所述至少两个文件块组合为所述第一部分和所述第二部分, 其中所述 第一部分和所述第二部分分别包括至少一个文件块。
结合第一方面第一种可能的实现方式, 在第二种可能的实现方式中, 所 述将所述设备文件分割为至少两个文件块, 包括:
将所述设备文件分割为至少两个文件块, 其中, 每一个文件块的起始地 址和长度根据预设策略确定;
所述将所述至少两个文件块组合为所述第一部分和所述第二部分,包括: 将所述至少两个文件块组合为所述第一部分和所述第二部分, 其中, 所 述第一部分和所述第二部分所包括的文件块的位置和数量分别根据所述策略 确定;
所述对所述第一部分和所述第二部分分别进行加密之前, 还包括: 根据所述策略确定所述第一部分中的文件块对应的第一加密算法和所述 第二部分中的文件块对应的所述第二加密算法。
结合第一方面第二种可能的实现方式, 在第三种可能的实现方式中, 所 述策略包括: 针对所述设备文件进行分割时文件块的起始地址和长度、 所述 第一部分和所述第二部分中文件块的位置和数量、 所述第一部分和所述第二 部分中文件块对应的加密算法。
在第一方面第四种可能的实现方式中, 所述第一部分包括的文件块中的 数据的重要性大于所述第二部分包括的文件块中的数据的重要性; 所述第一 加密算法的安全性高于所述第二加密算法的安全性。
结合第一方面第四种可能的实现方式, 在第五种可能的实现方式中, 所 述将所述设备文件分割为第一部分和第二部分包括:
将所述设备文件分割为至少两个文件块;
将所述至少两个文件块中的数据的重要性超过预设阈值的文件块组合为 所述第一部分;
将所述至少两个文件块中的数据的重要性未超过预设阈值的文件块组合 为所述第二部分。
在第一方面第六种可能的实现方式中, 所述第一部分中的文件块的容量 占所述设备文件总容量的比例为第一比例。
结合第一方面第六种可能的实现方式, 在第七种可能的实现方式中, 所 述将所述设备文件分割为第一部分和第二部分包括:
将所述设备文件分割为至少两个文件块,
将所述至少两个文件块中的一部分文件块组合为所述第一部分, 所述一 部分文件块的容量占所述设备文件总容量的比例为所述第一比例;
将所述至少两个文件块中除所述一部分以外的另一部分文件块组合为所 述第二部分。
结合第一方面第六种或第七种可能的实现方式, 在第八种可能的实现方 式中, 所述第一加密算法的安全性高于所述第二加密算法的安全性; 所述第 一比例小于 50%。
结合第一方面第二种或第八种可能的实现方式种任一种可能的实现方 式, 在第九种可能的实现方式中, 所述方法还包括:
生成信息表, 所述信息表包括所述至少两个文件块中每一文件块的起始 地址和长度、 所述第一部分和所述第二部分所包括的文件块的位置和数量、 所述第一部分中的文件块与第一加密算法的对应关系, 所述第二部分中的文 件块与所述第二加密算法的对应关系;
将所述信息表存储于所述加密的设备文件的预设区域, 或者将所述信息 表存储为独立于所述加密的设备文件的第一文件。
结合第一方面第九种可能的实现方式, 在第十种可能的实现方式中, 所 述生成信息表之后, 还包括:
对所述信息表进行加密, 所述信息表对应的加密算法为所述第一加密算 法;
所述将所述信息表存储于所述加密的设备文件的预设区域, 或者将所述 信息表存储为独立于所述加密的设备文件的第一文件, 包括:
将所述加密的信息表存储于所述加密的设备文件的预设区域, 或者将所 述加密的信息表存储为独立于所述加密的设备文件的第一文件。
第二方面提供一种设备文件的解密方法, 包括:
将加密的设备文件分割为第一部分和第二部分, 其中所述第一部分和所 述第二部分分别包括至少一个文件块;
对所述第一部分和所述第二部分分别进行解密, 其中所述第一部分中的 文件块对应的解密算法为第一解密算法, 所述第二部分中的文件块对应的解 密算法为第二解密算法, 所述第一解密算法与所述第二解密算法不同;
存储解密的设备文件。
在第二方面第一种可能的实现方式中, 所述将加密的设备文件分割为第 一部分和第二部分, 包括:
将所述加密的设备文件分割为所述第一部分和所述第二部分, 其中, 所 述第一部分和所述第二部分所包括的文件块的位置和数量分别根据预设策略 确定, 所述第一部分和所述第二部分所包括的文件块的起始地址和长度分别 根据所述策略确定;
所述对所述第一部分和所述第二部分分别进行解密之前, 还包括: 根据所述策略确定所述第一部分中的文件块对应的所述第一解密算法和 所述第二部分中的文件块对应的所述第二解密算法。
结合第二方面第一种可能的实现方式, 在第二种可能的实现方式中, 所 述策略包括: 所述第一部分和所述第二部分中文件块的起始地址和长度、 所 述第一部分和所述第二部分中文件块的位置和数量、 所述第一部分和所述第 二部分中文件块对应的解密算法。
在第二方面第三种可能的实现方式中, 所述将加密的设备文件分割为第 一部分和第二部分之前, 还包括:
从所述加密的设备文件中或独立于所述加密的设备文件的第一文件中获 取所述加密的设备文件的信息表, 所述信息表包括所述第一部分和所述第二 部分中文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文 件块的位置和数量、 所述第一部分中的文件块对应的所述第一加密算法和所 述第二部分中的文件块对应的所述第二加密算法;
所述将加密的设备文件分割为第一部分和第二部分, 包括:
根据所述信息表中所述第一部分和所述第二部分中文件块的起始地址和 长度、 所述第一部分和所述第二部分所包括的文件块的位置和数量, 将所述 加密的设备文件分割为所述第一部分和所述第二部分;
所述对所述第一部分和所述第二部分分别进行解密之前, 还包括: 根据所述信息表中所述第一部分中的文件块对应的所述第一加密算法和 所述第二部分中的文件块对应的所述第二加密算法, 确定所述第一部分中的 文件块对应的所述第一解密算法和所述第二部分中的文件块对应的所述第二 解密算法, 所述第一解密算法与所述第一加密算法互逆, 所述第二解密算法 与所述第二加密算法互逆。
结合第二方面第三种可能的实现方式, 在第四种可能的实现方式中, 若 所述信息表是加密的信息表, 所述从所述加密的设备文件中或独立于所述加 密的设备文件的第一文件中获取所述加密的设备文件的信息表之后,还包括: 对所述加密的信息表进行解密。
第三方面提供一种设备文件的加密装置, 包括:
分割单元, 用于将所述设备文件分割为第一部分和第二部分, 其中, 所 述第一部分和所述第二部分分别包括至少一个文件块;
加密单元, 用于对所述第一部分和所述第二部分分别进行加密, 其中所 述第一部分中的文件块对应的加密算法为第一加密算法, 所述第二部分中的 文件块对应的加密算法为第二加密算法, 所述第一加密算法与所述第二加密 算法不同;
存储单元, 用于存储加密的设备文件。
在第三方面第一种可能的实现方式中, 所述分割单元, 包括:
分割子单元, 用于将所述设备文件分割为至少两个文件块;
组合子单元, 用于将所述至少两个文件块组合为所述第一部分和所述第 二部分, 其中所述第一部分和所述第二部分分别包括至少一个文件块。 结合第三方面第一种可能的实现方式, 在第二种可能的实现方式中, 所 述分割子单元, 具体用于将所述设备文件分割为至少两个文件块, 其中, 每 一个文件块的起始地址和长度根据预设策略确定;
所述组合子单元, 具体用于将所述至少两个文件块组合为所述第一部分 和所述第二部分, 其中, 所述第一部分和所述第二部分所包括的文件块的位 置和数量分别根据所述策略确定;
所述设备文件的加密装置, 还包括:
确定单元, 用于根据所述策略确定所述第一部分中的文件块对应的第一 加密算法和所述第二部分中的文件块对应的所述第二加密算法。
结合第三方面第二种可能的实现方式, 在第三种可能的实现方式中, 所 述策略包括: 针对所述设备文件进行分割时文件块的起始地址和长度、 所述 第一部分和所述第二部分中文件块的位置和数量、 所述第一部分和所述第二 部分中文件块对应的加密算法。
在第三方面第四种可能的实现方式中, 所述第一部分包括的文件块中的 数据的重要性大于所述第二部分包括的文件块中的数据的重要性; 所述第一 加密算法的安全性高于所述第二加密算法的安全性。
结合第三方面第四种可能的实现方式, 在第五种可能的实现方式中, 所 述分割子单元, 具体用于将所述设备文件分割为至少两个文件块;
所述组合子单元, 还用于将所述至少两个文件块中的数据的重要性超过 预设阈值的文件块组合为所述第一部分; 将所述至少两个文件块中的数据的 重要性未超过预设阈值的文件块组合为所述第二部分。
在第三方面第六种可能的实现方式中, 所述第一部分中的文件块的容量 占所述设备文件总容量的比例为第一比例。
结合第三方面第六种可能的实现方式, 在第七种可能的实现方式中, 所 述分割子单元, 还用于将所述设备文件分割为至少两个文件块;
所述组合子单元, 还用于将所述至少两个文件块中的一部分文件块组合 为所述第一部分, 所述一部分文件块的容量占所述设备文件总容量的比例为 所述第一比例; 将所述至少两个文件块中除所述一部分以外的另一部分文件 块组合为所述第二部分。
结合第三方面第六种或第七种可能的实现方式, 在第八种可能的实现方 式中, 所述第一加密算法的安全性高于所述第二加密算法的安全性; 所述第 一比例小于 50%。
结合第三方面第二种或第八种可能的实现方式种任一种可能的实现方 式, 在第九种可能的实现方式中, 所述设备文件的加密装置还包括:
生成单元, 用于生成信息表, 所述信息表包括所述至少两个文件块中每 一文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文件块 的位置和数量、 所述第一部分中的文件块与第一加密算法的对应关系, 所述 第二部分中的文件块与所述第二加密算法的对应关系;
所述存储单元, 还用于将所述信息表存储于所述加密的设备文件的预设 区域, 或者将所述信息表存储为独立于所述加密的设备文件的第一文件。
结合第三方面第九种可能的实现方式, 在第十种可能的实现方式中, 所 述加密单元, 还用于对所述信息表进行加密, 所述信息表对应的加密算法为 所述第一加密算法;
所述存储单元, 还用于将加密的信息表存储于所述加密的设备文件的预 设区域,或者将加密的信息表存储为独立于所述加密的设备文件的第一文件。
第四方面提供一种设备文件的解密装置, 包括:
分割单元, 用于将加密的设备文件分割为第一部分和第二部分, 其中所 述第一部分和所述第二部分分别包括至少一个文件块;
解密单元, 用于对所述第一部分和所述第二部分分别进行解密, 其中所 述第一部分中的文件块对应的解密算法为第一解密算法, 所述第二部分中的 文件块对应的解密算法为第二解密算法, 所述第一解密算法与所述第二解密 算法不同;
存储单元, 用于存储解密的设备文件。
在第四方面第一种可能的实现方式中, 所述分割单元, 具体用于将所述 加密的设备文件分割为所述第一部分和所述第二部分, 其中, 所述第一部分 和所述第二部分所包括的文件块的位置和数量分别根据预设策略确定, 所述 第一部分和所述第二部分所包括的文件块的起始地址和长度分别根据所述策 略确定;
所述设备文件的解密装置, 还包括:
确定单元, 用于根据所述策略确定所述第一部分中的文件块对应的所述 第一解密算法和所述第二部分中的文件块对应的所述第二解密算法。
结合第四方面第一种可能的实现方式, 在第二种可能的实现方式中, 所 述策略包括: 所述第一部分和所述第二部分中文件块的起始地址和长度、 所 述第一部分和所述第二部分中文件块的位置和数量、 所述第一部分和所述第 二部分中文件块对应的解密算法。
在第四方面第三种可能的实现方式中,所述设备文件的解密装置还包括: 获取单元, 用于从所述加密的设备文件中或独立于所述加密的设备文件 的第一文件中获取所述加密的设备文件的信息表, 所述信息表包括所述第一 部分和所述第二部分中文件块的起始地址和长度、 所述第一部分和所述第二 部分所包括的文件块的位置和数量、 所述第一部分中的文件块对应的所述第 一加密算法和所述第二部分中的文件块对应的所述第二加密算法;
所述分割单元, 还用于根据所述信息表中所述第一部分和所述第二部分 中文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文件块 的位置和数量,将所述加密的设备文件分割为所述第一部分和所述第二部分; 所述确定单元, 还用于根据所述信息表中所述第一部分中的文件块对应 的所述第一加密算法和所述第二部分中的文件块对应的所述第二加密算法, 确定所述第一部分中的文件块对应的所述第一解密算法和所述第二部分中的 文件块对应的所述第二解密算法, 所述第一解密算法与所述第一加密算法互 逆, 所述第二解密算法与所述第二加密算法互逆。
结合第四方面第三种可能的实现方式, 在第四种可能的实现方式中, 所 述解密单元, 还用于, 若所述信息表是加密的信息表时, 对所述加密的信息 表进行解密。
本发明实施例提供的设备文件的加解密方法及装置, 通过将设备文件分 割为第一部分和第二部分, 并使用不同的第一加密算法和第二加密算法对第 一部分和第二部分中的文件块进行加密, 然后存储加密的设备文件, 使加密 的设备文件兼顾了加解密的安全性和处理速度。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见地, 下 面描述中的附图是本发明的一些实施例, 对于本领域普通技术人员来讲, 在 不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例提供的设备文件的加密方法实施例一的流程图; 图 2为本发明实施例提供的设备文件的加密方法实施例二的流程图; 图 3为本发明实施例提供的设备文件的加密方法实施例三的流程图; 图 4为本发明实施例提供的设备文件的加密方法实施例四的流程图; 图 5为本发明实施例提供的设备文件的解密方法实施例一的流程图; 图 6为本发明实施例提供的设备文件的解密方法实施例二的流程图; 图 7为本发明实施例提供的设备文件的解密方法实施例三的流程图; 图 8为本发明实施例提供的设备文件的加密装置实施例一的结构示意 图;
图 9为本发明实施例提供的设备文件的加密装置实施例二的结构示意 图;
图 10为本发明实施例提供的设备文件的加密装置实施例三的结构示意 图;
图 11为本发明实施例提供的设备文件的加密装置实施例四的结构示意 图;
图 12为本发明实施例提供的设备文件的解密装置实施例一的结构示意 图;
图 13为本发明实施例提供的设备文件的解密装置实施例二的结构示意 图;
图 14为本发明实施例提供的设备文件的解密装置实施例三的结构示意 图;
图 15为本发明实施例提供的设备文件的加密装置实施例五的结构示意 图;
图 16 为本发明实施例提供的设备文件的解密装置实施例四的结构示意 图。 具体实施方式
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发 明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于 本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获 得的所有其他实施例, 都属于本发明保护的范围。
现有技术中, 对于设备软件中的文件进行加解密时, 可以选择使用强加 密算法或者弱加密算法, 其中, 强加密算法的安全性高于弱加密算法的安全 性。 将设备软件中的文件称为设备文件, 一般地, 强加密算法的运算复杂度 高于弱加密算法, 因此采用强加密算法进行加密的设备文件加解密的处理速 度要比采用弱加密算法进行加密的设备文件加解密的处理速度慢。 因此现有 技术中或者选择强加密算法对设备文件进行加密, 保证设备文件的安全性, 但牺牲对设备文件进行加解密的处理速度; 或者选择弱加密算法对设备文件 进行加密, 提高对设备文件进行加解密的处理速度, 但是牺牲设备文件的安 全性。 总之, 现有技术对设备文件进行加解密的方法没有同时兼顾到安全性 和处理速度。
其中, 强加密算法有多种, 例如 3DES、 AES、 RSA 1024Bit等算法,其中,
3DES算法是指使用双长度 (16字节) 密钥 K= ( KLIIKR) 将 8字节明文数据 块进行 3次 DES加密 /解密, AES是美国国家标准技术研究所 NIST旨在取代 DES 的 21世纪的加密标准; RSA公开密钥密码体制就是使用不同的加密密钥与解 密密钥, 能同时用于加密和数字签名的算法, RSA的 1024位是指公钥及私钥 分别是 1024bit, 也就是 1024/8=128 Bytes, 相当于对称加密算法 80bit密钥的强 度。
弱加密算法有多种, 例如 AES 256-SHA RC4-MD5 等算法, 其中, AES-256:密钥长度为 256位的高级加密标准(Advanced Encryption Standard, AES ) SHA-1 :—种安全散列算法 (Secure Hash Algorithm) 。
鉴于现有技术的问题, 本发明实施例提供一种设备文件的加解密方法和 装置, 通过将待加密的设备文件分割为至少两个部分, 对于每一部分采用不 同的加密算法进行加密, 从而得到采用不同加密算法进行加密的设备文件。 在对加密的设备文件进行解密时,同样将加密的设备文件分为至少两个部分, 对于采用不同加密算法的部分分别采用相应的解密算法进行解密, 得到原始 的设备文件。 由于本发明实施例提供的设备文件的加解密算法对设备文件采 用了至少两种不同的加密算法进行加密处理, 增加了对设备文件进行加密的 复杂度, 同时由于每种加密算法的安全性和处理速度都不同, 从而比仅使用 安全性最高的加密算法时处理速度快, 而比仅使用处理速度最快的加密算法 时安全性高。 也就是说本发明实施例提供的设备文件的加解密方法同时兼顾 了对设备文件加解密时的安全性和处理速度, 在保证设备文件安全性的前提 下, 节约了系统资源。
为了便于表述, 本发明下述各实施例中, 将加密的设备文件简称为加密 文件。
图 1为本发明实施例提供的设备文件的加密方法实施例一的流程图, 如 图 1所示, 本实施例的方法包括:
歩骤 S101 , 将设备文件分割为第一部分和第二部分, 其中, 第一部分和 第二部分分别包括至少一个文件块。
例如, 本实施例提供的方法中, 将设备文件分割为第一部分和第二部分, 其中每一部分分别采用不同的加密算法进行加密。 由于对设备文件分割为第 一部分和第二部分时,第一部分和第二部分中一般包含的都不是连续的数据, 因此将第一部分和第二部分中包括的每一段连续的数据称为一个文件块, 在 确定第一部分和第二部分分别对应的加密算法时, 是针对每一个文件块使用 一种加密算法进行加密, 也就是说将设备文件分割后, 加密算法的加密粒度 是文件块。
歩骤 S102, 对第一部分和第二部分分别进行加密, 其中第一部分中的文 件块对应的加密算法为第一加密算法, 第二部分中的文件块对应的加密算法 为第二加密算法, 第一加密算法与第二加密算法不同。
例如, 在对设备文件进行分割后, 分别对第一部分和第二部分进行加密, 其中, 使用不同的加密算法对第一部分和第二部分中的文件块进行加密。 将 第一部分中文件块对应的加密算法称为第一加密算法, 将第二部分中文件块 对应的加密算法称为第二加密算法,其中第一加密算法与第二加密算法不同。 第一加密算法与第二加密算法不同, 意味着第一加密算法和第二加密算法的 安全性存在差异, 并且第一加密算法和第二加密算法的处理速度也不同, 对 使用第一加密算法和第二加密算法加密的文件进行解密的处理速度也不同。 因此使用本歩骤加密的设备文件具有比仅单独使用第一加密算法或第二加密 算法加密的设备文件更高的安全性或者更快的处理速度。 因此采用本发明实 施例提供的设备文件加密方法, 通过调整对设备文件分割的第一部分和第二 部分的大小以及第一加密算法和第二加密算法, 可以在对设备文件加密时兼 顾安全性和处理速度, 使加密的设备文件既保证一定的安全性又具有较快的 处理速度。
歩骤 S103 , 存储加密的设备文件。
例如, 在歩骤 S102中对设备文件进行加密后, 将设备文件存储到相应的 位置, 当运行设备软件时需要读取该设备文件时, 将首先读取到该加密的设 备文件, 然后对加密的设备文件解密后即可读取未加密的原始设备文件。
需要说明的是, 在本实施例中, 以将设备文件分割为两个部分为例, 对 本实施例提供的设备文件的加密方法进行说明, 但本发明提供的设备文件的 加密方法不以此为限。 只要是将设备文件分割为至少两个部分, 每一部分中 包括至少一个文件块, 并对每一部分中的文件块分别采用不同的加密算法进 行加密, 得到加密的设备文件的技术方案都在本发明的保护范围之内。
本实施例通过将设备文件分割为第一部分和第二部分, 并使用不同的第 一加密算法和第二加密算法对第一部分和第二部分中的文件块进行加密, 然 后存储加密的设备文件, 使加密的设备文件兼顾了加解密的安全性和处理速 度。
进一歩地, 在图 1所示实施例中, 歩骤 S101具体包括: 将所述设备文件 分割为至少两个文件块; 将所述至少两个文件块组合为所述第一部分和所述 第二部分, 其中所述第一部分和所述第二部分分别包括至少一个文件块。
例如, 由于设备文件的加密粒度为文件块, 因此实际上将设备文件分割 为第一部分和第二部分时, 首先可以将设备文件分割为至少两个文件块。 这 里的每个文件块为能够使用一个加密算法进行加密的一段数据。 然后再根据 每一文件块所对应的加密算法, 将需要使用相同的加密算法的文件块组合为 同一个部分, 生成设备文件的第一部分和第二部分。 其中第一部分和第二部 分中至少包括一个文件块。
由于对设备文件加密的加密粒度为文件块, 因此若需要分割的第一部分 和第二部分中的文件块是连续的, 则可以根据歩骤 S101的方法, 直接将设备 文件分割为第一部分和第二部分, 使第一部分和第二部分中分别包括至少一 个文件块。 而如果需要分割的第一部分和第二部分中的文件块不是连续存储 的, 那么就需要先将设备文件分割为至少一个文件块, 然后再将至少一个文 件块组合为第一部分和第二部分。 另外, 在对第一部分和第二部分中的文件 块进行加密时, 也有两种具体的方法, 可以先对第一部分和第二部分中的文 件块使用相应的加密算法进行加密, 然后将加密后的文件块再次组合为加密 后的第一部分和第二部分; 或者先将第一部分和第二部分中的文件块组合在 一起, 然后使用相应的加密算法对第一部分或第二部分统一进行加密。
同样地, 当需要将设备文件分割为两个以上的部分, 并且采用不同的加 密算法对每一部分中的文件块进行加密时, 也是需要首先将设备文件分割为 多个文件块, 并将多个文件块组合为多个部分, 并保证每一部分中包括至少 一个文件块。
图 2为本发明实施例提供的设备文件的加密方法实施例二的流程图, 如 图 2所示, 本实施例的方法包括:
歩骤 S201 , 将设备文件分割为至少两个文件块, 其中, 每一个文件块的 起始地址和长度根据预设策略确定。
例如, 本实施例在图 1所示实施例的基础上, 进一歩地提供一种具体的 设备文件加密方法。 本实施例中, 将设备文件分割为至少两个文件块的依据 是预设的策略, 该预设策略预先配置在系统中。 一个设备文件可以看做是在 存储器中的一段连续的地址中存储的数据, 在对设备文件进行分割时, 只需 要确定一个文件块的起始地址和长度, 即可确定一个文件块。 因此, 在本歩 骤中, 根据预设策略中每一文件块的起始地址和长度, 就可以将设备文件分 割为至少两个文件块。
歩骤 S202, 将所述至少两个文件块组合为第一部分和第二部分, 其中, 第一部分和第二部分所包括的文件块的位置和数量分别根据所述策略确定。
例如, 在根据预设策略将设备文件分割为至少两个文件块后, 仍然根据 预设策略将至少两个文件块组合为该设备文件的第一部分和第二部分。 由于 每个文件块的长度已经确定, 因此在将至少两个文件块组合为第一部分和第 二部分时, 只需要将每一部分中所包括的文件块的位置和数量确定, 就可以 确定第一部分和第二部分中所包括的具体数据。
歩骤 S203 , 根据所述策略确定第一部分中的文件块对应的第一加密算法 和第二部分中的文件块对应的第二加密算法, 第一加密算法与第二加密算法 不同。
例如, 在将设备文件分割为第一部分和第二部分后, 还是根据预设的策 略确定第一部分和第二部分中文件块所分别对应的加密算法。 也就是说在本 实施例中, 如何对设备文件进行分割, 分割后的设备文件的每一部分分别对 应哪种加密算法进行加密都是根据预设策略确定的。
歩骤 S204, 对第一部分和第二部分分别进行加密, 其中第一部分中的文 件块对应的加密算法为第一加密算法, 第二部分中的文件块对应的加密算法 为第二加密算法。
例如,本歩骤与歩骤 S102相同。由于本实施例中,在对设备文件加密时, 对设备文件进行分割和分割后的各部分对应的加密算法都是根据预设策略确 定的, 因此在对加密的设备文件进行解密时, 可以根据预设策略对该加密的 设备文件进行解密, 从而得到原始的设备文件。
歩骤 S205 , 存储加密的设备文件。
本实施例提供的设备文件的加密方法中, 根据预设策略对设备文件进行 分割和加密, 从而在对加密的设备文件进行解密时, 同样可以根据预设策略 进行解密, 提供了一种对设备文件进行加密的具体方法。
进一歩地, 在图 2所示实施例中, 该预设的策略包括: 针对所述设备文 件进行分割时文件块的起始地址和长度、 所述第一部分和所述第二部分中文 件块的位置和数量、所述第一部分和所述第二部分中文件块对应的加密算法。
例如, 该预设的策略可以根据经验值或历史数据确定, 或者该预设的策 略可以由用户自己设定。 该策略中包括对设备文件进行分割和确定所使用的 加密算法的内容, 具体包括将设备文件分割为至少两个文件块时每一文件块 的起始地址和长度, 以及将至少两个文件块合并为第一部分和第二部分时每 一部分中文件块的位置和数量, 根据上述两部分内容可以将设备文件分割为 第一部分和第二部分。 该策略中还包括第一部分和第二部分中文件块对应的 加密算法, 这样就可以根据预设的策略对设备文件进行加密处理。
需要说明的是, 在图 2所示实施例中, 以将设备文件分割为两个部分为 例, 对本实施例提供的设备文件的加密方法进行说明, 但本发明提供的设备 文件的加密方法不以此为限。 例如可以首先将设备文件分割为至少两个文件 块, 其中, 每一文件块的起始地址和大小根据预设的策略确定; 然后将所述 至少两个文件块组合为设备文件的至少两个部分, 其中, 每一部分所包括的 文件块的位置和数量分别根据所述策略确定, 每一部分中包括至少一个文件 块; 接下来根据所述策略确定设备文件的至少两个部分中每一部分中的文件 块对应的加密算法, 其中每一部分中的文件块对应的加密算法不同。 最后对 设备文件分割后的至少两个部分进行加密, 得到加密的设备文件。
本发明实施例提供的设备文件的加密方法实施例三提供另一种具体的设 备文件加密方法, 在本实施例中, 在对设备文件进行分割和确定加密算法时, 第一部分包括的文件块中的数据的重要性大于第二部分包括的文件块中的数 据的重要性; 第一加密算法的安全性高于第二加密算法的安全性。 也就是说, 本实施例中, 是根据存储的数据的重要性对设备文件进行分割, 并且确定相 应的加密算法,其中所存储数据的重要性高的部分对应安全性高的加密算法。
图 3为本发明实施例提供的设备文件的加密方法实施例三的流程图, 如 图 3所示, 本实施例的方法包括:
歩骤 S301 , 将设备文件分割为至少两个文件块。
例如, 本实施例中, 可以随机地将设备文件分割为至少两个文件块, 也 可以根据设备文件中的所存储数据的重要性将设备文件分割为至少两个文件 块。 在设备文件中, 存储的各种数据中, 有一些重要的数据, 例如关键算法、 关键处理策略等, 这些重要的数据一旦泄露就相当于整个设备文件泄露; 而 例如数据库等数据即使泄露, 在没有关键算法和处理策略的支持下, 也无法 得到整个设备文件。 对于设备文件中存储的不同数据, 可以对其设置相应的 重要性等级, 例如对于所存储的关键算法、 关键处理策略等对设备文件的安 全性影响最大的数据, 可以设置为最高优先级; 对于设备文件的一般算法、 一般处理策略等数据, 可以设置为中等优先级; 而对于数据库等对安全性基 本无影响的数据, 可以设置为低优先级。 另外, 还可以将设备文件的重要性 等级进行更细致地划分, 例如分为 5级、 7级等。 在本实施例中, 将设备文 件分割为至少两个文件块时, 可以按照所存储数据的重要性, 将重要性超过 预设阈值的部分和未超过预设阈值的部分分割开, 使分割后的文件块中某些 文件块中存储的数据的重要性超过预设阈值, 而另外的文件块中存储的数据 的重要性未超过预设阈值。 即使是随机对设备文件进行分割, 也需要对每一 文件块中的数据的重要性进行判断。 对设备文件进行分割时, 作为分割依据 的重要性阈值可以是根据经验值或者系统处理能力预设的, 例如重要性等级 共分为 5级, 其中等级 1表示重要性最高, 等级 5表示重要性最低, 预设的 重要性阈值可以为 3, 当设备文件中文件块中存储的数据的重要性为 1 或 2 时, 则判断超过预设阈值; 当设备文件中文件块中存储的数据的重要性为 3、 4、 5时, 则判断未超过预设阈值。
歩骤 S302, 将所述至少两个文件块中的数据的重要性超过预设阈值的文 件块组合为第一部分。
歩骤 S303 , 将所述至少两个文件块中的数据的重要性未超过预设阈值的 文件块组合为第二部分。
例如, 在歩骤 S302和 S303中, 基于歩骤 S301对设备文件的分割, 将所 存储数据的重要性超过预设阈值的文件块组合在一起, 作为所述设备文件的 第一部分, 而将所存储数据的重要性未超过预设阈值的文件块组合在一起, 作为所述设备文件的第二部分。 这样就根据所存储数据的重要性将设备文件 分割为了第一部分和第二部分。
歩骤 S304, 对第一部分和第二部分分别进行加密, 其中第一部分中的文 件块对应的加密算法为第一加密算法, 第二部分中的文件块对应的加密算法 为第二加密算法, 第一加密算法的安全性高于第二加密算法的安全性。
例如, 在对分割后的设备文件的第一部分和第二部分进行加密时, 由于 第一部分中所存储的数据的重要性超过预设阈值, 因此对第一部分中的文件 块进行加密所使用的第一加密算法的安全性也可以较高; 而对第二部分中的 文件块进行加密所使用的第二加密算法的安全性就可以低于第一加密算法的 安全性。 保证了设备文件中存储的重要数据的安全性, 就相当于保证了整个 设备文件的安全性; 而使用安全性相对较低的第二加密算法加密重要性较低 的数据, 加解密的处理速度则会较快。 因此本实施例提供的设备文件加密方 法既可以保证设备文件的安全性, 又提高了加解密的处理速度。
在本实施例中,只要第一加密算法的安全性高于第二加密算法的安全性, 则加密的设备文件的安全性会高于仅使用第二加密算法时的安全性, 而处理 速度会高于仅使用第一加密算法时的处理速度。 并且加密的设备文件的安全 性与仅使用第一加密算法进行加密时差距不大。 歩骤 S305, 存储加密的设备文件。
本实施例提供的设备文件的加密方法中, 根据所存储数据的重要性对设 备文件进行分割和加密, 从而提供了一种更加合理地对设备文件进行加密的 具体方法。
进一歩地, 在图 3所示实施例中, 歩骤 S305存储加密的设备文件之前, 还包括: 生成信息表, 所述信息表包括所述至少两个文件块中每一文件块的 起始地址和长度、 所述第一部分和所述第二部分所包括的文件块的位置和数 量、 所述第一部分中的文件块与第一加密算法的对应关系, 所述第二部分中 的文件块与所述第二加密算法的对应关系; 将信息表存储于加密的设备文件 的预设区域, 或者将信息表存储为独立于设备文件的第一文件。
例如, 在图 3所示实施例中, 可以根据设备文件中所存储的数据的重要 性对设备文件进行分割, 或者随机对设备文件进行分割, 并为分割后的设备 文件分配相应的加密算法。 但在对加密的设备文件进行解密时, 需要知道对 加密的设备文件的哪些部分使用了哪种加密算法, 才能使用相应的解密算法 进行解密处理。 因此在图 3所示实施里的基础上, 还可以生成信息表, 该信 息表中包括对设备文件进行分割和加密的各种信息, 例如所述信息表包括所 述至少两个文件块中每一文件块的起始地址和长度、 所述第一部分和所述第 二部分所包括的文件块的位置和数量、 所述第一部分中的文件块与第一加密 算法的对应关系,所述第二部分中的文件块与所述第二加密算法的对应关系。 根据上述信息, 在对加密的设备文件进行解密时, 就可以对相应的文件块使 用与相应的加密算法对应的解密算法进行解密, 最终得到原始的设备文件。 另外, 生成的信息表可以存储于加密的设备文件中, 例如在加密的设备文件 中预留一个预设大小的存储区域, 将生成的信息表存储在该区域中, 当需要 对加密的设备文件进行解密时, 首先从预设的区域中读取该信息表; 或者信 息表可以存储为独立于设备文件的第一文件, 也就是说可以将信息表作为独 立的文件存储起来, 并且建立第一文件和加密的设备文件的联系, 当需要对 加密的设备文件进行解密时, 首先读取该第一文件, 然后才根据第一文件中 的信息表对加密的设备文件进行解密。
进一歩地, 由于设备文件的信息表存储的是用于解密该设备文件的相关 信息, 若获取该信息表则可以解密该设备文件。 因此该信息表也可以进行加 密存储, 才能够保证加密的设备文件的安全性, 所以在生成信息表之后, 还 包括: 对信息表进行加密, 信息表对应的加密算法为第一加密算法。 将信息 表存储于加密的设备文件的预设区域, 或者将信息表存储为独立于加密的设 备文件的第一文件, 包括: 将加密的信息表存储于加密的设备文件的预设区 域, 或者将所述信息表存储为独立于所述加密的设备文件的第一文件。 由于 信息表中存储的数据对该加密的设备文件的安全性影响较大, 因此可以将其 认为是重要性超过预设阈值的数据, 因此对信息表进行加密使用的加密算法 为第一加密算法。
需要说明的是, 在图 3所示实施例中, 以将设备文件分割为两个部分为 例, 对本实施例提供的设备文件的加密方法进行说明, 但本发明提供的设备 文件的加密方法不以此为限。 例如可以首先将设备文件分割为至少两个文件 块, 其中, 至少一个文件块中的数据的重要性超过预设阈值; 将至少两个文 件块组合为设备文件的至少两个部分, 其中, 至少一个部分所包括的文件块 中所存储的数据的重要性超过预设阈值; 对所述设备文件的至少两个部分分 别进行加密, 其中, 所包括的文件块中所存储的数据的重要性超过预设阈值 的部分对应第一加密算法组, 所包括的文件块中所存储的数据的重要性未超 过预设阈值的部分对应第二加密算法组, 第一加密算法组和第二加密算法组 分别包括至少一个加密算法, 第一加密算法组中的加密算法的安全性高于第 二加密算法组中的加密算法的安全性。 也就是说, 不论将设备文件分割为几 个部分, 只要保证所存储的数据重要性超过预设阈值的部分对应的加密算法 的安全性高于所存储的数据重要性未超过预设阈值的部分对应的加密算法即 可。 若在存储加密的设备文件之前, 还生成了信息表, 则对信息表进行加密 可以使用第一加密算法组中的任一加密算法, 或者使用第一加密算法组中安 全性最高的加密算法。
本发明实施例提供的设备文件的加密方法实施例四提供又一种具体的设 备文件加密方法, 在本实施例中, 在对设备文件进行分割时, 是根据预设的 分割比例, 将设备文件分割为第一部分和第二部分, 其中第一部分和第二部 分中包括的文件块的容量占设备文件总容量的比例根据预设比例确定。 并且 为所占比例较小的部分中的文件块配置安全性较高的加密算法, 而为所占比 例较大的部分中的文件块配置安全性较低的加密算法。 图 4为本发明实施例提供的设备文件的加密方法实施例四的流程图, 如 图 4所示, 本实施例的方法包括:
歩骤 S401 , 将设备文件分割为至少两个文件块。
例如, 本实施例中, 总的思路是随机将设备文件分割为至少两个文件块, 在将至少两个文件块组合为第一部分和第二部分时, 根据预设的比例, 控制 第一部分和第二部分中所包括的文件块中的数据在设备文件中的比例。 为比 例较小的部分分配安全性较高的加密算法, 为比例较大的部分分配安全性较 低的加密算法, 则同样可以在保证加密的设备文件的安全性的基础上, 降低 加解密的处理速度。 因此, 在本歩骤中, 首先可以随机地将设备文件分割为 至少两个文件块。
歩骤 S402, 将所述至少两个文件块中的一部分文件块组合为第一部分, 所述一部分文件块的容量占设备文件总容量的比例为第一比例, 第一比例小 于 50%。
例如, 在将至少两个文件块组合为第一部分时, 同样可以随机地进行组 合, 只要保证组合后的第一部分中所包括的文件块的总容量占设备文件总容 量的比例为第一比例即可。 另外, 为了在保证加密的设备文件的安全性的基 础上, 尽量降低加解密的处理速度, 因此只要对容量较小的一部分使用安全 性较高的加密算法进行加密即可, 所以在本实施例中, 若确定需要对第一部 分使用安全性较高的加密算法进行加密, 则该第一比例可以小于 50%。
歩骤 S403 , 将所述至少两个文件块中除所述一部分以外的另一部分文件 块组合为第二部分。
例如, 在确定了第一部分中所包括的文件块后, 将剩余的文件块组合成 设备文件的第二部分。
歩骤 S404, 对第一部分和第二部分分别进行加密, 其中第一部分中的文 件块对应的加密算法为第一加密算法, 第二部分中的文件块对应的加密算法 为第二加密算法, 第一加密算法的安全性高于第二加密算法的安全性。
例如, 在对分割后的设备文件的第一部分和第二部分进行加密时, 由于 第一部分所占的比例为第一比例, 并且第一比例小于 50%, 因此为了降低加 解密处理速度, 对第一部分中的文件块进行加密所使用的第一加密算法的安 全性也可以较高; 而对第二部分中的文件块进行加密所使用的第二加密算法 的安全性就可以低于第一加密算法的安全性。
歩骤 S405 , 存储加密的设备文件。
本实施例提供的设备文件的加密方法中, 根据预设比例对设备文件进行 分割, 并对比例较小的一部分采用强加密算法进行加密, 从而提供了另一种 合理地对设备文件进行加密的具体方法。
进一歩地, 在图 4所示实施例中, 歩骤 S405存储加密的设备文件之前, 还包括: 生成信息表, 所述信息表包括所述至少两个文件块中每一文件块的 起始地址和长度、 所述第一部分和所述第二部分所包括的文件块的位置和数 量、 所述第一部分中的文件块与第一加密算法的对应关系, 所述第二部分中 的文件块与所述第二加密算法的对应关系; 将信息表存储于加密的设备文件 的预设区域, 或者将信息表存储为独立于加密的设备文件的第一文件。
例如, 在图 4所示实施例中, 根据预设的比例对设备文件进行分割, 并 为分割后的设备文件分配相应的加密算法。 但在对加密的设备文件进行解密 时, 需要知道对加密的设备文件的哪些部分使用了哪种加密算法, 才能使用 相应的解密算法进行解密处理。 因此在图 4所示实施里的基础上, 还可以生 成信息表, 该信息表中包括对设备文件进行分割和加密的各种信息, 例如所 述信息表包括所述至少两个文件块中每一文件块的起始地址和长度、 所述第 一部分和所述第二部分所包括的文件块的位置和数量、 所述第一部分中的文 件块与第一加密算法的对应关系, 所述第二部分中的文件块与所述第二加密 算法的对应关系。 根据上述信息, 在对加密的设备文件进行解密时, 就可以 对相应的文件块使用与相应的加密算法对应的解密算法进行解密, 最终得到 原始的设备文件。 另外, 生成的信息表可以存储于加密的设备文件中, 例如 在加密的设备文件中预留一个预设大小的存储区域, 将生成的信息表存储在 该区域中, 当需要对加密的设备文件进行解密时, 首先从预设的区域中读取 该信息表; 或者信息表可以存储为独立于加密的设备文件的第一文件, 也就 是说可以将信息表作为独立的文件存储起来, 并且建立第一文件和加密的设 备文件的联系, 当需要对加密的设备文件进行解密时, 首先读取该第一文件, 然后才根据第一文件中的信息表对加密的设备文件进行解密。
进一歩地, 由于设备文件的信息表存储的是用于解密该设备文件的相关 信息, 若获取该信息表则可以解密该设备文件。 因此该信息表也可以进行加 密存储, 才能够保证加密的设备文件的安全性, 所以在生成信息表之后, 还 包括: 对信息表进行加密, 信息表对应的加密算法为第一加密算法。 将信息 表存储于加密的设备文件的预设区域, 或者将信息表存储为独立于加密的设 备文件的第一文件, 包括: 将加密的信息表存储于加密的设备文件的预设区 域, 或者将所述信息表存储为独立于所述加密的设备文件的第一文件。 由于 信息表中存储的数据对该加密的设备文件的安全性影响较大, 因此可以将其 认为是较为重要的数据, 而由于第一加密算法的安全性高于第二加密算法, 因此对信息表进行加密使用的加密算法为第一加密算法。
需要说明的是, 在图 4所示实施例中, 以将设备文件分割为两个部分为 例, 对本实施例提供的设备文件的加密方法进行说明, 但本发明提供的设备 文件的加密方法不以此为限。 例如可以首先将设备文件分割为至少两个文件 块; 然后将至少两个文件块组合为设备文件的至少两个部分, 其中每一部分 中的文件块的容量占设备文件总容量的比例均为预设比例; 对所述设备文件 的至少两个部分分别进行加密, 其中, 所包括的文件块的容量占设备文件总 容量的比例越小, 则该部分所对应的加密算法的安全性越高。 也就是说, 不 论将设备文件分割为几个部分, 只要是容量所占比例较低的部分对应安全性 较高的加密算法即可。 若在存储加密的设备文件之前, 还生成了信息表, 则 对信息表进行加密可以使用安全性最高的加密算法。
另外, 在图 2所示实施例中, 仅示出了根据预设的策略对设备文件进行 分割并加密, 在对加密的设备文件进行解密时, 也是根据该预设的策略进行 解密的情况。 但本发明实施例提供的设备文件的加密方法不限于此, 例如还 可以是根据预设策略对设备文件进行分割并加密, 但在对加密的设备文件解 密时, 并不是根据预设的策略进行解密的。 而是与图 3和图 4所示实施例相 似地, 在根据预设策略对设备文件进行分割并加密后, 生成该设备文件的信 息表, 并将该信息表存储于加密的设备文件的预设区域, 或者将信息表存储 于独立于加密的设备文件的第一文件。 在需要对该加密的设备文件进行解密 时, 首先读取该信息表, 然后根据信息表中的信息对加密的设备文件进行解 密。 该信息表与图 3和图 4所示的信息表类似, 此处不再赘述。
图 5为本发明实施例提供的设备文件的解密方法实施例一的流程图, 如 图 5所示, 本实施例的方法包括: 歩骤 S501, 将加密的设备文件分割为第一部分和第二部分, 其中第一部 分和第二部分分别包括至少一个文件块。
例如, 本实施例提供一种设备文件的解密方法, 用于对使用本发明实施 例提供的设备文件的加密方法加密的设备文件进行解密。 由于本发明实施例 提供的设备文件的加密方法是将设备文件分割为两个部分后, 再对不同部分 采用不同的加密算法进行加密处理。 因此在本实施例中, 首先将加密的设备 文件分割为第一部分和第二部分, 其中, 该第一部分和第二部分的分割是以 文件块为粒度的, 第一部分和第二部分中分别包括至少一个文件块。 为了对 加密的设备文件进行解密, 对第一部分和第二部分的分割可以与对设备文件 进行加密时相对应。 根据对设备文件进行加密的具体方法, 在对加密的设备 文件进行解密时, 可以根据预设的策略对加密的设备文件进行分割, 也可以 根据信息表对设备文件进行分割。
歩骤 S502 , 对第一部分和第二部分分别进行解密, 其中第一部分中的文 件块对应的解密算法为第一解密算法, 第二部分中的文件块对应的解密算法 为第二解密算法, 第一解密算法与第二解密算法不同。
例如, 在得到加密的设备文件的第一部分和第二部分后, 分别对第一部 分和第二部分中包括的文件块使用相应的解密算法进行解密, 其中第一部分 中的文件块对应第一解密算法, 第二部分中的文件块对应第一加密算法。 由 于对文件进行加密和解密是一个互逆的过程, 因此在对第一部分中的文件块 进行解密的过程中, 所使用的第一解密算法需要与对该文件块进行加密时使 用的第一加密算法互逆; 同样地, 在对第二部分中的文件块进行解密的过程 中, 所使用的第二解密算法需要与对该文件块进行加密时使用的第而加密算 法互逆。 根据对设备文件进行加密的具体方法, 在对加密的设备文件进行解 密时, 第一部分和第二部分所对应的第一解密算法和第二解密算法可以根据 预设的策略确定, 也可以根据信息表确定。
歩骤 S503 , 存储解密的设备文件。
需要说明的是, 在本实施例中, 以将设备文件分割为两个部分为例, 对 本实施例提供的设备文件的解密方法进行说明, 但本发明提供的设备文件的 加密方法不以此为限。 只要是将设备文件分割为至少两个部分, 每一部分中 包括至少一个文件块, 并对每一部分中的文件块分别采用不同的解密算法进 行解密, 得到解密后的设备文件的技术方案都在本发明的保护范围之内。 本实施例通过将加密的设备文件分割为第一部分和第二部分, 并使用不 同的第一解密算法和第二解密算法对第一部分和第二部分中的文件块进行解 密, 然后存储解密后的设备文件, 提供了一种对加密的设备文件进行解密处 理的方法。
图 6为本发明实施例提供的设备文件的解密方法实施例二的流程图, 如 图 6所示, 本实施例的方法包括:
歩骤 S601 , 将加密的设备文件分割为第一部分和第二部分, 其中, 第一 部分和第二部分所包括的文件块的位置和数量分别根据预设策略确定, 第一 部分和第二部分所包括的文件块的起始地址和长度分别根据所述策略确定。
例如, 本实施例提供的设备文件的解密方法是针对使用预设策略对设备 文件进行分割和加密的方法提出的。 因此若要对加密的设备文件进行解密, 首先就可以根据预设策略将加密的设备文件分割为第一部分和第二部分。 由 于对设备文件进行加解密的粒度是文件块, 因此在将加密的设备文件分割为 第一部分和第二部分时, 具体是需要确定每一部分中包括哪些文件块。 根据 预设策略中文件块的位置和数量就可以确定第一部分和第二部分中都包括哪 些文件块, 并且根据该策略中文件块的起始地址和长度就可以确定每一文件 块中包括的具体数据。 这样在确定第一部分和第二部分中文件块对应的解密 算法时, 就可以具体确定每一段数据所使用的解密算法。
歩骤 S602, 根据所述策略确定第一部分中的文件块对应的第一解密算法 和第二部分中的文件块对应的第二解密算法。
例如, 在确定了加密的设备文件的第一部分和第二部分后, 还需要确定 第一部分和第二部分中每一文件块分别使用哪种解密算法进行解密。 在本实 施例中, 仍然通过预设策略确定每一部分中文件块对应的解密算法。 由于在 对设备文件加密时, 若是根据预设策略进行的分割和加密, 那么每一部分中 文件块所对应的加密算法包括在预设策略中, 并且由于加密算法和解密算法 为互逆的算法, 因此可以根据预设策略所确定的加密算法, 确定根据预设策 略分割的加密的设备文件的第一部分和第二部分中文件块对应的解密算法。 或者在预设策略中直接包括分割后的加密的设备文件的第一部分和第二部分 中文件块对应的解密算法。 歩骤 S603, 对第一部分和第二部分分别进行解密, 其中第一部分中的文 件块对应的解密算法为第一解密算法, 第二部分中的文件块对应的解密算法 为第二解密算法, 第一解密算法与第二解密算法不同。
例如, 在得到加密的设备文件的第一部分和第二部分后, 分别对第一部 分和第二部分中包括的文件块使用相应的解密算法进行解密, 其中第一部分 中的文件块对应第一解密算法, 第二部分中的文件块对应第一加密算法。 由 于对文件进行加密和解密是一个互逆的过程, 因此在对第一部分中的文件块 进行解密的过程中, 所使用的第一解密算法需要与对该文件块进行加密时使 用的第一加密算法互逆; 同样地, 在对第二部分中的文件块进行解密的过程 中, 所使用的第二解密算法需要与对该文件块进行加密时使用的第而加密算 法互逆。
歩骤 S604 , 存储解密的设备文件。
本实施例提供的设备文件的解密方法中, 根据预设策略对设备文件进行 分割和解密, 提供了一种对根据预设策略进行加密的设备文件进行解密的具 体方法。
进一歩地, 在图 6所示实施例中, 所述策略包括: 所述第一部分和所述 第二部分中文件块的起始地址和长度、 所述第一部分和所述第二部分中文件 块的位置和数量、 所述第一部分和所述第二部分中文件块对应的解密算法。
例如, 该预设的策略可以根据经验值或历史数据确定, 或者该预设的策 略可以由用户自己设定。 在对设备文件进行加密时, 也是根据该策略进行的 加密处理, 则才能使用该策略对加密的设备文件进行解密。 该策略中包括对 加密的设备文件进行分割和确定所使用的加密算法的内容, 具体包括将加密 的设备文件分割为第一部分和第二部分时, 第一部分和第二部分中文件块的 位置和数量, 以及没以文件块的起始地址和长度, 根据上述两部分内容可以 将加密的设备文件分割为第一部分和第二部分。 该策略中还包括第一部分和 第二部分中文件块对应的解密算法。 或者该策略中还可以包括对该设备文件 进行加密时, 第一部分和第二部分中文件块对应的加密算法, 根据加密算法 和解密算法互逆的原理也可以确定每一文件块对应的解密算法。
需要说明的是, 在图 6所示实施例中, 以将设备文件分割为两个部分为 例, 对本实施例提供的设备文件的解密方法进行说明, 但本发明提供的设备 文件的解密方法不以此为限。 例如可以首先将加密的设备文件分割为至少两 个部分, 其中, 每一部分所包括的文件块的位置和数量分别根据预设的策略 确定; 根据所述策略确定加密的设备文件的至少两个部分中每一部分中的文 件块对应的解密算法。 其中每一部分中的文件块对应的解密算法不同。 最后 对加密的设备文件的至少两个部分进行解密, 得到原始的设备文件。
图 7为本发明实施例提供的设备文件的解密方法实施例三的流程图, 如 图 7所示, 本实施例的方法包括:
歩骤 S701 , 从加密的设备文件中或独立于加密的设备文件的第一文件中 获取加密的设备文件的信息表, 所述信息表包括第一部分和第二部分中文件 块的起始地址和长度、 第一部分和第二部分所包括的文件块的位置和数量、 第一部分中的文件块对应的第一加密算法和第二部分中的文件块对应的第二 加密算法。
例如, 本实施例提供的设备文件的解密方法是针对在对设备文件进行加 密时, 生成了信息表的加密方法提出的相应解密方法。 在本实施例中, 首先 可以获取加密的设备文件的信息表。 该信息表存储于加密的设备文件的预设 区域, 或者该信息表存储于独立于加密的设备文件的第一文件中, 信息表所 存储的具体位置一般为预先约定好的。 该信息表中包括在对设备文件加密时 如何对设备文件进行分割和分割后的每部分所对应的加密算法。 例如该信息 表包括加密的设备文件的第一部分和第二部分中文件块的起始地址和长度、 第一部分和第二部分所包括的文件块的位置和数量、 第一部分中的文件块对 应的第一加密算法和第二部分中的文件块对应的第二加密算法。
歩骤 S702, 根据信息表中第一部分和第二部分中文件块的起始地址和长 度、 第一部分和第二部分所包括的文件块的位置和数量, 将加密的设备文件 分割为第一部分和第二部分。
例如, 由于对设备文件进行加解密的粒度是文件块, 因此在将加密的设 备文件分割为第一部分和第二部分时, 具体是需要确定每一部分中包括哪些 文件块。 根据信息表中文件块的位置和数量就可以确定第一部分和第二部分 中都包括哪些文件块, 并且根据该信息表中文件块的起始地址和长度就可以 确定每一文件块中包括的具体数据。 这样在确定第一部分和第二部分中文件 块对应的解密算法时, 就可以具体确定每一段数据所使用的解密算法。 歩骤 S703, 根据信息表中第一部分中的文件块对应的第一加密算法和第 二部分中的文件块对应的第二加密算法, 确定第一部分中的文件块对应的第 一解密算法和第二部分中的文件块对应的第二解密算法, 第一解密算法与第 一加密算法互逆, 第二解密算法与第二加密算法互逆。
例如, 在确定了加密的设备文件的第一部分和第二部分后, 还需要确定 第一部分和第二部分中每一文件块分别使用哪种解密算法进行解密。 在本实 施例中,歩骤 S701获取的信息表中包括第一部分中的文件块对应的第一加密 算法和第二部分中的文件块对应的第二加密算法, 由于加密算法和解密算法 为互逆的算法, 因此可以根据信息表中第一部分中的文件块对应的第一加密 算法和第二部分中的文件块对应的第二加密算法, 确定第一部分中的文件块 对应的第一解密算法和第二部分中的文件块对应的第二解密算法。
歩骤 S704, 对第一部分和第二部分分别进行解密, 其中第一部分中的文 件块对应的解密算法为第一解密算法, 第二部分中的文件块对应的解密算法 为第二解密算法, 第一解密算法与第二解密算法不同。
例如, 在得到加密的设备文件的第一部分和第二部分后, 分别对第一部 分和第二部分中包括的文件块使用相应的解密算法进行解密, 其中第一部分 中的文件块对应第一解密算法, 第二部分中的文件块对应第一加密算法。 由 于对文件进行加密和解密是一个互逆的过程, 因此在对第一部分中的文件块 进行解密的过程中, 所使用的第一解密算法需要与对该文件块进行加密时使 用的第一加密算法互逆; 同样地, 在对第二部分中的文件块进行解密的过程 中, 所使用的第二解密算法需要与对该文件块进行加密时使用的第而加密算 法互逆。
歩骤 S705 , 存储解密的设备文件。
本实施例提供的设备文件的解密方法中, 首先获取加密的设备文件的信 息表, 并根据该信息表对设备文件进行分割和解密, 提供了一种对在加密时 生成了信息表的设备文件进行解密的具体方法。
进一歩地, 在图 7所示实施例中, 歩骤 S701从加密的设备文件中或独立 于加密的设备文件的第一文件中获取加密的设备文件的信息表之后,还包括: 对所述信息表进行解密。
例如, 根据图 3或图 4实施例可知, 若在对设备文件进行加密的过程中, 生成了信息表, 则进一歩地, 还可以对该信息表进行加密。 因此在图 7所示 实施例中, 若在对设备文件进行加密时, 同时对信息表进行了加密, 则在对 设备文件进行解密时, 获取到的信息表为加密的信息表, 在获取该加密的信 息表后, 还需要对该加密的信息表进行解密, 才能获取信息表中的信息, 从 而对加密的设备文件进行解密。 在对加密的信息表进行解密之前, 还需要确 定加密该加密的信息表所使用的加密算法。 由于对信息表进行加密时, 一般 使用安全性最高的加密算法, 因此在对加密的信息表进行解密时, 仍然使用 安全性最高的加密算法对应的解密算法即可。
需要说明的是, 在图 7所示实施例中, 以将设备文件分割为两个部分为 例, 对本实施例提供的设备文件的解密方法进行说明, 但本发明提供的设备 文件的解密方法不以此为限。 例如获取的信息表中包括至少两个部分中文件 块的位置和数量, 以及每一部分中文件块对应的加密算法, 则可以首先将加 密的设备文件分割为至少两个部分, 其中, 每一部分所包括的文件块的位置 和数量分别根据信息表确定; 根据信息表确定加密的设备文件的至少两个部 分中每一部分中的文件块对应的解密算法。 其中每一部分中的文件块对应的 解密算法不同。 最后对加密的设备文件的至少两个部分进行解密, 得到原始 的设备文件。
图 8 为本发明实施例提供的设备文件的加密装置实施例一的结构示意 图, 如图 8所示, 本实施例的设备文件的加密装置, 包括:
分割单元 81, 用于将所述设备文件分割为第一部分和第二部分, 其中, 所述第一部分和所述第二部分分别包括至少一个文件块。
加密单元 82, 用于对所述第一部分和所述第二部分分别进行加密, 其中 所述第一部分中的文件块对应的加密算法为第一加密算法, 所述第二部分中 的文件块对应的加密算法为第二加密算法, 所述第一加密算法与所述第二加 密算法不同。
存储单元 83, 用于存储加密的设备文件。
本实施例的设备文件的加密装置用于执行图 1所示方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
图 9 为本发明实施例提供的设备文件的加密装置实施例二的结构示意 图, 如图 9所示, 本实施例的设备文件的加密装置在图 8的基础上, 分割单 元 81, 包括:
分割子单元 91, 用于将所述设备文件分割为至少两个文件块。
组合子单元 92, 用于将所述至少两个文件块组合为所述第一部分和所述 第二部分, 其中所述第一部分和所述第二部分分别包括至少一个文件块。
图 10 为本发明实施例提供的设备文件的加密装置实施例三的结构示意 图,如图 10所示,本实施例的设备文件的加密装置在图 9的基础上,还包括: 确定单元 84, 用于根据所述策略确定所述第一部分中的文件块对应的第 一加密算法和所述第二部分中的文件块对应的所述第二加密算法。
分割子单元 91,具体用于将所述设备文件分割为至少两个文件块,其中, 每一个文件块的起始地址和长度根据预设策略确定。
组合子单元 92, 具体用于将所述至少两个文件块组合为所述第一部分和 所述第二部分, 其中, 所述第一部分和所述第二部分所包括的文件块的位置 和数量分别根据所述策略确定。
本实施例的设备文件的加密装置用于执行图 2所示方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
进一歩地, 图 10所示实施例中, 所述策略包括: 针对所述设备文件进行 分割时文件块的起始地址和长度、 所述第一部分和所述第二部分中文件块的 位置和数量、 所述第一部分和所述第二部分中文件块对应的加密算法。
进一歩地, 在图 9所示实施例中, 所述第一部分包括的文件块中的数据 的重要性大于所述第二部分包括的文件块中的数据的重要性; 所述第一加密 算法的安全性高于所述第二加密算法的安全性。 分割子单元 91, 具体用于将 所述设备文件分割为至少两个文件块; 组合子单元 92, 还用于将所述至少两 个文件块中的数据的重要性超过预设阈值的文件块组合为所述第一部分; 将 所述至少两个文件块中的数据的重要性未超过预设阈值的文件块组合为所述 第二部分。
进一歩地, 在图 9所示实施例中, 所述第一部分中的文件块的容量占所 述设备文件总容量的比例为第一比例。 分割子单元 91, 还用于将所述设备文 件分割为至少两个文件块; 组合子单元 92, 还用于将所述至少两个文件块中 的一部分文件块组合为所述第一部分, 所述一部分文件块的容量占所述设备 文件总容量的比例为所述第一比例; 将所述至少两个文件块中除所述一部分 以外的另一部分文件块组合为所述第二部分。 所述第一加密算法的安全性高 于所述第二加密算法的安全性; 所述第一比例小于 50%。
图 11 为本发明实施例提供的设备文件的加密装置实施例四的结构示意 图,如图 11所示,本实施例的设备文件的加密装置在图 9的基础上,还包括: 生成单元 85, 用于生成信息表, 所述信息表包括所述至少两个文件块中 每一文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文件 块的位置和数量、 所述第一部分中的文件块与第一加密算法的对应关系, 所 述第二部分中的文件块与所述第二加密算法的对应关系。
存储单元 83, 还用于将所述信息表存储于所述加密的设备文件的预设区 域, 或者将所述信息表存储为独立于所述加密的设备文件的第一文件。
需要说明的是, 在图 10所实施例的基础上, 也可以包括生成单元 85。 进一歩地, 在图 11所示实施例中, 加密单元 82, 还用于对所述信息表 进行加密, 所述信息表对应的加密算法为所述第一加密算法; 存储单元 83, 还用于将加密的信息表存储于所述加密的设备文件的预设区域, 或者将加密 的信息表存储为独立于所述加密的设备文件的第一文件。
图 12 为本发明实施例提供的设备文件的解密装置实施例一的结构示意 图, 如图 12所示, 本实施例的设备文件的解密装置包括:
分割单元 121, 用于将加密的设备文件分割为第一部分和第二部分, 其 中所述第一部分和所述第二部分分别包括至少一个文件块。
解密单元 122, 用于对所述第一部分和所述第二部分分别进行解密, 其 中所述第一部分中的文件块对应的解密算法为第一解密算法, 所述第二部分 中的文件块对应的解密算法为第二解密算法, 所述第一解密算法与所述第二 解密算法不同。
存储单元 123, 用于存储解密的设备文件。
本实施例的设备文件的解密装置用于执行图 5所示方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
图 13 为本发明实施例提供的设备文件的解密装置实施例二的结构示意 图, 如图 13所示, 本实施例的设备文件的解密装置在图 12的基础上, 还包 括:
确定单元 124, 用于根据所述策略确定所述第一部分中的文件块对应的 所述第一解密算法和所述第二部分中的文件块对应的所述第二解密算法。 分割单元 121, 具体用于将所述加密的设备文件分割为所述第一部分和 所述第二部分, 其中, 所述第一部分和所述第二部分所包括的文件块的位置 和数量分别根据预设策略确定, 所述第一部分和所述第二部分所包括的文件 块的起始地址和长度分别根据所述策略确定。
本实施例的设备文件的解密装置用于执行图 6所示方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
进一歩地, 图 13所示实施例中, 所述策略包括: 所述第一部分和所述第 二部分中文件块的起始地址和长度、 所述第一部分和所述第二部分中文件块 的位置和数量、 所述第一部分和所述第二部分中文件块对应的解密算法。
图 14 为本发明实施例提供的设备文件的解密装置实施例三的结构示意 图, 如图 14所示, 本实施例的设备文件的解密装置在图 13的基础上, 还包 括:
获取单元 125, 用于从所述加密的设备文件中或独立于所述加密的设备 文件的第一文件中获取所述加密的设备文件的信息表, 所述信息表包括所述 第一部分和所述第二部分中文件块的起始地址和长度、 所述第一部分和所述 第二部分所包括的文件块的位置和数量、 所述第一部分中的文件块对应的所 述第一加密算法和所述第二部分中的文件块对应的所述第二加密算法。
分割单元 121, 还用于根据所述信息表中所述第一部分和所述第二部分 中文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文件块 的位置和数量,将所述加密的设备文件分割为所述第一部分和所述第二部分。
确定单元 124, 还用于根据所述信息表中所述第一部分中的文件块对应 的所述第一加密算法和所述第二部分中的文件块对应的所述第二加密算法, 确定所述第一部分中的文件块对应的所述第一解密算法和所述第二部分中的 文件块对应的所述第二解密算法, 所述第一解密算法与所述第一加密算法互 逆, 所述第二解密算法与所述第二加密算法互逆。
本实施例的设备文件的解密装置用于执行图 7所示方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
进一歩地, 图 14所示实施例中, 解密单元 122, 还用于, 若所述信息表 是加密的信息表时, 对所述加密的信息表进行解密。 图 15为本发明实施例提供的设备文件的加密装置实施例五的结构示意 图, 如图 15所示, 本实施例的设备文件的加密装置包括: 处理器 151、 存储 器 152。 其中, 处理器 151和存储器 152可以通过系统总线或其他方式相连, 图 15中以系统总线相连为例; 系统总线可以是工业标准结构 (Industrial Standard Architecture, ISA) 总线、 外部设备互联 (Peripheral Component Interconnect, PCI) 总线或扩展工业标准结构 ( Extended Industrial Standard Architecture, EISA) 总线等。 所述系统总线可以分为地址总线、 数据总线、 控制总线等。 为便于表示, 图 15中仅用一条线表示, 但并不表示仅有一根总 线或一种类型的总线。
处理器 151, 用于将所述设备文件分割为第一部分和第二部分, 其中, 所述第一部分和所述第二部分分别包括至少一个文件块; 对所述第一部分和 所述第二部分分别进行加密, 其中所述第一部分中的文件块对应的加密算法 为第一加密算法,所述第二部分中的文件块对应的加密算法为第二加密算法, 所述第一加密算法与所述第二加密算法不同。
存储器 152, 用于存储加密的设备文件。
本实施例的设备文件的加密装置用于实现图 1所示方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
进一歩地, 图 15所示实施例中, 处理器 151, 具体用于将所述设备文件 分割为至少两个文件块; 将所述至少两个文件块组合为所述第一部分和所述 第二部分, 其中所述第一部分和所述第二部分分别包括至少一个文件块。
进一歩地, 图 15所示实施例中, 处理器 151, 具体用于将所述设备文件 分割为至少两个文件块, 其中, 每一个文件块的起始地址和长度根据预设策 略确定; 将所述至少两个文件块组合为所述第一部分和所述第二部分, 其中, 所述第一部分和所述第二部分所包括的文件块的位置和数量分别根据所述策 略确定; 根据所述策略确定所述第一部分中的文件块对应的第一加密算法和 所述第二部分中的文件块对应的所述第二加密算法。
进一歩地, 图 15所示实施例中, 所述策略包括: 针对所述设备文件进行 分割时文件块的起始地址和长度、 所述第一部分和所述第二部分中文件块的 位置和数量、 所述第一部分和所述第二部分中文件块对应的加密算法。
进一歩地, 图 15所示实施例中, 所述第一部分包括的文件块中的数据的 重要性大于所述第二部分包括的文件块中的数据的重要性; 所述第一加密算 法的安全性高于所述第二加密算法的安全性。
进一歩地, 图 15所示实施例中, 处理器 151, 具体用于将所述设备文件 分割为至少两个文件块; 将所述至少两个文件块中的数据的重要性超过预设 阈值的文件块组合为所述第一部分; 将所述至少两个文件块中的数据的重要 性未超过预设阈值的文件块组合为所述第二部分。
进一歩地, 图 15所示实施例中, 所述第一部分中的文件块的容量占所述 设备文件总容量的比例为第一比例。
进一歩地, 图 15所示实施例中, 处理器 151, 还用于将所述设备文件分 割为至少两个文件块; 将所述至少两个文件块中的一部分文件块组合为所述 第一部分, 所述一部分文件块的容量占所述设备文件总容量的比例为所述第 一比例; 将所述至少两个文件块中除所述一部分以外的另一部分文件块组合 为所述第二部分。
进一歩地, 图 15所示实施例中, 所述第一加密算法的安全性高于所述第 二加密算法的安全性; 所述第一比例小于 50%。
进一歩地, 图 15所示实施例中, 处理器 151, 还用于生成信息表, 所述 信息表包括所述至少两个文件块中每一文件块的起始地址和长度、 所述第一 部分和所述第二部分所包括的文件块的位置和数量、 所述第一部分中的文件 块与第一加密算法的对应关系, 所述第二部分中的文件块与所述第二加密算 法的对应关系。
存储器 152, 还用于将所述信息表存储于所述加密的设备文件的预设区 域, 或者将所述信息表存储为独立于所述加密的设备文件的第一文件。
进一歩地, 图 15所示实施例中, 处理器 151, 还用于对所述信息表进行 加密, 所述信息表对应的加密算法为所述第一加密算法; 存储器 152, 还用 于将加密的信息表存储于所述加密的设备文件的预设区域, 或者将加密的信 息表存储为独立于所述加密的设备文件的第一文件。
图 16 为本发明实施例提供的设备文件的解密装置实施例四的结构示意 图, 如图 16所示, 本实施例的设备文件的解密装置包括: 处理器 161、 存储 器 162。 其中, 处理器 161和存储器 162可以通过系统总线或其他方式相连, 图 16中以系统总线相连为例; 系统总线可以是 ISA总线、 PCI总线或 EISA 总线等。 所述系统总线可以分为地址总线、 数据总线、 控制总线等。 为便于 表示,图 16中仅用一条线表示,但并不表示仅有一根总线或一种类型的总线。
处理器 161, 用于将加密的设备文件分割为第一部分和第二部分, 其中 所述第一部分和所述第二部分分别包括至少一个文件块; 对所述第一部分和 所述第二部分分别进行解密, 其中所述第一部分中的文件块对应的解密算法 为第一解密算法,所述第二部分中的文件块对应的解密算法为第二解密算法, 所述第一解密算法与所述第二解密算法不同;
存储器 162, 用于存储解密的设备文件。
本实施例的设备文件的解密装置用于实现图 5所示方法实施例的技术方 案, 其实现原理和技术效果类似, 此处不再赘述。
进一歩地, 图 16所示实施例中, 处理器 161, 具体用于将所述加密的设 备文件分割为所述第一部分和所述第二部分, 其中, 所述第一部分和所述第 二部分所包括的文件块的位置和数量分别根据预设策略确定, 所述第一部分 和所述第二部分所包括的文件块的起始地址和长度分别根据所述策略确定; 根据所述策略确定所述第一部分中的文件块对应的所述第一解密算法和所述 第二部分中的文件块对应的所述第二解密算法。
进一歩地, 图 16所示实施例中, 所述策略包括: 所述第一部分和所述第 二部分中文件块的起始地址和长度、 所述第一部分和所述第二部分中文件块 的位置和数量、 所述第一部分和所述第二部分中文件块对应的解密算法。
进一歩地, 图 16所示实施例中, 处理器 161, 还用于从所述加密的设备 文件中或独立于所述加密的设备文件的第一文件中获取所述加密的设备文件 的信息表, 所述信息表包括所述第一部分和所述第二部分中文件块的起始地 址和长度、 所述第一部分和所述第二部分所包括的文件块的位置和数量、 所 述第一部分中的文件块对应的所述第一加密算法和所述第二部分中的文件块 对应的所述第二加密算法根据所述信息表中所述第一部分和所述第二部分中 文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文件块的 位置和数量, 将所述加密的设备文件分割为所述第一部分和所述第二部分; 根据所述信息表中所述第一部分中的文件块对应的所述第一加密算法和所述 第二部分中的文件块对应的所述第二加密算法, 确定所述第一部分中的文件 块对应的所述第一解密算法和所述第二部分中的文件块对应的所述第二解密 算法, 所述第一解密算法与所述第一加密算法互逆, 所述第二解密算法与所 述第二加密算法互逆。
进一歩地, 图 16所示实施例中, 处理器 161, 还用于, 若所述信息表是 加密的信息表时, 对所述加密的信息表进行解密。
本领域普通技术人员可以理解: 实现上述各方法实施例的全部或部分歩 骤可以通过程序指令相关的硬件来完成。 前述的程序可以存储于一计算机可 读取存储介质中。 该程序在执行时, 执行包括上述各方法实施例的歩骤; 而 前述的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种可以存储程序代码 的介质。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其 限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或 者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应技 术方案的本质脱离本发明各实施例技术方案的保护范围。

Claims

权利 要求 书
1、 一种设备文件的加密方法, 其特征在于, 包括:
将所述设备文件分割为第一部分和第二部分, 其中, 所述第一部分和所 述第二部分分别包括至少一个文件块;
对所述第一部分和所述第二部分分别进行加密, 其中所述第一部分中的 文件块对应的加密算法为第一加密算法, 所述第二部分中的文件块对应的加 密算法为第二加密算法, 所述第一加密算法与所述第二加密算法不同;
存储加密的设备文件。
2、 根据权利要求 1所述的方法, 其特征在于, 所述将所述设备文件分割 为第一部分和第二部分包括:
将所述设备文件分割为至少两个文件块;
将所述至少两个文件块组合为所述第一部分和所述第二部分, 其中所述 第一部分和所述第二部分分别包括至少一个文件块。
3、 根据权利要求 2所述的方法, 其特征在于, 所述将所述设备文件分割 为至少两个文件块, 包括:
将所述设备文件分割为至少两个文件块, 其中, 每一个文件块的起始地 址和长度根据预设策略确定;
所述将所述至少两个文件块组合为所述第一部分和所述第二部分,包括: 将所述至少两个文件块组合为所述第一部分和所述第二部分, 其中, 所 述第一部分和所述第二部分所包括的文件块的位置和数量分别根据所述策略 确定;
所述对所述第一部分和所述第二部分分别进行加密之前, 还包括: 根据所述策略确定所述第一部分中的文件块对应的第一加密算法和所述 第二部分中的文件块对应的所述第二加密算法。
4、 根据权利要求 3所述的方法, 其特征在于, 所述策略包括: 针对所述 设备文件进行分割时文件块的起始地址和长度、 所述第一部分和所述第二部 分中文件块的位置和数量、 所述第一部分和所述第二部分中文件块对应的加 密算法。
5、 根据权利要求 1所述的方法, 其特征在于, 所述第一部分包括的文件 块中的数据的重要性大于所述第二部分包括的文件块中的数据的重要性; 所 述第一加密算法的安全性高于所述第二加密算法的安全性。
6、 根据权利要求 5所述的方法, 其特征在于, 所述将所述设备文件分割 为第一部分和第二部分包括:
将所述设备文件分割为至少两个文件块;
将所述至少两个文件块中的数据的重要性超过预设阈值的文件块组合为 所述第一部分;
将所述至少两个文件块中的数据的重要性未超过预设阈值的文件块组合 为所述第二部分。
7、 根据权利要求 1所述方法, 其特征在于, 所述第一部分中的文件块的 容量占所述设备文件总容量的比例为第一比例。
8、 根据权利要求 7所述方法, 其特征在于, 所述将所述设备文件分割为 第一部分和第二部分包括:
将所述设备文件分割为至少两个文件块,
将所述至少两个文件块中的一部分文件块组合为所述第一部分, 所述一 部分文件块的容量占所述设备文件总容量的比例为所述第一比例;
将所述至少两个文件块中除所述一部分以外的另一部分文件块组合为所 述第二部分。
9、 根据权利要求 7或 8所述的方法, 其特征在于, 所述第一加密算法的 安全性高于所述第二加密算法的安全性; 所述第一比例小于 50%。
10、 根据权利要求 3〜9任一项所述的方法, 其特征在于, 所述方法还包 括:
生成信息表, 所述信息表包括所述至少两个文件块中每一文件块的起始 地址和长度、 所述第一部分和所述第二部分所包括的文件块的位置和数量、 所述第一部分中的文件块与第一加密算法的对应关系, 所述第二部分中的文 件块与所述第二加密算法的对应关系;
将所述信息表存储于所述加密的设备文件的预设区域, 或者将所述信息 表存储为独立于所述加密的设备文件的第一文件。
11、 根据权利要求 10所述的方法, 其特征在于, 所述生成信息表之后, 还包括:
对所述信息表进行加密, 所述信息表对应的加密算法为所述第一加密算 法;
所述将所述信息表存储于所述加密的设备文件的预设区域, 或者将所述 信息表存储为独立于所述加密的设备文件的第一文件, 包括:
将所述加密的信息表存储于所述加密的设备文件的预设区域, 或者将所 述加密的信息表存储为独立于所述加密的设备文件的第一文件。
12、 一种设备文件的解密方法, 其特征在于, 包括:
将加密的设备文件分割为第一部分和第二部分, 其中所述第一部分和所 述第二部分分别包括至少一个文件块;
对所述第一部分和所述第二部分分别进行解密, 其中所述第一部分中的 文件块对应的解密算法为第一解密算法, 所述第二部分中的文件块对应的解 密算法为第二解密算法, 所述第一解密算法与所述第二解密算法不同;
存储解密的设备文件。
13、 根据权利要求 12所述的方法, 其特征在于, 所述将加密的设备文件 分割为第一部分和第二部分, 包括:
将所述加密的设备文件分割为所述第一部分和所述第二部分, 其中, 所 述第一部分和所述第二部分所包括的文件块的位置和数量分别根据预设策略 确定, 所述第一部分和所述第二部分所包括的文件块的起始地址和长度分别 根据所述策略确定;
所述对所述第一部分和所述第二部分分别进行解密之前, 还包括: 根据所述策略确定所述第一部分中的文件块对应的所述第一解密算法和 所述第二部分中的文件块对应的所述第二解密算法。
14、 根据权利要求 13所述的方法, 其特征在于, 所述策略包括: 所述第 一部分和所述第二部分中文件块的起始地址和长度、 所述第一部分和所述第 二部分中文件块的位置和数量、 所述第一部分和所述第二部分中文件块对应 的解密算法。
15、 根据权利要求 12所述的方法, 其特征在于, 所述将加密的设备文件 分割为第一部分和第二部分之前, 还包括:
从所述加密的设备文件中或独立于所述加密的设备文件的第一文件中获 取所述加密的设备文件的信息表, 所述信息表包括所述第一部分和所述第二 部分中文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文 件块的位置和数量、 所述第一部分中的文件块对应的所述第一加密算法和所 述第二部分中的文件块对应的所述第二加密算法;
所述将加密的设备文件分割为第一部分和第二部分, 包括:
根据所述信息表中所述第一部分和所述第二部分中文件块的起始地址和 长度、 所述第一部分和所述第二部分所包括的文件块的位置和数量, 将所述 加密的设备文件分割为所述第一部分和所述第二部分;
所述对所述第一部分和所述第二部分分别进行解密之前, 还包括: 根据所述信息表中所述第一部分中的文件块对应的所述第一加密算法和 所述第二部分中的文件块对应的所述第二加密算法, 确定所述第一部分中的 文件块对应的所述第一解密算法和所述第二部分中的文件块对应的所述第二 解密算法, 所述第一解密算法与所述第一加密算法互逆, 所述第二解密算法 与所述第二加密算法互逆。
16、 根据权利要求 15所述的方法, 其特征在于, 若所述信息表是加密的 信息表, 所述从所述加密的设备文件中或独立于所述加密的设备文件的第一 文件中获取所述加密的设备文件的信息表之后, 还包括:
对所述加密的信息表进行解密。
17、 一种设备文件的加密装置, 其特征在于, 包括:
分割单元, 用于将所述设备文件分割为第一部分和第二部分, 其中, 所 述第一部分和所述第二部分分别包括至少一个文件块;
加密单元, 用于对所述第一部分和所述第二部分分别进行加密, 其中所 述第一部分中的文件块对应的加密算法为第一加密算法, 所述第二部分中的 文件块对应的加密算法为第二加密算法, 所述第一加密算法与所述第二加密 算法不同;
存储单元, 用于存储加密的设备文件。
18、 根据权利要求 17所述的设备文件的加密装置, 其特征在于, 所述分 割单元, 包括:
分割子单元, 用于将所述设备文件分割为至少两个文件块;
组合子单元, 用于将所述至少两个文件块组合为所述第一部分和所述第 二部分, 其中所述第一部分和所述第二部分分别包括至少一个文件块。
19、 根据权利要求 18所述的设备文件的加密装置, 其特征在于, 所述分 割子单元, 具体用于将所述设备文件分割为至少两个文件块, 其中, 每一个 文件块的起始地址和长度根据预设策略确定;
所述组合子单元, 具体用于将所述至少两个文件块组合为所述第一部分 和所述第二部分, 其中, 所述第一部分和所述第二部分所包括的文件块的位 置和数量分别根据所述策略确定;
所述设备文件的加密装置, 还包括:
确定单元, 用于根据所述策略确定所述第一部分中的文件块对应的第一 加密算法和所述第二部分中的文件块对应的所述第二加密算法。
20、 根据权利要求 19所述的设备文件的加密装置, 其特征在于, 所述策 略包括: 针对所述设备文件进行分割时文件块的起始地址和长度、 所述第一 部分和所述第二部分中文件块的位置和数量、 所述第一部分和所述第二部分 中文件块对应的加密算法。
21、 根据权利要求 17所述的设备文件的加密装置, 其特征在于, 所述第 一部分包括的文件块中的数据的重要性大于所述第二部分包括的文件块中的 数据的重要性;所述第一加密算法的安全性高于所述第二加密算法的安全性。
22、 根据权利要求 21所述的设备文件的加密装置, 其特征在于, 所述分 割子单元, 具体用于将所述设备文件分割为至少两个文件块;
所述组合子单元, 还用于将所述至少两个文件块中的数据的重要性超过 预设阈值的文件块组合为所述第一部分; 将所述至少两个文件块中的数据的 重要性未超过预设阈值的文件块组合为所述第二部分。
23、 根据权利要求 17所述设备文件的加密装置, 其特征在于, 所述第一 部分中的文件块的容量占所述设备文件总容量的比例为第一比例。
24、 根据权利要求 23所述设备文件的加密装置, 其特征在于, 所述分割 子单元, 还用于将所述设备文件分割为至少两个文件块;
所述组合子单元, 还用于将所述至少两个文件块中的一部分文件块组合 为所述第一部分, 所述一部分文件块的容量占所述设备文件总容量的比例为 所述第一比例; 将所述至少两个文件块中除所述一部分以外的另一部分文件 块组合为所述第二部分。
25、 根据权利要求 23或 24所述的设备文件的加密装置, 其特征在于, 所述第一加密算法的安全性高于所述第二加密算法的安全性; 所述第一比例 小于 50%。
26、根据权利要求 19〜25任一项所述的设备文件的加密装置, 其特征在 于, 还包括:
生成单元, 用于生成信息表, 所述信息表包括所述至少两个文件块中每 一文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文件块 的位置和数量、 所述第一部分中的文件块与第一加密算法的对应关系, 所述 第二部分中的文件块与所述第二加密算法的对应关系;
所述存储单元, 还用于将所述信息表存储于所述加密的设备文件的预设 区域, 或者将所述信息表存储为独立于所述加密的设备文件的第一文件。
27、 根据权利要求 26所述的设备文件的加密装置, 其特征在于, 所述加 密单元, 还用于对所述信息表进行加密, 所述信息表对应的加密算法为所述 第一加密算法;
所述存储单元, 还用于将加密的信息表存储于所述加密的设备文件的预 设区域,或者将加密的信息表存储为独立于所述加密的设备文件的第一文件。
28、 一种设备文件的解密装置, 其特征在于, 包括:
分割单元, 用于将加密的设备文件分割为第一部分和第二部分, 其中所 述第一部分和所述第二部分分别包括至少一个文件块;
解密单元, 用于对所述第一部分和所述第二部分分别进行解密, 其中所 述第一部分中的文件块对应的解密算法为第一解密算法, 所述第二部分中的 文件块对应的解密算法为第二解密算法, 所述第一解密算法与所述第二解密 算法不同;
存储单元, 用于存储解密的设备文件。
29、 根据权利要求 28所述的设备文件的解密装置, 其特征在于, 所述分 割单元, 具体用于将所述加密的设备文件分割为所述第一部分和所述第二部 分, 其中, 所述第一部分和所述第二部分所包括的文件块的位置和数量分别 根据预设策略确定, 所述第一部分和所述第二部分所包括的文件块的起始地 址和长度分别根据所述策略确定;
所述设备文件的解密装置, 还包括:
确定单元, 用于根据所述策略确定所述第一部分中的文件块对应的所述 第一解密算法和所述第二部分中的文件块对应的所述第二解密算法。
30、 根据权利要求 29所述的设备文件的解密装置, 其特征在于, 所述策 略包括: 所述第一部分和所述第二部分中文件块的起始地址和长度、 所述第 一部分和所述第二部分中文件块的位置和数量、 所述第一部分和所述第二部 分中文件块对应的解密算法。
31、根据权利要求 28所述的设备文件的解密装置,其特征在于,还包括: 获取单元, 用于从所述加密的设备文件中或独立于所述加密的设备文件 的第一文件中获取所述加密的设备文件的信息表, 所述信息表包括所述第一 部分和所述第二部分中文件块的起始地址和长度、 所述第一部分和所述第二 部分所包括的文件块的位置和数量、 所述第一部分中的文件块对应的所述第 一加密算法和所述第二部分中的文件块对应的所述第二加密算法;
所述分割单元, 还用于根据所述信息表中所述第一部分和所述第二部分 中文件块的起始地址和长度、 所述第一部分和所述第二部分所包括的文件块 的位置和数量,将所述加密的设备文件分割为所述第一部分和所述第二部分; 所述确定单元, 还用于根据所述信息表中所述第一部分中的文件块对应 的所述第一加密算法和所述第二部分中的文件块对应的所述第二加密算法, 确定所述第一部分中的文件块对应的所述第一解密算法和所述第二部分中的 文件块对应的所述第二解密算法, 所述第一解密算法与所述第一加密算法互 逆, 所述第二解密算法与所述第二加密算法互逆。
32、 根据权利要求 31所述的设备文件的解密装置, 其特征在于, 所述解 密单元, 还用于, 若所述信息表是加密的信息表时, 对所述加密的信息表进 行解密。
PCT/CN2014/075102 2014-04-10 2014-04-10 设备文件的加解密方法及装置 WO2015154285A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201480000612.9A CN104205117B (zh) 2014-04-10 2014-04-10 设备文件的加解密方法及装置
PCT/CN2014/075102 WO2015154285A1 (zh) 2014-04-10 2014-04-10 设备文件的加解密方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/075102 WO2015154285A1 (zh) 2014-04-10 2014-04-10 设备文件的加解密方法及装置

Publications (1)

Publication Number Publication Date
WO2015154285A1 true WO2015154285A1 (zh) 2015-10-15

Family

ID=52088180

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/075102 WO2015154285A1 (zh) 2014-04-10 2014-04-10 设备文件的加解密方法及装置

Country Status (2)

Country Link
CN (1) CN104205117B (zh)
WO (1) WO2015154285A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11483147B2 (en) * 2020-01-23 2022-10-25 Bank Of America Corporation Intelligent encryption based on user and data properties

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102370842B1 (ko) * 2015-06-03 2022-03-08 삼성전자주식회사 컨텐츠를 암호화하기 위한 전자 장치 및 방법
CN105069365A (zh) * 2015-06-30 2015-11-18 广东欧珀移动通信有限公司 一种数据处理的方法及移动终端
CN105260668B (zh) * 2015-10-10 2018-07-24 北京搜狗科技发展有限公司 一种文件加密方法及电子设备
CN105335643B (zh) * 2015-10-28 2017-10-27 广东欧珀移动通信有限公司 文件的处理方法及处理系统
CN105306479A (zh) * 2015-11-11 2016-02-03 江苏中威科技软件系统有限公司 一种计算机数据嵌入方法、显示方法及其装置
CN105893857A (zh) * 2016-03-31 2016-08-24 北京金山安全软件有限公司 一种文件加密方法、装置及设备
CN106326767A (zh) * 2016-08-19 2017-01-11 北京奇虎科技有限公司 文件加密方法、文件解密方法及装置
CN107204986B (zh) * 2017-06-27 2019-10-18 四川捷云信通信息技术有限公司 云端存储加密方法、解密方法及云端存储加密装置
CN107908931B (zh) * 2017-11-16 2021-01-26 四川长虹电器股份有限公司 数字电视软件混合校验加密方法
CN109740308B (zh) * 2018-12-28 2021-04-16 厦门吉比特网络技术股份有限公司 一种服务器端版本的保护方法及系统
CN110768783A (zh) * 2019-09-30 2020-02-07 北京你财富计算机科技有限公司 一种改进PHP的XRsa加密的方法、电子设备及计算机可读介质
CN113132107B (zh) * 2019-12-31 2023-02-07 奇安信科技集团股份有限公司 许可证加密方法、装置、许可证解密方法、装置和设备
CN113098843B (zh) * 2021-03-08 2022-06-14 中国地质大学(武汉) 一种面向地质、地理大数据的高速随机抽样加密方法
CN113221149B (zh) * 2021-05-27 2024-02-09 深圳市共进电子股份有限公司 固件加密方法、装置、固件解密方法和计算机设备
CN113315844A (zh) * 2021-06-17 2021-08-27 中国农业银行股份有限公司 文件加密传输方法、装置、设备和计算机可读存储介质
CN115277158A (zh) * 2022-07-21 2022-11-01 温瑾 一种数据共享的数据交换系统
CN115378590B (zh) * 2022-10-27 2023-02-07 国网浙江义乌市供电有限公司 一种基于区块链的能源数据安全存储方法和系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1744523A (zh) * 2005-08-26 2006-03-08 南京邮电大学 一种面向移动代理网管的安全保护方法
US20070028099A1 (en) * 2003-09-11 2007-02-01 Bamboo Mediacasting Ltd. Secure multicast transmission
CN101930521A (zh) * 2010-05-11 2010-12-29 湖州信安科技有限公司 一种文件保护方法及其装置
CN202110552U (zh) * 2011-04-18 2012-01-11 江苏技术师范学院 一种基于多体交叉存储技术的软件保护装置
CN102567687A (zh) * 2010-12-15 2012-07-11 成都科创知识产权研究所 数据加密方法及系统
CN103095452A (zh) * 2011-11-01 2013-05-08 刘海云 需要采用穷举法解密的随机加密方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070028099A1 (en) * 2003-09-11 2007-02-01 Bamboo Mediacasting Ltd. Secure multicast transmission
CN1744523A (zh) * 2005-08-26 2006-03-08 南京邮电大学 一种面向移动代理网管的安全保护方法
CN101930521A (zh) * 2010-05-11 2010-12-29 湖州信安科技有限公司 一种文件保护方法及其装置
CN102567687A (zh) * 2010-12-15 2012-07-11 成都科创知识产权研究所 数据加密方法及系统
CN202110552U (zh) * 2011-04-18 2012-01-11 江苏技术师范学院 一种基于多体交叉存储技术的软件保护装置
CN103095452A (zh) * 2011-11-01 2013-05-08 刘海云 需要采用穷举法解密的随机加密方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11483147B2 (en) * 2020-01-23 2022-10-25 Bank Of America Corporation Intelligent encryption based on user and data properties

Also Published As

Publication number Publication date
CN104205117B (zh) 2017-04-26
CN104205117A (zh) 2014-12-10

Similar Documents

Publication Publication Date Title
WO2015154285A1 (zh) 设备文件的加解密方法及装置
US10652015B2 (en) Confidential communication management
EP3314522B1 (en) Technologies for memory confidentiality, integrity, and replay protection
EP3127274B1 (en) Methods and apparatus to securely share data
US9086819B2 (en) System and method for combining deduplication and encryption of data
TWI510017B (zh) 利用隨機排序和隨機區塊大小的用於安全資料傳輸的裝置和方法
US8826039B2 (en) Apparatus and method for providing hardware security
CN110650010B (zh) 一种非对称密钥中的私钥生成和使用方法、装置和设备
US11316671B2 (en) Accelerated encryption and decryption of files with shared secret and method therefor
CN107317677B (zh) 密钥存储及设备身份认证方法、装置
KR101317496B1 (ko) 전송 데이터를 보호하기 위한 방법 및 이 방법을 구현하기 위한 보안 시스템
US20130290733A1 (en) Systems and methods for caching security information
CN110443049B (zh) 一种安全数据存储管理的方法、系统及安全存储管理模块
US20130290734A1 (en) Systems and methods for caching security information
CN111917540B (zh) 一种数据加解密方法、装置、移动终端和存储介质
US20130290731A1 (en) Systems and methods for storing and verifying security information
CN107534558B (zh) 用于保护经由数据总线传输的数据的信息安全的方法以及数据总线系统
US20130290732A1 (en) Systems and methods for storing and verifying security information
WO2015090055A1 (zh) 一种数据存储、读取方法、装置及设备
US11165758B2 (en) Keystream generation using media data
WO2019122242A1 (en) System for securing deployed security cameras
CN107483387A (zh) 一种安全控制方法及装置
WO2022199796A1 (en) Method and computer-based system for key management
CN117221878B (zh) 一种基于无线网络设备的信息安全管控方法及装置

Legal Events

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

Ref document number: 14888808

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14888808

Country of ref document: EP

Kind code of ref document: A1