Security detection method and device for 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, and the security of the cryptographic algorithm is evaluated. This solves the problem of the lack of security testing in existing encryption schemes and realizes a comprehensive security assessment of the cryptographic algorithm and the revelation of potential vulnerabilities.

CN121308950AActive Publication Date: 2026-01-09UNIV OF ELECTRONICS SCI & TECH OF CHINA ZHONGSHAN INST
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202511419794.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-30
Publication Date
2026-01-09
Estimated Expiration
2045-09-30

AI Technical Summary

Technical Problem

Existing encryption schemes lack security testing, resulting in unclear encryption performance and an inability to assess their security.

Method used

By setting the target plaintext data, performing the inverse operation of the CBC chain operation, cracking the S-box, and solving based on the intermediate ciphertext and the inverse S-box, the decryption result is obtained. Finally, the result is compared with the target plaintext data to evaluate the security of the cryptographic algorithm.

Benefits of technology

It enables a comprehensive security assessment of cryptographic algorithms, reveals potential vulnerabilities, and improves the security detection capabilities of cryptographic algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121308950A_ABST
    Figure CN121308950A_ABST
Patent Text Reader

Abstract

The invention discloses a security detection method and device for a cryptographic algorithm, and the method comprises the steps: setting target plaintext data, and carrying out the processing of a target plaintext through a predefined cryptographic algorithm, and obtaining a target ciphertext; performing inverse operation of CBC chain operation on the target ciphertext to obtain an intermediate ciphertext; comparing the target plaintext data with the intermediate ciphertext, and cracking to obtain 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; and comparing the decryption result with the target plaintext data to obtain a comparison result. The device comprises a memory and a processor used for executing the security detection method of the cryptographic algorithm. The invention provides a new direction aiming at the security performance detection of the encryption method. The method can be widely applied to the field of security detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of security testing, and in particular to a method and apparatus for security testing of cryptographic algorithms. Background Technology

[0002] With the rapid development of digital image technology and the frequent use of video image information, its security issues are becoming increasingly serious. Cryptographic security analysts or cryptographic algorithm testers can exploit vulnerabilities in information transmission and storage to obtain sensitive information from images. To address this challenge, it is essential to adopt efficient chaotic image encryption technology to protect the privacy of video images.

[0003] Chaotic encryption possesses similar characteristics to cryptography, such as confusion, diffusion, and key manipulation. Compared to traditional text encryption, it also offers advantages in encryption efficiency for multimedia information. Currently, image encryption algorithms based on constructing S-boxes using chaotic systems have attracted widespread attention. Some current encryption algorithms employ S-box substitution and cipher block chaining (CBC) diffusion techniques. However, the security of this type of encryption scheme remains unclear; therefore, it is necessary to evaluate the security of such schemes. Summary of the Invention

[0004] In view of this, in order to address the issue that existing encryption schemes do not undergo security testing, and therefore their encryption performance is unclear, this invention proposes a security testing method for cryptographic algorithms, the method comprising the following steps:

[0005] Set the target plaintext data, and process the target plaintext using a predefined cryptographic algorithm to obtain the target ciphertext;

[0006] Perform the inverse operation of the CBC chain operation on the target ciphertext to obtain the intermediate ciphertext;

[0007] The target plaintext data and the intermediate ciphertext are compared to decrypt the S-box.

[0008] Construct an inverse S-box based on the S-box;

[0009] The decryption result is obtained by solving the intermediate ciphertext and the inverse S-box.

[0010] The decryption result and the target plaintext data are compared to obtain the comparison result.

[0011] The predefined cryptographic algorithms include CBC encryption and S-box encryption.

[0012] In some embodiments, it also includes:

[0013] The target ciphertext is converted into a two-dimensional data format.

[0014] This optimized step converts the three-dimensional data format of the target ciphertext into a two-dimensional data format. Subsequent decryption operations will be performed after this ciphertext to restore the original data.

[0015] In some embodiments, the formula for the inverse operation of CBC chaining is expressed as:

[0016]

