Plaintext data encryption method, device, equipment and computer-readable storage medium

By using preset mathematical models and curves to generate keys and fill data in plaintext data encryption method, the problems of leakage and stealing during key file transfer are solved, improving the security of encrypted files and simplifying the encryption process.

CN115632773BActive Publication Date: 2025-04-11SHENZHEN WANWU SECURITY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211291557.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-20
Publication Date
2025-04-11
Estimated Expiration
2042-10-20

AI Technical Summary

Technical Problem

The process of transmitting key files in the prior art may lead to the leakage or stolen key files, and building a public key infrastructure is difficult for engineers who lack basic knowledge of cryptography.

Method used

By obtaining plaintext data and its byte count, key data and fill data are generated using preset mathematical models and curves, and the target encrypted data is determined to avoid the transmission of key data.

Benefits of technology

Improves security of encrypted files, reduces the risk of key file leakage, and simplifies the encryption process, making it more suitable for users who do not need to have an in-depth understanding of cryptography details.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115632773B_ABST
    Figure CN115632773B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and computer-readable storage medium for encrypting plaintext data, wherein the method comprises: obtaining plaintext data and a first byte quantity; generating a first curve group according to a first mathematical model and a first curve quantity, and generating a second curve according to a second mathematical model; determining first key data according to the first curve group, determining a multiple of the first curve quantity greater than or equal to a minimum value of the first byte quantity, and if the minimum value is not equal to the first byte quantity, determining first filling data according to the second curve; determining first target encrypted data according to the first key data, the first filling data and the plaintext data. In the present invention, the first key data and the first filling data of the encryption process are dynamically generated according to the mathematical model, and there is no need to transmit the first key data, thereby eliminating the transmission risk of the key file and the storage risk of the key file, and further improving the security of data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of plaintext data encryption, and in particular to a plaintext data encryption method, device, equipment and computer-readable storage medium. Background Art

[0002] With the rapid development of informatization, people's demand for information security is getting higher and higher. In the application of information security and plaintext encryption, plaintext encryption is one of the basic application technologies for protecting information.

[0003] In the prior art, the method for encrypting plain text is usually to encrypt and decrypt through key files. However, the process of transmitting key files may often lead to the leakage of key files. If a PKI (Public Key Infrastructure) is established, it is a very difficult task for engineers who do not have basic knowledge of cryptography.

