Data transmission method and device, storage medium, electronic equipment and program product

By adjusting the key generation method of the RSA algorithm, the problem of excessive resource consumption of RSA algorithm is solved, the computing efficiency is improved and the application scenario is expanded.

CN119070990AActive Publication Date: 2024-12-03ZHEJIANG DAHUA TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411095279.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-03
Estimated Expiration
2044-08-09

AI Technical Summary

Technical Problem

RSA algorithms require large computing resources during runtime, resulting in excessive resource consumption and limited application scenarios.

Method used

By resetting the key generation method of the RSA algorithm, the public key index e and large prime numbers p and q are randomly generated, the decryption modulus is adjusted to p with a smaller value, the public key and private key are generated, and the public key is sent to the target device Used to encrypt and decrypt data.

Benefits of technology

It reduces the resource consumption of RSA algorithms in the device, improves the computing efficiency, and expands the application scenarios of RSA algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119070990A_ABST
    Figure CN119070990A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data transmission method and device, a storage medium, electronic equipment and a program product, and the method comprises the steps: generating a public key and a private key which are included in a transmission key of an asymmetric encryption RSA algorithm through the following modes: randomly generating a public key index e which is an integer; a large prime number p and a large prime number q are randomly generated, p serves as a private key modulus, p is different from q, a first difference value and e are co-prime, and the first difference value is the difference value of p and a preset value; the public key modulus N is determined based on p and q, the private key index d is determined based on p and e, the result of the remainder of the first difference value by the first product is the preset value, and the first product is the product of d and e; determining the public key based on e and N, and determining the private key based on p and d; and sending an indication message carrying the public key to a target device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communications, and in particular, to a data transmission method, device, storage medium, electronic device, and program product. Background Art

[0002] The RSA (Rivest-Shamir-Adleman) algorithm is widely used in the field of secure data transmission. Since the RSA algorithm in the related technology requires large computing resources during operation, it has the problems of excessive resource consumption and limited application scenarios. Summary of the invention

[0003] The embodiments of the present invention provide a data transmission method, device, storage medium, electronic device and program product to at least solve the problem that the RSA algorithm in the related art requires large computing resources during operation, and therefore has excessive resource consumption and limited application scenarios.

[0004] According to one embodiment of the present invention, a data transmission method is provided, comprising: generating a public key and a private key included in a transmission key of an asymmetric encryption RSA algorithm in the following manner: randomly generating a public key exponent e, wherein e is an integer; randomly generating a large prime number p and a large prime number q, and using p as a private key modulus, wherein p is different from q, a first difference is coprime with e, and the first difference is the difference between p and a predetermined value; determining a public key modulus N based on p and q, and determining a private key exponent d based on p and e, wherein a first product modulo the first difference is the predetermined value, and the first product is the product of d and e; determining the public key based on e and N, and determining the private key based on p and d; sending an indication message carrying the public key to a target device, wherein the indication message is used to instruct the target device to encrypt target data to be transmitted based on the public key to obtain target encrypted data, and the private key is used to decrypt the target encrypted data received from the target device to obtain the target data.

[0005] In an exemplary embodiment, the predetermined value is 1.

[0006] In an exemplary embodiment, sending the indication message carrying the public key to the target device includes: sending the indication message carrying the public key to the target device under the triggering of a request message sent by the target device.

[0007] In an exemplary embodiment, the indication message also includes a first digit of p, a first encryption algorithm, a first initial vector of the first encryption algorithm, and a first rule for indicating a method for generating a first key K of the first encryption algorithm, wherein the first initial vector and k are both binary numbers of a predetermined number of digits, and the predetermined number of digits is determined by a mode of the first encryption algorithm; the indication message is used to instruct the target device to encrypt the target data in the following manner: the target device generates a random number R with a digit number equal to the first digit; the target device derives R through a key derivation function KDF according to the first rule to obtain k; when the target device determines that a second digit of the target data is an integer multiple of the predetermined digit, based on k and the first initial vector, the target data is encrypted through the first encryption algorithm to obtain first intermediate data; the target device encrypts R based on the public key and according to the RSA algorithm to obtain second intermediate data; the target device determines the target encrypted data based on the first intermediate data and the second intermediate data.

[0008] In an exemplary embodiment, the indication message is also used to instruct the target device to perform the following operations: when the target device determines that the second digit of the target data is not an integer multiple of the predetermined digit, the target data is padded so that the second digit of the target data after padding is an integer multiple of the predetermined digit.

[0009] In an exemplary embodiment, the method also includes: receiving the target encrypted data sent by the target device, and determining whether the second intermediate data included in the target encrypted data is received for the first time; when it is determined that the second intermediate data is received for the first time, based on the private key, decrypting the second intermediate data according to the RSA algorithm to obtain R; based on the first rule, deriving R through kDF to obtain k, and storing k and the second intermediate data correspondingly; based on k and the first initial vector, decrypting the first intermediate data included in the target encrypted data through the first encryption algorithm to obtain the target data.

[0010] In an exemplary embodiment, after receiving the target encrypted data sent by the target device and determining whether the second intermediate data included in the target encrypted data is received for the first time, the method further includes: when it is determined that the second intermediate data is not received for the first time, obtaining k corresponding to the pre-stored second intermediate data; based on k and the first initial vector, decrypting the first intermediate data through the first encryption algorithm to obtain the target data.

[0011] According to another embodiment of the present invention, a data transmission device is provided, comprising: a generation module, used to generate a public key and a private key included in a transmission key of an asymmetric encryption RSA algorithm in the following manner: randomly generate a public key exponent e, wherein e is an integer; randomly generate a large prime number p and a large prime number q, and use p as a private key modulus, wherein p is different from q, a first difference is coprime with e, and the first difference is the difference between p and a predetermined value; determine a public key modulus N based on p and q, and determine a private key exponent d based on p and e, wherein a first product modulo the first difference is the predetermined value, and the first product is the product of d and e; determine the public key based on e and N, and determine the private key based on p and d; a sending module, used to send an indication message carrying the public key to a target device, wherein the indication message is used to instruct the target device to encrypt the target data to be transmitted based on the public key to obtain the target encrypted data, and the private key is used to decrypt the target encrypted data received from the target device to obtain the target data.

[0012] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.

[0013] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0014] According to yet another embodiment of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0015] Through the present invention, since the decryption modulus is adjusted to a smaller value p by resetting the key generation method of the RSA algorithm, the problem of excessive resource consumption and limited application scenarios caused by the RSA algorithm in the related art requiring large computing resources during operation can be solved, thereby achieving the effect of improving the computing efficiency of the RSA algorithm, reducing the resource consumption of the device running the RSA algorithm, and expanding the application scenarios of the RSA algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a hardware structure block diagram of a mobile terminal according to a data transmission method according to an embodiment of the present invention;

[0017] Figure 2 The process of the data transmission method according to the embodiment of the present invention is as follows Figure 1 ;

[0018] Figure 3 The process of the data transmission method according to the embodiment of the present invention is as follows Figure 2 ;

[0019] Figure 4 The process of the data transmission method according to the embodiment of the present invention is as follows Figure 3 ;

[0020] Figure 5 is a schematic diagram of a data transmission method according to an embodiment of the present invention;

[0021] Figure 6 is a structural block diagram of a data transmission device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0022] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0024] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal according to a data transmission method of an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0025] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data transmission method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0026] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0027] In this embodiment, a data transmission method running on the above mobile terminal or network architecture is provided. Figure 2 The process of the data transmission method according to the embodiment of the present invention is as follows Figure 1 ,like Figure 2 As shown, the process includes the following steps:

[0028] Step S202, generating a public key and a private key included in a transmission key of an asymmetric encryption RSA algorithm in the following manner: randomly generating a public key exponent e, wherein e is an integer; randomly generating a large prime number p and a large prime number q, and using p as a private key modulus, wherein p is different from q, a first difference is coprime with e, and the first difference is a difference between p and a predetermined value; determining a public key modulus N based on p and q, and determining a private key exponent d based on p and e, wherein a first product modulo the first difference is the predetermined value, and the first product is the product of d and e; determining the public key based on e and N, and determining the private key based on p and d;

[0029] Step S204, sending an indication message carrying the public key to the target device, wherein the indication message is used to instruct the target device to encrypt the target data to be transmitted based on the public key to obtain target encrypted data, and the private key is used to decrypt the target encrypted data received from the target device to obtain the target data.

[0030] In the above steps, the execution subjects of the above steps include but are not limited to: servers, mobile terminals, embedded systems, dedicated hardware security modules (HSM), other devices that can run RSA algorithms, etc., the target devices include but are not limited to: servers, mobile terminals, embedded systems, dedicated hardware security modules (HSM), other devices that can run RSA algorithms, etc., but are not limited to this, and the target data include but are not limited to: network communication data, digital certificates, software licenses, IoT device data, mobile device data, etc. The way of sending the indication message to the target device includes but is not limited to: sending through the MQTT (Message Queuing Telemetry Transport) protocol, sending through the CoAP (Constrained Application Protocol) protocol, sending through the RESTful API (Application Programming Interface), sending through LWM2M (Lightweight Machine to Machine), sending through FTP (File Transfer Protocol) / SFTP (Secure File Transfer Protocol), etc.

[0031] In an optional embodiment, the execution subject of the above steps includes but is not limited to: an Internet of Things device, the target device includes but is not limited to: a management tool end device, and the target data includes but is not limited to: configuration information sent by the management tool end device to the Internet of Things device.

[0032] Through the above steps, since the decryption modulus is adjusted to a smaller value p by resetting the key generation method of the RSA algorithm, the amount of computation required for the device to run the RSA algorithm is reduced, and the problems of excessive resource consumption and limited application scenarios caused by the RSA algorithm in the related technology requiring large computing resources during operation are solved. The computational efficiency of the RSA algorithm is improved, the resource consumption of the device running the RSA algorithm is reduced, and the application scenarios of the RSA algorithm are expanded.

[0033] In an optional embodiment, the predetermined value is 1.

[0034] In an optional embodiment, the method for generating a transmission key of the RSA algorithm includes but is not limited to: randomly generating a public key exponent e; randomly generating two prime numbers p and q, where p and q are different, p satisfies gcd(e, (p-1)) = 1, and p is the private key modulus; determining the public key modulus N and the private key exponent d, where N = p × q, d = e -1 mod(p-1); based on the public key exponent e and the public key modulus N, determine the public key included in the transmission key, and based on the private key exponent d and the private key modulus p, determine the private key included in the transmission key.

[0035] In an optional embodiment, sending the indication message carrying the public key to the target device includes: sending the indication message carrying the public key to the target device under the triggering of a request message sent by the target device.

[0036] In the above steps, the target device sends the indication message in a manner including but not limited to: sending via the MQTT protocol, sending via the CoAP protocol, sending via a RESTful API, sending via LWM2M, sending via FTP / SFTP, etc. The length of N is the standard length of the public key modulus of the RSA algorithm, for example, the length of N is 1024 bits, the length of N is 2048 bits, and so on.

[0037] In an optional embodiment, the indication message also includes a first digit of p, a first encryption algorithm, a first initial vector of the first encryption algorithm, and a first rule for indicating a method for generating a first key K of the first encryption algorithm, wherein the first initial vector and k are both binary numbers of a predetermined number of digits, and the predetermined number of digits is determined by a mode of the first encryption algorithm; the indication message is used to instruct the target device to encrypt the target data in the following manner: the target device generates a random number R with a digit number equal to the first digit; the target device derives R through a key derivation function KDF according to the first rule to obtain k; when the target device determines that a second digit of the target data is an integer multiple of the predetermined digit, based on k and the first initial vector, the target data is encrypted through the first encryption algorithm to obtain first intermediate data; the target device encrypts R based on the public key and according to the RSA algorithm to obtain second intermediate data; the target device determines the target encrypted data based on the first intermediate data and the second intermediate data.

[0038] In the above steps, the first encryption algorithm includes but is not limited to: AES128-OFB (Advanced Encryption Standard with a 128-bit block size in Output Feedback mode), AES-CBC (Advanced Encryption Standard in Cipher Block Chaining mode), AES-ECB (Advanced Encryption Standard in Electronic Codebook mode), AES-CTR (Advanced Encryption Standard in Counter mode), AES-GCM (Advanced Encryption Standard in Galois / Counter Mode), etc. The first initial vector is a preset vector. Exemplarily, the first initial vector can be a predetermined number of 0s. The method of encrypting R according to the RSA algorithm to obtain the second intermediate data includes but is not limited to: second intermediate data=R e mod N.

[0039] Through the above steps, the data to be transmitted is encrypted by combining symmetric encryption and asymmetric encryption, thereby improving the security of data transmission.

[0040] In an optional embodiment, the indication message is also used to instruct the target device to perform the following operations: when the target device determines that the second digit of the target data is not an integer multiple of the predetermined digit, the target data is padded so that the second digit of the target data after padding is an integer multiple of the predetermined digit.

[0041] In the above steps, the target data is filled, including but not limited to: filling the target data with 0.

[0042] In an optional embodiment, the method also includes: receiving the target encrypted data sent by the target device, and determining whether the second intermediate data included in the target encrypted data is received for the first time; when it is determined that the second intermediate data is received for the first time, based on the private key, decrypting the second intermediate data according to the RSA algorithm to obtain R; based on the first rule, deriving R through kDF to obtain k, and storing k and the second intermediate data correspondingly; based on k and the first initial vector, decrypting the first intermediate data included in the target encrypted data through the first encryption algorithm to obtain the target data.

[0043] In an optional embodiment, the management tool end device regenerates R according to a predetermined rule, updates the second intermediate data, and decrypts the second intermediate data according to the RSA algorithm to obtain R, including but not limited to: R = second intermediate data d mod p, that is, R is the result of performing a modulo operation on p with respect to the eth power of the second intermediate data.

[0044] Through the above steps, the target encrypted data generated by combining symmetric encryption and asymmetric encryption is decrypted, thereby improving the security of data transmission.

[0045] In an optional embodiment, after receiving the target encrypted data sent by the target device and determining whether the second intermediate data included in the target encrypted data is received for the first time, the method further includes: when it is determined that the second intermediate data is not received for the first time, obtaining k corresponding to the pre-stored second intermediate data; based on k and the first initial vector, decrypting the first intermediate data through the first encryption algorithm to obtain the target data.

[0046] Through the above steps, since the second intermediate data and the corresponding k are pre-stored, there is no need to re-perform the RSA decryption and KDF derivation process, and the pre-stored key K is directly used, which reduces the calculation overhead and improves the decryption efficiency.

[0047] The present invention is described as a whole below in conjunction with specific embodiments:

[0048] Figure 3 The process of the data transmission method according to the embodiment of the present invention is as follows Figure 2 ,like Figure 3 As shown, the process includes the following steps:

[0049] Step S302, generating a public key exponent e;

[0050] Step S304, randomly generate two prime numbers p and q, wherein p and q are different, p satisfies gcd(e,(p-1))=1, and p is the private key modulus;

[0051] Step S306, determine the public key modulus N and the private key exponent d, where N = p × q, d = e -1 mod(p-1);

[0052] Step S308, determining the public key included in the transmission key based on the public key exponent e and the public key modulus N, and determining the private key included in the transmission key based on the private key exponent d and the private key modulus p.

[0053] In the above steps, the public key is used to encrypt the information m to obtain the ciphertext c by the following formula, and the private key is used to decrypt the ciphertext c to obtain the information m by the following formula: c=m e mod N, m = c d mod p.

[0054] In the standard RSA algorithm in the related art, the private key modulus is N. Therefore, when decrypting, it is necessary to perform a modulo calculation on N. In this scheme, the generation rule of the transmission key is adjusted, and the modulo calculation on N in the related art in the decryption calculation is adjusted to a modulo calculation on p. The lightweight of the RSA algorithm can be achieved by minimizing the length of p. Moreover, since the public key modulus in this scheme is still N, and the length of N is the standard length of the public key of the RSA algorithm (for example, RSA-1024 bits, RSA-2048 bits), this scheme can improve the decryption calculation efficiency while taking into account the compatibility of public key encryption.

[0055] Figure 4 The process of the data transmission method according to the embodiment of the present invention is as follows Figure 3 , Figure 5 is a schematic diagram of a data transmission method according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:

[0056] Step S402: After the IoT device A is initialized, it automatically generates a transmission key of the RSA algorithm.

[0057] Step S404: before sending the sensitive configuration to device A, the management tool first obtains the public key of device A, the length PL of the private key modulus p, and the algorithm type used to encrypt the sensitive configuration.

[0058] Step S406: Device A returns the public key, pL, and the algorithm type Kdf-RSA-nopadding-AES128-OFB.

[0059] Step S408: The management tool generates a random number R of length pL, derives a 16-byte symmetric key K from R through the kdf algorithm, uses K to perform AES128-OFB symmetric encryption on the sensitive configuration to obtain the ciphertext E, uses the public key of device A to perform RSA encryption on R to obtain S, and sends S+E to device A.

[0060] Step S410, device A uses private key p to decrypt S to obtain R, derives a 16-byte symmetric key K from R through the kdf algorithm, and uses K to perform AES128-OFB decryption on E to obtain plaintext sensitive information.

[0061] In the above steps, after device A performs RSA decryption on the S, it stores the S and the corresponding k accordingly. If the received S is pre-stored, it is directly decrypted using k to obtain the plaintext sensitive information. The management tool end periodically updates or regenerates the S every predetermined number of times.

[0062] In the data transmission method in the above embodiment of the present application, the key generation rules of the RSA algorithm are lightweight modified so that the modified RSA algorithm can be efficiently executed on single-chip microcomputer devices and low-performance Internet of Things devices. Without the need for customization or additional peripheral costs such as chips, it can ensure the secure transmission of sensitive information of low-performance Internet of Things devices during configuration interaction and meet the confidentiality requirements of business processes.

[0063] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented 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, 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, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0064] In this embodiment, a data transmission device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0065] Figure 6 is a structural block diagram of a data transmission device according to an embodiment of the present invention. Figure 6 As shown, the device includes: a generating module 62, which is used to generate a public key and a private key included in the transmission key of the asymmetric encryption RSA algorithm in the following manner: randomly generate a public key exponent e, wherein e is an integer; randomly generate a large prime number p and a large prime number q, and use p as a private key modulus, wherein p is different from q, a first difference is coprime with e, and the first difference is the difference between p and a predetermined value; determine the public key modulus N based on p and q, and determine the private key exponent d based on p and e, wherein the modulus of the first product to the first difference is the predetermined value, and the first product is the product of d and e; determine the public key based on e and N, and determine the private key based on p and d; a sending module 64, which is used to send an indication message carrying the public key to a target device, wherein the indication message is used to instruct the target device to encrypt the target data to be transmitted based on the public key to obtain the target encrypted data, and the private key is used to decrypt the target encrypted data received from the target device to obtain the target data.

[0066] In an optional embodiment, the predetermined value is 1.

[0067] In an optional embodiment, the sending module 64 includes: a sending unit, configured to send the indication message carrying the public key to the target device under the triggering of the request message sent by the target device.

[0068] In an optional embodiment, the indication message also includes a first digit of p, a first encryption algorithm, a first initial vector of the first encryption algorithm, and a first rule for indicating a method for generating a first key K of the first encryption algorithm, wherein the first initial vector and k are both binary numbers of a predetermined number of digits, and the predetermined number of digits is determined by a mode of the first encryption algorithm; the indication message is used to instruct the target device to encrypt the target data in the following manner: the target device generates a random number R with a digit number equal to the first digit; the target device derives R through a key derivation function KDF according to the first rule to obtain k; when the target device determines that a second digit of the target data is an integer multiple of the predetermined digit, based on k and the first initial vector, the target data is encrypted through the first encryption algorithm to obtain first intermediate data; the target device encrypts R based on the public key and according to the RSA algorithm to obtain second intermediate data; the target device determines the target encrypted data based on the first intermediate data and the second intermediate data.

[0069] In an optional embodiment, the indication message is also used to instruct the target device to perform the following operations: when the target device determines that the second digit of the target data is not an integer multiple of the predetermined digit, the target data is padded so that the second digit of the target data after padding is an integer multiple of the predetermined digit.

[0070] In an optional embodiment, the data transmission device also includes: a receiving module, used to receive the target encrypted data sent by the target device, and determine whether the second intermediate data included in the target encrypted data is received for the first time; a first decryption module, used to decrypt the second intermediate data based on the private key and the RSA algorithm to obtain R when it is determined that the second intermediate data is received for the first time; a derivation module, used to derive R through kDF based on the first rule to obtain k, and store k and the second intermediate data correspondingly; a second decryption module, used to decrypt the first intermediate data included in the target encrypted data through the first encryption algorithm based on k and the first initial vector to obtain the target data.

[0071] In an optional embodiment, the data transmission device also includes: an acquisition module, which is used to receive the target encrypted data sent by the target device, determine whether the second intermediate data included in the target encrypted data is received for the first time, and when it is determined that the second intermediate data is not received for the first time, obtain the k corresponding to the pre-stored second intermediate data; a third decryption module, which is used to decrypt the first intermediate data based on k and the first initial vector through the first encryption algorithm to obtain the target data.