[0017] Among them, C c Both cp(x,y) and L represent the ciphertext in this round. c Both cp(x-1,y-1) and cp(x-1,y-1) represent the previous round of ciphertext, where x and y represent the number of rows and columns of the matrix, respectively.

[0018] 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 obtain the S-box specifically involves:

[0020] Based on the principle of S-box substitution operation, the S-box is obtained by comparing the values ​​and positions of the target plaintext and the intermediate ciphertext.

[0021] In some embodiments, the step of comparing the target plaintext data and the intermediate ciphertext to obtain the S-box specifically involves:

[0022] The detection method based on cyclic fixed-length frame skipping obtains the S-box according to the target plaintext data and the intermediate ciphertext.

[0023] In some embodiments, it also includes:

[0024] The introduction of an S-box substitution operation in the CBC chaining operation of a predefined cryptographic algorithm.

[0025] This optimization step involves adjusting and re-testing a predefined cryptographic algorithm when its security is found to be insufficient.

[0026] This invention also proposes a security detection device for cryptographic algorithms, 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 a security detection method for a cryptographic algorithm as described above.

[0030] Based on the above scheme, this invention provides a security detection method and apparatus for cryptographic algorithms. It employs a comprehensive security detection method, covering the detection of CBC chain operations and S-box substitution operations in cryptographic algorithms. By performing the inverse CBC chain operation on the target ciphertext and obtaining the encrypted information in the S-box by comparing the grayscale values ​​of plaintext pixels with the positions of intermediate ciphertext data, this invention can comprehensively evaluate the security of cryptographic algorithms and reveal potential vulnerabilities. Attached Figure Description

[0031] Figure 1 This is a flowchart illustrating a security detection method for a cryptographic algorithm according to the present invention;

[0032] Figure 2 This is a schematic diagram of the code logic for cracking the S-box using plaintext P and intermediate ciphertext E in a specific embodiment of the present invention;

[0033] Figure 3 This is a schematic diagram of the code logic of a specific embodiment of the present invention based on a cyclic fixed-length frame skipping algorithm;

[0034] Figure 4 These are the images and their corresponding histograms used in the decryption process of a specific embodiment of the present invention. Detailed Implementation

[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0036] It should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this application can be combined with each other.

[0037] It should be understood that the terms "system," "apparatus," "unit," and / or "module" used in this application are a method of distinguishing different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they may be replaced by other expressions.

[0038] Unless the context explicitly indicates an exception, words such as "a," "an," "a kind," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list; a method or apparatus may also include other steps or elements. An element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, product, or apparatus that includes the element.

[0039] In the description of the embodiments of this application, "a plurality of" refers to two or more. The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0040] Furthermore, flowcharts are used in this application to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed precisely in sequence. Instead, the steps can be processed in reverse order or simultaneously. Additionally, other operations can be added to these processes, or one or more steps can be removed from them.

[0041] Reference Figure 1 This is a flowchart illustrating an optional example of the security detection method for the cryptographic algorithm proposed in this invention. This method can be applied to computer devices, and the security detection method proposed in this embodiment may include, but is not limited to, the following steps:

[0042] Step S1: Set the target plaintext data and process the target plaintext using a predefined cryptographic algorithm to obtain the target ciphertext;

[0043] Step S2: Perform the inverse operation of CBC chaining on the target ciphertext to obtain the intermediate ciphertext;

[0044] Step S3: Compare the target plaintext data with the intermediate ciphertext to obtain the S-box;

[0045] Step S4: Construct the inverse S-box based on the S-box;

[0046] Step S5: Solve the code based on the intermediate ciphertext and the inverse S-box to obtain the decryption result;

[0047] Step S6: Compare the decryption result with the target plaintext data to obtain the comparison result.

[0048] In this embodiment, a 4×4 grayscale image with uniformly increasing pixel size is constructed as the original plaintext. The original plaintext is read sequentially and stored in matrix form. The original plaintext is then encrypted using the Arnold encryption algorithm to obtain the target ciphertext.

[0049]

[0050] Where P represents the original plaintext and C represents the target ciphertext.

[0051] In some feasible embodiments, it also includes:

[0052] The target ciphertext is converted into a two-dimensional data format.

[0053] For some color videos, the process begins by reading in an encrypted M×N×3 color video ciphertext stream and extracting and decomposing it into independent ciphertext image frames. Then, for each ciphertext image frame, the red, green, and blue color channels are separated, each with a size of M×N. Next, the three channels are concatenated in red, green, and blue order to form an M×3N ciphertext grayscale image matrix. If the source ciphertext video is a grayscale image, it is directly used as an M×N grayscale matrix. These steps convert the color video ciphertext frames into a grayscale ciphertext image matrix. Subsequent decryption algorithms are then performed on this grayscale ciphertext image sequence to recover the original video.

[0054] In some feasible embodiments, the formula for the inverse operation of CBC chaining is expressed as:

[0055]

[0056] Among them, C c Both cp(x,y) and L represent the ciphertext in this round. c Both cp(x-1,y-1) and cp(x-1,y-1) represent the previous round of ciphertext, where x and y represent the number of rows and columns of the matrix, respectively.

[0057] After obtaining the ciphertext, the first step is to study the final encryption operation, namely the CBC encryption mode. CBC encryption is a diffusion operation between the current input pixel and the previous encrypted pixel. Although this method enhances robustness against statistical, differential, and selection attacks, as well as known plaintext attacks, and guarantees the uniqueness of the scheme, its algorithm structure actually differs from the classic key-controlled CBC chain encryption structure. This is because without a key involved in the computation, the relationship between the ciphertext and plaintext generated by CBC encryption is fixed. This results in a high correlation between adjacent ciphertexts in the CBC encryption result, allowing almost all of the plaintext to be calculated from the ciphertext alone.

[0058] As we know from CBC chain encryption, when encrypting a pixel, the encryption result is the sum of the plaintext and the previous ciphertext, modulo 256. Therefore, there are two possibilities: the sum is greater than 256, or less than 256 but greater than 0. The modulo result is always a natural number between 1 and 255, i.e., cp ∈ [1, 256]. Thus, the summation and modulo operations during encryption are reversible, and the algorithm can be directly calculated through mathematical logic rearrangement, i.e., the inverse operation of the above formula.

[0059] The ciphertext in the middle can be obtained:

[0060]

[0061] Where E represents the intermediate ciphertext.

[0062] This step allows you to test the security of CBC chaining operations in cryptographic algorithms.

[0063] In some feasible embodiments, step S3 specifically includes:

[0064] Based on the principle of S-box substitution operation, the S-box is obtained by comparing the values ​​and positions of the target plaintext and the intermediate ciphertext.

[0065] After testing and analyzing the security of the CBC chain operation, the original algorithm degenerates into a substitution-only encryption algorithm. After decryption via CBC, an intermediate ciphertext equivalent to one that has only undergone substitution operations is obtained, carrying the internal information of the S-box in the encryption system, i.e., the intermediate ciphertext.

[0066] Continuing our analysis of the step preceding CBC encryption, the S-box substitution encryption, this process clearly involves three steps: first, ensuring the readability of the plaintext; second, retrieving the replacement value from the corresponding row of the S-box based on the plaintext value; and finally, replacing the corresponding plaintext value with the value retrieved in the second step at the appropriate position. According to the inverse CBC formula, cryptographic security analysts or testers can obtain the ciphertext encrypted solely by the S-box encryption system simply by reversing the CBC operation. However, the S-box encryption system is controlled solely by the substitution operation, without any effective scrambling or propagation of the result. This allows cryptographic security analysts or testers to directly obtain the information in the S-box through plaintext substitution. At this point, regardless of the S-box's performance, it is no longer confidential and thus loses its ability to defend against chosen-plaintext attacks.

[0067] The S-box is cracked by comparing the input plaintext and intermediate ciphertext. Since plaintext information is necessarily associated with ciphertext addresses, according to the chosen-plaintext attack condition, the values ​​and positions of the plaintext P and intermediate ciphertext E can be compared to crack the relevant S-box values. Therefore, 16 items of S-box information can be obtained from the original plaintext and intermediate ciphertext, both of which are 4×4 in size.

[0068] Whether using the chaotic-driven 12DArnold map S-box construction method or a similar DDE-constructed S-box for encryption, the essence is to use the plaintext grayscale value 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 with the intermediate ciphertext E, the following can be cracked. For example, the encryption of P(1,1) starts by obtaining the grayscale value 15 at position (1,1) in P. Then, the value G at index 15 is retrieved in the S-box. Before replacement, since the starting positions of the grayscale value and the S-box value are 0 and 1 respectively, G must be subtracted by one. That is, 15 is replaced by G-1, completing the encryption of one pixel. Taking the first row of P and E as an example, the first row of elements of the S-box structure is as follows:

[0069] Sbox(1,:)=[…40…56…16…84…]

[0070] Here, Sbox(1,:) represents the first row of the S-box structure, with index 15 for 40, index 30 for 56, index 45 for 16, and index 60 for 84. Therefore, a 4×4 non-repeating plaintext selection yields 16 values ​​for the S-box. By mathematical induction, we know that when the range of values ​​for each row in the plaintext selection covers all integers in the range [0, 255], the solution for each row of the S-box structure can be completed.

[0071] Algorithm diagram using plaintext and intermediate ciphertext (see reference) Figure 2 .

[0072] In some feasible embodiments, step S4 specifically includes:

[0073] To logically demonstrate the process of cryptographic algorithm security testing, we need to derive the inverse S-box from the obtained S-box to decrypt the intermediate ciphertext into plaintext. The inverse S-box is the reverse of the third encryption step. Similarly, the construction of a partial inverse S-box is shown in the following example:

[0074] re-Sbox(1,:)=[…45…15…30…60…]

[0075] Here, re-Sbox(1,:) is used as an array to represent the first row of the inverse S-box structure, with the index of 45 being 15, the index of 15 being 39, the index of 30 being 55, and the index of 60 being 83.

[0076] The difference between encryption and decryption lies solely in whether an S-box or an inverse S-box is used. As shown in step S3, the obtained S-box is derived from the original plaintext P and the intermediate ciphertext E. The richer the pixel values ​​of the original plaintext P, the more information the S-box reveals. A complete S-box can be calculated when every line of the plaintext contains all values ​​in the range [0, 255].

[0077] In some feasible embodiments, in steps S5 and S6:

[0078] By using the same method as encryption, passing E through an inverse S-box and performing the same operation as encryption, the intermediate ciphertext can be decrypted, thus completing the final decryption step. By comparing the decryption result with the original plaintext, the effectiveness of the detection method and the security of the cryptographic algorithm are determined. If the comparison results match, the detection method is feasible and effective, and the cryptographic algorithm is insecure; otherwise, the detection method is invalid, and the cryptographic algorithm is secure.

[0079] In some feasible embodiments, step S3 specifically includes:

[0080] The detection method based on cyclic fixed-length frame skipping obtains the S-box from the intermediate ciphertext E and the original plaintext P.

[0081] A relatively complete S-box is obtained by detecting or analyzing fragmented information one by one. Although analysis using known-plaintext attacks can maximize the acquisition of the S-box and more closely approximate the actual analysis or detection efficiency, the actual encrypted plaintext data has spatial and temporal correlations, thus wasting a lot of computing power on repeatedly solving a single information block in the S-box. This operation greatly reduces the efficiency of cryptanalysis.

[0082] To address this issue, this invention proposes a more efficient cryptanalysis method. Its core idea is to allow the detection simulator to access as many ciphertext grayscale values ​​as possible, encrypted from different plaintext grayscale values, within the shortest possible time, thereby improving detection efficiency. Specifically, for video cryptographic algorithm security detection, this involves setting a fixed offset frame skipping sequence to read and analyze the image. Furthermore, to address the issue of insufficient information acquisition due to excessive frame skipping, this invention loops this frame skipping operation to maximize the acquisition of key information from the S-box in the shortest possible time.

