Decryption method and device for ciphertext data block, and program product

By executing encryption operations and data block acquisition in parallel, the problem of long time and high cost of hard disk decryption is solved, and a low-cost and efficient decryption process is achieved.

CN118568753BActive Publication Date: 2024-10-22ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411021334.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-10-22
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

In the security industry, the hard drive decryption process is time-consuming and costly, and it is difficult for existing technology to effectively solve this problem.

Method used

By obtaining the decryption parameters of the target encrypted file, and when the encryption algorithm mode is the target mode, the target key is used to encrypt the initialization vector and the target ciphertext data block is obtained in parallel. Finally, the target vector and the target ciphertext data block are processed. Compute to obtain the plaintext data block, making full use of the characteristics of the encrypted file and shortening the decryption time.

Benefits of technology

It greatly shortens the time it takes to decrypt files, reduces hardware costs, and improves decryption efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568753B_ABST
    Figure CN118568753B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a decryption method and device for a ciphertext data block, and a program product, the method comprising: obtaining a target decryption parameter of a target encrypted file, the target decryption parameter comprising an encryption algorithm mode and an initialization vector required for encrypting an original file, the target encrypted file being a file obtained after encrypting the original file; when the encryption algorithm mode is a target mode, performing in parallel an operation of encrypting the initialization vector using a target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file; performing a target operation on the target vector and the target ciphertext data block to obtain a target plaintext data block. Through the present application, the problems of time-consuming and high-cost decryption in the related art are solved, and the effect of improving decryption efficiency at a low cost is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a method and device for decrypting a ciphertext data block, and a program product. Background Art

[0002] In the security industry, business data with large capacity, such as audio and video, is mostly stored on mechanical hard disks, while system files that take up less space are mostly stored on solid-state hard disks. Mechanical hard disks have a slower reading speed, but they can store data for a longer time and are less expensive; solid-state hard disks have a faster reading speed, but they can store data for a shorter time and are more expensive. However, compared to the reading speed of memory, the reading speed of hard disks is relatively low. Therefore, in order to speed up encryption and decryption, dedicated encryption and decryption chips are usually integrated on the hard disk to reduce the time consumption through high-throughput encryption and decryption chips, but there is a problem of high hardware cost. Summary of the invention

[0003] The embodiments of the present application provide a method and device for decrypting a ciphertext data block, and a program product, so as to at least solve the problem of time-consuming and high-cost decryption in the related art.

[0004] According to one embodiment of the present application, a method for decrypting a ciphertext data block is provided, comprising: obtaining target decryption parameters of a target encrypted file, wherein the target decryption parameters include an encryption algorithm mode and an initialization vector required for encrypting an original file, and the target encrypted file is a file obtained by encrypting the original file; when the encryption algorithm mode is a target mode, performing in parallel an operation of encrypting the initialization vector using a target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file; performing a target operation on the target vector and the target ciphertext data block to obtain a target plaintext data block, wherein the target plaintext data block is a data block included in the original file, and the target ciphertext data block is a data block obtained by encrypting the target plaintext data block.

[0005] In an exemplary embodiment, before obtaining the target decryption parameters of the target encrypted file, the method includes: pre-reading multiple decryption parameters of multiple encrypted files from an initial storage space, and caching the multiple decryption parameters and the unique identification information of the multiple encrypted files in the target storage space, wherein the multiple encrypted files include the target encrypted file, and the multiple decryption parameters include the target decryption parameters; obtaining the target decryption parameters of the target encrypted file includes: based on the target identification information of the target encrypted file, obtaining the target decryption parameters stored corresponding to the target encrypted file from the target storage space.

[0006] In an exemplary embodiment, when the encryption algorithm mode is a target mode, the operation of encrypting the initialization vector using a target key to obtain a target vector and the operation of obtaining a target ciphertext data block included in the target encrypted file are performed in parallel, including: when the target mode is an output feedback OFB mode, based on the position information of the target ciphertext data block in the target encrypted file, determining the number of encryption times for performing the encryption operation on the initialization vector; in a first thread, performing the encryption operation on the initialization vector using the target key according to the number of encryption times to obtain the target vector; in a second thread, obtaining the target ciphertext data block from the target encrypted file according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

