Lightweight public key test system

By generating prime pairs using an improved Miller-Rabin algorithm and combining RSA-OAEP and Montgomery modular multiplication algorithm for layered encryption, the problems of high latency and insufficient security of traditional public-key algorithms are solved, realizing a fast encryption and decryption process and a highly secure public-key testing system.

CN120896697APending Publication Date: 2025-11-04NAVAL UNIV OF ENG PLA +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510523820.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-11-04

AI Technical Summary

Technical Problem

Traditional public-key algorithms suffer from high latency in multi-operation scenarios, impacting user experience and facing the risk of being cracked by quantum computing. Furthermore, data privacy protection and authentication authorization urgently need to be addressed in fields such as the Internet of Things and cloud computing.

Method used

A dynamic prime number generation module is used to generate prime number pairs based on the improved Miller-Rabin algorithm. Combined with a composite modulus construction module and a key pair generation module, layered encryption is performed using the RSA-OAEP padding scheme and the Montgomery modular multiplication algorithm. A decryption verification module is used to detect man-in-the-middle attacks, and a SHA-3 hash function is used to generate ciphertext integrity tags.

Benefits of technology

It improves the security and performance of public key algorithms, reduces latency, enhances user experience, and prevents data tampering through hash verification, thereby improving network security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120896697A_ABST
    Figure CN120896697A_ABST
Patent Text Reader

Abstract

The invention discloses a lightweight public key test system, and particularly relates to the field of public key test, which comprises a dynamic prime number generation module, a composite modulus construction module, a key pair generation module, a hybrid encryption module and a decryption verification module, the method comprises the following steps: generating prime number pairs with specific security strength, collecting initial entropies through a hardware entropy source, and storing the initial entropies into a security entropy pool; testing different base values, and calculating a power calculation value to judge a prime number; p and q are input into the CRT to generate a composite modulus, an Euler function is calculated through block iteration, and a check code is embedded; using an extended Euclidean algorithm to generate a public key and a private key, selecting a prime number from a predefined interval as a public key index, and verifying the prime number performance by a verification formula; performing layered encryption on the plaintext, encoding the plaintext by using an RSA-OAEP filling scheme in the first layer, calculating a ciphertext by using a Montgomery modular multiplication algorithm in the second layer, and adding an integrity label; cRT is used to optimize a decryption process, a Gaussian merging algorithm is used to reconstruct a plaintext, and a ciphertext label is synchronously verified to detect man-in-the-middle attack.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of public key testing, more particularly, to a lightweight public key testing system. BACKGROUND

[0002] In today's digital age, information security has become a critical issue; public key encryption technology as the cornerstone of information security, its security and reliability directly affect personal privacy, corporate secrets and even national security.

[0003] With the rapid development of information technology, network security problems have become increasingly prominent, especially in emerging technology fields such as the Internet of Things, cloud computing, and big data, data privacy protection and authentication authorization have become key issues that need to be addressed; public key cryptography as an important part of modern cryptography, with its asymmetry and security in data encryption, digital signature and key exchange plays an important role in the field.

[0004] However, in actual use, there are still some shortcomings, such as in the scenario that needs to be operated multiple times; the high delay of the traditional algorithm may affect the overall application performance, leading to a decline in user experience; with the development of quantum computing, traditional public key algorithms face the risk of being cracked. SUMMARY

[0005] In order to overcome the above-mentioned defects of the prior art, the embodiments of the present application provide a lightweight public key testing system to solve the problems raised in the background art.

[0006] To achieve the above-mentioned purpose, the present application provides the following technical solutions:

[0007] Dynamic prime number generation module: for generating a pair of prime numbers with a specific security strength based on the improved Miller-Rabin algorithm;

[0008] Composite modulus construction module: for inputting the prime number p and the second prime number q into CRT, generating a composite modulus, and calculating the Euler function through a block iteration algorithm, while embedding a hash-based modulus check code;

[0009] Key pair generation module: using the extended Euclidean algorithm to generate a public key and a private key, wherein the public key is dynamically selected through a predefined security interval;

[0010] Hybrid encryption module: based on the public key and the modulus, performing layered encryption on the plaintext, using the RSA-OAEP padding scheme to randomize the encoding of the plaintext in the first layer, calculating the ciphertext through the Montgomery modular multiplication algorithm in the second layer, and appending a ciphertext integrity label based on SHA-3;