[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present invention is to provide a plaintext data encryption method, device, equipment and computer-readable storage medium, aiming to solve technical problems such as the existing process of transmitting key files may cause the leakage of key files or the theft of key files during use.

[0006] To achieve the above object, the present invention provides a plaintext data encryption method, which comprises the following steps:

[0007] Obtaining plaintext data and the number of first bytes of the plaintext data;

[0008] Generate a first curve group according to a preset first mathematical model and a preset number of first curves, and generate a second curve according to a preset second mathematical model;

[0009] Determine first key data according to the first curve group, and determine a minimum value whose multiple of the first curve number is greater than or equal to the first byte number, and if the minimum value is not equal to the first byte number, determine first padding data according to the second curve;

[0010] Determine first target encrypted data corresponding to the plaintext data based on the first key data, the first padding data, and the plaintext data.

[0011] Further, the step of determining the first key data according to the first curve group includes:

[0012] Dividing the first number of bytes by the first number of curves to obtain a first value;

[0013] First key data is determined according to the first value and the first curve group.

[0014] Further, the step of determining the first key data according to the first value and the first curve group includes:

[0015] According to the first value, coordinate data is selected on each first curve in the first curve group to obtain first data, and the first data is used as first key data.

[0016] Furthermore, it is characterized in that the step of determining the first filling data according to the second curve comprises:

[0017] Performing a modulo operation on the first byte quantity and the first curve quantity to obtain a second value;

[0018] First filling data is determined according to the second value and the second curve.

[0019] Furthermore, the step of determining first filling data according to the second value and the second curve includes:

[0020] Selecting coordinate data on the second curve to obtain a preset number of second coordinate data, and acquiring a second numerical matrix corresponding to the second coordinate data;

[0021] According to the selection algorithm and the second value, second data is selected from the second value matrix, and the second data is used as the first filling data.

[0022] Further, the step of determining the first target encrypted data corresponding to the plaintext data according to the first key data, the first padding data and the plaintext data includes:

[0023] Performing a bitwise operation on the plaintext data and the first key data to obtain third data;

[0024] Performing a bitwise operation on the first padding data and the first key data to obtain fourth data;

[0025] Mixing the third data with the fourth data according to a preset mixing rule to obtain fifth data;

[0026] Performing a bitwise operation on the fifth data and the first key data to obtain sixth data;

[0027] According to a preset translation rule, the sixth data is translated to obtain seventh data;

[0028] Performing a bitwise operation on the seventh data and the first key data to obtain first encrypted data;

[0029] The first encrypted data and the second number of bytes of the first padding data are used as first target encrypted data.

[0030] Furthermore, the plaintext data encryption method also includes:

[0031] Acquire second target encrypted data, wherein the second target encrypted data includes the second encrypted data and the third byte quantity;

[0032] Determine the number of second curves corresponding to the second encrypted data, and determine a third mathematical model and a fourth mathematical model corresponding to the number of second curves;

[0033] generating a third curve group according to the third mathematical model, and generating a fourth curve according to the fourth mathematical model;

[0034] Determine second key data according to each third curve in the third curve group, and determine second padding data according to the fourth curve and the third byte quantity;

[0035] Determine second plaintext data corresponding to the second encrypted data according to the second key data, the second padding data, and the second encrypted data.

[0036] In addition, to achieve the above-mentioned purpose, the present invention also provides a plaintext data encryption device, the plaintext data encryption device comprising:

[0037] An acquisition module, used for acquiring plaintext data and the number of first bytes of the plaintext data;

[0038] A generating module, used to generate a first curve group according to a preset first mathematical model and a preset number of first curves, and to generate a second curve according to a preset second mathematical model;

[0039] A first determination module is used to determine first key data according to the first curve group, and determine a minimum value of the first byte number whose multiple is greater than or equal to the first byte number, and if the minimum value is not equal to the first byte number, determine first padding data according to the second curve;

[0040] The second determination module is used to determine the first target encrypted data corresponding to the plaintext data according to the first key data, the first padding data and the plaintext data.

[0041] In addition, to achieve the above-mentioned purpose, the present invention also provides a plaintext data encryption device, which includes: a memory, a processor, and a plaintext data encryption program stored on the memory and executable on the processor, and the plaintext data encryption program implements the steps of the aforementioned plaintext data encryption method when executed by the processor.

[0042] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a plaintext data encryption program is stored, and when the plaintext data encryption program is executed by a processor, the steps of the aforementioned plaintext data encryption method are implemented.

[0043] The present invention obtains second target encrypted data, wherein the second target encrypted data includes second encrypted data and a third byte quantity, then determines the number of second curves corresponding to the second encrypted data, and determines a third mathematical model and a fourth mathematical model corresponding to the second curve quantity, then generates a third curve group according to the third mathematical model, and generates a fourth curve according to the fourth mathematical model, then determines second key data according to each third curve in the third curve group, determines second filling data according to the fourth curve and the third byte quantity, and then determines second plaintext data corresponding to the second encrypted data according to the second key data, the second filling data and the second encrypted data, and can determine the corresponding third mathematical model and fourth mathematical model according to the second key bit number, thereby determining the second key data and the second filling data according to the third mathematical model and the fourth mathematical model, and realizing decryption of the second encrypted data to obtain the plaintext data corresponding to the second encrypted data, the second key data of the decryption process is generated by the mathematical model, and there is no need to transmit the second key data, thereby improving the security of the encrypted file. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a schematic diagram of the structure of a plaintext data encryption device in a hardware operating environment involved in an embodiment of the present invention;

[0045] Figure 2 This is a schematic diagram of the process of the first embodiment of the plaintext data encryption method of the present invention;

[0046] Figure 3 It is a functional module diagram of an embodiment of a plaintext data encryption device of the present invention.

[0047] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0049] like Figure 1 As shown, Figure 1 It is a schematic diagram of the structure of a plaintext data encryption device in a hardware operating environment involved in an embodiment of the present invention.

[0050] The plaintext data encryption device of the embodiment of the present invention can be a PC, or it can be a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a portable computer, or other portable terminal devices with display function.

[0051] like Figure 1 As shown, the plaintext data encryption device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0052] Optionally, the plaintext data encryption device may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the plaintext data encryption device is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the application of the posture of the plaintext data encryption device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the plaintext data encryption device may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.

[0053] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0054] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a plaintext data encryption program.

[0055] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the plaintext data encryption program stored in the memory 1005.

[0056] In this embodiment, the plaintext data encryption device includes: a memory 1005, a processor 1001, and a plaintext data encryption program stored on the memory 1005 and executable on the processor 1001, wherein the processor 1001 calls the plaintext data encryption program stored in the memory 1005 and executes the steps of the plaintext data encryption method in the following embodiments.

[0057] The present invention also provides a method for encrypting plaintext data, referring to Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the method of the present invention.

[0058] In this embodiment, the plaintext data encryption method includes the following steps:

[0059] Step S101, obtaining plaintext data and the number of first bytes of the plaintext data;

[0060] In this embodiment, the plaintext data to be encrypted and the first byte quantity of the plaintext data are obtained, wherein the plaintext data refers to unencrypted text or character string, and the first byte quantity refers to the number of bytes of the plaintext data.

[0061] Step S102, generating a first curve group according to a preset first mathematical model and a preset number of first curves, and generating a second curve according to a preset second mathematical model;

[0062] In this embodiment, a preset first mathematical model is artificially established, and a first curve group is generated according to a preset number of first curves, wherein the first curve group includes a preset number of first curves, and a preset second mathematical model is artificially established to generate a second curve. Each first curve and second curve in the first curve group is defined in a finite field.

[0063] Step S103, determining first key data according to the first curve group, and determining a minimum value of the first byte number whose multiple is greater than or equal to the first byte number; if the minimum value is not equal to the first byte number, determining first padding data according to the second curve;

[0064] In this embodiment, first, the first byte quantity is divided by the first curve quantity to obtain a first value, and then the first key data is determined according to the first value and the first curve group. It is determined that the multiple of the first curve quantity is greater than or equal to the minimum value of the first byte quantity, for example, the first curve quantity is 3 and the first byte quantity is 34, then the multiple of the first curve quantity is greater than or equal to the minimum value of the first byte quantity is 36. Then, if the minimum value is not equal to the first byte quantity, the first byte quantity of the plaintext data is modulo-operated with the first curve quantity to obtain a second value, and then the first padding data is determined according to the second value and the second curve.

[0065] Furthermore, in one embodiment, step 103 includes:

[0066] Step a, dividing the first byte quantity by the first curve quantity to obtain a first value;

[0067] Step b: determining first key data according to the first value and the first curve group.

[0068] In this embodiment, first, the number of first bytes of the plaintext data is determined, that is, the number of bytes of the plaintext data is determined, for example, the number of first bytes of the plaintext data is 1024 bytes. Then, the number of first bytes is divided by the number of first curves to obtain a first value, and coordinate data is selected on the first curve group according to the first value to determine the first key data. Specifically, the coordinate data of the first value can be uniformly selected on each first curve to obtain the first data, and the first data is used as the first key data.

[0069] Furthermore, in one embodiment, the step b comprises:

[0070] Step b1, according to the first numerical value, selecting coordinate data on each first curve in the first curve group to obtain first data, and using the first data as first key data.

[0071] In this embodiment, according to the first value, coordinate data is selected on each first curve in the first curve group to obtain first data, and the first data is used as the first key data. Specifically, if the first value is 10, 10 coordinate data are selected on each curve, wherein the coordinate data includes X-axis data and Y-axis data.

[0072] Furthermore, in one embodiment, step 103 includes:

[0073] Step c, performing a modulo operation on the first byte quantity and the first curve quantity to obtain a second value;

[0074] Step d: determining first filling data according to the second value and the second curve.

[0075] In this embodiment, first, a modulo operation is performed on the first byte quantity and the first value to obtain a second value. Specifically, the first byte quantity of the plaintext data is 5, and the first value is 4, then the second value is 3, that is, the absolute value of 5%4-4. Finally, the first padding data is determined according to the second value and the second curve.

[0076] Furthermore, in one embodiment, step d comprises:

[0077] Step d1, selecting coordinate data on the second curve to obtain a preset number of second coordinate data, and obtaining a second numerical matrix corresponding to the second coordinate data;

[0078] Step d2: selecting second data from the second numerical matrix according to the selection algorithm and the second numerical value, and using the second data as the first filling data.

[0079] In this embodiment, first, coordinate data is selected on the second curve to obtain a preset number of second coordinate data, and a second numerical matrix corresponding to the second coordinate data is obtained. Specifically, after the second mathematical model is established, coordinate data is selected on the second curve to obtain the second numerical matrix.

[0080] Finally, according to the selection algorithm and the second value, second data is selected from the second value matrix, wherein the second data is then used as the first filling data.

[0081] Step S104: Determine first target encrypted data corresponding to the plaintext data according to the first key data, the first padding data and the plaintext data.

[0082] In this embodiment, a bit operation is performed based on the first key data, the first padding data and the plaintext data to increase the security of the first encrypted data, thereby determining the first encrypted data corresponding to the plaintext data. The second byte quantity of the first encrypted data and the first padding data is used as the first target encrypted data.

[0083] Furthermore, in one embodiment, step S104 includes:

[0084] Step e, performing a bit operation on the plaintext data and the first key data to obtain third data;

[0085] Step f, performing a bit operation on the first padding data and the first key data to obtain fourth data;

[0086] Step g, mixing the third data with the fourth data according to a preset mixing rule to obtain fifth data;

[0087] Step h, performing a bit operation on the fifth data and the first key data to obtain sixth data;

[0088] Step i, according to a preset translation rule, the sixth data is translated to obtain seventh data;

[0089] Step j, performing a bit operation on the seventh data and the first key data to obtain first encrypted data;

[0090] Step k: taking the first encrypted data and the second byte quantity of the first padding data as the first target encrypted data.

[0091] In this embodiment, the plaintext data and the first key data are bitwise operated to obtain the third data, wherein the bitwise operation can be bitwise AND, bitwise OR, bitwise XOR, bitwise inversion, etc., or a combination of multiple bitwise operations, such as bitwise AND and bitwise OR. Next, the first padding data and the first key data are bitwise operated to obtain the fourth data, and the third data and the fourth data are byte-position-transformed according to the mixing rule. The data after the third data and the fourth data are scattered and re-integrated is used as the fifth data.

[0092] Next, the fifth data and the first key data are subjected to a bit operation to obtain the sixth data. Then, according to a preset translation rule, the sixth data is translated to obtain the seventh data, wherein the translation rule may be to swap the positions of every two bytes of the sixth data. For example, if there are byte 1 and byte 2, and byte 1 is in front of byte 2, then after the position swap, byte 1 is behind byte 2. The translation rule may also be an overall translation, and the sixth data is translated by 3 bytes as a whole. Finally, the seventh data and the first key data are subjected to a bit operation to obtain the first encrypted data. Finally, the second byte quantity of the first encrypted data and the first padding data is used as the first target encrypted data.

