CN109543434B - Block chain information encryption method, decryption method, storage method and device - Google Patents
Block chain information encryption method, decryption method, storage method and device Download PDFInfo
- Publication number
- CN109543434B CN109543434B CN201811437176.8A CN201811437176A CN109543434B CN 109543434 B CN109543434 B CN 109543434B CN 201811437176 A CN201811437176 A CN 201811437176A CN 109543434 B CN109543434 B CN 109543434B
- Authority
- CN
- China
- Prior art keywords
- key
- random
- user
- block chain
- keys
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Bioethics (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Databases & Information Systems (AREA)
- Storage Device Security (AREA)
Abstract
The invention relates to a block chain information encryption method, a block chain information decryption method, a block chain information storage method and a block chain information storage device. The block chain information encryption method is used for encrypting multi-user interaction information and comprises the following steps: an original encryption step, namely encrypting the original text by a random key to obtain a ciphertext; a key generation step, namely generating a pair of random public keys and random private keys, and then respectively calculating the random private keys and more than 1 user public keys by adopting an encryption algorithm to respectively obtain independent common keys; a secondary encryption step, wherein random keys are respectively encrypted through each common key to obtain an independent identification key; the user public key, the common secret key and the identification secret key are in one-to-one correspondence. The invention can realize the secret decryption in the multi-user interaction forms of group chat, forum, microblog and the like, so that a wider social function can be realized on the block chain, and the invention has high encryption security and keeps good user experience.
Description
Technical Field
The present invention relates to a block chain encryption technology, and in particular, to a block chain information encryption method, a block chain information decryption method, a block chain information storage method, and a block chain information storage device.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. In a narrow sense, the blockchain is a distributed account book which is a chain data structure formed by combining data blocks in a sequential connection mode according to a time sequence and is guaranteed in a cryptographic mode and cannot be tampered and forged. Broadly, the blockchain technique is a completely new distributed infrastructure and computing approach that utilizes blockchain data structures to verify and store data, utilizes distributed node consensus algorithms to generate and update data, utilizes cryptography to secure data transmission and access, and utilizes intelligent contracts composed of automated script code to program and manipulate data.
At present, the social tool on the blockchain has privacy problems because once the data is linked, the data is public data and can be seen by all people. If it is desired that the data on the social tools (e.g., instant chat tools, forums, etc.) stored in the blockchain not be seen by unauthorized third parties, the data must be stored encrypted, and the biggest problem now is that the blockchain cannot effectively encrypt the multi-person interaction information. Therefore, there is a need to develop a technology for effectively encrypting and decrypting interactive information on a blockchain.
Disclosure of Invention
The present invention provides a method for encrypting and decrypting block chain information, a method for storing block chain information, and a device thereof.
In order to achieve the purpose, the invention adopts the following technical scheme:
the block chain information encryption method is used for encrypting multi-user interaction information and comprises the following steps:
an original encryption step, namely encrypting the original text by a random key to obtain a ciphertext;
a key generation step, namely generating a pair of random public keys and random private keys, and then respectively calculating the random private keys and the user public keys of each user participating in interaction by adopting an encryption algorithm to respectively obtain independent common keys;
a secondary encryption step, wherein random keys are respectively encrypted through each common key to obtain an independent identification key;
the user public key, the common secret key and the identification secret key are in one-to-one correspondence.
Further, in the key generation step, a pair of random public key and random private key of the ECDH is generated, and then the random private key and more than 1 user public key are respectively operated by using an ECDH algorithm to respectively obtain a single common key.
Further, the user public key is an etherhouse public key, and the user public key is paired with the user public key to form a user private key.
The invention also discloses a block chain information decryption method, which is used for decrypting the ciphertext obtained by the block chain information encryption method; the information decryption method comprises the following steps: acquiring a user private key corresponding to the user public key, and respectively carrying out decryption operation on the random public key and the user private key by adopting an encryption algorithm to obtain an independent common key; decrypting the identification key by using the obtained common key to obtain a random key; and decrypting the ciphertext by using the obtained random key.
The invention also discloses another block chain information decryption method, which is used for decrypting the ciphertext obtained by the block chain information encryption method; the information decryption method comprises the following steps: acquiring a user private key corresponding to the user public key, and respectively carrying out decryption operation on the random public key and the user private key by adopting an ECDH algorithm to obtain a common key; decrypting the identification key by using the obtained common key to obtain a random key; and decrypting the ciphertext by using the obtained random key.
The invention also discloses a block chain information storage method, which stores the ciphertext, the identification key and the random public key obtained by the block chain information encryption method in the block chain. A check code is arranged behind/in front of the storage bit of each random public key and used for checking the random secret key. And a check code is arranged behind/in front of the storage bit of the ciphertext and used for checking the original text.
The invention also discloses an electronic device, comprising: a processor; and a memory having computer readable instructions stored thereon which, when executed by the processor, implement the above encryption method, decryption method and storage method.
The present invention also discloses a computer-readable storage medium on which a computer program is stored, the computer program implementing the above encryption method, decryption method and storage method when executed by a processor.
Compared with the prior art, the invention has the beneficial effects that: the random key of the encrypted original text is encrypted through the common key, the common key is obtained through the operation of the random private key and each user public key participating in interaction, only the ciphertext, the random public key and all identification keys need to be stored when the common key is stored on the block chain, only the data stored on the block chain is intercepted under the condition that other people cannot know the user private key, and an unauthorized third party cannot see the content of the ciphertext. By the method, the cryptograph and the decrypted cryptograph are simultaneously stored and decrypted at one time for multiple users on the block chain, the confidential decryption in multi-user interaction modes such as group chat, forum and microblog can be realized, a wider social function can be realized on the block chain, the encryption safety is high, and good user experience is kept.
Drawings
Fig. 1 is a flow chart illustrating a block chain information encryption method according to the present invention.
FIG. 2 is a block chain information storage method according to the present invention.
Detailed Description
In order to more fully understand the technical contents of the present invention, the technical solutions of the present invention will be further described and illustrated with reference to the following specific embodiments.
The blockchain information encryption method of the embodiment can encrypt multi-user interaction information, so that the method can be applied to blockchain technology. The block chain information encryption method of the embodiment comprises an original encryption step, a key generation step and a secondary encryption step. The original encryption step and the key generation step are not in sequence and can be carried out simultaneously, and the secondary encryption step can be carried out only after the other two steps are finished.
The purpose of the original encryption step is to encrypt the original text first. The information encryption method can be applied to the social interaction of multiple persons, and the original text can be chat information or a sent file. In the original encryption step, a random key is generated, and then the original text is encrypted by the random key to obtain a ciphertext. Only one random key is corresponding to one original text, and the random key can be used for encrypting the original text by adopting symmetric encryption, asymmetric encryption or a Hash algorithm. In this embodiment, the random key is used to encrypt the original text by using an AES algorithm in a symmetric encryption algorithm. When decrypting, the original text can be decrypted as long as the ciphertext and the corresponding random key exist.
The purpose of the key generation step is to generate a common key for encrypting the random key. In the key generation step, a pair of random public key and random private key is generated firstly, then the random private key is respectively operated with the user public key of each user in the social interaction of multiple persons by adopting an encryption algorithm to respectively obtain independent common keys, and at the moment, each common key corresponds to each user one to one. Each account of the etherhouse is defined by a pair of keys, a Private Key (Private Key) and a Public Key (Public Key). In this embodiment, the user public key is an etherhouse public key, and the user public key in pair is a user private key. The key generation step of this embodiment adopts the ECDH algorithm, that is: firstly, a pair of random public key and random private key of ECDH is temporarily generated, and then the ECDH algorithm is adopted to calculate the random private key and the user public key of each interactive user, so as to obtain a common key corresponding to the user public key. The ECDH is an existing algorithm, under the condition that a pair of private key and public key exists, a pair of random private key and random public key is generated temporarily, and the result obtained by ECDH operation of the random private key and the existing public key is the same as the result obtained by ECDH operation of the random public key and the existing private key. The common secret key can also be obtained by performing ECDH operation on the random public key and the user private key, which is the mode adopted during decryption.
In the secondary encryption step, the same random key is encrypted through each common key to obtain a plurality of independent identification keys, and the user public key, the common key and the identification keys are in one-to-one correspondence relationship. The common secret key can be used for encrypting the random secret key in a symmetric encryption mode, an asymmetric encryption mode or a Hash algorithm. In the embodiment, the common key is used for encrypting the random key by adopting an AES _ CBC algorithm in a symmetric encryption algorithm. During decryption, the random key can be decrypted as long as the identification key and the corresponding common key exist. And the decrypted random key is subjected to one-time verification, and the decrypted random key is directly quitted without passing the verification and prompts that the opening fails. In addition, each user participating in the interaction needs to decrypt the random key in the decryption process, wherein even if some users fail to decrypt the random key, the decryption of other users on the random key is not influenced.
Correspondingly, the block chain information decryption method of the present embodiment is used for decrypting the ciphertext obtained by the block chain information encryption method of the present embodiment. The information decryption method comprises the following steps: firstly, acquiring a user private key corresponding to a user public key of each interactive user, and respectively carrying out decryption operation on the random public key and each user private key by adopting an encryption algorithm to obtain an independent common key; then, the obtained common secret keys are used for decrypting the identification secret keys respectively to obtain random secret keys; and finally, decrypting the ciphertext by using the obtained random key.
In this embodiment, the user public key is an etherhouse public key, and thus the corresponding user private key is an etherhouse private key. The encryption method of the embodiment adopts the ECDH algorithm, so that after the user private key of each interactive user is obtained, the ECDH algorithm is adopted to calculate the random public key and the user private key to obtain the common key corresponding to each user. The AES _ CBC used in the encryption method of this embodiment encrypts the random key, so the AES _ CBC mode is correspondingly used in the decryption method to decrypt the identification key with the common key to restore the original random key. In the encryption method of the embodiment, the AES is used for encrypting the original text, so that the encrypted text is decrypted and restored by the restored random key in the AES mode during the decryption method. And the original text obtained after decryption and reduction needs to be verified, and the original text which does not pass the verification is directly quitted and the failure of opening is prompted.
The blockchain information storage method of this embodiment is used to store the ciphertext, the identification key, and the random public key obtained by the blockchain information encryption method of this embodiment in the blockchain, and other information of the information encryption method of this embodiment is not stored, such as the common key, the random private key, the plaintext, the user private key, and the user public key. As shown in fig. 2, a check code is arranged behind/in front of the storage bit of each random public key for checking the random secret key, and a check code is arranged behind/in front of the storage bit of the ciphertext for checking the original text, and any place needs to directly quit and prompt the opening failure without passing the check. The verification method may employ the MD5 algorithm.
The present embodiment further includes an electronic device, which includes: a processor; and a memory on which computer-readable instructions are stored, the computer-readable instructions, when executed by the processor, implementing the information encryption method, the information decryption method, and the information storage method of the present embodiment.
The present embodiment also includes a computer-readable storage medium on which a computer program is stored, the computer program, when executed by a processor, implementing the information encryption method, the information decryption method, and the information storage method of the present embodiment. Computer media refers to any substance capable of storing information, including without limitation various ROMs, RAMs, mechanical memories, solid state memories, portable memories, and the like.
The above-mentioned description is only for the purpose of further explaining the technical contents of the present invention by way of example, so as to facilitate the reader's understanding, but does not represent a limitation to the embodiments of the present invention, and any technical extension or re-creation made by the present invention is protected by the present invention.
Claims (7)
1. The block chain information encryption method is used for encrypting multi-user interaction information and comprises the following steps:
an original encryption step, namely encrypting the original text by a random key to obtain a ciphertext;
a key generation step, namely generating a pair of random public keys and random private keys of the ECDH, and then respectively calculating the random private keys and the user public key of each user participating in interaction by adopting an ECDH algorithm to respectively obtain separate common keys;
a second encryption step, wherein the random key is encrypted by each common key to obtain an independent identification key;
the user public key, the common secret key and the identification secret key are in one-to-one correspondence;
the user public key is an Ether house public key, the user public key and the user public key form a pair to be a user private key, and the user private key is the Ether house private key.
2. A block chain information decryption method for decrypting a ciphertext obtained by the block chain information encryption method of claim 1; the information decryption method comprises the following steps:
acquiring a user private key corresponding to a user public key, and respectively carrying out decryption operation on the random public key and the user private key by adopting an ECDH algorithm to obtain the common key;
decrypting the identification key by using the obtained common key to obtain the random key;
and decrypting the ciphertext by using the obtained random key.
3. A blockchain information storage method, characterized by storing the ciphertext, the identification key, and the random public key obtained by the blockchain information encryption method according to claim 1 in a blockchain.
4. The blockchain information storage method according to claim 3, wherein a check code for checking the random key is provided after/before a storage bit of each of the random public keys.
5. The method for storing block chain information according to claim 3, wherein a check code is provided after/before the storage bit of the ciphertext for checking the ciphertext.
6. An electronic device, comprising:
a processor; and
a memory having computer readable instructions stored thereon which, when executed by the processor, implement the method of any of claims 1 to 5.
7. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811437176.8A CN109543434B (en) | 2018-11-28 | 2018-11-28 | Block chain information encryption method, decryption method, storage method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811437176.8A CN109543434B (en) | 2018-11-28 | 2018-11-28 | Block chain information encryption method, decryption method, storage method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109543434A CN109543434A (en) | 2019-03-29 |
CN109543434B true CN109543434B (en) | 2020-10-09 |
Family
ID=65850972
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811437176.8A Active CN109543434B (en) | 2018-11-28 | 2018-11-28 | Block chain information encryption method, decryption method, storage method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109543434B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110336774B (en) * | 2019-04-17 | 2021-07-27 | 中国联合网络通信集团有限公司 | Mixed encryption and decryption method, equipment and system |
CN110059503B (en) * | 2019-04-24 | 2023-03-24 | 成都派沃特科技股份有限公司 | Traceable social information anti-leakage method |
CN110084599B (en) * | 2019-04-28 | 2021-04-20 | 百度在线网络技术(北京)有限公司 | Key processing method, device, equipment and storage medium |
CN110750803B (en) * | 2019-10-18 | 2021-04-09 | 支付宝(杭州)信息技术有限公司 | Method and device for providing and fusing data |
CN110889128A (en) * | 2019-11-27 | 2020-03-17 | 上海禾一网络科技有限公司 | Input method and device based on block chain storage and encryption key exchange |
CN111294203B (en) * | 2020-01-22 | 2022-02-11 | 腾讯科技(深圳)有限公司 | Information transmission method |
CN116055048B (en) * | 2023-03-31 | 2023-05-30 | 成都四方伟业软件股份有限公司 | Method and device for storing and restoring scattered keys |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104202158A (en) * | 2014-09-22 | 2014-12-10 | 浪潮电子信息产业股份有限公司 | Data symmetric and asymmetric hybrid encryption and decryption method based on cloud computing |
CN104868996A (en) * | 2014-02-25 | 2015-08-26 | 中兴通讯股份有限公司 | Data encryption and decryption method, device thereof, and terminal |
Family Cites Families (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7426745B2 (en) * | 2003-04-24 | 2008-09-16 | International Business Machines Corporation | Methods and systems for transparent data encryption and decryption |
CN103618607B (en) * | 2013-11-29 | 2016-07-06 | 北京信长城技术研究院 | A kind of Security Data Transmission and key exchange method |
IN2014CH00681A (en) * | 2014-02-13 | 2015-08-14 | Infosys Ltd | |
CN104394155B (en) * | 2014-11-27 | 2017-12-12 | 暨南大学 | It can verify that multi-user's cloud encryption keyword searching method of integrality and completeness |
CN104967516B (en) * | 2015-07-24 | 2018-04-24 | 四川理工学院 | Multi-user's encryption data may compare encryption method and encryption data comparative approach |
US20170178127A1 (en) * | 2015-12-18 | 2017-06-22 | International Business Machines Corporation | Proxy system mediated legacy transactions using multi-tenant transaction database |
CN107979584B (en) * | 2016-11-22 | 2019-08-13 | 南京银链信息科技有限公司 | Block chain information hierarchical sharing method and system |
CN107038578B (en) * | 2017-04-19 | 2020-10-16 | 浙江数秦科技有限公司 | Multi-signature transaction information processing method in data transaction platform based on block chain |
CN107426170B (en) * | 2017-05-24 | 2019-08-09 | 阿里巴巴集团控股有限公司 | A kind of data processing method and equipment based on block chain |
CN108768988B (en) * | 2018-05-17 | 2021-01-05 | 深圳前海微众银行股份有限公司 | Block chain access control method, block chain access control equipment and computer readable storage medium |
-
2018
- 2018-11-28 CN CN201811437176.8A patent/CN109543434B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104868996A (en) * | 2014-02-25 | 2015-08-26 | 中兴通讯股份有限公司 | Data encryption and decryption method, device thereof, and terminal |
CN104202158A (en) * | 2014-09-22 | 2014-12-10 | 浪潮电子信息产业股份有限公司 | Data symmetric and asymmetric hybrid encryption and decryption method based on cloud computing |
Also Published As
Publication number | Publication date |
---|---|
CN109543434A (en) | 2019-03-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109543434B (en) | Block chain information encryption method, decryption method, storage method and device | |
US6125185A (en) | System and method for encryption key generation | |
CN109495274B (en) | Decentralized intelligent lock electronic key distribution method and system | |
US9485096B2 (en) | Encryption / decryption of data with non-persistent, non-shared passkey | |
US20110145576A1 (en) | Secure method of data transmission and encryption and decryption system allowing such transmission | |
US10057060B2 (en) | Password-based generation and management of secret cryptographic keys | |
CN106104562A (en) | Safety of secret data stores and recovery system and method | |
CN104243149B (en) | Encrypt and Decrypt method, device and server | |
US20080165965A1 (en) | Method of two strings private key (symmetric) encryption and decryption algorithm | |
CN103795533A (en) | Id-based encryption and decryption method, and apparatus for executing same | |
JP2010220212A (en) | Securing communications sent by first user to second user | |
CN102833246A (en) | Social video information security method and system | |
CN106130716A (en) | Cipher key exchange system based on authentication information and method | |
CN108768647B (en) | Random number generation method for block chain | |
CN103095452A (en) | Random encryption method needing to adopt exhaustion method for deciphering | |
Oktaviana et al. | Three-pass protocol implementation in caesar cipher classic cryptography | |
CN101325483B (en) | Method and apparatus for updating symmetrical cryptographic key, symmetrical ciphering method and symmetrical deciphering method | |
CN115883052A (en) | Data encryption method, data decryption method, device and storage medium | |
JP2024511236A (en) | Computer file security encryption method, decryption method and readable storage medium | |
Saikumar | DES-Data Encryption Standard | |
CN111541652B (en) | System for improving security of secret information keeping and transmission | |
Olumide et al. | A hybrid encryption model for secure cloud computing | |
CN109347923A (en) | Anti- quantum calculation cloud storage method and system based on unsymmetrical key pond | |
CN109743162A (en) | A kind of operated using ideal lattice carries out the matched encryption method of identity attribute | |
CN106257859A (en) | A kind of password using method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |