CN110100422B - Data writing method and device based on block chain intelligent contract and storage medium - Google Patents

Data writing method and device based on block chain intelligent contract and storage medium Download PDF

Info

Publication number
CN110100422B
CN110100422B CN201780002394.6A CN201780002394A CN110100422B CN 110100422 B CN110100422 B CN 110100422B CN 201780002394 A CN201780002394 A CN 201780002394A CN 110100422 B CN110100422 B CN 110100422B
Authority
CN
China
Prior art keywords
block chain
account
information
key
ciphertext
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
Application number
CN201780002394.6A
Other languages
Chinese (zh)
Other versions
CN110100422A (en
Inventor
谢辉
王健
周阳
陈敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cloudminds Shanghai Robotics Co Ltd
Original Assignee
Cloudminds Robotics Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Cloudminds Robotics Co Ltd filed Critical Cloudminds Robotics Co Ltd
Publication of CN110100422A publication Critical patent/CN110100422A/en
Application granted granted Critical
Publication of CN110100422B publication Critical patent/CN110100422B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols

Abstract

A data writing method, a data writing device and a storage medium based on a block chain intelligent contract are used for protecting privacy information of a block chain account. The method comprises the following steps: encrypting the information to be encrypted of the first block chain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first block chain account; encrypting the symmetric secret key according to the public key of the first block chain account to obtain a secret key ciphertext of the first block chain account; and writing the information ciphertext of the first block chain account and the key ciphertext of the first block chain account into a block chain where the first block chain account is located through an intelligent contract.

Description

Data writing method and device based on block chain intelligent contract and storage medium
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method and an apparatus for writing data based on a blockchain intelligent contract, and a storage medium.
Background
The Block chain technology is a distributed, decentralized and distrust-free network data consensus storage technology, and achieves the synchronization problem of distributed computing based on a unique Block (Block) generation mechanism and a P2P (Point to Point) network communication mechanism.
For a traditional public blockchain, the transaction information of any blockchain account is public, and any blockchain account can view the transaction information of other blockchain accounts. However, the transaction information of the blockchain account may include privacy information (e.g., user identity information), and the conventional public blockchain cannot protect the privacy information well.
Disclosure of Invention
The main purpose of the present disclosure is to provide a data writing method, device and storage medium based on a blockchain intelligent contract, which are used to protect privacy information of a blockchain account.
In order to achieve the above object, a first aspect of the present disclosure provides a data writing method based on a block chain intelligent contract, including:
encrypting the information to be encrypted of the first block chain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first block chain account;
encrypting the symmetric secret key according to the public key of the first block chain account to obtain a secret key ciphertext of the first block chain account;
and writing the information ciphertext of the first block chain account and the key ciphertext of the first block chain account into a block chain where the first block chain account is located through an intelligent contract.
A second aspect of the present disclosure provides a data writing apparatus based on a block chain intelligent contract, including:
the first encryption module is used for encrypting the information to be encrypted of the first block chain account according to a pre-acquired symmetric key to obtain an information ciphertext of the first block chain account;
the second encryption module is used for encrypting the symmetric secret key according to the public key of the first block chain account to obtain a secret key ciphertext of the first block chain account;
and the writing module is used for writing the information ciphertext of the first block chain account and the key ciphertext of the first block chain account into the block chain where the first block chain account is located through an intelligent contract.
A third aspect of the present disclosure provides a data writing apparatus based on a blockchain intelligent contract, including:
at least one processor unit, a communication interface, a memory, and a communication bus; the at least one processor unit, the communication interface and the memory are communicated with each other through the communication bus;
the memory is configured to store program code;
the at least one processor unit is configured to execute the program code to implement the method of the first aspect.
A fourth aspect of the present disclosure provides a computer-readable storage medium for storing a computer program comprising instructions for performing the method of the first aspect.
By adopting the technical scheme, the information ciphertext of the first block chain account and the key ciphertext of the first block chain account are stored in the block chain through an intelligent contract, the key ciphertext of the first block chain account can be decrypted only through a private key, and then the information ciphertext of the first block chain account is decrypted to obtain the information to be encrypted of the first block chain account, and the private key of the first block chain account can only be known by the private key and can not be known by other block chain accounts on the block chain, so that the other block chain accounts on the block chain can not decrypt the key ciphertext of the first block chain account, the information ciphertext of the first block chain account can not be further decrypted, and the information to be encrypted of the first block chain account can not be obtained. Therefore, the protection of the information to be encrypted of the first block chain account is realized by adopting the method.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flowchart of a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure.
Fig. 2 is a schematic flowchart of encryption in a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure.
Fig. 3 is a schematic flowchart of decryption in a data writing method based on a block chain smart contract according to an embodiment of the present disclosure.
Fig. 4 is another schematic flowchart of a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure.
Fig. 5 is another schematic flowchart of a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure.
Fig. 6 is a schematic structural diagram of a data writing apparatus based on a block chain smart contract according to an embodiment of the present disclosure.
Fig. 7 is a schematic structural diagram of another data writing apparatus based on a block chain intelligent contract according to an embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
The embodiment of the present disclosure provides a data writing method based on a block chain intelligent contract, and fig. 1 is a schematic flow diagram of the data writing method based on the block chain intelligent contract provided by the embodiment of the present disclosure, as shown in fig. 1, the method includes the following steps:
step S101: encrypting the information to be encrypted of the first block chain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first block chain account;
step S102: encrypting the symmetric secret key according to the public key of the first block chain account to obtain a secret key ciphertext of the first block chain account;
step S103: and writing the information ciphertext of the first block chain account and the key ciphertext of the first block chain account into a block chain where the first block chain account is located through an intelligent contract.
The first blockchain account may be any blockchain account in the blockchain in which the first blockchain account is located. The information to be encrypted for the first blockchain account includes, but is not limited to: private information (e.g., user identity information) of the first blockchain account itself or public information of the first blockchain account itself. Accordingly, the first blockchain account executes the data writing method based on the blockchain intelligent contract provided by the embodiment of the disclosure, and protects the private information of the first blockchain account or the public information of the first blockchain account. Optionally, for the public information of the first blockchain account, since the public information is public information, the first blockchain account directly writes the public information into the blockchain where the first blockchain account is located, so as to accelerate the data processing speed and improve the data processing efficiency.
Optionally, before step S101, the method further includes:
receiving information to be encrypted sent by the terminal equipment outside the block chain;
and determining the received information to be encrypted as the information to be encrypted of the first block chain account.
The information to be encrypted for the first blockchain account may be provided by any terminal, device or system, etc. outside the blockchain. Illustratively, the information to be encrypted is information to be encrypted, which is sent from a terminal device outside the blockchain where the first blockchain account is located. For a terminal device outside a blockchain where a first blockchain account is located, sending information that needs to be encrypted to the first blockchain account, and executing, by the first blockchain account, the data writing method based on the blockchain intelligent contract provided by the embodiment of the present disclosure to protect the information that needs to be encrypted by the terminal device.
The obtaining method of the symmetric key obtained in advance in step S101 includes, but is not limited to, the following two embodiments:
the first embodiment: and before encrypting the information to be encrypted of the first block chain account every time, randomly generating the symmetric key, and acquiring the randomly generated symmetric key.
The second embodiment: and before encrypting the information to be encrypted of the first block chain account for the first time, randomly generating the symmetric key, and acquiring the first randomly generated symmetric key.
With the first implementation manner, before encrypting information to be encrypted each time, the first blockchain account randomly generates a symmetric key, and performs steps S101 to S102 by using the randomly generated symmetric key this time. Since the rule for generating the symmetric key is randomly generated each time, the symmetric key generated by the first blockchain account at each time is different, and thus the symmetric key used by the first blockchain account at each time of performing steps S101 to S102 is different.
With the second implementation manner, before encrypting the information to be encrypted for the first time, the first blockchain account randomly generates a symmetric key, and performs steps S101 to S102 by using the symmetric key generated randomly for the first time. After the first random generation of the symmetric key, the first block chain account uses the first random generated symmetric key every time steps S101-S102 are performed thereafter. That is, as long as the first blockchain account randomly generates the symmetric key before encrypting the information to be encrypted for the first time, the symmetric key generated randomly for the first time is fixed as the symmetric key used by the first blockchain account to perform steps S101 to S102, and thus the symmetric keys used by the first blockchain account to perform steps S101 to S102 are the same.
After the first blockchain account obtains the symmetric key in advance, steps S101 to S102 are performed. Fig. 2 is a schematic flowchart of encryption in a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure. As shown in fig. 2, on one hand, the first blockchain account encrypts the information to be encrypted of the first blockchain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first blockchain account; on the other hand, the first block chain account encrypts the pre-acquired symmetric key according to the public key of the first block chain account to obtain a key ciphertext of the first block chain account. The information ciphertext of the first blockchain account and the key ciphertext of the first blockchain account form a digital envelope, so that the first blockchain account completes encryption of the information to be encrypted and the pre-acquired symmetric key in the form of the digital envelope.
After the first blockchain account has executed steps S101-S102, step S103 is executed, and the information ciphertext of the first blockchain account obtained by executing step S101 and the key ciphertext of the first blockchain account obtained by executing step S102 are both written into the blockchain where the first blockchain account is located through the smart contract. The information ciphertext of the first block chain account and the key ciphertext of the first block chain account are stored in the block chain, the key ciphertext of the first block chain account can be decrypted only through the private key, and then the information ciphertext of the first block chain account is decrypted to obtain the information to be encrypted of the first block chain account, and the private key of the first block chain account is only known by the private key and is not known to other block chain accounts on the block chain, so that the key ciphertext of the first block chain account cannot be decrypted by other block chain accounts on the block chain, the information ciphertext of the first block chain account cannot be further decrypted, and the information to be encrypted of the first block chain account cannot be obtained. Therefore, the protection of the information to be encrypted of the first block chain account is realized by adopting the method.
Optionally, after step S103, the method further comprises:
establishing a first mapping relation between the first blockchain account and the information ciphertext of the first blockchain account and the key ciphertext of the first blockchain account respectively;
according to the first blockchain account, based on the first mapping relation, reading an information ciphertext of the first blockchain account and a key ciphertext of the first blockchain account from the blockchain;
decrypting the cipher key ciphertext of the first block chain account according to the private key of the first block chain account to obtain the symmetric cipher key;
and decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
After the first blockchain account has performed step S103, the information to be encrypted is included in the information ciphertext of the first blockchain account and is stored on the blockchain where the first blockchain account is located. If the information to be encrypted needs to be obtained, firstly, the information ciphertext of the first block chain account and the key ciphertext of the first block chain account need to be read from the block chain where the first block chain account is located. Embodiments of reading include, but are not limited to, the following:
after step S103 is executed, a mapping relationship (i.e., a first mapping relationship) between the first blockchain account and the information ciphertext of the first blockchain account and the key ciphertext of the first blockchain account is first established, so that the information ciphertext of the first blockchain account and the key ciphertext of the first blockchain account are queried from the blockchain where the first blockchain account is located through the first mapping relationship and the first blockchain account, and are read out.
Fig. 3 is a schematic flowchart of decryption in a data writing method based on a block chain smart contract according to an embodiment of the present disclosure. After the information ciphertext of the first block chain account and the key ciphertext of the first block chain account are read, as shown in fig. 3, the first block chain account decrypts the read key ciphertext by using its own private key to obtain a symmetric key, and then decrypts the read information ciphertext by using the symmetric key to obtain the information to be encrypted.
The above embodiment is applicable to the case where the information to be encrypted is only disclosed for the first blockchain account and is kept secret for other blockchain accounts except for the first blockchain account.
Optionally, in another embodiment, the information to be encrypted is disclosed to the first blockchain account and the second blockchain account, and is kept secret from other blockchain accounts except the first blockchain account and the second blockchain account, wherein the number of the second blockchain accounts is one or more. Correspondingly, the information to be encrypted of the first blockchain account is public information of a second blockchain account, and the first blockchain account and the second blockchain account belong to the same blockchain; fig. 4 is another schematic flowchart of a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure. As shown in fig. 4, the method further includes, in addition to steps S101-S103:
step S104: encrypting the symmetric secret key according to the public key of the second block chain account to obtain a secret key ciphertext of the second block chain account;
step S105: and writing the information ciphertext of the first block chain account and the key ciphertext of the second block chain account into the block chain through an intelligent contract.
Optionally, after step S105, the method further comprises:
establishing a second mapping relation between the second blockchain account and the information ciphertext of the first blockchain account and the key ciphertext of the second blockchain account respectively;
according to the second blockchain account, based on the second mapping relation, reading an information ciphertext of the first blockchain account and a key ciphertext of the second blockchain account from the blockchain;
decrypting the cipher key ciphertext of the second block chain account according to the private key of the second block chain account to obtain the symmetric cipher key;
and decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
Wherein steps S104-S105 are similar to steps S102-S103. After the first blockchain account obtains the symmetric key in advance, steps S101 to S102 and step S104 are performed. On one hand, the first block chain account encrypts the information to be encrypted of the first block chain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first block chain account; on the other hand, the first block chain account encrypts the pre-acquired symmetric key according to the public key of the first block chain account to obtain a key ciphertext of the first block chain account, and the first block chain account encrypts the pre-acquired symmetric key according to the public key of the second block chain account to obtain a key ciphertext of the second block chain account. The information ciphertext of the first blockchain account and the key ciphertext of the first blockchain account form a digital envelope, and the information ciphertext of the first blockchain account and the key ciphertext of the second blockchain account form another digital envelope, so that the first blockchain account completes encryption of the information to be encrypted and the pre-acquired symmetric key in the form of two digital envelopes.
After the first blockchain account has performed steps S101-S102 and step S104, step S103 and step S105 are performed. The process of the first blockchain account executing step S105 is: the information ciphertext of the first blockchain account obtained by executing the step S101 and the key ciphertext of the second blockchain account obtained by executing the step S104 are both written into a blockchain where the first blockchain account and the second blockchain account are commonly located through an intelligent contract. Since the information ciphertext of the first blockchain account and the key ciphertext of the second blockchain account are stored in the blockchain, the key ciphertext of the second blockchain account can be decrypted only by the private key of the second blockchain account, or, the private key of the first blockchain account can be used to decrypt the cipher text of the first blockchain account, further decrypting the information ciphertext of the first blockchain account to obtain the information to be encrypted of the first blockchain account, while the private key of the first blockchain account and the private key of the second blockchain account are respectively only known to themselves and not to other blockchain accounts on the blockchain, therefore, other blockchain accounts on the blockchain cannot decrypt the key ciphertext of the first blockchain account and the key ciphertext of the second blockchain account, and cannot further decrypt the information ciphertext of the first blockchain account, so that the to-be-encrypted information of the first blockchain account cannot be obtained. Therefore, only the protection of the information to be encrypted is realized by adopting the method.
After the first blockchain account obtains the symmetric key in advance, steps S101 to S102 are performed. As shown in fig. 2, on one hand, the first blockchain account encrypts the information to be encrypted of the first blockchain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first blockchain account; on the other hand, the first block chain account encrypts the pre-acquired symmetric key according to the public key of the first block chain account to obtain a key ciphertext of the first block chain account. The information ciphertext and the key ciphertext actually form a "digital envelope" such that the first blockchain account completes the encryption of the information to be encrypted and the pre-acquired symmetric key in the form of a "digital envelope".
After the first blockchain account has executed steps S101-S102, step S103 is executed, and the information ciphertext of the first blockchain account obtained by executing step S101 and the key ciphertext of the first blockchain account obtained by executing step S102 are both written into the blockchain where the first blockchain account is located through the smart contract. The information ciphertext and the key ciphertext are stored in the block chain, the key ciphertext can be decrypted only through the private key of the first block chain account, the information ciphertext is decrypted, and the information to be encrypted is obtained. Therefore, the method realizes that the information to be encrypted is only disclosed for the first blockchain account and the second blockchain account.
Fig. 5 is another schematic flowchart of a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure. The following describes a data writing method based on a block chain intelligent contract according to an embodiment of the present disclosure, with reference to fig. 5, taking the employee information managed by the staff member of the company as an example.
When a personnel specially-assigned person inputs the employee information of a certain employee, only the personnel specially-assigned person and the employee are allowed to check the private information of the employee, such as name, identity card, mailbox, wage and the like, and the private information is kept secret for other persons; and public information such as prize evaluation, evaluation and reimbursement of employees and the like is allowed to be checked by all the employees. Therefore, when the private information is input, a computer (used as a first block chain account) used by a personnel specially-assigned person randomly generates a symmetric key, and the private information is encrypted to form an information ciphertext; then, the public key of the first block chain account and the public key of the computer (as a second block chain account) used by the employee are used for encrypting the symmetric keys respectively to form two key ciphertexts. And then writing the information ciphertext and the two key ciphertexts into a blockchain where the first blockchain account and the second blockchain account are located together through the intelligent contract. For the above disclosure, the information is written directly into the block chain. Fig. 5 illustrates an example of a key ciphertext, where the key ciphertext and the message ciphertext form a digital envelope, and the digital envelope is stored in the block chain via a smart contract.
After the information is input according to the above manner, the private information of the employee can decrypt the corresponding private key ciphertext only through the private key of the employee (i.e., the private key of the second blockchain account) or the private key of the personnel (i.e., the private key of the first blockchain account), and then decrypt the information ciphertext to check the private information of the employee.
Based on the same inventive concept, the embodiment of the present disclosure further provides a data writing device based on the intelligent block chain contract, which is used for executing the data writing method based on the intelligent block chain contract provided by the embodiment of the present disclosure. Fig. 6 is a schematic structural diagram of a data writing apparatus based on a block chain smart contract according to an embodiment of the present disclosure. As shown in fig. 6, the data writing apparatus 600 based on the blockchain intelligent contract includes:
the first encryption module 601 is configured to encrypt information to be encrypted of the first block chain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first block chain account;
a second encryption module 602, configured to encrypt the symmetric key according to the public key of the first block chain account to obtain a key ciphertext of the first block chain account;
a first writing module 603, configured to write the information ciphertext of the first blockchain account and the key ciphertext of the first blockchain account into a blockchain where the first blockchain account is located through an intelligent contract.
Optionally, the apparatus further comprises:
the first establishing module is used for establishing a first mapping relation between the first block chain account and the information ciphertext of the first block chain account and the key ciphertext of the first block chain account;
a first reading module, configured to read, according to the first blockchain account and based on the first mapping relationship, an information ciphertext of the first blockchain account and a key ciphertext of the first blockchain account from the blockchain;
the first decryption module is used for decrypting the cipher key ciphertext of the first block chain account according to the private key of the first block chain account to obtain the symmetric cipher key;
and the second decryption module is used for decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
Optionally, the information to be encrypted of the first blockchain account is public information of a second blockchain account, and the first blockchain account and the second blockchain account belong to the same blockchain; the device further comprises:
the third encryption module is configured to encrypt the symmetric key according to the public key of the second block chain account to obtain a key ciphertext of the second block chain account;
and the second writing module is used for writing the information ciphertext of the first block chain account and the key ciphertext of the second block chain account into the block chain through an intelligent contract.
Optionally, the apparatus further comprises:
the second establishing module is used for establishing a second mapping relation between the second block chain account and the information ciphertext of the first block chain account and the key ciphertext of the second block chain account;
a second reading module, configured to read, according to the second blockchain account and based on the second mapping relationship, an information ciphertext of the first blockchain account and a key ciphertext of the second blockchain account from the blockchain where the second blockchain account is located;
the third decryption module is configured to decrypt the key ciphertext of the second block chain account according to the private key of the second block chain account to obtain the symmetric key;
and the fourth decryption module is used for decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
Optionally, the apparatus further comprises:
the first obtaining module is used for randomly generating the symmetric secret key before encrypting the information to be encrypted of the first block chain account every time, and obtaining the randomly generated symmetric secret key; or
And the second obtaining module is used for randomly generating the symmetric key before encrypting the information to be encrypted of the first block chain account for the first time, and obtaining the symmetric key randomly generated for the first time.
Optionally, the apparatus further comprises:
the receiving module is used for receiving information to be encrypted sent by the terminal equipment outside the block chain;
the determining module is configured to determine the received information to be encrypted as the information to be encrypted of the first blockchain account.
It should be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the modules of the block generation apparatus described above may refer to corresponding processes in the foregoing method embodiments, and are not described herein again.
In addition, the above division of the block generation device composition module is only one logic function division, and there may be another division manner in actual implementation. Moreover, the physical implementation of each module may also be in various ways, which is not limited by the present disclosure.
Based on the same inventive concept, an embodiment of the present disclosure further provides a data writing device based on a block chain intelligent contract, and fig. 7 is a schematic structural diagram of another data writing device based on a block chain intelligent contract according to an embodiment of the present disclosure. As shown in fig. 7, the data writing device 110 based on the block chain intelligent contract includes:
at least one processor unit (such as processor unit 111 shown in fig. 7), a communication interface 112, a memory 113, and a communication bus 114; the at least one processor unit, the communication interface 112 and the memory 113 are in communication with each other via the communication bus 114;
the memory 113 is configured to store program code, and the at least one processor unit is configured to execute the program code to implement the data writing method based on the blockchain intelligent contract provided by the embodiment of the present disclosure, which is specifically described with reference to the above method embodiment.
The disclosed embodiments also provide a non-transitory computer-readable storage medium, such as the memory 113, including instructions executable by a processor of the apparatus 110 to perform the method for writing data based on the blockchain intelligent contract provided by the disclosed embodiments. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that the various features described in the above embodiments may be combined in any suitable manner without departing from the scope of the invention. In order to avoid unnecessary repetition, various possible combinations will not be separately described in this disclosure.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (12)

1. A data writing method based on a block chain intelligent contract is characterized by comprising the following steps:
encrypting the information to be encrypted of the first block chain account according to a pre-obtained symmetric key to obtain an information ciphertext of the first block chain account; wherein the information to be encrypted comprises private information or public information related to the first blockchain account and private information or public information related to the second blockchain account, and the first blockchain account and the second blockchain account belong to the same blockchain;
encrypting the symmetric secret key according to the public key of the first block chain account to obtain a secret key ciphertext of the first block chain account;
encrypting the symmetric secret key according to the public key of the second block chain account to obtain a private key ciphertext of the second block chain account;
and writing the information ciphertext of the first block chain account, the key ciphertext of the first block chain account and the key ciphertext of the second block chain account into the block chain through an intelligent contract.
2. The method according to claim 1, wherein after writing the information ciphertext of the first blockchain account and the key ciphertext of the first blockchain account into the blockchain in which the first blockchain account is located through a smart contract, the method further comprises:
establishing a first mapping relation between the block chain account of the first block chain account and the information ciphertext of the first block chain account and the key ciphertext of the first block chain account respectively;
reading an information ciphertext of the first blockchain account and a key ciphertext of the first blockchain account from the blockchain based on the first mapping relation according to the blockchain account of the first blockchain account;
decrypting the cipher key ciphertext of the first block chain account according to the private key of the first block chain account to obtain the symmetric cipher key;
and decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
3. The method of claim 1, wherein after writing the information ciphertext for the first blockchain account, the key ciphertext for the first blockchain account, and the key ciphertext for the second blockchain account into the blockchain via a smart contract, the method further comprises:
establishing a second mapping relation between the block chain account of the second block chain account and the information ciphertext of the first block chain account and the key ciphertext of the second block chain account respectively;
reading an information ciphertext of the first block chain account and a key ciphertext of the second block chain account from a block chain where the first block chain account is located based on the second mapping relation according to the block chain account of the second block chain account;
decrypting the cipher key ciphertext of the second block chain account according to the private key of the second block chain account to obtain the symmetric cipher key;
and decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
4. The method according to claim 1, wherein before encrypting the information to be encrypted of the first blockchain account according to a pre-obtained symmetric key, the method further comprises:
before encrypting the information to be encrypted of the first block chain account every time, randomly generating the symmetric secret key, and acquiring the randomly generated symmetric secret key; or
And before encrypting the information to be encrypted of the first block chain account for the first time, randomly generating the symmetric key, and acquiring the first randomly generated symmetric key.
5. The method according to claim 1, wherein before encrypting the information to be encrypted of the first blockchain account according to a pre-obtained symmetric key, the method further comprises:
receiving information to be encrypted sent by the terminal equipment outside the block chain;
and determining the received information to be encrypted as the information to be encrypted of the first block chain account.
6. A data writing apparatus based on a blockchain intelligent contract, comprising:
the first encryption module is used for encrypting the information to be encrypted of the first block chain account according to a pre-acquired symmetric key to obtain an information ciphertext of the first block chain account; wherein the information to be encrypted comprises private information or public information related to the first blockchain account and private information or public information related to the second blockchain account, and the first blockchain account and the second blockchain account belong to the same blockchain;
the second encryption module is used for encrypting the symmetric secret key according to the public key of the first block chain account to obtain a secret key ciphertext of the first block chain account;
the second encryption module is further configured to encrypt the symmetric key according to the public key of the second block chain account to obtain a private key ciphertext of the second block chain account;
and the first writing module is used for writing the information ciphertext of the first block chain account, the key ciphertext of the first block chain account and the key ciphertext of the second block chain account into the block chain through an intelligent contract.
7. The apparatus of claim 6, further comprising:
the first establishing module is used for establishing a first mapping relation between the block chain account of the first block chain account and the information ciphertext of the first block chain account and the key ciphertext of the first block chain account;
a first reading module, configured to read, according to a blockchain account of the first blockchain account, an information ciphertext of the first blockchain account and a key ciphertext of the first blockchain account from the blockchain based on the first mapping relationship;
the first decryption module is used for decrypting the cipher key ciphertext of the first block chain account according to the private key of the first block chain account to obtain the symmetric cipher key;
and the second decryption module is used for decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
8. The apparatus of claim 6, further comprising:
a second establishing module, configured to establish a second mapping relationship between the blockchain account of the second blockchain account and the information ciphertext of the first blockchain account and the key ciphertext of the second blockchain account, respectively;
a second reading module, configured to read, according to the block chain account of the second block chain account and based on the second mapping relationship, an information ciphertext of the first block chain account and a key ciphertext of the second block chain account from the block chain where the first block chain account is located;
the third decryption module is configured to decrypt the key ciphertext of the second block chain account according to the private key of the second block chain account to obtain the symmetric key;
and the fourth decryption module is used for decrypting the information ciphertext of the first block chain account according to the symmetric key to obtain the information to be encrypted of the first block chain account.
9. The apparatus of claim 6, further comprising:
the first obtaining module is used for randomly generating the symmetric secret key before encrypting the information to be encrypted of the first block chain account every time, and obtaining the randomly generated symmetric secret key; or
And the second obtaining module is used for randomly generating the symmetric key before encrypting the information to be encrypted of the first block chain account for the first time, and obtaining the symmetric key randomly generated for the first time.
10. The apparatus of claim 6, further comprising:
the receiving module is used for receiving information to be encrypted sent by the terminal equipment outside the block chain;
the determining module is configured to determine the received information to be encrypted as the information to be encrypted of the first blockchain account.
11. A data writing apparatus based on a blockchain intelligent contract, comprising:
at least one processor unit, a communication interface, a memory, and a communication bus; the at least one processor unit, the communication interface and the memory are communicated with each other through the communication bus;
the memory is configured to store program code;
the at least one processor unit is configured to execute the program code to implement the method of any of claims 1-5.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program which can be executed by a processor to implement the method according to any of claims 1-5.
CN201780002394.6A 2017-12-28 2017-12-28 Data writing method and device based on block chain intelligent contract and storage medium Active CN110100422B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/119559 WO2019127265A1 (en) 2017-12-28 2017-12-28 Blockchain smart contract-based data writing method, device and storage medium

Publications (2)

Publication Number Publication Date
CN110100422A CN110100422A (en) 2019-08-06
CN110100422B true CN110100422B (en) 2021-11-05

Family

ID=67062944

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201780002394.6A Active CN110100422B (en) 2017-12-28 2017-12-28 Data writing method and device based on block chain intelligent contract and storage medium

Country Status (2)

Country Link
CN (1) CN110100422B (en)
WO (1) WO2019127265A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110335151B (en) * 2019-07-09 2022-12-20 郭小川 Centralized language prediction machine matched with intelligent contract application, information output method and system
CN112787976B (en) * 2019-11-06 2023-04-07 阿里巴巴集团控股有限公司 Data encryption, decryption and sharing method, device, system and storage medium
CN111369236B (en) * 2020-02-19 2023-07-07 建信金融科技有限责任公司 Data management method and device applied to blockchain
CN111736783A (en) * 2020-06-23 2020-10-02 湖南天河国云科技有限公司 Self-service printing method based on block chain
CN112019348B (en) * 2020-08-26 2022-02-11 合肥工业大学 Smart phone cloud positioning method based on block chain privacy protection
CN112261015B (en) * 2020-10-12 2023-05-12 北京沃东天骏信息技术有限公司 Information sharing method, platform, system and electronic equipment based on block chain
CN114726560A (en) * 2020-12-22 2022-07-08 富泰华工业(深圳)有限公司 Data protection method, computer device and readable storage medium
CN114760081A (en) * 2020-12-28 2022-07-15 富泰华工业(深圳)有限公司 File encryption and decryption method and device and electronic equipment
CN115023920B (en) * 2021-11-05 2024-01-19 富途网络科技(深圳)有限公司 Method and device for data processing in a equity incentive system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106330452A (en) * 2016-08-13 2017-01-11 深圳市樊溪电子有限公司 Security network attachment device and method for block chain
CN106534097A (en) * 2016-10-27 2017-03-22 上海亿账通区块链科技有限公司 Block chain trading based authority control method and system
CN107294709A (en) * 2017-06-27 2017-10-24 阿里巴巴集团控股有限公司 A kind of block chain data processing method, apparatus and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10013573B2 (en) * 2015-12-16 2018-07-03 International Business Machines Corporation Personal ledger blockchain

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106330452A (en) * 2016-08-13 2017-01-11 深圳市樊溪电子有限公司 Security network attachment device and method for block chain
CN106534097A (en) * 2016-10-27 2017-03-22 上海亿账通区块链科技有限公司 Block chain trading based authority control method and system
CN107294709A (en) * 2017-06-27 2017-10-24 阿里巴巴集团控股有限公司 A kind of block chain data processing method, apparatus and system

Also Published As

Publication number Publication date
CN110100422A (en) 2019-08-06
WO2019127265A1 (en) 2019-07-04

Similar Documents

Publication Publication Date Title
CN110100422B (en) Data writing method and device based on block chain intelligent contract and storage medium
CN101765996B (en) Device and method for remote authentication and transaction signatures
US11930103B2 (en) Method, user device, management device, storage medium and computer program product for key management
US11210658B2 (en) Constructing a distributed ledger transaction on a cold hardware wallet
CN103067160A (en) Method and system of generation of dynamic encrypt key of encryption secure digital memory card (SD)
CN101789865A (en) Dedicated server used for encryption and encryption method
CN103378971B (en) A kind of data encryption system and method
CN101720071A (en) Short message two-stage encryption transmission and secure storage method based on safety SIM card
EP4150879A1 (en) Constructing a distributed ledger transaction on a cold hardware wallet
CN108667784B (en) System and method for protecting internet identity card verification information
CN112953974B (en) Data collision method, device, equipment and computer readable storage medium
CN104243149A (en) Encrypting and decrypting method, device and server
CN109543434A (en) Block chain information encryption method, decryption method, storage method and device
US11431489B2 (en) Encryption processing system and encryption processing method
CN109842589A (en) A kind of cloud storage encryption method, device, equipment and storage medium
CN111262852B (en) Business card signing and issuing method and system based on block chain
CN110113162A (en) A kind of sensitive information processing system, method and its equipment
CN111245771A (en) Instant message encryption and decryption method, device, equipment and storage medium
CN105577650A (en) Remote time synchronization method and system of one-time password (OTP)
CN106257859A (en) A kind of password using method
CN114374518B (en) PSI (program specific information) intersection information acquisition method and device with intersection counting function and storage medium
TWI611316B (en) Text processing method for safe input method, text processing device and text processing system
CN110419195A (en) Data managing method and system in IOT lightweight terminal environments based on proxy re-encryption
CN115499118A (en) Message key generation method, message key generation device, file encryption method, message key decryption method, file encryption device, file decryption device and medium
CN105681027A (en) HSM encrypted information synchronization method, device and system

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
TA01 Transfer of patent application right

Effective date of registration: 20210304

Address after: 201111 2nd floor, building 2, no.1508, Kunyang Road, Minhang District, Shanghai

Applicant after: Dalu Robot Co.,Ltd.

Address before: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant before: Shenzhen Qianhaida Yunyun Intelligent Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 201111 Building 8, No. 207, Zhongqing Road, Minhang District, Shanghai

Patentee after: Dayu robot Co.,Ltd.

Address before: 201111 2nd floor, building 2, no.1508, Kunyang Road, Minhang District, Shanghai

Patentee before: Dalu Robot Co.,Ltd.

CP03 Change of name, title or address