[0093] The plaintext data encryption method proposed in this embodiment obtains plaintext data and the first byte quantity of the plaintext data, then generates a first curve group according to a preset first mathematical model and a preset first curve quantity, and generates a second curve according to a preset second mathematical model, and then determines the first key data according to the first curve group, and determines that the multiple of the first curve quantity is greater than or equal to the minimum value of the first byte quantity. If the minimum value is not equal to the first byte quantity, the first filling data is determined according to the second curve, and then the first target encrypted data corresponding to the plaintext data is determined according to the first key data, the first filling data and the plaintext data. The curve can be generated according to the preset mathematical model, and the first key data and the first filling data can be obtained according to the curve, so that the plaintext data can be encrypted according to the first key data and the first filling data to obtain the first target encrypted data. The first key data of the encryption process is generated by the mathematical model, and there is no need to transmit the first key data, thereby improving the security of the encrypted file.

[0094] Based on the first embodiment, a second embodiment of the plaintext data encryption method of the present invention is proposed. In this embodiment, step S104 includes:

[0095] Step S201, obtaining second target encrypted data, wherein the second target encrypted data includes second encrypted data and a third byte quantity;

[0096] Step S202, determining the number of second curves corresponding to the second encrypted data, and determining a third mathematical model and a fourth mathematical model corresponding to the number of second curves;

[0097] Step S203, generating a third curve group according to the third mathematical model, and generating a fourth curve according to the fourth mathematical model;

[0098] Step S204, determining second key data according to each third curve in the third curve group, and determining second padding data according to the fourth curve and the third byte quantity;

[0099] Step S202: Determine second plaintext data corresponding to the second encrypted data according to the second key data, the second padding data and the second encrypted data.

[0100] In this embodiment, first, the second target encrypted data is obtained, wherein the second target encrypted data includes the second encrypted data and the third byte quantity, then, the number of second curves corresponding to the second encrypted data is determined, such as, the number of second curves is 3, and the third mathematical model and the fourth mathematical model corresponding to the second curve quantity are determined.

[0101] Then, a third curve group is generated according to the third mathematical model, and a fourth curve is generated according to the fourth mathematical model, data is selected on each third curve in the third curve group to obtain second key data, and data is selected on the fourth curve according to the fourth curve and the third byte quantity to obtain second filling data.

[0102] Finally, the second plaintext data corresponding to the second encrypted data is determined according to the second key data, the second padding data and the second encrypted data.

[0103] In this embodiment, by obtaining the second target encrypted data, wherein the second target encrypted data includes the second encrypted data and the third byte quantity, then determining the second curve quantity corresponding to the second encrypted data, and determining the third mathematical model and the fourth mathematical model corresponding to the second curve quantity, then generating a third curve group according to the third mathematical model, and generating a fourth curve according to the fourth mathematical model, then determining the second key data according to each third curve in the third curve group, determining the second filling data according to the fourth curve and the third byte quantity, and then determining the second plaintext data corresponding to the second encrypted data according to the second key data, the second filling data and the second encrypted data, the corresponding third mathematical model and the fourth mathematical model can be determined according to the second key bit number, so as to determine the second key data and the second filling data according to the third mathematical model and the fourth mathematical model, and realize decryption of the second encrypted data to obtain the plaintext data corresponding to the second encrypted data, the second key data of the decryption process is generated by the mathematical model, and there is no need to transmit the second key data, thereby improving the security of the encrypted file.

[0104] The present invention also provides a plaintext data encryption device, referring to Figure 3 , the plaintext data encryption device comprises:

[0105] An acquisition module 10 is used to acquire plaintext data and the number of first bytes of the plaintext data;

[0106] A generating module 20, configured to generate a first curve group according to a preset first mathematical model and a preset number of first curves, and to generate a second curve according to a preset second mathematical model;

[0107] A first determination module 30 is used to determine first key data according to the first curve group, and determine a minimum value of the first byte number whose multiple is greater than or equal to the first byte number, and if the minimum value is not equal to the first byte number, determine first padding data according to the second curve;