[0007] In an exemplary embodiment, when the encryption algorithm mode is a target mode, the operation of encrypting the initialization vector using the target key to obtain the target vector and the operation of obtaining the target ciphertext data block included in the target encrypted file are performed in parallel, including: when the target mode is a counter mode, determining the number of plaintext data blocks currently obtained; obtaining a first initialization vector based on the number of plaintext data blocks currently obtained and the initialization vector; in a first thread, performing an encryption operation on the first initialization vector using the target key to obtain the target vector; in a second thread, obtaining the target ciphertext data block from the target encrypted file according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

[0008] In an exemplary embodiment, based on the number of the currently obtained plaintext data blocks and the initialization vector, a first initialization vector is obtained, including: when the number of the currently obtained plaintext data blocks is 0, the initialization vector is determined as the first initialization vector; when the number of the currently obtained plaintext data blocks is greater than 0, a target addition operation is performed on the initialization vector to obtain the first initialization vector.

[0009] In an exemplary embodiment, a target operation is performed on the target vector and the target ciphertext data block to obtain a target plaintext data block, including: converting the target vector and the target ciphertext data block according to a target base to obtain a target vector in the target base and a target ciphertext data block in the target base; performing an exclusive-OR operation on the target vector in the target base and the target ciphertext data block in the target base to obtain the target plaintext data block.

[0010] According to an embodiment of the present application, a decryption device for a ciphertext data block is provided, comprising: a first acquisition module, used to obtain target decryption parameters of a target encrypted file, wherein the target decryption parameters include an encryption algorithm mode and an initialization vector required for encrypting an original file, and the target encrypted file is a file obtained by encrypting the original file; a first encryption module, used to, when the encryption algorithm mode is a target mode, perform in parallel an operation of encrypting the initialization vector using a target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file; a first execution module, used to perform a target operation on the target vector and the target ciphertext data block to obtain a target plaintext data block, wherein the target plaintext data block is a data block included in the original file, and the target ciphertext data block is a data block obtained by encrypting the target plaintext data block.

[0011] In an exemplary embodiment, the above-mentioned device also includes: a first reading module, which is used to pre-read multiple decryption parameters of multiple encrypted files from the initial storage space before obtaining the target decryption parameters of the target encrypted file, and cache the multiple decryption parameters and the unique identification information of the multiple encrypted files in the target storage space accordingly, wherein the multiple encrypted files include the target encrypted file, and the multiple decryption parameters include the target decryption parameters; the above-mentioned first acquisition module includes: a first acquisition sub-module, which is used to obtain the above-mentioned target decryption parameters stored corresponding to the above-mentioned target encrypted file from the above-mentioned target storage space based on the target identification information of the above-mentioned target encrypted file.

[0012] In an exemplary embodiment, the first encryption module includes: a first determination submodule, which is used to determine the number of encryption operations performed on the initialization vector based on the position information of the target ciphertext data block in the target encrypted file when the target mode is the output feedback OFB mode; a first execution submodule, which is used to perform the encryption operation on the initialization vector using the target key according to the number of encryptions in the first thread to obtain the target vector; and a second acquisition submodule, which is used to obtain the target ciphertext data block from the target encrypted file according to the identification information of the target ciphertext data block in the second thread, wherein the first thread and the second thread are executed in parallel.

[0013] In an exemplary embodiment, the first encryption module includes: a second determination submodule, used to determine the number of plaintext data blocks currently obtained when the target mode is the counter mode; a first acquisition submodule, used to obtain a first initialization vector based on the number of plaintext data blocks currently obtained and the initialization vector; a second execution submodule, used to perform an encryption operation on the first initialization vector using the target key in the first thread to obtain the target vector; a third acquisition submodule, used to obtain the target ciphertext data block from the target encrypted file in the second thread according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

[0014] In an exemplary embodiment, the first obtaining submodule includes: a first determining unit, used to determine the initialization vector as the first initialization vector when the number of the currently obtained plaintext data blocks is 0; a first executing unit, used to perform a target addition operation on the initialization vector to obtain the first initialization vector when the number of the currently obtained plaintext data blocks is greater than 0.