[0011] Decryption and verification module: Uses a decryption process optimized by CRT, then reconstructs the plaintext using the Gaussian merging algorithm, and simultaneously verifies the ciphertext label to detect man-in-the-middle attacks.

[0012] Preferably, in the dynamic prime number generation module, initial entropy is collected from a hardware entropy source and stored in a secure entropy pool; the entropy pool data is obfuscated using SHA-3-512; a 256-bit random seed is extracted from the entropy pool to construct candidate numbers; the specific method for constructing candidate numbers is as follows:

[0013] a = 2 b-1 +(Rmod2 b-2 )×2+1; where a represents the candidate number, b represents the target prime number bit width, and R represents the random seed;

[0014] Pre-calculate the first 100 small prime numbers (2,3,5,...,541), and check if a is divisible by any small prime number; if a is divisible by any small prime number, discard it and generate new candidate numbers.

[0015] The improved Miller-Rabin primality test decomposes a-1 into binary form and finds the largest integer such that a-1 can be represented as c×2. d Where a represents a candidate number, c represents an odd number, and d represents the largest integer, satisfying Then, parallel testing is performed, using multiple threads to test different base values ​​f simultaneously, with each thread dynamically selecting from the entropy pool;

[0016] The initial number of test rounds is g. If a candidate number passes the test 5 times consecutively but is close to the threshold, the number of rounds is automatically increased to g+64 to ensure that the error probability is less than 2. -128 ;

[0017] Each time a prime number is generated, a portion of the entropy value is consumed and the entropy pool hash is recalculated to prevent seed reuse.

[0018] After p is generated, the formula that q needs to satisfy is as follows:

[0019] Where p represents a prime number, q represents the second prime number, and b represents the bit width of the target prime number.

[0020] Preferably, in the composite module, based on CRT optimization, the calculation method for the composite module is as follows:

[0021] B = p × q, where B represents the composite modulus, p represents a prime number, and q represents the second prime number;

[0022] The multiplication operation employs a block processing strategy, decomposing large integers into 64-bit word-length units and then applying an improved Karatsuba algorithm.

[0023] After the composite modulus is calculated, the Euler function is calculated, and the calculation method of the Euler function is specifically as follows:

[0024] φ(B) = (p-1)(q-1), wherein φ(B) represents the Euler function, p represents a prime number, and q represents a second prime number.

[0025] Preferably, in the key pair generation module, in the public key generation stage, a prime number is selected as a public key exponent from a predefined security interval, the predefined security interval is [2 16 , 2 256 ], a prime number with a low Hamming weight is selected to optimize the encryption speed, and a Miller-Rabin primality test is performed, and a verification formula is used to verify whether the selected public key is a prime number, and the calculation method of the verification formula is specifically as follows:

[0026] wherein V represents a base, the value range of the base is V ∈ {2, 3, 5, 7}, and m0 represents a candidate public key.

[0027] According to the verification formula, it is determined whether there is a base that makes the verification formula true, if the verification formula is true, the candidate public key at this time is a prime number, and if not, the candidate public key at this time is not a prime number.

[0028] The calculation method of the candidate public key is specifically as follows:

[0029] m0 = SHA3-256(B||h0||j), wherein m0 represents a candidate public key, B represents a composite modulus, h0 represents a hardware timestamp, j represents a trial counter, and SHA3-256 represents an encryption hash function.

[0030] The calculation method of the private key is specifically as follows:

[0031] n = m -1 mod φ(B), wherein n represents a private key, m represents a public key, and φ(B) represents an Euler function.

[0032] Preferably, in the hybrid encryption module, an RSA-OAEP padding scheme is used to generate a random seed, a SHA-3 hash function and a mask generation function are used to expand the random seed, and then the plaintext is padded to a fixed length, and the encoded data is generated by performing XOR operation on the plaintext and the mask.

[0033] wherein the seed is expanded into a byte stream of any length through iterative hash calculation; in the expansion process, the seed and the counter value are spliced and hashed each time, and the result is spliced into continuous mask data.

[0034] The original data is filled to a target size consistent with the bit length of the RSA modulus; the filling format usually includes the plaintext itself, zero padding of a fixed length, and a marker byte identifying the padding boundary; the padded plaintext is XORed with the previously generated mask byte by byte to generate the encoded data