[0108] The second determination module 40 is used to determine first target encrypted data corresponding to the plaintext data according to the first key data, the first padding data and the plaintext data.

[0109] Furthermore, the first determining module 30 is further configured to:

[0110] Dividing the first number of bytes by the first number of curves to obtain a first value;

[0111] First key data is determined according to the first value and the first curve group.

[0112] Furthermore, the first determining module 30 is further configured to:

[0113] According to the first value, coordinate data is selected on each first curve in the first curve group to obtain first data, and the first data is used as first key data.

[0114] Furthermore, the first determining module 30 is further configured to:

[0115] Performing a modulo operation on the first byte quantity and the first curve quantity to obtain a second value;

[0116] First filling data is determined according to the second value and the second curve.

[0117] Furthermore, the first determining module 30 is further configured to:

[0118] Selecting coordinate data on the second curve to obtain a preset number of second coordinate data, and acquiring a second numerical matrix corresponding to the second coordinate data;

[0119] According to the selection algorithm and the second value, second data is selected from the second value matrix, and the second data is used as the first filling data.

[0120] Furthermore, the second determining module 40 is further configured to:

[0121] Performing a bitwise operation on the plaintext data and the first key data to obtain third data;

[0122] Performing a bitwise operation on the first padding data and the first key data to obtain fourth data;

[0123] Mixing the third data with the fourth data according to a preset mixing rule to obtain fifth data;

[0124] Performing a bitwise operation on the fifth data and the first key data to obtain sixth data;

[0125] According to a preset translation rule, the sixth data is translated to obtain seventh data;

[0126] Performing a bitwise operation on the seventh data and the first key data to obtain first encrypted data;

[0127] The first encrypted data and the second number of bytes of the first padding data are used as first target encrypted data.

[0128] Furthermore, the plaintext data encryption device is also used for:

[0129] Acquire second target encrypted data, wherein the second target encrypted data includes the second encrypted data and the third byte quantity;

[0130] Determine the number of second curves corresponding to the second encrypted data, and determine a third mathematical model and a fourth mathematical model corresponding to the number of second curves;

[0131] generating a third curve group according to the third mathematical model, and generating a fourth curve according to the fourth mathematical model;

[0132] Determine second key data according to each third curve in the third curve group, and determine second padding data according to the fourth curve and the third byte quantity;

[0133] Determine second plaintext data corresponding to the second encrypted data according to the second key data, the second padding data, and the second encrypted data.

[0134] The methods executed by the above-mentioned program units can refer to the various embodiments of the plaintext data encryption method of the present invention, which will not be repeated here.

[0135] In addition, an embodiment of the present invention also proposes a plaintext data encryption device, which includes: a memory, a processor, and a plaintext data encryption program stored in the memory and executable on the processor, and when the plaintext data encryption program is executed by the processor, the steps of the plaintext data encryption method described above are implemented.

[0136] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, on which a plaintext data encryption program is stored. When the plaintext data encryption program is executed by a processor, the steps of the plaintext data encryption method described above are implemented.

[0137] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0138] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

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

[0140] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for encrypting plaintext data, characterized in that: The plaintext data encryption method comprises the following steps: Obtaining plaintext data and the number of first bytes of the plaintext data; Generate a first curve group according to a preset first mathematical model and a preset number of first curves, and generate a second curve according to a preset second mathematical model; Determine first key data according to the first curve group, and determine a minimum value whose multiple of the first curve number is greater than or equal to the first byte number, and if the minimum value is not equal to the first byte number, determine first padding data according to the second curve; The step of determining the first key data according to the first curve group comprises: Dividing the first number of bytes by the first number of curves to obtain a first value; Determine first key data according to the first value and the first curve group; The step of determining first filling data according to the second curve comprises: Performing a modulo operation on the first byte quantity and the first curve quantity to obtain a second value; Determine first filling data according to the second value and the second curve; Determine first target encrypted data corresponding to the plaintext data according to the first key data, the first padding data, and the plaintext data; The step of determining the first target encrypted data corresponding to the plaintext data according to the first key data, the first padding data and the plaintext data comprises: Performing a bitwise operation on the plaintext data and the first key data to obtain third data; Performing a bitwise operation on the first padding data and the first key data to obtain fourth data; Mixing the third data with the fourth data according to a preset mixing rule to obtain fifth data; Performing a bitwise operation on the fifth data and the first key data to obtain sixth data; According to a preset translation rule, the sixth data is translated to obtain seventh data; Performing a bitwise operation on the seventh data and the first key data to obtain first encrypted data; The first encrypted data and the second number of bytes of the first padding data are used as first target encrypted data.

