A data encryption and decryption method, device and medium based on blockchain

By using encoding and random number generation technology on the blockchain, combining the public keys of multiple nodes for data encryption, the problem of symmetric key propagation security risks in the existing technology is solved, and high-security data encryption is achieved.

CN111934878BActive Publication Date: 2025-02-21INSPUR YUNZHOU (SHANDONG) IND INTERNET CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010603403.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-29
Publication Date
2025-02-21
Estimated Expiration
2040-06-29

AI Technical Summary

Technical Problem

When encrypting data in the prior art, there are security risks in generating and spreading symmetric keys, and the security of encrypted data cannot be guaranteed.

Method used

Using a blockchain-based data encryption method, by encoding the original data, multiple random numbers and node public keys are generated, the first encryption factor and the second encryption factor are determined, and combined into encrypted data and sent to the block. chain.

Benefits of technology

Encrypting the public keys and random numbers of multiple nodes ensures that other nodes cannot know the random numbers, thus greatly ensuring the security of the encrypted data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111934878B_ABST
    Figure CN111934878B_ABST
Patent Text Reader

Abstract

The present application discloses a data encryption and decryption method, device and medium based on blockchain, including: encoding original data to obtain a preset encoding result; obtaining multiple random numbers through random number generation, and obtaining public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm; determining a first encryption factor according to the preset encoding result, multiple random numbers and the public keys of multiple nodes; obtaining a base point of the preset algorithm, and respectively calculating the multiple random numbers with the base point of the preset algorithm to determine multiple second encryption factors; combining the first encryption factor and the multiple second encryption factors into encrypted data in a preset order, and sending the encrypted data to the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data encryption and decryption method, device and medium based on blockchain. Background Art

[0002] In the blockchain system, the data on the chain is tamper-proof, but at the same time, the data is visible to all members. Therefore, for the purpose of privacy protection, sensitive data on the chain usually needs to be encrypted using a data encryption algorithm.

[0003] When encrypting data, symmetric encryption algorithms are mostly used. However, in existing symmetric encryption algorithms, security risks may arise when generating and disseminating symmetric keys, and the security of encrypted data cannot be guaranteed. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a blockchain-based data encryption and decryption method, device and medium to solve the problem of insecure data encryption in the prior art.

[0005] The present application embodiment adopts the following technical solutions:

[0006] The present application provides a data encryption method based on blockchain, the method comprising:

[0007] Encode the original data to obtain a preset encoding result;

[0008] Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm;

[0009] Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes;

[0010] Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors;

[0011] The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

[0012] It should be noted that the embodiment of the present application first encodes the original data to obtain a preset encoding result, then determines the first encryption factor based on the preset encoding result, multiple random numbers and the public keys of multiple nodes, and then determines the first encryption factor based on the preset algorithm. Finally, the first encryption factor and the second encryption factor are combined to encrypt the data. The encrypted data is encrypted using the public keys of multiple nodes and multiple random numbers. Since other nodes cannot know the random numbers, the security of the encrypted data can be greatly guaranteed.

[0013] Furthermore, the public key of the node is determined based on the private key of the node and a base point of the preset algorithm.

[0014] Furthermore, the preset algorithm is an elliptic curve digital signature algorithm, and the public key of the node is a point on the elliptic curve.

[0015] It should be noted that the public key and private key obtained according to the elliptic curve data signature algorithm satisfy that the private key is a positive integer, the public key is a point on the elliptic curve, and there is also a base point. The public key can be obtained by calculating the private key and the base point.

[0016] Furthermore, encoding the original data to obtain a preset encoding result specifically includes:

[0017] Convert the raw data into a hexadecimal number of a preset length;

[0018] Using the hexadecimal number of the preset length as the x-coordinate of the elliptic curve in the elliptic curve digital signature algorithm;

[0019] The y coordinate of the corresponding elliptic curve is determined according to the x coordinate of the elliptic curve, and the y coordinate of the elliptic curve is used as the preset encoding result.

[0020] Furthermore, the number of the nodes is set to at least four.

[0021] It should be noted that the greater the number of nodes, the higher the security of the original data encryption.

[0022] The present application also provides a blockchain-based data decryption method, the method comprising:

[0023] Receive a decryption factor sent by each node, wherein the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, the private key of the node is obtained by a preset algorithm, and the public key of the node is determined according to the private key of the node and the base point of the preset algorithm;

[0024] Add multiple decryption factors to get the decryption key;

[0025] Obtaining a first encryption factor in the encrypted data on the blockchain;

[0026] Subtract the decryption key from the first encryption factor to obtain a preset encoding result;

[0027] The preset encoding result is inversely encoded to determine the original data.

[0028] It should be noted that the public key and private key in the embodiment of the present application are determined by a preset algorithm, and the public key of the node is determined based on the private key of the node and the base point of the preset algorithm. The private keys of multiple nodes can be used to decrypt the encrypted data.

[0029] Furthermore, the preset algorithm is an elliptic curve digital signature algorithm, and the private key of the node is a positive integer.

[0030] The present application also provides a blockchain-based data encryption device, the device comprising:

[0031] at least one processor; and,

[0032] a memory communicatively connected to the at least one processor; wherein,

[0033] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0034] Encode the original data to obtain a preset encoding result;

[0035] Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm;

[0036] Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes;

[0037] Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors;

[0038] The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

[0039] The embodiment of the present application also provides a blockchain-based data encryption medium, which stores computer executable instructions, and the computer executable instructions are configured as follows:

[0040] Encode the original data to obtain a preset encoding result;

[0041] Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm;

[0042] Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes;

[0043] Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors;

[0044] The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

[0045] The embodiment of the present application also provides a data decryption device based on blockchain, the device comprising:

[0046] at least one processor; and,

[0047] a memory communicatively connected to the at least one processor; wherein,

[0048] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0049] Receive a decryption factor sent by each node, wherein the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, and the private key of the node is obtained by a preset algorithm;

[0050] Add multiple decryption factors to get the decryption key;

[0051] Obtaining a first encryption factor in the encrypted data on the blockchain;

[0052] Subtract the decryption key from the first encryption factor to obtain a preset encoding result;

[0053] The preset encoding result is inversely encoded to determine the original data.

[0054] The embodiment of the present application also provides a blockchain-based data decryption medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:

[0055] Receive a decryption factor sent by each node, wherein the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, and the private key of the node is obtained by a preset algorithm;

[0056] Add multiple decryption factors to get the decryption key;

[0057] Obtaining a first encryption factor in the encrypted data on the blockchain;

[0058] Subtract the decryption key from the first encryption factor to obtain a preset encoding result;

[0059] The preset encoding result is inversely encoded to determine the original data.

[0060] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:

[0061] 1. The embodiment of the present application first encodes the original data to obtain a preset encoding result, then determines the first encryption factor according to the preset encoding result, multiple random numbers and the public keys of multiple nodes, and then determines the first encryption factor according to the preset algorithm, and finally composes the first encryption factor and the second encryption factor into encrypted data. The encrypted data is encrypted by the public keys of multiple nodes and multiple random numbers. Since other nodes cannot know the random numbers, the security of the encrypted data can be greatly guaranteed;

[0062] 2. The public key and private key in the embodiment of the present application are determined by a preset algorithm, and the public key of the node is determined based on the private key of the node and the base point of the preset algorithm. The private keys of multiple nodes can be used to decrypt the encrypted data. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0064] Figure 1 A flowchart of a data encryption method based on blockchain provided in Example 1 of this specification;

[0065] Figure 2 A flowchart of a blockchain-based data decryption method provided in Example 2 of this specification. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0067] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0068] Figure 1 This is a flowchart of a data encryption method based on blockchain provided in Embodiment 1 of this specification. In Embodiment 1 of this specification, the subsequent steps may be performed by the encryption node, which may specifically include:

[0069] Step S101: The encryption node encodes the original data to obtain a preset encoding result.

[0070] In step S101 of the embodiment of the present specification, encoding the original data to obtain a preset encoding result may specifically include:

[0071] Convert the raw data into a hexadecimal number of a preset length;

[0072] Using the hexadecimal number of the preset length as the x-coordinate of the elliptic curve in the elliptic curve digital signature algorithm;

[0073] The y coordinate of the corresponding elliptic curve is determined according to the x coordinate of the elliptic curve, and the y coordinate of the elliptic curve is used as the preset encoding result. Wherein, the y coordinates of the two corresponding elliptic curves are determined according to the x coordinate of the elliptic curve, and the y coordinate of one of the elliptic curves can be used as the preset encoding result, for example, the point with the smaller y coordinate can be used as the preset encoding result. The x coordinate and y coordinate of the elliptic curve are both positive numbers.