[0035] The second layer calculates the ciphertext by receiving the encoded data using the Montgomery modular multiplication algorithm, and the encoded data is first converted in the Montgomery domain;

[0036] The calculation method of the intermediate ciphertext is specifically:

[0037] Wherein, Y0 represents the intermediate ciphertext, Q0 represents the converted encoded data, m0 represents the public key exponent, T represents the base number of the Montgomery domain conversion, and B represents the composite modulus;

[0038] The calculation method of the ciphertext is specifically:

[0039] Y=Y0×T -1 mod B, wherein Y represents the ciphertext, Y0 represents the intermediate ciphertext, T represents the base number of the Montgomery domain conversion, and B represents the composite modulus;

[0040] After generating the ciphertext, the hash value of the ciphertext is calculated using the SHA-3 hash algorithm to generate the integrity tag.

[0041] Preferably, in the decryption verification module, after receiving the ciphertext, the ciphertext is decomposed into a form based on a prime number p and a second prime number q, and the calculation method based on the prime number p is specifically:

[0042] Z p =Y mod p, wherein Z p represents the local ciphertext based on the prime number p, Y represents the ciphertext, and p represents the prime number;

[0043] The calculation method based on the second prime number q is specifically:

[0044] Z q =Y mod q, wherein Z q represents the local ciphertext based on the second prime number q, Y represents the ciphertext, and q represents the second prime number;

[0045] Then, the private key is used to decrypt Z p and Z q respectively to obtain the local plaintext;

[0046] The Gaussian merging algorithm is used to merge R p and R q into the complete plaintext; the calculation method of the complete plaintext is specifically:

[0047] R0=R p xq x U(q, p) + R q xp x U(p, q), wherein R0 represents a complete plaintext, R q represents a partial plaintext obtained by decrypting Z q , q represents a second large prime number, p represents a prime number, U(q, p) represents a multiplicative inverse of the second prime number q under the prime number p, U(p, q) represents a multiplicative inverse of the prime number p under the second prime number q, and R q represents a partial plaintext obtained by decrypting Z q ;

[0048] In the decryption process or after the decryption is completed, the receiver recalculates the plaintext using a preset hash function or a digital signature algorithm to obtain a new label;

[0049] The newly calculated label is compared with the original label provided by the sender; if the two are consistent, it is indicated that the ciphertext has not been tampered with, and the decryption is successful; if the two are inconsistent, it is indicated that the intermediate attack or the data has been tampered with.

[0050] Technical effects and advantages of the present application:

[0051] The present application generates a prime number pair with a specific security strength based on an improved Miller-Rabin algorithm, and generates a public key and a private key through an extended Euclidean algorithm. In the transmission and storage of a composite modulus, a hash-based check code is used to prevent data tampering. The hybrid encryption module uses an RSA-OAEP padding scheme and a Montgomery modular multiplication algorithm to perform layered encryption on the plaintext, and appends a ciphertext integrity label generated by a SHA-3 hash function. The decryption verification module reconstructs the plaintext through a CRT optimized decryption process and a Gaussian merging algorithm, and synchronously verifies the ciphertext label to detect the intermediate attack; the present application greatly improves the user experience through a fast encryption and decryption process and a low delay network response, and improves the security level of the public key algorithm by forcibly checking the SHA-3 label in the decryption stage and combining the time side channel protection of the Gaussian merging algorithm. BRIEF DESCRIPTION OF DRAWINGS

[0052] Figure 1 It is a schematic diagram of the overall structure of the present application.

[0053] Figure 2 It is a schematic diagram of layered encryption in the hybrid encryption module of the present application. DETAILED DESCRIPTION

[0054] The technical solutions in the embodiments of the present application will be clearly and completely described with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative effort belong to the scope of the present application.

[0055] Please refer to Figure 1 As shown in the figure, the present application provides a lightweight public key test system, which comprises a dynamic prime number generation module, a composite modulus construction module, a key pair generation module, a hybrid encryption module and a decryption verification module.

[0056] The dynamic prime number generation module is used for generating a prime number pair (p, q) with a specific security strength based on an improved Miller-Rabin algorithm.

