A method, apparatus, and electronic device for plaintext encryption, and a storage medium

By using a combination of random numbers and hash functions in the encryption system, pseudo-random numbers are generated for secondary encryption, thus solving the problem of security verification in the encryption system, ensuring the security of data transmission, and detecting system tampering.

CN116248270BActive Publication Date: 2026-01-09CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211711680.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-01-09
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

Existing encryption systems are difficult to verify for security; cryptographic systems are not necessarily completely secure; and the security of encryption algorithms is difficult to determine.

Method used

The first ciphertext group is generated by encrypting a first randomly generated random number obtained during the first plaintext encryption process. During the second plaintext encryption process, the first random number is hashed using a preset hash function to generate a second random number, which is then used to encrypt the second ciphertext group.

Benefits of technology

This invention enables the modification of encrypted random data in an encryption system using a hash function, thereby verifying the security of the encryption system, ensuring the security of data transmission, and verifying the tampering of the cryptographic system without the recipient's knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116248270B_ABST
    Figure CN116248270B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a plaintext encryption method and device, electronic equipment and storage medium, the method comprises: in the first plaintext encryption process, a first random number is obtained, and the first random number is used for plaintext encryption to generate a first ciphertext group; in the second plaintext encryption process, the first random number is mapped according to a preset hash function to generate a second random number, and the second random number is used for plaintext encryption to generate a second ciphertext group. Through the embodiments of the present application, the first random data is mapped by the hash function to generate the pseudo random number, and then the second random number is generated for encryption, and the security of the encryption system is verified by modifying the encryption random data in the encryption system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of encryption technology, in particular to a plaintext encryption method and device, electronic equipment and storage medium. BACKGROUND

[0002] For the confidentiality of information, we usually encrypt the information, transmit the encrypted information, and the receiving party and the sending party reach a certain agreement, so that the encrypted information can be decrypted at the receiving party, thereby achieving the effect of secure transmission of information. However, the password system is not necessarily completely secure. It is difficult to verify the security of the encryption system or a certain encryption algorithm. SUMMARY

[0003] In view of the above problems, a plaintext encryption method, device, electronic equipment and storage medium are provided to overcome the above problems or at least partially solve the above problems, comprising:

[0004] A plaintext encryption method, the method comprising:

[0005] In the first plaintext encryption process, a first random number is generated randomly, and the first random number is used for plaintext encryption to generate a first ciphertext group;

[0006] In the second plaintext encryption process, the first random number is hashed according to a preset hash function to generate a second random number, and the second random number is used for plaintext encryption to generate a second ciphertext group.

[0007] Optionally, the first random number is hashed according to the preset hash function to generate a second random number, comprising:

[0008] A third plaintext information for hiding transmission is obtained, and a hash function for carrying the third plaintext information is generated for the first random number;

[0009] The first random number is hashed according to the hash function to generate a second random number.

[0010] Optionally, it further comprises:

[0011] During the transmission of the first ciphertext group and the second ciphertext group, the first ciphertext group and the second ciphertext group are intercepted;

[0012] According to the first ciphertext group and the second ciphertext group, a third plaintext information is obtained.

[0013] Optionally, the third plaintext information is obtained according to the first ciphertext group and the second ciphertext group, comprising:

[0014] obtaining hash parameter information of the hash function;

[0015] obtaining the second random number according to the hash parameter information, the first ciphertext group and the second ciphertext group;

[0016] determining first plaintext information, second plaintext information and third plaintext information based on the second random number.

[0017] Optionally, the plaintext encryption using the first random number comprises:

[0018] encrypting preset first plaintext information based on the preset encryption algorithm and the first random number to generate the first ciphertext group.

[0019] Optionally, the first ciphertext group comprises first sub-ciphertext and second sub-ciphertext, and the preset encryption algorithm and the first random number encrypt the preset first plaintext information to generate the first ciphertext group, which comprises:

[0020] generating the first sub-ciphertext according to the preset encryption algorithm and the first random number;

[0021] calculating the public key information of the preset encryption algorithm, the first random number and the preset first plaintext information according to the preset encryption algorithm to generate the second sub-ciphertext.

[0022] Optionally, the plaintext encryption using the second random number comprises:

[0023] encrypting preset second plaintext information based on the preset encryption algorithm and the second random number to generate the second ciphertext group.

[0024] Optionally, the second ciphertext group comprises third sub-ciphertext and fourth sub-ciphertext, and the preset encryption algorithm and the second random number encrypt the preset second plaintext information to generate the second ciphertext group, which comprises:

[0025] generating the third sub-ciphertext according to the preset encryption algorithm and the second random number;

[0026] calculating the public key information of the preset encryption algorithm, the second random number and the preset second plaintext information according to the preset encryption algorithm to generate the fourth sub-ciphertext.

[0027] Optionally, the method further comprises:

[0028] sending the first ciphertext group to a first receiver, so that the first receiver obtains the first plaintext information after decrypting according to the preset encryption algorithm;

[0029] The second ciphertext group is sent to a second receiver, so that the second receiver obtains second plaintext information after decryption according to the preset encryption algorithm.

[0030] A plaintext encryption device, the device comprising:

[0031] A first plaintext encryption module is configured to generate a first random number in a first plaintext encryption process, and encrypt the plaintext by using the first random number to generate a first ciphertext group.

[0032] A second plaintext encryption module is configured to perform hash mapping on the first random number according to a preset hash function to generate a second random number in a second plaintext encryption process, and encrypt the plaintext by using the second random number to generate a second ciphertext group.

[0033] Optionally, the second plaintext encryption module comprises:

[0034] A hash function generation submodule is configured to obtain third plaintext information to be hidden, and generate a hash function for carrying the third plaintext information for the first random number.

[0035] A second random number generation submodule is configured to perform hash mapping on the first random number by using the hash function to generate a second random number.

[0036] Optionally, the device further comprises:

[0037] A ciphertext interception module is configured to intercept the first ciphertext group and the second ciphertext group during transmission of the first ciphertext group and the second ciphertext group.

[0038] A third plaintext analysis module is configured to obtain third plaintext information according to the first ciphertext group and the second ciphertext group.

[0039] Optionally, the third plaintext analysis module comprises:

[0040] A hash parameter acquisition submodule is configured to obtain hash parameter information of the hash function.

[0041] A second random number determination submodule is configured to obtain the second random number according to the hash parameter information, the first ciphertext group, and the second ciphertext group.

[0042] A plaintext information determination submodule is configured to determine the first plaintext information, the second plaintext information, and the third plaintext information based on the second random number.

[0043] An electronic device comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the method of plaintext encryption as described above.

[0044] A computer-readable storage medium having stored thereon a computer program, the computer program, when executed by a processor, implementing the method of plaintext encryption as described above.

[0045] Embodiments of the present application have the following advantages:

[0046] In the first plaintext encryption process, a first random number is obtained, and plaintext encryption is performed using the first random number to generate a first ciphertext group; in the second plaintext encryption process, the first random number is hashed according to a preset hash function to generate a second random number, and plaintext encryption is performed using the second random number to generate a second ciphertext group, so that the first random data is hashed by the hash function to generate a pseudo-random number, and then the second random number is generated for encryption, and the security of the encryption system is verified by modifying the encryption random data in the encryption system. BRIEF DESCRIPTION OF DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed to be used in the description of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0048] Figure 1 is a step flow chart of a plaintext encryption method provided by an embodiment of the present application;

[0049] Figure 2 is a step flow chart of another plaintext encryption method provided by an embodiment of the present application;

[0050] Figure 3a is a step flow chart of another plaintext encryption method provided by an embodiment of the present application;

[0051] Figure 3b is a schematic diagram of an encryption communication system model architecture provided by an embodiment of the present application;

[0052] Figure 3c is a schematic diagram of an encryption and decryption process provided by an embodiment of the present application;

[0053] Figure 4 is a structural schematic diagram of a plaintext encryption device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the above objectives, characteristics and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0055] With reference to Figure 1 , a step flow chart of a method for plaintext encryption provided by an embodiment of the present application is shown, which can specifically include the following steps:

[0056] In step 101, a first random number is obtained in a first plaintext encryption process, and the first random number is used for plaintext encryption to generate a first ciphertext group.

[0057] In the present application, the encryption algorithm used by the encryption system can be a non-pile encryption algorithm or a symmetric encryption algorithm.

[0058] In actual application, a random number can be randomly taken in a preset numerical range as the first random number, and the first random number is stored in the encryption system, and then the first random number is used for the first plaintext encryption in the encryption system. The plaintext encryption process is that the set plaintext to be sent is subjected to relevant encryption operation by the preset encryption algorithm in the encryption system to generate the ciphertext corresponding to the plaintext, and then the data is sent in the form of the ciphertext, so as to ensure the security of the data.

[0059] The first ciphertext group can include one or more sub-ciphertexts, and the one or more sub-ciphertexts can be generated based on the first random number.

[0060] In an embodiment of the present application, step 101 includes: encrypting the preset first plaintext information based on the preset encryption algorithm and the first random number to generate the first ciphertext group.

[0061] The preset encryption algorithm is the encryption algorithm used in the encryption system, the preset first plaintext information is the plaintext to be sent by the encryption system, the first ciphertext group is the ciphertext data transmitted in the analog channel, and the specified receiving method can decrypt the first ciphertext group by the public key to obtain the first plaintext information.

[0062] In an embodiment of the present application, the first ciphertext group includes a first sub-ciphertext and a second sub-ciphertext, the preset encryption algorithm and the first random number are used to encrypt the preset first plaintext information to generate the first ciphertext group, which includes the following sub-steps:

[0063] Step S11, generating the first sub-ciphertext according to the preset encryption algorithm and the first random number;

[0064] In actual application, in the encryption system, the first sub-ciphertext can be generated by using the related encryption parameters of the preset encryption algorithm and the first random number.

[0065] For example, taking the Elgamal encryption algorithm as an example, for the first use, the first random number k1∈Z p-1 is randomly selected. K1 can be 0, 1, 2, …, P-1, that is, K1 is a positive integer between 0 and p-1.

[0066] After the random selection of K1, the parameters g and p in the encryption system are used, and k1 is calculated according to the formula to obtain the first sub-ciphertext C1.

[0067] Step S11, the public key information of the preset encryption algorithm, the first random number and the preset first plaintext information are calculated according to the preset encryption algorithm to generate the second sub-ciphertext.

[0068] In the encryption system, the public key information of the encryption algorithm, the first random number and the first plaintext information can also be used for plaintext encryption to obtain the second sub-ciphertext.

[0069] For example, assuming that the first plaintext information is m1=13, the private key x of the Elgamal encryption algorithm is 19, the parameter p is 173, the parameter g is 2, and the public key y of the encryption system is calculated according to the private key y=g x modp=98, and then the second sub-ciphertext can be obtained according to .

[0070] It should be noted that in actual application, the preset encryption algorithm, the parameters and the like can be adjusted according to actual needs, which are not limited in the embodiments of the present application.

[0071] Step 102, in the second plaintext encryption process, the first random number is mapped by a preset hash function to generate a second random number, and the second random number is used for plaintext encryption to generate a second ciphertext group.

[0072] In the first encryption, the first random number is randomly taken to encrypt the plaintext to be sent, and the first random data can be saved, and then the first random number is used to generate the second random number, realizing the generation of pseudo-random number.

[0073] Specifically, the hash function of the first random number can be preset in the encryption system, and then the second random number can be generated based on the hash function and the first random number used in the first plaintext encryption process after the first plaintext encryption is completed. The process is the process of mapping the first random number by the hash function.

[0074] After the second random number is generated based on the first random number, the second random number can be used as a random number in a second plaintext encryption process to perform plaintext encryption, so that a second ciphertext group can be obtained.

[0075] The second ciphertext group can include one or more sub-ciphertexts, and the one or more sub-ciphertexts can be generated based on the second random number.

[0076] Since the second ciphertext information and the first ciphertext information are both essentially obtained based on the same encryption algorithm, a receiver receiving the second ciphertext information can still perform ciphertext decryption using the public key corresponding to the first plaintext encryption to obtain corresponding plaintext information.

[0077] It should be noted that the encryption algorithms used in the first plaintext encryption process and the second plaintext encryption process are consistent, and only the random numbers used are different, and the plaintexts targeted in the first plaintext encryption process and the second plaintext encryption process can be the same or different.

[0078] It can be understood that in the two plaintext encryption processes, only the random number is changed, so that the receiver can decrypt the plaintext, and thus the tampering of the cryptographic system can be performed without the receiver's awareness through the above two processes, verifying the defects of the cryptographic system.

[0079] In an embodiment of the present application, the plaintext encryption using the second random number includes:

[0080] The preset second plaintext information is encrypted based on a preset encryption algorithm and the second random number to generate a second ciphertext group.

[0081] In an embodiment of the present application, the second ciphertext group includes a third sub-ciphertext and a fourth sub-ciphertext, and the preset encryption algorithm and the second random number are used to encrypt the preset second plaintext information to generate the second ciphertext group, including the following sub-steps:

[0082] In the sub-step S21, the third sub-ciphertext is generated based on the preset encryption algorithm and the second random number.

[0083] In actual application, after the second random number is obtained by performing hash mapping on the first random number, the third sub-ciphertext can be generated in the encryption system using the related encryption parameters of the preset encryption algorithm and the second random number.

[0084] It should be noted that the generation process of the third sub-ciphertext can be parameterized with the first sub-ciphertext.

[0085] For example, in the second plaintext encryption process, the third sub-ciphertext The parameters g and p are parameters pre-set in the encryption system, and are the same as the first sub-ciphertext.

[0086] Sub-step S22, the public key information of the preset encryption algorithm, the second random number and the preset second plaintext information are calculated according to the preset encryption algorithm to generate a fourth sub-ciphertext.

[0087] In the encryption system, the public key information of the encryption algorithm, the second random number and the second plaintext information can also be used for plaintext encryption to obtain the fourth sub-ciphertext.

[0088] For example, the fourth sub-ciphertext is Wherein, m2 is the second plaintext information, and y is the public key of the encryption system.

[0089] In an embodiment of the present application, the method further comprises: sending the first ciphertext group to the first receiver so that the first receiver obtains the first plaintext information after decryption according to the preset encryption algorithm; and sending the second ciphertext group to the second receiver so that the second receiver obtains the second plaintext information after decryption according to the preset encryption algorithm.

[0090] In actual application, the sender processes the plaintext into ciphertext through the encryption system, and then transmits it to the receiver through the simulation channel. The receiver can store the public key information of the encryption system and the following parameters, such as parameter p and parameter g. Then, when the first receiver or the second receiver receives the first ciphertext group or the second ciphertext, the ciphertext can be decrypted to obtain the corresponding plaintext information.

[0091] For example, the first plaintext encryption obtains Next, the following is calculated The first receiver obtains the inverse element s = 46 after obtaining C1 and C2; wherein, s * C1 x modp≡1(x is the private key), so the first plaintext information m'1 = s * C2 mod p = 13 can be decrypted.

[0092] The encryption process in the encryption system usually involves randomly generating random numbers. In the present application, a new second random number is generated based on the first random number generated in the previous plaintext encryption process. The second random number is actually a pseudo-random number. Therefore, encryption using the second random number actually tampers the details of the encryption process in the encryption system, so that the security of the encryption system can be verified.

[0093] The embodiment of the present application realizes the generation of pseudo random numbers by hashing mapping the first random data through a hash function, and then encrypts by using the generated second random number, and verifies the security of the encryption system by modifying the random data in the encryption system.

[0094] Moreover, the encryption method based on the hashing mapping of the random number in the embodiment of the present application does not limit the encryption algorithm used by the encryption system, and can be widely used in various encryption algorithms in the encryption system, and has universality. For the specific encryption algorithm in the encryption system, the encryption process can be adjusted according to the characteristics of the encryption algorithm.

[0095] Referring to Figure 2 , a step flow chart of another plaintext encryption method provided by an embodiment of the present application is shown, and specifically can include the following steps:

[0096] Step 201, in the first plaintext encryption process, a first random number generated randomly is obtained, and the first random number is used for plaintext encryption to generate a first ciphertext group.

[0097] Step 202, in the second plaintext encryption process, third plaintext information used for hidden transmission is obtained, and a hash function used for carrying the third plaintext information is generated for the first random number; the first random number is hashed mapped by using the hash function to generate a second random number, and the second random number is used for plaintext encryption to generate a second ciphertext group.

[0098] In the second plaintext encryption process, in the encryption system, the third plaintext information used for hidden transmission can be input, and then the hash function can be set as a function of the first random number carrying the third plaintext information. After the hash function is determined, the first random number can be mapped by using the hash function, so that the second random number can be obtained, and then the second ciphertext group is generated by using the second random data.

[0099] In the embodiment of the present application, by setting the third plaintext information in the hash function, the hidden information can be set. When the second ciphertext group is sent to the end party, the receiving party can only analyze the second plaintext information, and cannot analyze the third plaintext information, which verifies the insecurity of the encryption system, and on the other hand, based on the encryption idea, the hidden information can also be set for encryption transmission, to ensure the security of data transmission.

[0100] Meanwhile, the third plaintext information application field is more extensive, and not only can be used in the conventional information carrier, but also pictures, voice and the like can be used as the information hiding carrier.

[0101] Referring to Figure 3a , a step flow chart of another plaintext encryption method provided by an embodiment of the present application is shown, and specifically can include the following steps:

[0102] In step 301, in the first plaintext encryption process, a first random number is obtained, and the first random number is used for plaintext encryption to generate a first ciphertext group.

[0103] In step 302, in the second plaintext encryption process, third plaintext information used for hiding transmission is obtained, and a hash function used for carrying the third plaintext information is generated according to the first random number; the first random number is subjected to hash mapping by using the hash function to generate a second random number, and the second random number is used for plaintext encryption to generate a second ciphertext group.

[0104] In step 303, in the first ciphertext group and the second ciphertext group transmission process, the first ciphertext group and the second ciphertext group are intercepted.

[0105] After the first plaintext encryption to generate the first ciphertext group and the second plaintext encryption to generate the second ciphertext group, the first ciphertext group and the second ciphertext group can be intercepted from the analog channel before being transmitted to the receiving party.

[0106] It should be noted that the way of intercepting the first ciphertext group and the second ciphertext group can be selected according to the actual scene, and this is not limited too much in the embodiment of the present application.

[0107] As shown in Figure 3b , it is a schematic diagram of an encryption communication system model architecture, and as shown in Figure 3c , it is a schematic diagram of an encryption and decryption process.

[0108] The sender (i.e., the sending end) can process plaintext and call the encryption system to perform encryption processing on the plaintext.

[0109] The analog channel is used to transmit the ciphertext from the sending end to the receiving end.

[0110] The receiving end calls the encryption system to perform decryption after receiving the ciphertext from the analog channel.

[0111] The attacker (or verifier) intercepts the transmitted ciphertext from the analog channel by eavesdropping the channel, and performs decryption of the ciphertext and decryption of the threshold message (i.e., the hidden information).

[0112] The cryptographic system can be used for encryption, decryption, and improved encryption, wherein the second random number generation part is the improved encryption.

[0113] In actual operation, the attacker can obtain the ciphertext transmitted twice from the analog signal, and then verify the encryption system through the twice transmitted ciphertext.

[0114] The verification process is a process of obtaining the third plaintext information according to the first ciphertext group and the second ciphertext group. When the attacker can analyze the hidden third plaintext information by using the obtained first ciphertext group and the second ciphertext group twice, it is proved that the encryption system is inaccurate. Meanwhile, the hidden information is transmitted by using the pseudo-random number generated by the hash function to realize data encryption transmission.

[0115] In step 304, the third plaintext information is obtained according to the first ciphertext group and the second ciphertext group.

[0116] After obtaining the first ciphertext group and the second ciphertext group, the third plaintext information can be obtained by combining the first ciphertext group and the second ciphertext group, so as to verify that the encryption system has been modified, that is, the encryption system is insecure.

[0117] In an embodiment of the present application, step 304 can include the following sub-steps:

[0118] In sub-step S31, the hash parameter information of the hash function is obtained.

[0119] In sub-step S32, the second random number is obtained according to the hash parameter information, the first ciphertext group and the second ciphertext group.

[0120] The second random number is obtained based on the hash mapping of the first random number, and the second random number is obtained based on the hash parameter information and the first ciphertext group combined with the second ciphertext group generated based on the first random number and the second random number. Then the second random number can be inversely deduced.

[0121] In sub-step S33, the first plaintext information, the second plaintext information and the third plaintext information are determined based on the second random number.

[0122] After obtaining the second random data, the first plaintext information, the second plaintext information and the third plaintext information are calculated based on the correlation between the parameters.

[0123] The embodiment of the present application acquires a first random number generated randomly in a first plaintext encryption process, and uses the first random number to generate a first ciphertext group by plaintext encryption; in a second plaintext encryption process, a third plaintext information used for hiding sending is acquired, and a hash function used for carrying the third plaintext information is generated for the first random number; the first random number is mapped by the hash function to generate a second random number, and the second random number is used for plaintext encryption to generate a second ciphertext group. In the sending process of the first ciphertext group and the second ciphertext group, the first ciphertext group and the second ciphertext group are intercepted; the third plaintext information is obtained according to the first ciphertext group and the second ciphertext group, the first random data is mapped by the hash function to generate a pseudo random number, and then the second random number is generated for encryption, the security of the encryption system is verified by modifying the random data for encryption in the encryption system.

[0124] The above embodiment of the present application is exemplarily described below taking the Elgamal encryption algorithm encryption process as an example.

[0125] Suppose that the system can freely select the used power operation. Suppose that the ElGamal private key of the attacker is X, the corresponding public key is Y, W is a fixed odd integer, and H is a strong pseudo-random function (i.e. a hash function) with a hidden seed in cryptography. It is assumed that the value output by H is less than The following algorithm is based on the operation of a Diffie-Hellman device used twice in succession. Let a and b be fixed constants.

[0126] (1) The first plaintext encryption process is: k1∈Z p-1 is randomly selected and output

[0127]

[0128] (2) k1 is stored in a non-volatile memory for use when the device is used next time.

[0129] (3) Hash function setting:

[0130] (t∈{0,1} is randomly selected)

[0131] k2=H(z)

[0132] Among them, the parameters W1, a, b are fixed parameters, increasing the complexity of z, which is also for security consideration, and these parameters are set by the attacker.

[0133] (4) The second plaintext encryption process is:

[0134] The attacker need only passively tap the communication line to obtain C1 and C3 to compute k2.

[0135] where z is called the hidden field element and the value of k2 is found as follows.

[0136] 1.

[0137] 2. z1 = C1 / r X mod p

[0138] 3. If then output H(z1)

[0139] 4. z2 = z1 / g W

[0140] 5. If then output H(z2).

[0141] After k2 is determined, the key for the second DH key exchange can be determined by k2. To allow k2 to take on any value less than p-1, we assume that g1 = g -Xb-W mod p, g2 = g -Xb mod p, and g3 = g 1-aX mod p. Technically, nothing is encrypted in the DH key exchange. However, the resulting shared key can be viewed as conceptually encrypted by both parties.

[0142] The above process is explained in the following example of encryption and decryption using the Elgamal encryption algorithm:

[0143] Suppose the encryption system has the following parameters: p = 173, g = 2, a = b = w = 0, and H(z) = z*123 (where 123 is the hidden message).

[0144] Bob takes the private key x = 19 and then computes the public key y = g x mod p = 98. Bob then makes the public key public so that Alice can also obtain some parameters (p, g, y),

[0145] (A) Alice sends the plaintext message m1 = 13 to Bob

[0146] Suppose the first k1 = 17 is taken and stored for later use, then the encryption is performed to obtain Next, find (y is the public key), and send C1 and C2 to Bob.

[0147] Bob computes the inverse s = 46; where s*C1 xmodp≡1 (x is the private key), thus the plaintext m' = s * C2 mod p = 13 = m can be decrypted, and the above is the normal initialization, encryption, decryption process.

[0148] (II) After steganography attack, k2 becomes a pseudo-random number and cannot be perceived by the user, as follows. First, the hash mapping of the first stored k1 is calculated, and k2 = H(z) (although greater than p, the user cannot perceive it because the user can only look at C1, C2), k2 = 13653 is determined, and when a second message m2 = 16 is sent, the ciphertext can be calculated as follows: Next, Alice sends the ciphertext (C1, C2) to Bob, and Bob can continue to decrypt, first calculating the inverse s' = 155, which satisfies s' * C1' x modp≡1, thus the receiver Bob can normally decrypt the plaintext m2' = s' * C'2 mod p = 16 = m2.

[0149] Therefore, it can be seen that after the steganography attack, the system can still perform normal encryption and decryption operations on the message, and completely does not affect its own use, and then such a system for the third party (attacker) can not only decrypt the ciphertext corresponding to the plaintext without knowing the private key, but also can hide the information it wants, and the hidden information can be achieved through the set hash function.

[0150] The decryption process of the attacker is as follows:

[0151] C1 = g k modp, C1 x = (g k modp) x = g xk modp = (g x modp) k = y k modp, and then

[0152] k2 is calculated, and the original ciphertext can be decrypted without the private key x.

[0153] Since k2 = H(C1) = C1 * 123, and k2 and C1 are known values, the hidden information k2 / C1 = 123 (i.e., the hidden message) can be solved.

[0154] ​It should be noted that, for the method embodiments, the series of acts combined is described for simplicity, but those skilled in the art should know that the embodiments of the present application are not limited to the order of the acts described, because according to the embodiments of the present application, certain steps can be performed in other orders or at the same time. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the acts involved are not necessarily the necessary acts of the embodiments of the present application.

[0155] Referring to Figure 4 , a structural schematic diagram of a plaintext encryption device provided by an embodiment of the present application is shown, which can specifically include the following modules:

[0156] The first plaintext encryption module 401 is configured to, in the first plaintext encryption process, obtain a first random number generated randomly, and perform plaintext encryption by using the first random number to generate a first ciphertext group.

[0157] The second plaintext encryption module 402 is configured to, in the second plaintext encryption process, perform hash mapping on the first random number according to a preset hash function to generate a second random number, and perform plaintext encryption by using the second random number to generate a second ciphertext group.

[0158] In an embodiment of the present application, the second plaintext encryption module 402 includes:

[0159] The hash function generation submodule is configured to obtain third plaintext information to be hidden, and generate a hash function for carrying the third plaintext information for the first random number.

[0160] The second random number generation submodule is configured to perform hash mapping on the first random number by using the hash function to generate a second random number.

[0161] In an embodiment of the present application, the device further includes:

[0162] The ciphertext interception module is configured to intercept the first ciphertext group and the second ciphertext group in the sending process of the first ciphertext group and the second ciphertext group.

[0163] The third plaintext analysis module is configured to obtain third plaintext information according to the first ciphertext group and the second ciphertext group.

[0164] In an embodiment of the present application, the third plaintext analysis module includes:

[0165] The hash parameter acquisition submodule is configured to obtain hash parameter information of the hash function.

[0166] a second random number determination sub-module, configured to determine the second random number according to the hash parameter information, the first ciphertext group and the second ciphertext group;

[0167] a plaintext information determination sub-module, configured to determine first plaintext information, second plaintext information and third plaintext information based on the second random number.

[0168] In an embodiment of the present application, the first plaintext encryption module 401 comprises:

[0169] a first plaintext encryption sub-module, configured to encrypt preset first plaintext information based on the preset encryption algorithm and the first random number to generate a first ciphertext group.

[0170] In an embodiment of the present application, the first ciphertext group comprises a first sub-ciphertext and a second sub-ciphertext, and the encryption of the preset first plaintext information based on the preset encryption algorithm and the first random number to generate a first ciphertext group comprises:

[0171] a first sub-ciphertext generation unit, configured to generate a first sub-ciphertext according to the preset encryption algorithm and the first random number;

[0172] a second sub-ciphertext generation unit, configured to calculate a second sub-ciphertext according to the public key information of the preset encryption algorithm, the first random number and preset first plaintext information according to the preset encryption algorithm.

[0173] In an embodiment of the present application, the second plaintext encryption module 402 comprises:

[0174] a second plaintext encryption sub-module, configured to encrypt preset second plaintext information based on the preset encryption algorithm and the second random number to generate a second ciphertext group.

[0175] In an embodiment of the present application, the second ciphertext group comprises a third sub-ciphertext and a fourth sub-ciphertext, and the second plaintext encryption sub-module comprises:

[0176] a third sub-ciphertext unit, configured to generate a third sub-ciphertext according to the preset encryption algorithm and the second random number;

[0177] a fourth sub-ciphertext unit, configured to calculate a fourth sub-ciphertext according to the public key information of the preset encryption algorithm, the second random number and preset second plaintext information according to the preset encryption algorithm.

[0178] In an embodiment of the present application, the device further comprises:

[0179] a first decryption module, configured to send the first ciphertext group to a first recipient, so that the first recipient obtains first plaintext information after decryption according to the preset encryption algorithm.

[0180] A second decryption module is configured to send the second ciphertext set to a second receiver, so that the second receiver decrypts the second ciphertext set according to the preset encryption algorithm to obtain second plaintext information.

[0181] An embodiment of the present application further provides an electronic device, which can comprise a processor, a memory, and a computer program stored on the memory and capable of running on the processor, and the computer program is executed by the processor to realize the method for encrypting plaintext as described above.

[0182] An embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the method for encrypting plaintext as described above.

[0183] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts refer to the part of the method embodiment.

[0184] Each embodiment in the specification is described in a progressive manner, and each embodiment mainly describes the difference from other embodiments, and the same and similar parts of each embodiment refer to each other.

[0185] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can adopt 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.

[0186] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams according to the method, terminal device (system), and computer program product of the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal devices produce a device for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one flow or multiple flows and / or blocks Figure 1 The device for implementing the functions specified in one block or multiple blocks.

[0187] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks

[0188] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks

[0189] While preferred embodiments of the application have been described, those skilled in the art will recognize that additional modifications and changes can be made thereto without departing from the scope of the application. Accordingly, the appended claims are intended to cover all such modifications and changes as fall within the scope of the application.

[0190] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and do not imply singular or plural. Moreover, the terms "include", "have", or any other variant thereof are intended to encompass non-exclusive inclusions, such that processes, methods, articles, or apparatuses that comprise a set of elements not expressly listed are not excluded from the scope of the process, method, article, or apparatus. Further, the term "comprises" or "comprising" does not exclude the presence of additional elements or steps. Furthermore, the words "a" or "an" shall not be construed as meaning "one and only one". To the contrary, the phrase "one or more" or "at least one" means one, two, three, four, or more than four. The terms "plurality" and "a plurality", as well as "multiple" or "a multiple", mean two or more than two. The term "coupled" means directly or indirectly connected, linked, or associated, as the context requires.

[0191] The above provides a method, device, electronic equipment and storage medium for plaintext encryption, and the principle and implementation manner of the present application are described by using specific examples. The above description of the embodiments is only used to help understand the method and core idea of the present application; meanwhile, for those skilled in the art, the specific implementation manner and application range can be changed according to the idea of the present application. In conclusion, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A method of encrypting plaintext, characterized by, The method comprises: In the first plaintext encryption process, a first random number is generated randomly, and the first random number is used for plaintext encryption to generate a first ciphertext group; the first ciphertext group comprises one or more sub-ciphertexts, and the one or more sub-ciphertexts are generated based on the first random number; In the second plaintext encryption process, the first random number is mapped by a preset hash function to generate a second random number, and the second random number is used for plaintext encryption to generate a second ciphertext group; The plaintext encryption using the second random number comprises: Based on a preset encryption algorithm and the second random number, preset second plaintext information is encrypted to generate a second ciphertext group; The second ciphertext group comprises third sub-ciphertexts and fourth sub-ciphertexts, and the encryption of the preset second plaintext information based on the preset encryption algorithm and the second random number to generate a second ciphertext group comprises: The third sub-ciphertexts are generated according to the preset encryption algorithm and the second random number; The fourth sub-ciphertexts are generated by calculating the public key information of the preset encryption algorithm, the second random number and the preset second plaintext information according to the preset encryption algorithm.