[0074] In step S102, the encryption node obtains multiple random numbers through random number generation, and obtains public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm.

[0075] In step S102 of the embodiment of the present specification, the public key of the node may be determined based on the private key of the node and the base point of the preset algorithm.

[0076] The preset algorithm may be an elliptic curve digital signature algorithm, which is a simulation of the digital signature algorithm (DSA) using elliptic curve cryptography (ECC). The private key obtained by the preset algorithm may be a relatively large positive integer, the public key may be a point on the elliptic curve, and the following relationship exists between the node public key and the private key:

[0077] Q=d*G, where Q is the public key of the node, d is the private key of the node, G is the base point of the elliptic curve in the elliptic curve digital signature algorithm, and * is the operation in the elliptic curve digital signature algorithm (not a multiplication operation).

[0078] It should be noted that the private key d of a node cannot be obtained by calculating the public key Q of the node and the base point G.

[0079] It should be noted that the random number generator may be an existing random number generator.

[0080] Step S103: The encryption node determines a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes.

[0081] In step S103 of the embodiment of this specification, the number of nodes is set to at least four. The more nodes there are, the higher the security of encrypting the original data. The following takes four nodes as an example for detailed description:

[0082] If the preset algorithm is an elliptic curve digital signature algorithm, the preset encoding result should be a point on the elliptic curve, and the preset encoding result can be recorded as M. The number of nodes is the same as the number of public keys, and the node public keys can be recorded as Q1, Q2, Q3 and Q4 respectively. The number of public keys is the same as the number of random numbers, and the number of random numbers can be recorded as r1, r2, r3 and r4. The first encryption factor can be determined according to the following formula:

[0083] C=M+r1*Q1+r2*Q2+r3*Q3+r4*Q4, where C is the first encryption factor and * is the operation in the elliptic curve digital signature algorithm.

[0084] Step S104: The encryption node obtains a base point of the preset algorithm, and respectively calculates the multiple random numbers with the base point of the preset algorithm to determine multiple second encryption factors.

[0085] In step S104 of the embodiment of the present specification, following step S103, the second encryption factor can be determined by the following formula:

[0086] E1=r1*G;

[0087] E2=r2*G;

[0088] E3=r3*G;

[0089] E4=r4*G;

[0090] Among them, E1 is the first second encryption factor, E2 is the second second encryption factor, E3 is the third second encryption factor, E4 is the fourth second encryption factor, G is the base point of the elliptic curve in the elliptic curve digital signature algorithm, and * is the operation in the elliptic curve digital signature algorithm.

[0091] Step S105: The encryption node combines the first encryption factor and the multiple second encryption factors into encrypted data in a preset order, and sends the encrypted data to the blockchain.

[0092] In step S105 of the embodiment of this specification, following step S104, the encrypted data can be determined by the following formula:

[0093] (C, E1, E2, E3, E4).

[0094] It should be noted that this order is not unique, and the first encryption factor and the plurality of second encryption factors may be arranged in a variety of orders.

[0095] The embodiment of the present application first encodes the original data to obtain a preset encoding result, then determines the first encryption factor based on the preset encoding result, multiple random numbers and public keys of multiple nodes, and then determines the first encryption factor based on a preset algorithm. Finally, the first encryption factor and the second encryption factor are combined to encrypt the data. The encrypted data is encrypted using the public keys of multiple nodes and multiple random numbers. Since other nodes cannot know the random numbers, the security of the encrypted data can be greatly guaranteed.

[0096] Corresponding to the first embodiment of this specification is, Figure 2 This is a flowchart of a data decryption method based on blockchain provided in Embodiment 2 of this specification. In this embodiment of the specification, the subsequent steps may be performed by the decryption node, which may specifically include:

[0097] Step S201: The decryption node receives the decryption factor sent by each node.

[0098] In step S201 of the embodiment of the present specification, the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, and the private key of the node is obtained by a preset algorithm. The preset algorithm may be an elliptic curve digital signature algorithm.

[0099] In step S201 of the embodiment of this specification, the number of nodes is set to at least four. The more nodes there are, the higher the security of encrypting the original data. The following takes four nodes as an example for detailed description:

[0100] If the preset algorithm is the elliptic curve digital signature algorithm, the preset encoding result should be a point on the elliptic curve, and the preset encoding result can be recorded as M. The number of nodes is the same as the number of public keys, and the public keys of the nodes can be recorded as Q1, Q2, Q3 and Q4 respectively, and the private keys of the nodes are recorded as d1, d2, d3 and d4 respectively. The number of public keys is the same as the number of random numbers, and the number of random numbers can be recorded as r1, r2, r3 and r4. The second encryption factors are E1, E2, E3 and E4 respectively, and the decryption factor can be determined according to the following formula:

[0101] D1 = d1 * E1;

[0102] D2=d2*E2;

[0103] D3=d3*E3;

[0104] D4=d4*E4;

[0105] Wherein, D1 is the first decryption factor, D2 is the second decryption factor, D3 is the third decryption factor, D4 is the fourth decryption factor, and * is the operation in the elliptic curve digital signature algorithm.

[0106] It should be noted that the node's private key d1 cannot be obtained by calculating the first decryption factor D1 and the first second encryption factor E1, the node's private key d2 cannot be obtained by calculating the first decryption factor D2 and the first second encryption factor E2, the node's private key d3 cannot be obtained by calculating the first decryption factor D3 and the first second encryption factor E3, and the node's private key d4 cannot be obtained by calculating the first decryption factor D4 and the first second encryption factor E4.

[0107] Step S202: The decryption node adds multiple decryption factors to obtain a decryption key.

[0108] In step S202 of the embodiment of the present specification, following step S201, multiple decryption factors are added, which can be specifically referred to in the following formula:

[0109] D = D1 + D2 + D3 + D4;

[0110] Among them, D is the decryption key.

[0111] Step S203: The decryption node obtains the first encryption factor in the encrypted data on the blockchain.

[0112] In step S203 of the embodiment of this specification, the encrypted data has been uploaded to the blockchain in the first embodiment of this specification, and the decryption node can obtain the first encryption factor in the encrypted data on the blockchain. The specific formula is:

[0113] C=M+r1*Q1+r2*Q2+r3*Q3+r4*Q4;

[0114] Among them, C is the first encryption factor, r1, r2, r3 and r4 are four random numbers, and Q1, Q2, Q3 and Q4 are the public keys of four nodes.

[0115] Step S204: The decryption node subtracts the decryption key from the first encryption factor to obtain a preset encoding result.

[0116] In step S204 of the embodiment of this specification, the specific formula may be:

[0117] CD=M+r1*Q1+r2*Q2+r3*Q3+r4*Q4-d1*E1-d2*E2-d3*E3-d4*E4;

[0118] Q=d*G, so Q1=d1*G, Q2=d2*G, Q3=d3*G, Q4=d4*G;

[0119] Furthermore, given that E1=r1*G, E2=r2*G, E3=r3*G, E4=r4*G, we can conclude that:

[0120] CD=M+r1*d1*G+r2*d2*G+r3*d3*G+r4*d4*G-d1*r1*G-d2*r2*G-d3*r3*G-d4*r4*G=M;

[0121] Wherein, G is the base point of the elliptic curve in the elliptic curve digital signature algorithm, and * is the operation in the elliptic curve digital signature algorithm.

[0122] Step S205: the decryption node reverses the preset encoding result to determine the original data.

[0123] In step S205 of the embodiment of the present specification, the preset encoding result can be inversely encoded in combination with the encoding method in step S101 to determine the original data.

[0124] The public key and the private key in the embodiment of the present application are determined by a preset algorithm, and the public key of the node is determined based on the private key of the node and the base point of the preset algorithm. The private keys of multiple nodes can be used to complete the decryption of encrypted data.

[0125] The present application also provides a blockchain-based data encryption device, the device comprising:

[0126] at least one processor; and,

[0127] a memory communicatively connected to the at least one processor; wherein,

[0128] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0129] Encode the original data to obtain a preset encoding result;

[0130] Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm;

[0131] Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes;

[0132] Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors;

[0133] The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

[0134] The embodiment of the present application also provides a blockchain-based data encryption medium, which stores computer executable instructions, and the computer executable instructions are configured as follows:

[0135] Encode the original data to obtain a preset encoding result;

[0136] Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm;

[0137] Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes;

[0138] Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors;

[0139] The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

[0140] The embodiment of the present application also provides a data decryption device based on blockchain, the device comprising:

[0141] at least one processor; and,

[0142] a memory communicatively connected to the at least one processor; wherein,