[0015] In an exemplary embodiment, the above-mentioned first execution module includes: a first conversion submodule, used to convert the above-mentioned target vector and the above-mentioned target ciphertext data block according to the target base, so as to obtain the target vector in the above-mentioned target base and the target ciphertext data block in the above-mentioned target base; and a third execution submodule, used to perform an exclusive OR operation on the target vector in the above-mentioned target base and the target ciphertext data block in the above-mentioned target base, so as to obtain the above-mentioned target plaintext data block.

[0016] According to another embodiment of the present application, a computer program product is provided, including a computer program, wherein the computer program is configured for a processor to execute the steps of any of the above method embodiments.

[0017] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to enable a processor to execute the steps in any of the above method embodiments.

[0018] According to another embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor is configured to execute the computer program to perform the steps in any one of the method embodiments.

[0019] Through the present application, the encryption algorithm mode of the target encrypted file and the initialization vector required for encrypting the original file are first obtained, and then when the encryption algorithm mode is the target mode, the operation of encrypting the initialization vector using the target key to obtain the target vector and the operation of obtaining the target ciphertext data block included in the target encrypted file are performed in parallel, and finally the target operation is performed on the target vector and the target ciphertext data block to obtain the target plaintext data block. Taking full advantage of the characteristics of the encryption algorithm mode of the target encrypted file, the acquisition operation of the target ciphertext data block and the encryption operation of the initialization vector are performed in parallel, and after the target ciphertext data block is obtained, the target operation is directly performed, which greatly shortens the time consumption of decrypting the file, thereby solving the problems of time consumption and high cost of decryption in the related technology, and achieving the effect of improving the decryption efficiency at low cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a hardware structure block diagram of a mobile terminal of a method for decrypting a ciphertext data block in an embodiment of the present application;

[0021] Figure 2 is a flow chart of a method for decrypting a ciphertext data block according to an embodiment of the present application;

[0022] Figure 3 It is a schematic diagram of a decryption method of a ciphertext data block in a specific embodiment of the present application;

[0023] Figure 4 It is a schematic diagram of the format of an encrypted file or encrypted page in a specific embodiment of the present application;

[0024] Figure 5 It is a flowchart of a method for decrypting a ciphertext data block according to a specific embodiment of the present application;

[0025] Figure 6 It is a structural block diagram of a decryption device for a ciphertext data block according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0028] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 1 is a hardware structure block diagram of a mobile terminal for decrypting a ciphertext data block according to an embodiment of the present application. Figure 1As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0029] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a decryption method of a ciphertext data block in an embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0030] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0031] In this embodiment, a method for decrypting a ciphertext data block is provided. Figure 2 is a flowchart of a method for decrypting a ciphertext data block according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0032] Step S202, obtaining target decryption parameters of the target encrypted file, wherein the target decryption parameters include an encryption algorithm mode and an initialization vector required for encrypting the original file, and the target encrypted file is a file obtained after encrypting the original file;

[0033] Step S204, when the encryption algorithm mode is the target mode, performing in parallel an operation of encrypting the initialization vector using the target key to obtain the target vector and an operation of obtaining the target ciphertext data block included in the target encrypted file;

[0034] Step S206, performing a target operation on the target vector and the target ciphertext data block to obtain a target plaintext data block, wherein the target plaintext data block is a data block included in the original file, and the target ciphertext data block is a data block obtained after encrypting the target plaintext data block.

[0035] In this embodiment, the execution subject of the above steps can be a terminal, a server, a specific processor set in the terminal or server, or a processor or processing device set relatively independently from the terminal or server, but is not limited thereto.

[0036] Optionally, the target encrypted file may be a file in the format of text, image, table, audio, video, etc.

[0037] Optionally, the target decryption parameters include, in addition to the encryption algorithm mode and the initialization vector, but are not limited to: the encryption algorithm type of the target encrypted file and the length of the target encrypted file.

[0038] Optionally, the initialization vector is a random number that meets cryptographic security requirements, such as 8D1230BC67A12D.

[0039] Through the above steps, the encryption algorithm mode of the target encrypted file and the initialization vector required for encrypting the original file are first obtained, and then when the encryption algorithm mode is the target mode, the operation of encrypting the initialization vector using the target key to obtain the target vector and the operation of obtaining the target ciphertext data block included in the target encrypted file are performed in parallel, and finally the target operation is performed on the target vector and the target ciphertext data block to obtain the target plaintext data block. The characteristics of the encryption algorithm mode of the target encrypted file are fully utilized, and the acquisition operation of the target ciphertext data block is performed in parallel with the encryption operation of the initialization vector. After the target ciphertext data block is obtained, the target operation is directly performed, which greatly shortens the time consumption of decrypting the file. Therefore, the problems of time consumption and high cost of decryption in the related technology are solved, and the effect of improving the decryption efficiency at low cost is achieved.

[0040] In an exemplary embodiment, before obtaining the target decryption parameters of the target encrypted file, the method includes: pre-reading multiple decryption parameters of multiple encrypted files from an initial storage space, and caching the multiple decryption parameters and the unique identification information of the multiple encrypted files in the target storage space, wherein the multiple encrypted files include the target encrypted file, and the multiple decryption parameters include the target decryption parameters; obtaining the target decryption parameters of the target encrypted file includes: based on the target identification information of the target encrypted file, obtaining the target decryption parameters stored corresponding to the target encrypted file from the target storage space.

[0041] Optionally, in an embodiment, the initial storage space is a storage space in a storage device, including but not limited to: a mechanical hard disk, a solid-state hard disk, a hybrid hard disk, an external hard disk, a network attached storage, a direct storage, a tape storage, and an optical storage. The target storage space is a storage space in the memory. The unique identification information of the encrypted file is used to uniquely determine the encrypted file, including but not limited to: a file name, a file hash value, a file serial number, and a globally unique identifier of the file. For example, the following three encrypted files are stored in the mechanical hard disk: encrypted file A, serial number 123, decryption parameter D; encrypted file B, serial number 456, decryption parameter E; encrypted file C, serial number 789, decryption parameter F, the decryption parameters of the three encrypted files are read from the mechanical hard disk in advance, and the decryption parameters are cached in the memory in the following manner: 123-decryption parameter D; 456-decryption parameter E; 789-decryption parameter F. When decryption is to be performed, the decryption parameters of the encrypted file are directly obtained from the memory according to the serial number of the encrypted file. In this embodiment, the decryption parameters of the encrypted file are cached in the target storage space in advance, so as to improve the efficiency of obtaining the target decryption parameters.

[0042] In an exemplary embodiment, when the encryption algorithm mode is a target mode, the operation of encrypting the initialization vector using a target key to obtain a target vector and the operation of obtaining a target ciphertext data block included in the target encrypted file are performed in parallel, including: when the target mode is an output feedback OFB mode, based on the position information of the target ciphertext data block in the target encrypted file, determining the number of encryption times for performing the encryption operation on the initialization vector; in a first thread, performing the encryption operation on the initialization vector using the target key according to the number of encryption times to obtain the target vector; in a second thread, obtaining the target ciphertext data block from the target encrypted file according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

[0043] Optionally, in this embodiment, the target key can be input by a user or obtained from a hardware security device, the encryption operation includes but is not limited to the encryption operation implemented by a symmetric algorithm, and the identification information of the target ciphertext block is used to obtain the target ciphertext data block from the target encrypted file, including but not limited to: the data block sequence number, the globally unique identifier of the data block. Figure 3 As shown, Figure 3 It is a schematic diagram of a decryption method of a ciphertext data block in a specific embodiment of the present application. Assuming that the position information of the target ciphertext data block in the target encrypted file is the third block, the first thread uses the target key to perform three encryption operations on the initialization vector to obtain the target vector, and the second thread obtains the target ciphertext data block from the target encrypted file according to the sequence number 3. In this embodiment, the purpose of improving the decryption efficiency is achieved by executing the acquisition operation of the target ciphertext data block and the encryption operation of the initialization vector in parallel.