2. The method for encrypting plaintext data according to claim 1, characterized in that: The step of determining the first key data according to the first value and the first curve group comprises: According to the first value, coordinate data is selected on each first curve in the first curve group to obtain first data, and the first data is used as first key data.

3. The method for encrypting plaintext data according to claim 1, characterized in that: The step of determining first filling data according to the second value and the second curve comprises: Selecting coordinate data on the second curve to obtain a preset number of second coordinate data, and acquiring a second numerical matrix corresponding to the second coordinate data; According to the selection algorithm and the second value, second data is selected from the second value matrix, and the second data is used as the first filling data.

4. The method for encrypting plaintext data according to claim 1, wherein: The plaintext data encryption method also includes: Acquire second target encrypted data, wherein the second target encrypted data includes the second encrypted data and the third byte quantity; Determine the number of second curves corresponding to the second encrypted data, and determine a third mathematical model and a fourth mathematical model corresponding to the number of second curves; generating a third curve group according to the third mathematical model, and generating a fourth curve according to the fourth mathematical model; Determine second key data according to each third curve in the third curve group, and determine second padding data according to the fourth curve and the third byte quantity; Determine second plaintext data corresponding to the second encrypted data according to the second key data, the second padding data, and the second encrypted data.

5. A plaintext data encryption device, characterized in that: The plaintext data encryption device comprises: An acquisition module, used for acquiring plaintext data and the number of first bytes of the plaintext data; A generating module, used to generate a first curve group according to a preset first mathematical model and a preset number of first curves, and to generate a second curve according to a preset second mathematical model; a first determination module, configured to determine first key data according to the first curve group, specifically to divide the first byte quantity by the first curve quantity to obtain a first value; determine the first key data according to the first value and the first curve group; and determine a minimum value whose multiple of the first curve quantity is greater than or equal to the first byte quantity, and if the minimum value is not equal to the first byte quantity, determine first padding data according to the second curve, specifically to perform a modulo operation on the first byte quantity and the first curve quantity to obtain a second value; determine the first padding data according to the second value and the second curve; The second determination module is used to determine the first target encrypted data corresponding to the plaintext data according to the first key data, the first filling data and the plaintext data, and is specifically used to perform a bit operation on the plaintext data and the first key data to obtain the third data; perform a bit operation on the first filling data and the first key data to obtain the fourth data; mix the third data and the fourth data according to a preset mixing rule to obtain the fifth data; perform a bit operation on the fifth data and the first key data to obtain the sixth data; shift the sixth data according to a preset shift rule to obtain the seventh data; perform a bit operation on the seventh data and the first key data to obtain the first encrypted data; and use the second byte quantity of the first encrypted data and the first filling data as the first target encrypted data.

6. A plaintext data encryption device, characterized in that: The plaintext data encryption device comprises: a memory, a processor, and a plaintext data encryption program stored in the memory and executable on the processor, wherein the plaintext data encryption program implements the steps of the plaintext data encryption method as described in any one of claims 1 to 4 when executed by the processor.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plaintext data encryption program, and when the plaintext data encryption program is executed by the processor, the steps of the plaintext data encryption method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • An optimized intelligent card cryptographic algorithm template attack method

    CN109787741A

  • Method for obtaining secret key of cryptographic equipment based on DES operation power consumption

    CN111934847A