[0083] Logical reference based on the cyclic fixed-length frame skipping algorithm Figure 3 .

[0084] In some feasible embodiments, it also includes:

[0085] The introduction of an S-box substitution operation in the CBC chaining operation of a predefined cryptographic algorithm.

[0086] By introducing an S-box substitution operation into the CBC module, the algorithm no longer relies on simple adjacent block relationships. Instead, this invention incorporates the chaotic sequence generated by the key into the S-box substitution operation, increasing the influence of the key and simultaneously raising the overall complexity of the cryptographic algorithm.

[0087] This improvement makes inverse derivation more difficult. Within the existing framework of enhanced CBC operations, inverse derivation is no longer a simple linear process, but a more complex nonlinear one, involving intricate interactions of S-box substitution, chaotic diffusion, and key generation. This increased complexity effectively raises the difficulty of inverse derivation, hindering the simple derivation of encryption coefficients.

[0088] The encryption and decryption process involved in this invention refers to... Figure 4 Specifically: Figure 4 (a) indicates the selected plaintext; Figure 4 (b) is the histogram of (a); Figure 4 (c) represents the encrypted image; Figure 4 In the middle (d), the histogram of (c) is shown. Figure 4 (e) indicates the intermediate ciphertext; Figure 4 In the middle (f), the histogram of (e) is shown. Figure 4 (g) indicates that the ciphertext image is decrypted using the inverse S-box; Figure 4 The histogram of (h) is the histogram of (g).

[0089] A security detection device for cryptographic algorithms:

[0090] At least one processor;

[0091] At least one memory for storing at least one program;

[0092] When the at least one program is executed by the at least one processor, the at least one processor implements a security detection method for a cryptographic algorithm as described above.

[0093] The content of the above method embodiments is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0094] A storage medium storing processor-executable instructions, which, when executed by a processor, are used to implement a security detection method for a cryptographic algorithm as described above.

[0095] The content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0096] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.

Claims

1. A security detection method for a cryptographic algorithm, characterized in that, Includes the following steps: Set the target plaintext data, and process the target plaintext using a predefined cryptographic algorithm to obtain the target ciphertext; Perform the inverse operation of the CBC chain operation on the target ciphertext to obtain the intermediate ciphertext; The target plaintext data and the intermediate ciphertext are compared to decrypt the S-box. Construct an inverse S-box based on the S-box; The decryption result is obtained by solving the intermediate ciphertext and the inverse S-box. The decryption result and the target plaintext data are compared to obtain the comparison result.

2. The security detection method for a cryptographic algorithm according to claim 1, characterized in that, Also includes: The target ciphertext is converted into a two-dimensional data format.

3. The security detection method for a cryptographic algorithm according to claim 1, characterized in that, The formula for the inverse operation of CBC chaining is expressed as: Among them, C c Both cp(x,y) and L represent the ciphertext in this round. c Both cp(x-1,y-1) and cp(x-1,y-1) represent the previous round of ciphertext, where x and y represent the number of rows and columns of the matrix, respectively.

4. The security detection method for a cryptographic algorithm according to claim 1, characterized in that, The step of comparing the target plaintext data with the intermediate ciphertext to obtain the S-box specifically involves: Based on the principle of S-box substitution operation, the S-box is obtained by comparing the values ​​and positions of the target plaintext and the intermediate ciphertext.

5. The security detection method for a cryptographic algorithm according to claim 1, characterized in that, The step of comparing the target plaintext data with the intermediate ciphertext to obtain the S-box specifically involves: The detection method based on cyclic fixed-length frame skipping obtains the S-box according to the target plaintext data and the intermediate ciphertext.

6. The security detection method for a cryptographic algorithm according to claim 1, characterized in that, Also includes: The introduction of an S-box substitution operation in the CBC chaining operation of a predefined cryptographic algorithm.

7. A security detection device for a cryptographic algorithm, characterized in that, include: 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 a security detection method for a cryptographic algorithm as described in any one of claims 1-6.

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

  • Method for determining a cryptographic key, computer program, and data processing system

    US20230027694A1