[0143] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0144] Receive a decryption factor sent by each node, wherein the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, and the private key of the node is obtained by a preset algorithm;

[0145] Add multiple decryption factors to get the decryption key;

[0146] Obtaining a first encryption factor in the encrypted data on the blockchain;

[0147] Subtract the decryption key from the first encryption factor to obtain a preset encoding result;

[0148] The preset encoding result is inversely encoded to determine the original data.

[0149] The embodiment of the present application also provides a blockchain-based data decryption medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:

[0150] Receive a decryption factor sent by each node, wherein the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, and the private key of the node is obtained by a preset algorithm;

[0151] Add multiple decryption factors to get the decryption key;

[0152] Obtaining a first encryption factor in the encrypted data on the blockchain;

[0153] Subtract the decryption key from the first encryption factor to obtain a preset encoding result;

[0154] The preset encoding result is inversely encoded to determine the original data.

[0155] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0156] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0157] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0158] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0159] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take 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 code.

[0160] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0161] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0162] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0163] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0164] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0165] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

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

[0167] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0168] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0169] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A data encryption method based on blockchain, characterized in that: The method comprises: Encode the original data to obtain a preset encoding result; Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm; Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes; Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors; The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

2. The data encryption method based on blockchain according to claim 1 is characterized in that: The public key of the node is determined based on the private key of the node and the base point of the preset algorithm.

3. The data encryption method based on blockchain according to claim 2 is characterized in that: The preset algorithm is an elliptic curve digital signature algorithm, and the public key of the node is a point on the elliptic curve.

4. The data encryption method based on blockchain according to claim 3 is characterized in that: The encoding of the original data to obtain a preset encoding result specifically includes: Convert the raw data into a hexadecimal number of a preset length; Using the hexadecimal number of the preset length as the x-coordinate of the elliptic curve in the elliptic curve digital signature algorithm; The y coordinate of the corresponding elliptic curve is determined according to the x coordinate of the elliptic curve, and the y coordinate of the elliptic curve is used as the preset encoding result.

5. The data encryption method based on blockchain according to claim 1 is characterized in that: The number of the nodes is set to at least four.

6. A data decryption method based on blockchain, characterized in that: The method comprises: Receive a decryption factor sent by each node, wherein the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, the private key of the node is obtained by a preset algorithm, and the public key of the node is determined according to the private key of the node and the base point of the preset algorithm; Add multiple decryption factors to get the decryption key; Obtaining a first encryption factor in the encrypted data on the blockchain; Subtract the decryption key from the first encryption factor to obtain a preset encoding result; The preset encoding result is inversely encoded to determine the original data.

7. The data decryption method based on blockchain according to claim 6 is characterized in that: The preset algorithm is an elliptic curve digital signature algorithm, and the private key of the node is a positive integer.

8. A data encryption device based on blockchain, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Encode the original data to obtain a preset encoding result; Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm; Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes; Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors; The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

9. A data encryption medium based on blockchain, storing computer executable instructions, characterized in that: The computer executable instructions are configured to: Encode the original data to obtain a preset encoding result; Obtain multiple random numbers through random number generation, and obtain public keys of multiple nodes on the blockchain, wherein the number of the random numbers is the same as the number of the public keys, and the public keys are obtained through a preset algorithm; Determine a first encryption factor according to the preset encoding result, multiple random numbers, and public keys of multiple nodes; Obtaining a base point of the preset algorithm, and performing operations on the multiple random numbers and the base point of the preset algorithm respectively to determine multiple second encryption factors; The first encryption factor and the plurality of second encryption factors are combined into encrypted data in a preset order, and the encrypted data is sent to the blockchain.

10. A data decryption device based on blockchain, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Receive a decryption factor sent by each node, wherein the decryption factor is obtained by calculating the corresponding second encryption factor and the corresponding private key of each node, the number of the second encryption factors is the same as the number of the decryption factors, and the private key of the node is obtained by a preset algorithm; Add multiple decryption factors to get the decryption key; Obtaining a first encryption factor in the encrypted data on the blockchain; Subtract the decryption key from the first encryption factor to obtain a preset encoding result; The preset encoding result is inversely encoded to determine the original data.

Citation Information

Patent Citations

  • Blockchain data processing method, device and system

    CN107294709A

  • Encryption and decryption method and device for block chain database, equipment and storage medium thereof

    CN109802940A