[0044] In an exemplary embodiment, when the encryption algorithm mode is a target mode, the operation of encrypting the initialization vector using the target key to obtain the target vector and the operation of obtaining the target ciphertext data block included in the target encrypted file are performed in parallel, including: when the target mode is a counter mode, determining the number of plaintext data blocks currently obtained; obtaining a first initialization vector based on the number of plaintext data blocks currently obtained and the initialization vector; in a first thread, performing an encryption operation on the first initialization vector using the target key to obtain the target vector; in a second thread, obtaining the target ciphertext data block from the target encrypted file according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

[0045] In an exemplary embodiment, based on the number of the currently obtained plaintext data blocks and the initialization vector, a first initialization vector is obtained, including: when the number of the currently obtained plaintext data blocks is 0, the initialization vector is determined as the first initialization vector; when the number of the currently obtained plaintext data blocks is greater than 0, a target addition operation is performed on the initialization vector to obtain the first initialization vector.

[0046] Optionally, in this embodiment, the counter mode includes but is not limited to: Counter (CTR) mode, Galois / Counter Mode (GCM) mode. The purpose of performing the sum operation on the initialization vector is to avoid reusing the same initialization vector during the decryption process, and the sum value of the initialization vector can be determined according to the number of plaintext data blocks obtained. For example, assuming that the initialization vector is 8D1230BC67A12D, and the number of plaintext data blocks obtained is 0, then the initialization vector is the first initialization vector; assuming that the number of plaintext data blocks obtained is 2, then the initialization vector is added by 1 to obtain the first initialization vector, 8D1230BC67A12D+1, the number of plaintext data blocks obtained is 3, then the initialization vector is added by 2 to obtain the first initialization vector, 8D1230BC67A12D+2, and the number of plaintext data blocks obtained is 4, then the initialization vector is added by 3 to obtain the first initialization vector, 8D1230BC67A12D+3. In this embodiment, the purpose of improving the decryption efficiency is achieved by executing the acquisition operation of the target ciphertext data block and the encryption operation of the initialization vector in parallel.

[0047] In an exemplary embodiment, a target operation is performed on the target vector and the target ciphertext data block to obtain a target plaintext data block, including: converting the target vector and the target ciphertext data block according to a target base to obtain a target vector in the target base and a target ciphertext data block in the target base; performing an exclusive-OR operation on the target vector in the target base and the target ciphertext data block in the target base to obtain the target plaintext data block.

[0048] Optionally, in this embodiment, the target vector and the target ciphertext data block are generally in hexadecimal, so the target vector and the target ciphertext data block need to be converted into binary when performing an XOR operation on the target vector and the target ciphertext data block. If necessary, the binary form of the result can be converted back into hexadecimal or other numerical representations. In this embodiment, the purpose of accurate decryption is achieved by performing base conversion on the target vector and the target ciphertext data block.

[0049] The present invention will be described below in conjunction with specific embodiments:

[0050] The format of the encrypted file or encrypted page includes: encryption algorithm type: usually a symmetric encryption algorithm, such as Advanced Encryption Standard (AES), Chinese National Commercial Encryption Standard (SM4); encryption algorithm mode: usually a symmetric encryption algorithm mode, such as OFB, CTR and GCM; initialization vector: the initialization vector used to encrypt subsequent ciphertext data, which can be a random number that meets the security requirements of cryptography; ciphertext length: used to record the length of ciphertext data; ciphertext data: stores the encrypted data. Figure 4 As shown, Figure 4 It is a schematic diagram of the format of an encrypted file or encrypted page according to a specific embodiment of the present application.

[0051] Figure 5 FIG. 1 is a flowchart of a method for decrypting a ciphertext data block according to a specific embodiment of the present application. This embodiment is described by taking the output feedback OFB mode as an example. Figure 5 As shown:

[0052] S502, pre-reading the decryption parameters of the encrypted file: encryption algorithm type, encryption algorithm mode, initialization vector, ciphertext length, and caching them in memory;

[0053] S504, start reading the target encrypted file;

[0054] S506, searching the memory for target decryption parameters of the target encrypted file: encryption algorithm type, encryption algorithm mode, initialization vector, ciphertext length;