[0072] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0073] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0074] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0075] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0076] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0077] An embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0078] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0079] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0080] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data transmission method, characterized in that: include: Generate a public key and a private key included in a transmission key of an asymmetric encryption RSA algorithm in the following manner: randomly generate a public key exponent e, where e is an integer; randomly generate a large prime number p and a large prime number q, and use p as a private key modulus, where p is different from q, a first difference is coprime with e, and the first difference is the difference between p and a predetermined value; determine a public key modulus N based on p and q, and determine a private key exponent d based on p and e, where a first product modulo the first difference is the predetermined value, and the first product is the product of d and e; determine the public key based on e and N, and determine the private key based on p and d; An indication message carrying the public key is sent to the target device, wherein the indication message is used to instruct the target device to encrypt the target data to be transmitted based on the public key to obtain target encrypted data, and the private key is used to decrypt the target encrypted data received from the target device to obtain the target data.

2. The method according to claim 1, characterized in that The predetermined value is 1.

3. The method according to claim 1, characterized in that Sending the indication message carrying the public key to the target device includes: sending the indication message carrying the public key to the target device under the triggering of the request message sent by the target device.

4. The method according to claim 1, characterized in that: The indication message further includes a first digit of p, a first encryption algorithm, a first initial vector of the first encryption algorithm, and a first rule for indicating a method for generating a first key K of the first encryption algorithm, wherein the first initial vector and k are both binary numbers of a predetermined number of digits, and the predetermined number of digits is determined by a mode of the first encryption algorithm; The instruction message is used to instruct the target device to encrypt the target data in the following manner: The target device generates a random number R whose number of bits is the first number of bits; The target device derives R by using a key derivation function KDF according to the first rule to obtain k; When the target device determines that the second digit of the target data is an integer multiple of the predetermined digit, based on k and the first initial vector, encrypts the target data by using the first encryption algorithm to obtain first intermediate data; The target device encrypts R based on the public key according to the RSA algorithm to obtain second intermediate data; The target device determines the target encrypted data based on the first intermediate data and the second intermediate data.

5. The method according to claim 4, characterized in that The instruction message is also used to instruct the target device to perform the following operations: When the target device determines that the second digit of the target data is not an integer multiple of the predetermined digit, the target data is padded so that the second digit of the target data after padded is an integer multiple of the predetermined digit.

6. The method according to claim 4, characterized in that The method further comprises: receiving the target encrypted data sent by the target device, and determining whether the second intermediate data included in the target encrypted data is received for the first time; When it is determined that the second intermediate data is received for the first time, decrypting the second intermediate data according to the RSA algorithm based on the private key to obtain R; Based on the first rule, derive R through kDF to obtain k, and store k and the second intermediate data correspondingly; Based on k and the first initial vector, the first intermediate data included in the target encrypted data is decrypted by the first encryption algorithm to obtain the target data.

7. The method according to claim 6, characterized in that After receiving the target encrypted data sent by the target device and determining whether the second intermediate data included in the target encrypted data is received for the first time, the method further includes: When it is determined that the second intermediate data is not received for the first time, obtaining k corresponding to the pre-stored second intermediate data; Based on k and the first initial vector, the first intermediate data is decrypted by using the first encryption algorithm to obtain the target data.

8. A data transmission device, characterized in that: include: A generation module, used to generate a public key and a private key included in a transmission key of an asymmetric encryption RSA algorithm in the following manner: randomly generate a public key exponent e, where e is an integer; randomly generate a large prime number p and a large prime number q, and use p as a private key modulus, where p is different from q, a first difference is coprime with e, and the first difference is the difference between p and a predetermined value; determine a public key modulus N based on p and q, and determine a private key exponent d based on p and e, where a first product modulo the first difference is the predetermined value, and the first product is the product of d and e; determine the public key based on e and N, and determine the private key based on p and d; A sending module is used to send an indication message carrying the public key to a target device, wherein the indication message is used to instruct the target device to encrypt the target data to be transmitted based on the public key to obtain target encrypted data, and the private key is used to decrypt the target encrypted data received from the target device to obtain the target data.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • (k,n) threshold signature method and (k,n) threshold signature device based on RSA, and electronic equipment

    CN109510709A

  • Implicit certificate key generation method based on SM2 digital signature

    CN112367175A

  • Data processing method, decryption terminal, encryption terminal and storage medium

    CN116226874A

  • Public resource transaction data encryption and decryption method and system based on block chain, and medium

    CN117294429A

  • Text security transmission system and text security encryption and decryption method

    CN117978519A