A security detection method and device of a cryptographic algorithm
By performing the inverse operation of CBC chaining and the S-box substitution operation on the cryptographic algorithm, the S-box is cracked, the inverse S-box is constructed, and the plaintext data is compared. This solves the problem of the lack of security detection in existing encryption schemes and realizes a comprehensive security assessment and potential vulnerability disclosure of the cryptographic algorithm.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNIV OF ELECTRONICS SCI & TECH OF CHINA ZHONGSHAN INST
- Filing Date
- 2025-09-30
- Publication Date
- 2026-04-10
AI Technical Summary
Existing encryption schemes lack security testing, resulting in unclear encryption performance and an inability to assess their security.
By setting the target plaintext data, performing the inverse operation of CBC chaining, breaking the S-box, constructing the inverse S-box to solve the intermediate ciphertext, and finally comparing it with the target plaintext data, the security of the cryptographic algorithm is evaluated.
It enables a comprehensive security assessment of cryptographic algorithms, reveals potential vulnerabilities, and improves the security detection capabilities of cryptographic algorithms.
Smart Images

Figure CN121308950B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of security detection, and in particular to a security detection method and device for a cryptographic algorithm. BACKGROUND
[0002] With the rapid development of digital image technology, video image information is frequently used, making its security problem increasingly serious. Cryptographic algorithm security analysts or cryptographic algorithm detection personnel can obtain sensitive information in the image by exploiting vulnerabilities in information transmission and storage. To address this challenge, it is extremely necessary to use efficient chaotic image encryption technology for privacy protection of video images.
[0003] Chaotic encryption has similar features to cryptography, such as confusion, diffusion, and key. Compared with traditional text encryption, it also has advantages in multimedia information encryption efficiency. Currently, image encryption algorithms based on S-boxes constructed from chaotic systems have attracted widespread attention. Some encryption algorithms now use S-box replacement and cipher block chaining (CBC) diffusion technology, but the security of this type of encryption scheme is not clear, so it is necessary to evaluate the security of this type of scheme. SUMMARY
[0004] Therefore, in order to solve the problem that the existing encryption scheme is not subjected to security detection, and thus it is unclear whether it has good encryption performance, the present application provides a security detection method for a cryptographic algorithm, which comprises the following steps:
[0005] Setting a target plaintext data, and processing the target plaintext through a predefined cryptographic algorithm to obtain a target ciphertext;
[0006] Performing inverse operation of CBC chain operation on the target ciphertext to obtain an intermediate ciphertext;
[0007] Comparing the target plaintext data and the intermediate ciphertext to crack an S-box;
[0008] Constructing an inverse S-box according to the S-box;
[0009] Solving according to the intermediate ciphertext and the inverse S-box to obtain a decryption result;
[0010] Comparing the decryption result and the target plaintext data to obtain a comparison result.
[0011] Among them, the predefined cryptographic algorithm includes a CBC encryption mode and an S-box encryption mode.
[0012] In some embodiments, it further comprises:
[0013] Converting the target ciphertext into a two-dimensional data format.
[0014] Through the preferred step, the three-dimensional data format of the target ciphertext is converted into a two-dimensional data format, and subsequent decryption operations are performed on the ciphertext to achieve the purpose of restoring the original data.
[0015] In some embodiments, the formula of the inverse operation of the CBC chain operation is:
[0016]
[0017] wherein, and both represent the current round of ciphertext, and both represent the previous round of ciphertext, and x and y represent the number of rows and columns of the matrix, respectively.
[0018] wherein, the CBC encryption is a diffusion operation between the current input pixel and the previous encrypted pixel.
[0019] In some embodiments, the step of comparing the target plaintext data and the intermediate ciphertext to crack the S-box is specifically:
[0020] Based on the principle of S-box substitution operation, by comparing the value and position relationship of the target plaintext and the intermediate ciphertext, the relevant S-box value is cracked to obtain the S-box.
[0021] In some embodiments, the step of comparing the target plaintext data and the intermediate ciphertext to crack the S-box is specifically:
[0022] Based on the detection method of cyclic fixed-length frame hopping, the S-box is obtained according to the target plaintext data and the intermediate ciphertext.
[0023] In some embodiments, the method further comprises:
[0024] Introducing an S-box substitution operation in the CBC chain operation in the pre-defined cryptographic algorithm.
[0025] Through the preferred step, when it is detected that the security of the pre-defined cryptographic algorithm is not high, the cryptographic algorithm is adjusted and re-detected.
[0026] The application also proposes a security detection device of a cryptographic algorithm, comprising:
[0027] At least one processor;
[0028] At least one memory for storing at least one program;
[0029] When the at least one program is executed by the at least one processor, the at least one processor implements the security detection method of the cryptographic algorithm as described above.
[0030] Based on the above scheme, the application provides a security detection method and device of a cryptographic algorithm, which adopts a comprehensive security detection method and covers the detection of CBC chain operation and S-box substitution operation of the cryptographic algorithm. By performing inverse operation of the CBC chain operation on the target ciphertext and comparing the pixel gray value of the plaintext with the position of the intermediate ciphertext data to obtain the encryption information in the S-box, the application can comprehensively evaluate the security of the cryptographic algorithm and reveal potential vulnerabilities. BRIEF DESCRIPTION OF DRAWINGS
[0031] Figure 1 is a flowchart of a security detection method of a cryptographic algorithm of the application;
[0032] Figure 2 is a code logic diagram of the application for cracking the S-box by using the plaintext P and the intermediate ciphertext E;
[0033] Figure 3 is a code logic diagram of the application based on the cyclic fixed-length frame hopping algorithm;
[0034] Figure 4 is an image and its corresponding histogram applied in the decryption process of the embodiment of the application. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the application.
[0036] It should be noted that, for the convenience of description, only the parts related to the application are shown in the drawings. The embodiments in the application and the features in the embodiments can be combined with each other without conflict.
[0037] It should be understood that the "system", "device", "unit" and / or "module" used in the application is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0038] The singular forms "a," "an," and "the" do not exclude plural referents unless the context clearly dictates otherwise. The term "or" means "and / or" unless the context clearly dictates otherwise. The term "comprises" and variations thereof do not exclude the presence of additional elements or steps. Where the indefinite article is used, the specification is to be understood as embracing both the singular and plural forms and vice versa. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The meaning of "in" and "determining" includes a direct measurement or an indirect measurement of the desired property. The meaning of "comprising" and "including" is non-limiting and comprises one or more steps or elements of any integer or group thereof without excluding other steps or elements.
[0039] In the description of embodiments of the present application, "multiple" means two or more than two. The following terms "first", "second", are only used for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features.
[0040] In addition, flowcharts are used in the present application to illustrate the operations performed by the system according to the embodiments of the present application. It should be understood that the preceding or subsequent operations are not necessarily performed in sequence. On the contrary, each step can be processed in reverse order or simultaneously. Meanwhile, other operations can be added to these processes, or one or more steps of operations can be removed from these processes.
[0041] Reference Figure 1 The flowchart of an optional example of the security detection method of the cryptographic algorithm proposed in the present application. The method can be applied to computer equipment. The security detection method proposed in the present embodiment can include but is not limited to the following steps:
[0042] Step S1, set target plaintext data, and process the target plaintext through a predefined cryptographic algorithm to obtain target ciphertext;
[0043] Step S2, perform inverse operation of CBC chain operation on the target ciphertext to obtain intermediate ciphertext;
[0044] Step S3, compare the target plaintext data and the intermediate ciphertext to crack the S-box;
[0045] Step S4, construct an inverse S-box according to the S-box;
[0046] Step S5, solve according to the intermediate ciphertext and the inverse S-box to obtain a decryption result;
[0047] Step S6, compare the decryption result and the target plaintext data to obtain a comparison result.
[0048] In this embodiment, a pixel uniform increase gray scale image of size 4x4 is constructed as the original plaintext. The original plaintext is read in sequence and stored in the form of a matrix. The original plaintext is encrypted according to the Arnold encryption algorithm to obtain the target ciphertext.
[0049]
[0050]
[0051] wherein P represents the original plaintext, and C represents the target ciphertext
[0052] In some possible embodiments, further comprising:
[0053] Converting the target ciphertext into a two-dimensional data format.
[0054] For some color videos, first, the encrypted color video ciphertext stream of size MxNx3 is read in, and is extracted into independent ciphertext image frames. Then, for each frame of ciphertext image, the red, green, and blue three color channels are separated, and each channel has a size of MxN. Next, the three channels are spliced in the order of red, green, and blue into a ciphertext grayscale image matrix with a size of Mx3N. If the source ciphertext video is a grayscale image, it is directly used as an MxN grayscale matrix. Through the above steps, the conversion of the color video ciphertext frame to the grayscale ciphertext image matrix is realized. The subsequent decryption algorithm operation will be performed on the grayscale ciphertext image sequence to achieve the purpose of restoring the original video.
[0055] In some possible embodiments, the formula of the inverse operation of the CBC chain operation is:
[0056]
[0057] wherein, and both represent the current round of ciphertext, and both represent the previous round of ciphertext, and x and y represent the number of rows and columns, respectively.
[0058] After obtaining the ciphertext, first, the last encryption operation, i.e., the CBC encryption mode, is studied. The CBC encryption is a diffusion operation between the current input pixel and the previous encrypted pixel. Although this method enhances the robustness against statistical, differential, and selection attacks and known plaintext attacks, and guarantees the uniqueness of the scheme, the algorithm structure is actually different from the classic key-controlled CBC chain encryption structure. The reason is that without the participation of the key operation, the relationship between the ciphertext and the plaintext obtained by the CBC encryption is fixed. Thus, the CBC encryption result has a high correlation between adjacent ciphertexts, and almost all the plaintexts can be calculated from the ciphertexts.
[0059] From the CBC chain encryption, when encrypting a pixel, since the encryption result is the sum of plaintext and the previous round ciphertext modulo 256. Then there are two cases of the sum result greater than 256 and less than 256 and greater than 0. And the result of modulo is a natural number between 1~255, that is, cp∈[1, 256]. Then the sum and modulo operation in encryption is reversible, the algorithm can be directly calculated by mathematical logic shift, that is, the inverse operation of the above formula.
[0060] The intermediate ciphertext can be obtained:
[0061]
[0062] Wherein, E represents the intermediate ciphertext.
[0063] Through this step, the security of the CBC chain operation in the password algorithm can be detected.
[0064] In some feasible embodiments, in the step S3, it specifically comprises:
[0065] Based on the principle of S-box substitution operation, by comparing the value and position relationship of the target plaintext and the intermediate ciphertext, the related S-box value is cracked, and the S-box is obtained.
[0066] After detecting and analyzing the security of the CBC chain operation, the original algorithm will degenerate into a substitution encryption algorithm. After CBC decryption, an intermediate ciphertext equivalent to only performing a substitution operation is obtained, and the internal information of the S-box in the encryption system is carried, that is, the intermediate ciphertext.
[0067] Continue to analyze the previous step of CBC encryption, the S-box substitution encryption. Obviously, the encryption process has three steps: first, ensure the readability of the plaintext; the second step is to take out the value to be replaced according to the plaintext value in the corresponding S-box row; finally, the corresponding plaintext value is replaced with the value obtained in the second step. According to the inverse operation formula of CBC, the password algorithm security analyst or password algorithm detection personnel only needs to restore the CBC operation according to the formula to obtain the ciphertext after the S-box encryption system. But the S-box encryption system is only controlled by the operation of the substitution operation, and there is no effective permutation or diffusion operation on the result of the substitution. This leads to that the password algorithm security analyst or password algorithm detection personnel can directly obtain the information in the S-box through the plaintext. At this time, no matter how good the performance of the S-box is, it will no longer be secret, thereby losing the ability to resist the chosen plaintext attack
[0068] The S-box is cracked by comparing the input original plaintext and the intermediate ciphertext. Since the plaintext information is necessarily associated with the ciphertext address. In this way, according to the conditions of the chosen plaintext attack, the relevant S-box values can be cracked by comparing the value and position relationship of the plaintext P and the intermediate ciphertext E. Therefore, 16 S-boxes can be obtained from the original plaintext and the intermediate ciphertext with a size of 4x4.
[0069] Whether it is a 12D Arnold map S-box construction method driven by chaos or an S-box constructed by similar DDE for encryption, the essence is to use the gray value of the plaintext as an index to match the corresponding ciphertext value in the S-box for replacement. Here, for Arnold encryption, by comparing the original plaintext P and the intermediate ciphertext E, the content that can be cracked is as follows. For example, the encryption of P(1,1) starts from the gray value 15 of position (1,1) in P. Then the value G with subscript 15 is retrieved in the S-box. Before replacement, since the starting positions of the gray value and the S-box value are 0 and 1 respectively, G-1 is also subtracted from G. That is, 15 is replaced by G-1 to complete the encryption of one pixel. Taking the first row of P and E as an example, the first row of the S-box structure is obtained as follows:
[0070]
[0071] Among them, Sbox(1,:) as an array represents the first row of the S-box structure, the subscript of 40 is 15, the subscript of 56 is 30, the subscript of 16 is 45, and the subscript of 84 is 60. Therefore, 16 values of the S-box can be obtained from the 4x4 non-repeating chosen plaintext. According to mathematical induction, when the value range of each row of the chosen plaintext covers all integers in [0, 255], each row of the S-box structure can be solved.
[0072] Algorithm diagram using plaintext and intermediate ciphertext Figure 2 .
[0073] In some possible embodiments, the step S4 specifically includes:
[0074] In order to logically demonstrate the process of security detection of the cryptographic algorithm, we need to obtain the inverse S-box to decrypt the intermediate ciphertext to plaintext according to the obtained S-box. The inverse S-box is the inverse process of the third encryption. Similarly, the construction of part of the inverse S-box is shown in the following example:
[0075]
[0076] Among them, re-Sbox(1,:) as an array represents the first row of the inverse S-box structure, the subscript of 45 is 15, the subscript of 15 is 39, the subscript of 30 is 55, and the subscript of 60 is 83.
[0077] The difference between the encryption and decryption operations is only that the S-box or the inverse S-box is used. As shown in step S3, the obtained Sbox is obtained from the original plaintext P and the intermediate ciphertext E. The more pixel values of the original plaintext P, the more information the S-box leaks. When all values in [0, 255] appear in each row of the plaintext, the complete S-box can be calculated.
[0078] In some possible embodiments, steps S5 and S6 are:
[0079] By the same means as encryption, E is subjected to the same operation as encryption through the inverse S-box to achieve substitution decryption of the intermediate ciphertext, that is, the last step of decryption is completed. By comparing the decryption result with the original plaintext, it is determined whether the detection method is effective and whether the cryptographic algorithm is secure. If the comparison result is consistent, it means that the detection method is feasible and effective and the cryptographic algorithm is insecure; otherwise, it means that the detection method is invalid and the cryptographic algorithm is secure.
[0080] In some possible embodiments, the step S3 specifically includes:
[0081] The detection method based on the cyclic fixed-length frame jump obtains the S-box according to the intermediate ciphertext E and the original plaintext P.
[0082] The relatively complete S-box is obtained by detecting or analyzing the fragment information one by one. Although the known plaintext attack analysis can maximize the acquisition of the S-box and be closer to the actual analysis or detection efficiency, the actual encrypted plaintext data has spatial correlation and temporal correlation in space and time, and therefore a large amount of computing power is wasted on repeatedly solving a certain information block in the S-box. This operation greatly reduces the password analysis efficiency.
[0083] In view of this situation, the present application proposes a more efficient password analysis method. The core idea is to let the detection simulator contact the ciphertext grayscale values encrypted by different plaintext grayscale values in the shortest time as much as possible, thereby improving the detection efficiency. Specifically, for video password algorithm security detection, a fixed offset frame jump is set to read the image for analysis. And in order to deal with the situation that the frame jump is too large and the information is insufficient, the present application cyclically performs the frame jump operation to obtain the main information of the S-box in the shortest time as much as possible.
[0084] Based on the cyclic fixed-length frame jump algorithm logic reference Figure 3 .
[0085] In some possible embodiments, the method further includes:
[0086] In the pre-defined CBC chain operation of the cryptographic algorithm, the one-time S-box substitution operation is introduced.
[0087] By introducing a one-time S-box substitution operation in the CBC module, the algorithm no longer relies on simple adjacent block relationships. Instead, the present application incorporates the chaotic sequence generated by the key into the S-box substitution operation, increasing the influence of the key while improving the overall complexity of the cryptographic algorithm.
[0088] This improvement makes reverse derivation more difficult. In the existing framework of enhanced CBC operation, reverse derivation is no longer a simple linear process, but a more complex nonlinear process involving the complex interaction of S-box substitution, chaotic diffusion and key generation. The introduction of this complexity effectively increases the difficulty of reverse derivation, hindering the simple derivation of the encryption coefficient.
[0089] The encryption and decryption process involved in the present application refers to Figure 4 , specifically: Figure 4 (a) in the figure indicates the selected plaintext; Figure 4 (b) is the histogram of (a); Figure 4 (c) in the figure indicates the ciphertext image; Figure 4 (d) is the histogram of (c); Figure 4 (e) in the figure indicates the intermediate ciphertext; Figure 4 (f) is the histogram of (e); Figure 4 (g) in the figure indicates the decryption of the ciphertext image using the inverse S-box; Figure 4 (h) is the histogram of (g).
[0090] A security detection device of a cryptographic algorithm:
[0091] At least one processor;
[0092] At least one memory for storing at least one program;
[0093] When the at least one program is executed by the at least one processor, the at least one processor implements the security detection method of the cryptographic algorithm as described above.
[0094] The contents in the above method embodiments are all applicable to the device embodiments, the device embodiments specifically implement the same functions as the above method embodiments, and achieve the same beneficial effects as the above method embodiments.
[0095] A storage medium having processor-executable instructions stored therein, the processor-executable instructions, when executed by a processor, are used to implement the security detection method of the cryptographic algorithm as described above.
[0096] The contents in the method embodiments are applicable to the storage medium embodiments, the storage medium embodiments specifically implement the same functions as the method embodiments, and achieve the same beneficial effects as the method embodiments.
[0097] The above is a specific description of the preferred embodiments of the application, but the application is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the application. These equivalent modifications or replacements are all included in the scope defined by the claims of the application.
Claims
1. A method of security detection of a cryptographic algorithm, characterized in that, The method comprises the following steps: Setting target plaintext data, and processing the target plaintext through a predefined cryptographic algorithm to obtain target ciphertext; Performing inverse operation of CBC chain operation on the target ciphertext to obtain intermediate ciphertext; Comparing the target plaintext data and the intermediate ciphertext to crack an S-box; Constructing an inverse S-box according to the S-box; Solving according to the intermediate ciphertext and the inverse S-box to obtain a decryption result; Comparing the decryption result and the target plaintext data to obtain a comparison result; wherein, and both represent the current round ciphertext, and both represent the previous round ciphertext, and x and y represent the number of rows and columns, respectively. The step of comparing the target plaintext data and the intermediate ciphertext to crack the S-box is specifically: Based on the principle of S-box substitution operation, the values of the relevant S-box are cracked by comparing the value and position relationship of the target plaintext and the intermediate ciphertext to obtain the S-box. The step of comparing the target plaintext data and the intermediate ciphertext to crack the S-box is specifically: Based on a cyclic fixed-length frame jump detection method, the S-box is obtained according to the target plaintext data and the intermediate ciphertext.
2. The method of claim 1, wherein the security of the cryptographic algorithm is determined by the step of: Further comprising: Converting the target ciphertext into a two-dimensional data format.
3. The method of claim 1, wherein the security of the cryptographic algorithm is determined by: Further comprising: Introducing a one-time S-box substitution operation in the CBC chain operation in the predefined cryptographic algorithm.
4. A security detection apparatus of a cryptographic algorithm, characterized by comprising: Comprise: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the security detection method of the cryptographic algorithm according to any one of claims 1-3.
Citation Information
Patent Citations
AEC encryption and decryption apparatus and methods in CBC mode
CN106034022A
Method, device and equipment for testing cryptographic algorithm performance and storage medium
CN116032496A