[0055] S508, in the main thread, read the target ciphertext data block from the disk, and after a delay, obtain the target ciphertext data block. The time consumption of this step is determined by the media type and usage conditions of the hard disk. For example, the media types of hard disks are mainly divided into mechanical hard disks and solid-state hard disks, and solid-state hard disks have faster reading speeds. For another example, the usage conditions of the hard disk, such as temperature, disk fragmentation, and usage frequency, will also affect the reading speed. For example, disk fragmentation may cause the seek time to become longer, thereby increasing the reading time;

[0056] S510, while reading the target ciphertext data block in the main thread, in parallel in the encryption thread, encrypt the initialization vector multiple times according to the target key to generate a target vector, and the maximum length of the target vector does not exceed the ciphertext length specified in the algorithm parameters;

[0057] S512, XOR the target ciphertext data block with the target vector. In extreme scenarios, the length of the target vector will be smaller than the target ciphertext data block. You can wait until the target vector is long enough before XORing it with the target ciphertext data block to obtain the target plaintext data block.

[0058] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0059] In this embodiment, a decryption device for a ciphertext data block is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are not repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0060] Figure 6 is a structural block diagram of a decryption device for a ciphertext data block according to an embodiment of the present application, such as Figure 6 As shown, the device comprises:

[0061] The first acquisition module 602 is used to acquire target decryption parameters of a target encrypted file, wherein the target decryption parameters include an encryption algorithm mode and an initialization vector required for encrypting the original file, and the target encrypted file is a file obtained after encrypting the original file;

[0062] The first encryption module 604 is used to perform, in parallel, an operation of encrypting the initialization vector using a target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file when the encryption algorithm mode is a target mode;

[0063] The first execution module 606 is used to perform a target operation on the target vector and the target ciphertext data block to obtain a target plaintext data block, wherein the target plaintext data block is a data block included in the original file, and the target ciphertext data block is a data block obtained after encrypting the target plaintext data block.

[0064] In an exemplary embodiment, the above-mentioned device also includes: a first reading module, which is used to pre-read multiple decryption parameters of multiple encrypted files from the initial storage space before obtaining the target decryption parameters of the target encrypted file, and cache the multiple decryption parameters and the unique identification information of the multiple encrypted files in the target storage space accordingly, wherein the multiple encrypted files include the target encrypted file, and the multiple decryption parameters include the target decryption parameters; the above-mentioned first acquisition module includes: a first acquisition sub-module, which is used to obtain the above-mentioned target decryption parameters stored corresponding to the above-mentioned target encrypted file from the above-mentioned target storage space based on the target identification information of the above-mentioned target encrypted file.

[0065] In an exemplary embodiment, the first encryption module 604 includes: a first determination submodule, which is used to determine the number of encryption operations performed on the initialization vector based on the position information of the target ciphertext data block in the target encrypted file when the target mode is the output feedback OFB mode; a first execution submodule, which is used to perform the encryption operation on the initialization vector using the target key according to the number of encryptions in the first thread to obtain the target vector; and a second acquisition submodule, which is used to obtain the target ciphertext data block from the target encrypted file according to the identification information of the target ciphertext data block in the second thread, wherein the first thread and the second thread are executed in parallel.

[0066] In an exemplary embodiment, the first encryption module 604 includes: a second determination submodule, used to determine the number of plaintext data blocks currently obtained when the target mode is the counter mode; a first acquisition submodule, used to obtain a first initialization vector based on the number of plaintext data blocks currently obtained and the initialization vector; a second execution submodule, used to perform an encryption operation on the first initialization vector using the target key in the first thread to obtain the target vector; a third acquisition submodule, used to obtain the target ciphertext data block from the target encrypted file in the second thread according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

[0067] In an exemplary embodiment, the first obtaining submodule includes: a first determining unit, used to determine the initialization vector as the first initialization vector when the number of the currently obtained plaintext data blocks is 0; a first executing unit, used to perform a target addition operation on the initialization vector to obtain the first initialization vector when the number of the currently obtained plaintext data blocks is greater than 0.