2. The method of claim 1, wherein, The hash mapping of the first random number by the preset hash function to generate a second random number comprises: Third plaintext information used for hiding sending is obtained, and a hash function used for carrying the third plaintext information is generated for the first random number; The first random number is mapped by the hash function to generate a second random number.

3. The method of claim 2, wherein, Further comprising: During the sending of the first ciphertext group and the second ciphertext group, the first ciphertext group and the second ciphertext group are intercepted; Third plaintext information is obtained according to the first ciphertext group and the second ciphertext group.

4. The method of claim 3, wherein, The obtaining of the third plaintext information according to the first ciphertext group and the second ciphertext group comprises: Hash parameter information of the hash function is obtained; The second random number is obtained according to the hash parameter information, the first ciphertext group and the second ciphertext group; Based on the second random number, first plaintext information, second plaintext information and third plaintext information are determined.

5. The method of claim 1, wherein, The plaintext encryption using the first random number comprises: Based on the preset encryption algorithm and the first random number, preset first plaintext information is encrypted to generate a first ciphertext group.

6. The method of claim 5, wherein, The first ciphertext group comprises first sub-ciphertexts and second sub-ciphertexts, and the encryption of the preset first plaintext information based on the preset encryption algorithm and the first random number to generate a first ciphertext group comprises: The first sub-ciphertexts are generated according to the preset encryption algorithm and the first random number; The second sub-ciphertexts are generated by calculating the public key information of the preset encryption algorithm, the first random number and the preset first plaintext information according to the preset encryption algorithm.

7. The method of claim 1, wherein, Further comprising: The first ciphertext group is sent to a first receiver, so that the first receiver obtains first plaintext information after decryption according to the preset encryption algorithm; The second ciphertext group is sent to a second receiver, so that the second receiver obtains second plaintext information after decryption according to the preset encryption algorithm.

8. An apparatus for encryption of plaintext, characterized by The device comprises: A first plaintext encryption module is configured to, in a first plaintext encryption process, obtain a first random number generated randomly, and perform plaintext encryption using the first random number to generate a first ciphertext group; the first ciphertext group comprises one or more sub-ciphertexts, and the one or more sub-ciphertexts are generated based on the first random number; A second plaintext encryption module is configured to, in a second plaintext encryption process, perform hash mapping on the first random number according to a preset hash function to generate a second random number, and perform plaintext encryption using the second random number to generate a second ciphertext group; The second plaintext encryption module comprises: A second plaintext encryption submodule is configured to encrypt preset second plaintext information based on a preset encryption algorithm and the second random number to generate a second ciphertext group; The second ciphertext group comprises a third sub-ciphertext and a fourth sub-ciphertext, and the second plaintext encryption submodule comprises: A third sub-ciphertext unit is configured to generate a third sub-ciphertext according to the preset encryption algorithm and the second random number; A fourth sub-ciphertext unit is configured to calculate a public key information of the preset encryption algorithm, the second random number, and preset second plaintext information according to the preset encryption algorithm to generate a fourth sub-ciphertext.

9. The apparatus of claim 8, wherein, The second plaintext encryption module comprises: A hash function generation submodule is configured to obtain third plaintext information to be hidden, and generate a hash function for carrying the third plaintext information for the first random number; A second random number generation submodule is configured to perform hash mapping on the first random number using the hash function to generate a second random number.

10. The apparatus of claim 9, wherein, Further comprising: A ciphertext interception module is configured to intercept the first ciphertext group and the second ciphertext group during transmission of the first ciphertext group and the second ciphertext group; A third plaintext analysis module is configured to obtain third plaintext information according to the first ciphertext group and the second ciphertext group.

11. The apparatus of claim 10, wherein, The third plaintext analysis module comprises: A hash parameter acquisition submodule is configured to obtain hash parameter information of the hash function; A second random number determination submodule is configured to obtain the second random number according to the hash parameter information, the first ciphertext group, and the second ciphertext group; A plaintext information determination submodule is configured to determine first plaintext information, second plaintext information, and third plaintext information based on the second random number.

12. An electronic device, comprising: A computer program stored on the computer readable storage medium and capable of running on the processor, when executed by the processor, implements the plaintext encryption method according to any one of claims 1 to 7.

13. A computer-readable storage medium, characterized in that, A computer program stored on the computer readable storage medium and capable of running on the processor, when executed by the processor, implements the plaintext encryption method according to any one of claims 1 to 7.