[0057] In the dynamic prime number generation module, initial entropy is collected from a hardware entropy source and stored in a secure entropy pool, and SHA-3-512 is used to confuse the entropy pool data; a 256-bit random seed is extracted from the entropy pool to construct a candidate number, and the calculation method of the candidate number is specifically as follows:

[0058] a = 2 b-1 +(R mod 2 b-2 )×2+1; wherein a represents the candidate number, b represents the target prime number bit width, and R represents the random seed.

[0059] The first 100 small prime numbers (2, 3, 5,..., 541) are pre-calculated, and it is checked whether a is divisible by any small prime number; if a is divisible by any small prime number, the candidate number is discarded and regenerated.

[0060] The improved Miller-Rabin primality test decomposes a-1 into binary, finds the largest integer such that a-1 can be expressed as c×2 d , wherein a represents the candidate number, c represents an odd number, and d represents the largest integer, satisfying Parallel testing is then performed, and different base values f are tested simultaneously by using multiple threads, and each thread dynamically selects from the entropy pool.

[0061] The power value is calculated, and the calculation method of the power value is specifically as follows:

[0062] A = f c mod a, wherein A represents the power value, f represents the base value, c represents an odd number, and a represents the candidate number.

[0063] If the calculated power value is 1 or a-1, a is a prime number, and the next round of verification is entered.

[0064] If the calculated power value is not 1 or a-1, then a d-1 square operation is performed, and it is checked whether a-1 exists; if not, a is a prime number;

[0065] The prime number is an object to be excluded, and the factorization of the prime number will destroy the security of the cryptographic system;

[0066] The initial test round is g, and if the candidate number passes the test for 5 consecutive times but is close to the threshold, the round is automatically increased to g+64, ensuring that the error probability is less than 2 -128 ;

[0067] After generating a prime number each time, part of the entropy value is consumed and the entropy pool hash is recalculated to prevent seed reuse;

[0068] When p is generated, the formula that q needs to satisfy is:

[0069] Where p represents a prime number, q represents a second prime number, and b represents the target prime number bit width.

[0070] Composite modulus construction module: used for inputting p and q into CRT to generate a composite modulus, and calculating the Euler function through a block iteration algorithm, while embedding a hash-based modulus check code;

[0071] In the composite modulus construction module, based on the optimization of CRT, the calculation method of the composite modulus is:

[0072] B=p×q, where B represents a composite modulus, p represents a prime number, and q represents a second prime number;

[0073] Where the multiplication operation adopts a block processing strategy, which decomposes a large integer into 64-bit units and then applies an improved Karatsuba algorithm for implementation;

[0074] After calculating the composite modulus, the Euler function is calculated, and the calculation method of the Euler function is:

[0075] φ(B)=(p-1)(q-1), where φ(B) represents an Euler function, p represents a prime number, and q represents a second prime number;

[0076] When transmitting and storing the composite modulus, the check code is also sent, and when receiving or using the composite modulus, the hash value of the received composite modulus is calculated and compared with the transmitted check code; if they are equal, it means that the data is complete; if they are not equal, the composite modulus is discarded and a warning is issued;

[0077] The hash-based check code can effectively prevent data tampering.

[0078] The key pair generation module generates a public key m and a private key n by using an extended Euclidean algorithm, wherein the public key e is dynamically selected from a predefined security interval;

[0079] In the key pair generation module, in the public key generation stage, a prime number is selected as a public key exponent from a predefined security interval, the predefined security interval is [2 16 , 2 256 ], a prime number with a low Hamming weight is selected to optimize the encryption speed, and a Miller-Rabin primality test is performed, and a verification formula is used to verify whether the selected public key is a prime number, and the calculation method of the verification formula is specifically as follows:

[0080] Wherein, V represents a base, the value range of the base is V∈{2, 3, 5, 7}, and m0 represents a candidate public key;

[0081] According to the verification formula, whether there is a base that makes the verification formula true is verified, if the verification formula is true, the candidate public key at this time is a prime number, and if not, the candidate public key at this time is not a prime number;

[0082] The calculation method of the candidate public key is specifically as follows:

[0083] m0=SHA3-256(B||h0||j), wherein m0 represents a candidate public key, B represents a composite modulus, h0 represents a hardware timestamp, j represents a trial counter, and SHA3-256 represents an encryption hash function;

[0084] The calculation method of the private key is specifically as follows:

[0085] n=m -1 modφ(B), wherein n represents a private key, m represents a public key, and φ(B) represents an Euler function;

[0086] The private key is further divided into two sub-keys by CRT, and the calculation method of the first sub-key is specifically as follows:

[0087] m p =m mod(p-1), wherein m p represents the first sub-key, p represents a prime number, and m represents a private key exponent;

[0088] The calculation method of the second sub-key is specifically as follows:

[0089] m q =m mod(q-1), wherein m q represents the second sub-key, q represents a second prime number, and m represents a private key.

[0090] Hybrid encryption module: based on the public key m and the modulus B, the plaintext M is executed hierarchical encryption, the first layer uses RSA-OAEP padding scheme to randomize the encoding of the plaintext, the second layer calculates the ciphertext C through Montgomery modular multiplication algorithm, and the ciphertext integrity label based on SHA-3 is attached;

[0091] In the hybrid encryption module, the random seed is generated using the RSA-OAEP padding scheme, the random seed is expanded using the SHA-3 hash function and the mask generation function, and then the plaintext is padded to a fixed length, and the encoded data is generated by XORing the mask;

[0092] Wherein, the seed is expanded into a byte stream of any length by iterative hash calculation; in the expansion process, the seed is spliced with the counter value and hashed each time, and the result is spliced into continuous mask data;

[0093] The original data is padded to the target size consistent with the bit length of the RSA modulus; the padding format usually includes the plaintext itself, zero padding of fixed length, and marker bytes identifying the padding boundary; the padded plaintext is XORed with the previously generated mask byte by byte to generate the encoded data

[0094] The second layer calculates the ciphertext by receiving the encoded data using the Montgomery modular multiplication algorithm, and the encoded data is converted through the Montgomery domain first, and the conversion method of the converted encoded data is:

[0095] Q0=Q×T mod B, wherein Q0 represents the converted encoded data, Q represents the encoded data, T represents the base number of Montgomery domain conversion, and B represents the composite modulus;

[0096] The value of the base number of Montgomery domain conversion is 2 i , i represents the number of bits of the composite modulus;

[0097] The calculation method of the intermediate ciphertext is specifically:

[0098] Wherein, Y0 represents the intermediate ciphertext, Q0 represents the converted encoded data, m0 represents the public key exponent, T represents the base number of Montgomery domain conversion, and B represents the composite modulus;

[0099] The calculation method of the ciphertext is specifically:

[0100] Y=Y0×T -1 mod B, wherein Y represents the ciphertext, Y0 represents the intermediate ciphertext, T represents the base number of Montgomery domain conversion, and B represents the composite modulus;

[0101] After generating the ciphertext, the hash value of the ciphertext is calculated using the SHA-3 hash algorithm to generate the integrity label.

[0102] Decryption and verification module: Used to decrypt the text using a CRT-optimized process, then reconstruct the plaintext using a Gaussian merging algorithm, and simultaneously verify the ciphertext label to detect man-in-the-middle attacks;

[0103] In the decryption verification module, after receiving the ciphertext, it decomposes the ciphertext into a form based on a prime number p and a second prime number q. The specific calculation method based on the prime number p is as follows:

[0104] Z p =Y mod p, where Z p Y is represented as a local ciphertext based on the prime number p, where Y represents the ciphertext and p represents the prime number.

[0105] The specific calculation method based on the second prime number q is as follows:

[0106] Z q =Y mod q, where Z q Y is represented as the local ciphertext based on the second prime number q, where Y represents the ciphertext and q represents the second prime number.

[0107] Then use the private key to check Z respectively p and Z q Decryption yields partial plaintext; then the private key is used to decrypt Z. p The specific method for calculating the partial plaintext obtained through decryption is as follows:

[0108] Among them, R p Represented as Z p The partial plaintext obtained by decryption, Z p It is represented as a local ciphertext based on the prime number p, where n0 represents the private key exponent;

[0109] Use the private key to pair Z q The specific method for calculating the partial plaintext obtained through decryption is as follows:

[0110] Among them, R q Represented as Z q The partial plaintext obtained by decryption, Z q It is represented as a local ciphertext based on the second prime number q, where n0 represents the private key exponent;

[0111] Using the Gaussian merging algorithm, R p and R q The process of merging the plaintext into complete plaintext is as follows:

[0112] R0 = R p ×q×U(q,p)+R q ×p×U(p, q), where R0 represents the complete plaintext, R qThe partial plaintext obtained by decrypting Z q The partial plaintext obtained by decrypting Z q The partial plaintext obtained by decrypting Z q The partial plaintext obtained by decrypting Z

[0113] In the decryption process or after the decryption is completed, the receiver uses a preset hash function or a digital signature algorithm to recalculate the plaintext to obtain a new tag;

[0114] The newly calculated tag is compared with the original tag provided by the sender; if they are consistent, it means that the ciphertext has not been tampered with, and the decryption is successful; if they are not consistent, it means that the intermediate attack or the data has been tampered with.

[0115] Finally: the above only for the preferred embodiments of the present application, and not for limiting the present application, any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application, should be included in the protection scope of the present application.

Claims

1. A lightweight public key testing system, characterized in that, include: Dynamic prime number generation module: used to generate prime number pairs (p, q) with a specific security strength based on the improved Miller-Rabin algorithm; Composite Modulus Construction Module: This module is used to input a prime number p and a second prime number q into the CRT, generate a composite modulus, calculate the Euler totient function using a block iterative algorithm, and embed a hash-based modulus check code. Key pair generation module: Uses the extended Euclidean algorithm to generate public and private keys, where the public key is dynamically selected through a predefined security range; Hybrid encryption module: used to perform layered encryption on plaintext based on public key and modulus. The first layer uses the RSA-OAEP padding scheme to randomize the plaintext, and the second layer calculates the ciphertext using the Montgomery modular multiplication algorithm and adds a ciphertext integrity tag based on SHA-3. Decryption and verification module: Uses a decryption process optimized by CRT, then reconstructs the plaintext using the Gaussian merging algorithm, and simultaneously verifies the ciphertext label to detect man-in-the-middle attacks.

2. The lightweight public key testing system according to claim 1, characterized in that: In the dynamic prime number generation module, initial entropy is collected from the hardware entropy source and stored in the secure entropy pool. The entropy pool data is obfuscated using SHA-3-512. A 256-bit random seed is extracted from the entropy pool to construct candidate numbers. The specific calculation method for constructing candidate numbers is as follows: a = 2 b-1 +(Rmod2 b-2 )×2+1; where a represents the candidate number, b represents the target prime number bit width, and R represents the random seed; Pre-calculate the first 100 small prime numbers (2,3,5,...,541), and check if a is divisible by any small prime number; if a is divisible by any small prime number, discard it and generate new candidate numbers. The improved Miller-Rabin primality test decomposes a-1 into binary form and finds the largest integer such that a-1 can be represented as c×2. d Where a represents a candidate number, c represents an odd number, and d represents the largest integer, satisfying Then, parallel testing is performed, using multiple threads to test different base values ​​f simultaneously, with each thread dynamically selecting from the entropy pool.

3. The lightweight public key testing system according to claim 2, characterized in that: The improved Miller-Rabin primality test decomposes a-1 into binary form and finds the largest integer such that a-1 can be represented as c×2. d Where a represents a candidate number, c represents an odd number, and d represents the largest integer, satisfying Then, parallel testing is performed, using multiple threads to test different base values ​​f simultaneously, with each thread dynamically selecting from the entropy pool; The specific method for calculating the exponentiation value is as follows: A = f c mod a, where A represents the exponentiation value, f represents the base value, c represents an odd number, and a represents a candidate number; If the calculated power value is 1 or a-1, then a is a prime number, and we proceed to the next round of verification; If the calculated exponentiation value is not 1 or a-1, then perform the d-1th squaring operation to check if a-1 exists; if it does not exist, then a is a composite number. After p is generated, the formula that q needs to satisfy is as follows: Where p represents a prime number, q represents the second prime number, and b represents the bit width of the target prime number.

4. The lightweight public key testing system according to claim 1, characterized in that: In the composite module, based on CRT optimization, the specific method for calculating the composite module is as follows: B = p × q, where B represents the composite modulus, p represents a prime number, and q represents the second prime number; The multiplication operation employs a block processing strategy, decomposing large integers into 64-bit word-length units and then applying an improved Karatsuba algorithm. After calculating using the composite modulus, the Euler's totient function is then calculated. The specific method for calculating the Euler's totient function is as follows: φ(B) = (p-1)(q-1), where φ(B) represents Euler's totient function, p represents a prime number, and q represents the second prime number.

5. A lightweight public key testing system according to claim 1, characterized in that: In the key pair generation module, during the public key generation stage, a prime number is selected from a predefined security interval as the public key exponent. The predefined security interval is [2]. 16 ,2 256 Then, a prime number with a low Hamming weight is selected to optimize the encryption speed, and a Miller-Rabin primality test is performed. The verification formula is used to verify whether the selected public key is a prime number. The specific calculation method of the verification formula is as follows: Where V represents the cardinality, and the value of the cardinality is in the range of V∈{2,3,5,7}, and m0 represents the candidate public key; The verification formula is used to check if there exists a cardinality such that the verification formula holds true. If it holds true, then the candidate public key is a prime number; if it does not exist, then the candidate public key is not a prime number.

6. A lightweight public key testing system according to claim 5, characterized in that: The specific method for calculating the candidate public key is as follows: m0 = SHA3-256(B||h0||j), where m0 represents the candidate public key, B represents the composite modulus, h0 represents the hardware timestamp, j represents the attempt counter, and SHA3-256 represents the cryptographic hash function; The specific method for calculating the private key is as follows: n = m -1 modφ(B), where n represents the private key, m represents the public key, and φ(B) represents the Euler totient function; Then, the private key is split using CRT, dividing it into two subkeys. The specific method for calculating the first subkey is as follows: m p = m mod(p-1), where m p Let p be the first subkey, p be a prime number, and m be the private key exponent. The calculation method for the second subkey is as follows: m q = m mod(q-1), where m q Let q represent the second subkey, q represent the second prime number, and m represent the private key.

7. A lightweight public key testing system according to claim 1, characterized in that: In the hybrid encryption module, a random seed is generated using the RSA-OAEP padding scheme, the random seed is expanded using the SHA-3 hash function and the mask generation function, the plaintext is then padded to a fixed length, and the encoded data is generated by XORing with the mask. The second layer calculates the ciphertext using the Montgomery modular multiplication algorithm after receiving the encoded data. The encoded data is first transformed using the Montgomery field, and the specific calculation method for the transformed encoded data is as follows: Q0 = Q × T mod B, where Q0 represents the converted encoded data, Q represents the encoded data, T represents the radix of the Montgomery domain conversion, and B represents the composite modulus; The specific method for calculating the intermediate ciphertext is as follows: Y0 = Q0 m0 ×T -1 mod B, where Y0 represents the intermediate ciphertext, Q0 represents the converted encoded data, m0 represents the public key exponent, T represents the radix of the Montgomery field conversion, and B represents the composite modulus; The specific method for calculating the ciphertext is as follows: Y = Y0 × T -1 mod B, where Y represents the ciphertext, Y0 represents the intermediate ciphertext, T represents the radix of the Montgomery domain transformation, and B represents the composite modulus.

8. A lightweight public key testing system according to claim 1, characterized in that: In the decryption verification module, after receiving the ciphertext, it decomposes the ciphertext into a form based on a prime number p and a second prime number q. The specific calculation method based on the prime number p is as follows: Z p =Y mod p, where Z p Y is represented as a local ciphertext based on the prime number p, where Y represents the ciphertext and p represents the prime number. The specific calculation method based on the second prime number q is as follows: Z q =Y mod q, where Z q Y is represented as the local ciphertext based on the second prime number q, where Y represents the ciphertext and q represents the second prime number. Then use the private key to check Z respectively p and Z q Decryption is performed to obtain partial plaintext.

9. A lightweight public key testing system according to claim 1, characterized in that: Then use the private key to pair Z p The specific method for calculating the partial plaintext obtained through decryption is as follows: Among them, R p Represented as Z p The partial plaintext obtained by decryption, Z p It is represented as a local ciphertext based on the prime number p, where n0 represents the private key exponent; Use the private key to pair Z q The specific method for calculating the partial plaintext obtained through decryption is as follows: Among them, R q Represented as Z q The partial plaintext obtained by decryption, Z q It is represented as a local ciphertext based on the second prime number q, where n0 represents the private key exponent; Using the Gaussian merging algorithm, R p and R q Merge into complete plaintext.