[0068] In an exemplary embodiment, the first execution module 606 includes: a first conversion submodule, used to convert the target vector and the target ciphertext data block according to the target base to obtain the target vector in the target base and the target ciphertext data block in the target base; and a third execution submodule, used to perform an XOR operation on the target vector in the target base and the target ciphertext data block in the target base to obtain the target plaintext data block.

[0069] An embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0070] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0071] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0072] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0073] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0074] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0075] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0076] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for decrypting a ciphertext data block, characterized in that: include: Obtaining target decryption parameters of a target encrypted file, wherein the target decryption parameters include an encryption algorithm mode and an initialization vector required for encrypting an original file, and the target encrypted file is a file obtained after encrypting the original file; When the encryption algorithm mode is a target mode, performing in parallel an operation of encrypting the initialization vector using a target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file; A target operation is performed on the target vector and the target ciphertext data block to obtain a target plaintext data block, wherein the target plaintext data block is a data block included in the original file, and the target ciphertext data block is a data block obtained after encrypting the target plaintext data block.

2. The method according to claim 1, characterized in that Before obtaining the target decryption parameters of the target encrypted file, the method includes: pre-reading multiple decryption parameters of multiple encrypted files from the initial storage space, and caching the multiple decryption parameters and the unique identification information of the multiple encrypted files in the target storage space, wherein the multiple encrypted files include the target encrypted file, and the multiple decryption parameters include the target decryption parameters; Acquiring a target decryption parameter of a target encrypted file includes: acquiring the target decryption parameter stored corresponding to the target encrypted file from the target storage space based on the target identification information of the target encrypted file.

3. The method according to claim 1, characterized in that When the encryption algorithm mode is the target mode, performing in parallel an operation of encrypting the initialization vector using the target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file, including: In the case where the target mode is the output feedback (OFB) mode, determining the number of encryption times of performing the encryption operation on the initialization vector based on the position information of the target ciphertext data block in the target encrypted file; In the first thread, according to the number of encryptions, using the target key to perform the encryption operation on the initialization vector to obtain the target vector; In the second thread, the target ciphertext data block is obtained from the target encrypted file according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

4. The method according to claim 1, characterized in that When the encryption algorithm mode is the target mode, performing in parallel an operation of encrypting the initialization vector using the target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file, including: When the target mode is the counter mode, determining the number of currently obtained plaintext data blocks; Obtaining a first initialization vector based on the number of the currently obtained plaintext data blocks and the initialization vector; In a first thread, an encryption operation is performed on the first initialization vector using the target key to obtain the target vector; In the second thread, the target ciphertext data block is obtained from the target encrypted file according to the identification information of the target ciphertext data block, wherein the first thread and the second thread are executed in parallel.

5. The method according to claim 4, characterized in that Obtaining a first initialization vector based on the number of currently obtained plaintext data blocks and the initialization vector includes: When the number of the currently obtained plaintext data blocks is 0, determining the initialization vector as the first initialization vector; When the number of the currently obtained plaintext data blocks is greater than 0, a target sum operation is performed on the initialization vector to obtain the first initialization vector.

6. The method according to claim 1, characterized in that Performing a target operation on the target vector and the target ciphertext data block to obtain a target plaintext data block includes: Convert the target vector and the target ciphertext data block according to a target base to obtain a target vector in the target base and a target ciphertext data block in the target base; An exclusive OR operation is performed on the target vector in the target base and the target ciphertext data block in the target base to obtain the target plaintext data block.

7. A decryption device for a ciphertext data block, characterized in that: include: A first acquisition module is used to acquire target decryption parameters of a target encrypted file, wherein the target decryption parameters include an encryption algorithm mode and an initialization vector required for encrypting an original file, and the target encrypted file is a file obtained after encrypting the original file; A first encryption module, configured to, when the encryption algorithm mode is a target mode, perform in parallel an operation of encrypting the initialization vector using a target key to obtain a target vector and an operation of obtaining a target ciphertext data block included in the target encrypted file; The first execution module is used to perform a target operation on the target vector and the target ciphertext data block to obtain a target plaintext data block, wherein the target plaintext data block is a data block included in the original file, and the target ciphertext data block is a data block obtained after encrypting the target plaintext data block.

8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 6 when executed by a processor.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 6 are implemented.