Password encryption and decryption method based on ECC (Error Correction Code) algorithm and storage medium
By selecting the standard order range and specific random number type of the elliptic curve in the ECC algorithm, and calculating the public key using the same-point addition method, the problem of slow encryption operation speed in the traditional ECC algorithm is solved, and the fast and safe encryption and decryption algorithm are achieved Sex improvement.
Patent Information
- Application Number
- CN202411418874.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In traditional ECC algorithms, the process of generating public keys continuously performs addition operations from the basis points, resulting in extremely slow encryption operations, especially when the order of the elliptic curve is large, computer computing power is insufficient, making it difficult to quickly realize the encryption of data plaintext.
By selecting an elliptic curve about the x-axis symmetry, setting a standard order range, and generating a private key composed of the sum of integer values of 2 or 3, using the method of adding the same point, and setting the intermediate conversion function to Simplify the calculation process and reduce the multiplication operation time.
It improves the computing speed of the encryption and decryption algorithm, reduces the calculation amount, and ensures the speed and security of the password encryption and decryption process.
Smart Images

Figure CN119316132A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of password encryption and decryption, and in particular to a password encryption and decryption method and a storage medium based on an ECC algorithm. Background Art
[0002] When using the ECC algorithm for password encryption and decryption, the public key needs to be calculated using the private key and the base point. However, in the traditional ECC algorithm, after generating a random number, addition operations are generally performed continuously from the base point until the product of the base point and the random number is calculated to generate the public key. In actual operation, if the random number is large and the order of the elliptic curve is large, the inverse operation in the encryption process will take up a lot of time, and due to the limited computing power of the computer, it is often difficult to quickly implement the encryption process of the data plaintext, affecting the speed of data transmission. Especially when security needs to be guaranteed, the order of the elliptic curve is often larger, so the encryption operation is extremely slow during the operation. Summary of the invention
[0003] In view of the deficiencies in the prior art, the present invention provides a cryptographic encryption and decryption method and storage medium based on the ECC algorithm, which solves the problem that the traditional ECC algorithm generates a public key by continuously performing addition operations from a base point until the product of the base point and a random number is calculated, which causes extremely slow encryption operations.
[0004] To achieve the above object, the present invention provides the following technical solutions:
[0005] A cryptographic encryption and decryption method based on an ECC algorithm includes a sender for encrypting and sending data, and a receiver for receiving and decrypting the data. The method includes the following steps:
[0006] S1. The key management system selects an elliptic curve symmetric about the x-axis, and selects a point on the elliptic curve whose order is within the standard order range as a standard base point;
[0007] S2. The key management system generates at least one first private key and a second private key composed of the sum of integer values of 2 or 3, and calculates the corresponding first public key and second public key according to the standard base point to obtain a first key pair and a second key pair, and sends the first key pair and the second key pair to the sender and the receiver respectively, and the receiver and the sender perform public key exchange;
[0008] S3. The sender obtains the data plaintext, and signs the data plaintext based on the first key to obtain a signature value, and encodes the data plaintext to a plaintext point on the elliptic curve according to the second public key and the first private key, and sends the signature value, the plaintext point coordinates and the first public key to the receiver;
[0009] S4. The receiver verifies the signature value;
[0010] If the verification is successful, proceed to step S5;
[0011] If the verification fails, the process ends;
[0012] S5. The receiver decrypts the plaintext point using the first public key to obtain the data plaintext.
[0013] Preferably, in step S1, the following steps are specifically included:
[0014] S11. The key management system selects an elliptic curve that is symmetric about the x-axis and sets a standard order range of the elliptic curve; the standard order range is 80 to 120, and the expression of the elliptic curve is:
[0015] y 2 =x 3 +ax+b
[0016] In the above formula, y is the ordinate value of the elliptic curve, x is the abscissa value of the elliptic curve, a and b are the first curve coefficient and the second curve coefficient respectively;
[0017] S12. Selecting a number of points on the elliptic curve as first base points;
[0018] S13, simulating the elliptic curve and calculating the orders of several first base points;
[0019] S14, obtaining a first base point within the standard order range and marking it as a second base point;
[0020] S15, respectively calculating the absolute value of the difference between the order of each second base point and the median of the standard order range;
[0021] S16. Select the second base point whose absolute value of the difference between the order and the median of the standard order range is the smallest as the standard base point.
[0022] Preferably, in step S2, the following steps are specifically included:
[0023] S21. The key management system sets a random number range, wherein the values in the random number range are all in a form that can be simplified to a sum of at least one value consisting of an integer power of 2 or 3;
[0024] S22. The key management system generates, within a random number range, random numbers that can be simplified to the sum of a number of integer powers of 2 or 3 as the first private key and the second private key;
[0025] S23, adding the standard base points at the same point, and sequentially adding the results of each same point addition to obtain a set of intersection points consisting of the results of the same point addition;
[0026] S24. Calculate the first public key and the second public key according to the intersection point set, the first private key, the second private key and the standard base point; the calculation formula of the first public key and the second public key is:
[0027] G=SJ
[0028] in,
[0029]
[0030] In the above formula, G is the first public key or the second public key, J is the coordinate of the standard base point, and g i It represents the result of adding the i-th same point in the intersection set, Q is the cut-off factor, and its value is 0 or 1. That is the first private key or the second private key, that is, S. There are n identical points in the intersection set.
[0031] S25. Generate a first key pair and a second key pair according to the first private key and the first public key and the second private key and the second public key, respectively, and send the first key pair and the second key pair to the sender and the receiver, respectively, and send the first public key and the second public key to the receiver and the sender, respectively.
[0032] Preferably, in step S23, the following steps are specifically included:
[0033] S231, add the standard base points at the same point, and add the results of each same point addition in sequence; the calculation formula for the same point addition is:
[0034]
[0035] In the above formula, x i and i They represent the x-axis coordinate and y-axis coordinate of the result of the i-th addition of the same point, and a represents the first curve coefficient;
[0036] S232, setting an intermediate conversion function; the expression of the intermediate conversion function is:
[0037]
[0038] In the above formula, x i-1 and i-1 They represent the x-axis coordinate and y-axis coordinate of the result of the i-1th addition of the same point, and a represents the first curve coefficient;
[0039] S233, simplifying the calculation formula of same-point addition according to the intermediate conversion function, the simplified calculation formula of same-point addition is:
[0040]
[0041] In the above formula, x i and i They respectively represent the x-axis coordinate and y-axis coordinate of the result of the i-th addition at the same point, μ represents the intermediate conversion function, and a represents the first curve coefficient.
[0042] Preferably, in step S3, the following steps are specifically included:
[0043] S31, the sender obtains the plaintext data, and encodes the plaintext data to a plaintext point on the elliptic curve according to the second public key and the first private key; the coordinate expression of the plaintext point is: (m x , m y )
[0044] in,
[0045] m x =M+G2·S
[0046] m y =J.S
[0047] In the above formula, m x and m y are the horizontal and vertical coordinates of the plaintext point, M is the data plaintext, G2 is the second public key, there are n identical points in the intersection set, Q is the cut-off factor, its value is 0 or 1, S is the first private key or the second private key, and J represents the coordinates of the standard base point;
[0048] S32, randomly generating a first random number within a random number range;
[0049] S33, calculating the first coordinate according to the first random number and the base point coordinate; the expression of the first coordinate is:
[0050] Z1=K1·J=(X1,Y1)
[0051] In the above formula, Z1 represents the first coordinate, K1 is the first random number, J is the base point coordinate, X1 and Y1 are the x-axis coordinate and y-axis coordinate of the first coordinate respectively;
[0052] S34. Perform a modulus operation on the x-axis coordinate of the first coordinate according to the order of the elliptic curve to obtain a first signature value. The calculation formula of the first signature value is:
[0053] r1=X1modn 0
[0054] In the above formula, r1 is the first signature value, X1 is the x-axis coordinate of the first coordinate, mod is the modulus operator, and n 0 is the order of the elliptic curve;
[0055] S35. Determine whether the first signature value is equal to 0;
[0056] If yes, return to step S32;
[0057] If not, proceed to step S36;
[0058] S36. Perform a hash operation on the data plaintext through a hash function to obtain a hash value. The expression for calculating the hash value is:
[0059] W=H(M)
[0060] In the above formula, W represents the result of the hash operation of the data plaintext, that is, the hash value, M represents the data plaintext, and H(·) represents the hash operation of the data in the brackets;
[0061] S37. Calculate a second signature value according to the order of the elliptic curve, the hash value, the first signature value, the first private key and the first random number; the calculation formula of the second signature value is:
[0062] r2=K1 -1 (W+S1·r1)modn 0
[0063] In the above formula, r2 represents the second signature value, K1 represents the first random number, W represents the result of the hash operation of the data plaintext, that is, the hash value, S1 represents the first private key, r1 represents the first signature value, mod is the modulus operator, and n 0 is the order of the elliptic curve;
[0064] S38. Determine whether the second signature value is equal to 0;
[0065] If yes, return to step S32;
[0066] If not, proceed to step S39;
[0067] S39. Generate a signature value according to the first signature value and the second signature value, and send the signature value, the plaintext point coordinates and the first public key to the recipient.
[0068] Preferably, in step S4, the following steps are specifically included:
[0069] S41: The receiver obtains the signature value and determines whether the first signature value and the second signature value are both less than the order of the elliptic curve;
[0070] If yes, go to the next step;
[0071] If not, output a prompt indicating that the signature is abnormal and end;
[0072] S42. Calculate the signature verification function according to the hash value of the data plaintext, the first signature value, and the second signature value; the expression of the signature verification function is as follows:
[0073]
[0074] In the above formula, α1 represents the first verification value of the signature verification function, α2 represents the second verification value of the signature verification function, r1 represents the first signature value, r2 represents the second signature value, and W represents the hash value of the data plaintext;
[0075] S43. Calculate the signature verification value according to the signature verification function and the first public key. The calculation formula of the signature verification value is:
[0076] V=α1J+α2G1
[0077] In the above formula, V represents the verification value, α1 and α2 represent the first verification value and the second verification value respectively, J represents the base point coordinates, and G1 represents the first public key;
[0078] S44, determine whether the signature verification value is equal to the first coordinate,
[0079] If yes, proceed to step S5;
[0080] If not, the verification will be rejected.
[0081] Preferably, in step S5, the calculation formula of the data plaintext is:
[0082] M=m x -S2m y
[0083] In the above formula, M represents the data plaintext, m x and m y They represent the x-axis and y-axis coordinate values of the plaintext point respectively.
[0084] The present invention also provides a computer storage medium storing a computer program, wherein the computer program implements the steps of any one of the cryptographic encryption and decryption methods when executed.
[0085] Compared with the prior art, the present invention provides a password encryption and decryption method and storage medium based on the ECC algorithm, which has the following beneficial effects:
[0086] 1. In order to further improve the operation speed of the cryptographic encryption and decryption algorithm while ensuring its security, the present invention further studies the elliptic function and summarizes the operation rules in the encryption and decryption process. On the one hand, the elliptic curve is restricted from the perspective of limiting the order of the standard range, and on the other hand, the operation process of the encryption and decryption algorithm is restricted. By selecting a special data type, the random number range is limited, and the operation process is simplified according to the data characteristics within the random number range, thereby greatly improving the operation speed of the encryption and decryption algorithm.
[0087] 2. The present invention selects a random number range formed by the sum of integer powers of 2 or 3. During the calculation process, it is only necessary to calculate the corresponding public key based on the random number range, eliminating the process of gradually calculating the public key, thereby greatly reducing the amount of calculation.
[0088] 3. The present invention can reduce the time of a multiplication operation by setting an intermediate conversion function, thereby further improving the operation speed in the process of calculating the public key. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0090] Figure 1 It is a flow chart of the password encryption and decryption method based on the ECC algorithm of the present invention;
[0091] Figure 2 The figure is a schematic diagram of the calculation process of same-point addition according to the present invention. DETAILED DESCRIPTION
[0092] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods, so that the implementation process of how the present application uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.
[0093] Those skilled in the art can understand that all or part of the steps in the following embodiments can be completed by instructing the relevant hardware through a program, so the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0094] In order to solve the problem that the traditional ECC algorithm generates a public key by continuously performing addition operations from a base point until the product of the base point and a random number is calculated, which causes an extremely slow encryption operation speed, the present invention provides a password encryption and decryption method based on the ECC algorithm, and for the application of this type of number theory in cryptography, by studying the solution process and solution method of this type of elliptic curve equation, explore improved methods to optimize the running speed of this type of encryption and decryption method, including a sender for encrypting and sending data, and a receiver for receiving and decrypting data, such as Figure 1 As shown, the method comprises the following steps:
[0095] S1. The key management system selects an elliptic curve symmetric about the x-axis, and selects a point on the elliptic curve whose order is within the standard order range as a standard base point; for the elliptic encryption algorithm based on ECC, it is first necessary to determine the parameters of the elliptic curve, that is, to select an elliptic curve with suitable parameters, which comprehensively affects the security and speed of the encryption and decryption algorithm. The order of the homology curve is the number of discrete points of the homology curve. The discrete integer points are contained in a finite field. The more discrete points in the finite field, the higher the security of the encryption and decryption algorithm. Conversely, the worse the security, but the faster the calculation of encryption and decryption speed, so it is necessary to reasonably select the parameters of the elliptic curve. In step S1, the following steps are specifically included:
[0096] S11. The key management system selects an elliptic curve that is symmetric about the x-axis and sets the standard order range of the elliptic curve. Generally, the standard order range is 80 to 120, which can comprehensively ensure the optimization of the calculation speed and encryption and decryption speed under the conventional computing power on the market. The expression of the elliptic curve is:
[0097] y 2 =x 3 +ax+b
[0098] In the above formula, y is the ordinate value of the elliptic curve, x is the abscissa value of the elliptic curve, a and b are the first curve coefficient and the second curve coefficient respectively;
[0099] S12. Selecting a number of points on the elliptic curve as first base points;
[0100] S13, simulating the elliptic curve and calculating the orders of several first base points;
[0101] S14, obtaining a first base point within the standard order range and marking it as a second base point;
[0102] S15, respectively calculating the absolute value of the difference between the order of each second base point and the median of the standard order range;
[0103] S16. Select the second base point with the smallest absolute value of the difference between the order and the median of the standard order range as the standard base point. The standard base point selected in this way can better represent the effect to be obtained by the standard order range, that is, the effect of the selected standard base point is more in line with the encryption and decryption effect to be obtained when the standard order range is preset.
[0104] S2, the key management system generates at least one first private key and a second private key composed of the sum of integer powers of 2 or 3, and calculates the corresponding first public key and second public key according to the standard base point to obtain a first key pair and a second key pair, and sends the first key pair and the second key pair to the sender and the receiver respectively, and the receiver and the sender exchange public keys; when the computer computing power is constant, when it is necessary to ensure the encryption and decryption effect, the encryption and decryption speed is improved, so through further research on the elliptic curve solution process, some general laws are found, and such laws are applied to improve the encryption and decryption speed. In step S2, the following steps are specifically included:
[0105] S21. The key management system sets a random number range, and the values in the random number range are all in the form of being simplified to the sum of values consisting of at least one integer power of 2 or 3; that is, the values in the random number range are either in the form of the sum of values consisting of at least one integer power of 2, such as 2 1 +2 3 +2 4 , or a sum of at least one integer power of 3, such as 3 1 +3 3 +3 4 form;
[0106] S22. The key management system generates, within a random number range, random numbers that can be simplified to the sum of a number of integer powers of 2 or 3 as the first private key and the second private key;
[0107] S23, adding the standard base points at the same point, and sequentially adding the results of each same point addition to obtain a set of intersection points composed of the results of the same point addition; for the same point addition process, by studying the calculation formula of the same point addition, finding its common terms and replacing them, the calculation time can be further reduced and the speed of encryption and decryption can be improved. In step S23, the following steps are specifically included:
[0108] S231, add the standard base points at the same point, and add the results of each same point addition in sequence; the calculation formula for the same point addition is:
[0109]
[0110] In the above formula, x i and i They represent the x-axis coordinate and y-axis coordinate of the result of the i-th addition of the same point, and a represents the first curve coefficient;
[0111] S232, setting an intermediate conversion function; the expression of the intermediate conversion function is:
[0112]
[0113] In the above formula, x i-1 and i-1 They represent the x-axis coordinate and y-axis coordinate of the result of the i-1th addition of the same point, and a represents the first curve coefficient;
[0114] S233, simplifying the calculation formula of same-point addition according to the intermediate conversion function, the simplified calculation formula of same-point addition is:
[0115]
[0116] In the above formula, x i and i They respectively represent the x-axis coordinate and y-axis coordinate of the result of the i-th addition of the same point, μ represents the intermediate conversion function, and a represents the first curve coefficient. By setting the intermediate conversion function, one multiplication operation can be reduced;
[0117] S24. Calculate the first public key and the second public key according to the intersection point set, the first private key, the second private key and the standard base point; the calculation formula of the first public key and the second public key is:
[0118] G=SJ
[0119] in,
[0120]
[0121] In the above formula, G is the first public key or the second public key, J is the coordinate of the standard base point, and g i It represents the result of adding the i-th same point in the intersection set, Q is the cut-off factor, and its value is 0 or 1. That is, the first private key or the second private key, that is, S. There are n identical points in the intersection set, such as Figure 2 As shown, it is a schematic diagram of the calculation process of adding the same point, which is an integer power of 2, such as 4 times and 8 times. For example, when calculating 32J, 32 addition operations and 64 inversion operations are required using the traditional method, but according to the calculation method mentioned in the present invention, the result obtained only requires 5 addition operations and 5 inversion operations;
[0122] S25. Generate a first key pair and a second key pair according to the first private key and the first public key and the second private key and the second public key, respectively, and send the first key pair and the second key pair to the sender and the receiver, respectively, and send the first public key and the second public key to the receiver and the sender, respectively.
[0123] S3, the sender obtains the data plaintext, and signs the data plaintext based on the first key to obtain the signature value, and encodes the data plaintext to a plaintext point on the elliptic curve according to the second public key and the first private key, and sends the signature value, the plaintext point coordinates and the first public key to the receiver; for the data signature, in order to synchronously improve the speed of the data signature, based on the random number range, and using the calculation method in step S2, the calculation speed is synchronously improved. In step S3, the following steps are specifically included:
[0124] S31, the sender obtains the plaintext data, and encodes the plaintext data to a plaintext point on the elliptic curve according to the second public key and the first private key; the coordinate expression of the plaintext point is: (m x , m y )
[0125] in,
[0126] m x =M+G2·S
[0127] m y =J.S
[0128] In the above formula, m x and m y are the horizontal and vertical coordinates of the plaintext point, M is the data plaintext, G2 is the second public key, there are n identical points in the intersection set, Q is the cut-off factor, its value is 0 or 1, S is the first private key or the second private key, and J represents the coordinates of the standard base point;
[0129] S32, randomly generating a first random number within a random number range;
[0130] S33, calculating the first coordinate according to the first random number and the base point coordinate; the expression of the first coordinate is:
[0131] Z1=K1·J=(X1,Y1)
[0132] In the above formula, Z1 represents the first coordinate, K1 is the first random number, J is the base point coordinate, X1 and Y1 are the x-axis coordinate and y-axis coordinate of the first coordinate respectively, and the calculation process of the first coordinate applies the relevant fast calculation method mentioned in step S2 to improve the calculation speed.
[0133] S34. Perform a modulus operation on the x-axis coordinate of the first coordinate according to the order of the elliptic curve to obtain a first signature value. The calculation formula of the first signature value is:
[0134] r1=X1modn 0
[0135] In the above formula, r1 is the first signature value, X1 is the x-axis coordinate of the first coordinate, mod is the modulus operator, and n 0is the order of the elliptic curve;
[0136] S35. Determine whether the first signature value is equal to 0;
[0137] If yes, return to step S32;
[0138] If not, proceed to step S36;
[0139] S36. Perform a hash operation on the data plaintext through a hash function to obtain a hash value. The expression for calculating the hash value is:
[0140] W=H(M)
[0141] In the above formula, W represents the result of the hash operation of the data plaintext, that is, the hash value, M represents the data plaintext, and H(·) represents the hash operation of the data in the brackets;
[0142] S37. Calculate a second signature value according to the order of the elliptic curve, the hash value, the first signature value, the first private key and the first random number; the calculation formula of the second signature value is:
[0143] r2=K1 -1 (W+S1·r1)modn 0
[0144] In the above formula, r2 represents the second signature value, K1 represents the first random number, W represents the result of the hash operation of the data plaintext, that is, the hash value, S1 represents the first private key, r1 represents the first signature value, mod is the modulus operator, and n 0 is the order of the elliptic curve;
[0145] S38. Determine whether the second signature value is equal to 0;
[0146] If yes, return to step S32;
[0147] If not, proceed to step S39;
[0148] S39. Generate a signature value according to the first signature value and the second signature value, and send the signature value, the plaintext point coordinates and the first public key to the recipient.
[0149] S4. The receiver verifies the signature value;
[0150] If the verification is successful, proceed to step S5;
[0151] If the verification fails, the process ends. In order to explain in detail the method for verifying the signature value, in step S4, the process specifically includes the following steps:
[0152] S41: The receiver obtains the signature value and determines whether the first signature value and the second signature value are both less than the order of the elliptic curve;
[0153] If yes, go to the next step;
[0154] If not, output a prompt indicating that the signature is abnormal and end;
[0155] S42. Calculate the signature verification function according to the hash value of the data plaintext, the first signature value, and the second signature value; the expression of the signature verification function is as follows:
[0156]
[0157] In the above formula, α1 represents the first verification value of the signature verification function, α2 represents the second verification value of the signature verification function, r1 represents the first signature value, r2 represents the second signature value, and W represents the hash value of the data plaintext;
[0158] S43. Calculate the signature verification value according to the signature verification function and the first public key. The calculation formula of the signature verification value is:
[0159] V=α1J+α2G1
[0160] In the above formula, V represents the verification value, α1 and α2 represent the first verification value and the second verification value respectively, J represents the base point coordinates, and G1 represents the first public key;
[0161] S44, determine whether the signature verification value is equal to the first coordinate,
[0162] If yes, proceed to step S5;
[0163] If not, the verification will be refused;
[0164] S5. The receiver decrypts the plaintext point using the first public key to obtain the data plaintext; the calculation formula for the data plaintext is:
[0165] M=m x -S2m y
[0166] In the above formula, M represents the data plaintext, m x and m y They represent the x-axis and y-axis coordinate values of the plaintext point respectively.
[0167] When the present invention is implemented, in order to further improve the operation speed of the cryptographic encryption and decryption algorithm while ensuring its security, further research is conducted on elliptic functions, and the operation rules in the encryption and decryption process are summarized. Therefore, on the one hand, the elliptic curve is restricted from the perspective of limiting the order of the standard range, and on the other hand, the operation process of the encryption and decryption algorithm is restricted. By selecting a special data type, the random number range is limited, and the operation process is simplified according to the data characteristics within the random number range, thereby greatly improving the operation speed of the encryption and decryption algorithm.
[0168] The present invention also provides a computer storage medium storing a computer program, which implements the steps of the cryptographic encryption and decryption method when the computer program is executed.
[0169] The above implementation methods have been described in detail. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A cryptographic encryption and decryption method based on an ECC algorithm, comprising a sender for encrypting and sending data, and a receiver for receiving and decrypting data, characterized in that: The method comprises the following steps: S1. The key management system selects an elliptic curve symmetric about the x-axis, and selects a point on the elliptic curve whose order is within the standard order range as a standard base point; S2. The key management system generates at least one first private key and a second private key composed of the sum of integer values of 2 or 3, and calculates the corresponding first public key and second public key according to the standard base point to obtain a first key pair and a second key pair, and sends the first key pair and the second key pair to the sender and the receiver respectively, and the receiver and the sender perform public key exchange; S3. The sender obtains the data plaintext, and signs the data plaintext based on the first key to obtain a signature value, and encodes the data plaintext to a plaintext point on the elliptic curve according to the second public key and the first private key, and sends the signature value, the plaintext point coordinates and the first public key to the receiver; S4. The receiver verifies the signature value; If the verification is successful, proceed to step S5; If the verification fails, the process ends; S5. The receiver decrypts the plaintext point using the first public key to obtain the data plaintext.
2. The method for encrypting and decrypting a password according to claim 1, characterized in that: In step S1, the following steps are specifically included: S11. The key management system selects an elliptic curve that is symmetric about the x-axis and sets a standard order range of the elliptic curve; the standard order range is 80 to 120, and the expression of the elliptic curve is: y 2 =x 3 +ax+b In the above formula, y is the ordinate value of the elliptic curve, x is the abscissa value of the elliptic curve, a and b are the first curve coefficient and the second curve coefficient respectively; S12. Selecting a number of points on the elliptic curve as first base points; S13, simulating the elliptic curve and calculating the orders of several first base points; S14, obtaining a first base point within the standard order range and marking it as a second base point; S15, respectively calculating the absolute value of the difference between the order of each second base point and the median of the standard order range; S16. Select the second base point whose absolute value of the difference between the order and the median of the standard order range is the smallest as the standard base point.
3. The method for encrypting and decrypting a password according to claim 1, characterized in that: In step S2, the following steps are specifically included: S21. The key management system sets a random number range, wherein the values in the random number range are all in a form that can be simplified to a sum of at least one value consisting of an integer power of 2 or 3; S22. The key management system generates, within a random number range, random numbers that can be simplified to the sum of a number of integer powers of 2 or 3 as the first private key and the second private key; S23, adding the standard base points at the same point, and sequentially adding the results of each same point addition to obtain a set of intersection points consisting of the results of the same point addition; S24. Calculate the first public key and the second public key according to the intersection point set, the first private key, the second private key and the standard base point; the calculation formula of the first public key and the second public key is: G=SJ in, In the above formula, G is the first public key or the second public key, J is the coordinate of the standard base point, and g i It represents the result of adding the i-th same point in the intersection set, Q is the cut-off factor, and its value is 0 or 1. That is the first private key or the second private key, that is, S. There are n identical points in the intersection set. S25. Generate a first key pair and a second key pair according to the first private key and the first public key and the second private key and the second public key, respectively, and send the first key pair and the second key pair to the sender and the receiver, respectively, and send the first public key and the second public key to the receiver and the sender, respectively.
4. The method for encrypting and decrypting a password according to claim 3, characterized in that: In step S23, the following steps are specifically included: S231, add the standard base points at the same point, and add the results of each same point addition in sequence; the calculation formula for the same point addition is: In the above formula, x i and i They represent the x-axis coordinate and y-axis coordinate of the result of the i-th addition of the same point, and a represents the first curve coefficient; S232, setting an intermediate conversion function; the expression of the intermediate conversion function is: In the above formula, x i-1 and i-1 They represent the x-axis coordinate and y-axis coordinate of the result of the i-1th addition of the same point, and a represents the first curve coefficient; S233, simplifying the calculation formula of same-point addition according to the intermediate conversion function, the simplified calculation formula of same-point addition is: In the above formula, x i and i They respectively represent the x-axis coordinate and y-axis coordinate of the result of the i-th addition at the same point, μ represents the intermediate conversion function, and a represents the first curve coefficient.
5. The method for encrypting and decrypting a password according to claim 1, characterized in that: In step S3, the following steps are specifically included: S31, the sender obtains the plaintext data, and encodes the plaintext data to a plaintext point on the elliptic curve according to the second public key and the first private key; the coordinate expression of the plaintext point is: (m x , m y ) in, m x =M+G2·S m y =J·S In the above formula, m x and m y are the horizontal and vertical coordinates of the plaintext point, M is the data plaintext, G2 is the second public key, there are n identical points in the intersection set, Q is the cut-off factor, its value is 0 or 1, S is the first private key or the second private key, and J represents the coordinates of the standard base point; S32, randomly generating a first random number within a random number range; S33, calculating the first coordinate according to the first random number and the base point coordinate; the expression of the first coordinate is: Z1=K1·J=(X1,Y1) In the above formula, Z1 represents the first coordinate, K1 is the first random number, J is the base point coordinate, X1 and Y1 are the x-axis coordinate and y-axis coordinate of the first coordinate respectively; S34. Perform a modulus operation on the x-axis coordinate of the first coordinate according to the order of the elliptic curve to obtain a first signature value. The calculation formula of the first signature value is: r1=X1modn 0 In the above formula, r1 is the first signature value, X1 is the x-axis coordinate of the first coordinate, mod is the modulus operator, and n 0 is the order of the elliptic curve; S35. Determine whether the first signature value is equal to 0; If yes, return to step S32; If not, proceed to step S36; S36. Perform a hash operation on the data plaintext through a hash function to obtain a hash value. The expression for calculating the hash value is: W=H(M) In the above formula, W represents the result of the hash operation of the data plaintext, that is, the hash value, M represents the data plaintext, and H(·) represents the hash operation of the data in the brackets; S37. Calculate a second signature value according to the order of the elliptic curve, the hash value, the first signature value, the first private key and the first random number; the calculation formula of the second signature value is: r2=K1 -1 (W+S1·r1)modn 0 In the above formula, r2 represents the second signature value, K1 represents the first random number, W represents the result of the hash operation of the data plaintext, that is, the hash value, S1 represents the first private key, r1 represents the first signature value, mod is the modulus operator, and n 0 is the order of the elliptic curve; S38. Determine whether the second signature value is equal to 0; If yes, return to step S32; If not, proceed to step S39; S39. Generate a signature value according to the first signature value and the second signature value, and send the signature value, the plaintext point coordinates and the first public key to the recipient.
6. The method for encrypting and decrypting a password according to claim 1, characterized in that: In step S4, the following steps are specifically included: S41: The receiver obtains the signature value and determines whether the first signature value and the second signature value are both less than the order of the elliptic curve; If yes, go to the next step; If not, output a prompt indicating that the signature is abnormal and end; S42. Calculate the signature verification function according to the hash value of the data plaintext, the first signature value, and the second signature value; the expression of the signature verification function is as follows: In the above formula, α1 represents the first verification value of the signature verification function, α2 represents the second verification value of the signature verification function, r1 represents the first signature value, r2 represents the second signature value, and W represents the hash value of the data plaintext; S43. Calculate the signature verification value according to the signature verification function and the first public key. The calculation formula of the signature verification value is: V=α1J+α2G1 In the above formula, V represents the verification value, α1 and α2 represent the first verification value and the second verification value respectively, J represents the base point coordinates, and G1 represents the first public key; S44, determine whether the signature verification value is equal to the first coordinate, If yes, proceed to step S5; If not, the verification will be rejected.
7. The method for encrypting and decrypting a password according to claim 1, characterized in that: In step S5, the calculation formula of the data plaintext is: M=m x -S2m y In the above formula, M represents the data plaintext, m x and m y They represent the x-axis and y-axis coordinate values of the plaintext point respectively.
8. A computer storage medium, characterized in that: A computer program is stored, and when the computer program is executed, the steps of the cryptographic encryption and decryption method according to any one of claims 1 to 7 are implemented.
