Data processing method based on block chain and related equipment

文档序号:1478688 发布日期:2020-02-25 浏览:2次 中文

阅读说明:本技术 基于区块链的数据处理方法及相关设备 (Data processing method based on block chain and related equipment ) 是由 张骁 于 2019-11-12 设计创作,主要内容包括:一种基于区块链的数据处理方法,包括:获取待登记的隐私数据;随机生成对称加密密钥,并根据对称加密算法,使用所述对称加密密钥对所述隐私数据进行加密,获得第一密文;将对称加密密钥映射至公开的椭圆曲线上,获得椭圆曲线上的第一坐标点;随机生成第一随机数;采用非对称加密算法,根据第一随机数以及椭圆曲线的基点,计算第二密文,以及根据第一坐标点、第一随机数以及预先获取的监管公钥,计算第三密文;将第一密文、第二密文、第三密文以及隐私数据对应的明文索引编号发送至区块链,以将所述隐私数据保存在所述区块链上。本发明还提供一种用户客户端、监管客户端及存储介质。本发明能够对数据进行有效记录,同时,确保数据的安全。(A data processing method based on a block chain comprises the following steps: obtaining private data to be registered; randomly generating a symmetric encryption key, and encrypting the private data by using the symmetric encryption key according to a symmetric encryption algorithm to obtain a first ciphertext; mapping the symmetric encryption key to a public elliptic curve to obtain a first coordinate point on the elliptic curve; randomly generating a first random number; calculating a second ciphertext according to the first random number and a base point of the elliptic curve by adopting an asymmetric encryption algorithm, and calculating a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key; and sending the first ciphertext, the second ciphertext, the third ciphertext and a plaintext index number corresponding to the private data to a block chain so as to store the private data on the block chain. The invention also provides a user client, a supervision client and a storage medium. The invention can effectively record the data and ensure the safety of the data.)

1. A data processing method based on a block chain is applied to a user client, and is characterized in that the method comprises the following steps:

obtaining private data to be registered;

randomly generating a symmetric encryption key, and encrypting the private data by using the symmetric encryption key according to a symmetric encryption algorithm to obtain a first ciphertext;

mapping the symmetric encryption key to a public elliptic curve to obtain a first coordinate point on the elliptic curve;

randomly generating a first random number;

calculating a second ciphertext according to the first random number and a base point of the elliptic curve by adopting an asymmetric encryption algorithm, and calculating a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key;

and sending the first ciphertext, the second ciphertext, the third ciphertext and a plaintext index number corresponding to the private data to a block chain so as to store the private data on the block chain.

2. The method according to claim 1, wherein prior to said obtaining private data to be registered, the method further comprises:

acquiring an elliptic curve public parameter and a supervision public key disclosed by a supervisor, wherein the elliptic curve public parameter comprises a base point G of an elliptic curve and a line order n of the elliptic curve;

the randomly generating a first random number includes: randomly generating a first random number k smaller than n;

the calculating a second ciphertext according to the first random number and the base point of the elliptic curve by using an asymmetric encryption algorithm, and calculating a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key comprise:

the second ciphertext and the third ciphertext are calculated using the following equations:wherein M represents the first coordinate point, Y represents the supervision public key, C1 represents the second ciphertext, and C2 represents the third ciphertext.

3. The method of claim 1, further comprising:

mapping the first random number into a key two-dimensional code;

and outputting the key two-dimensional code and the plaintext index number on a private data registry.

4. The method of claim 3, further comprising:

acquiring a target plaintext index number to be inquired and a target secret key two-dimensional code;

sending the target plaintext index number to the block chain to obtain a target ciphertext stored on the block chain, wherein the target ciphertext comprises a target first ciphertext, a target second ciphertext and a target third ciphertext;

reading the target secret key two-dimensional code to obtain a target random number;

calculating a target coordinate point of a target symmetric encryption key mapped on the elliptic curve according to the target third ciphertext, the target random number and the supervision public key;

determining a target symmetric encryption key corresponding to the target coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and decrypting the target first ciphertext by using the target symmetric encryption key to obtain target privacy data.

5. The method according to any one of claims 1 to 4, wherein before sending the first ciphertext, the second ciphertext, the third ciphertext, and a plaintext index number corresponding to the privacy data onto a blockchain, the method further comprises:

acquiring a user identifier of a user to which the private data belongs;

and generating a plaintext index number corresponding to the private data according to the user identifier by adopting a Hash algorithm.

6. A data processing method based on a block chain is applied to a supervision client, and is characterized by comprising the following steps:

acquiring ciphertext to be supervised from a block chain, wherein the ciphertext to be supervised comprises a first ciphertext, a second ciphertext and a third ciphertext;

acquiring a pre-stored supervision private key;

calculating a first coordinate point of a first symmetric encryption key mapped on an elliptic curve according to the supervision private key, the second ciphertext and the third ciphertext;

determining a first symmetric encryption key corresponding to the first coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and decrypting the first ciphertext by using the first symmetric encryption key to obtain the supervision data.

7. The method of claim 6, wherein computing a first coordinate point of a first symmetric encryption key mapping on an elliptic curve based on the supervisory private key and the second and third ciphertexts comprises:

the target coordinate point is calculated using the following formula: c2-x·C1=M;

Wherein C1 represents the second ciphertext, C2 represents the third ciphertext, x represents the supervisory private key, and M represents the first coordinate point.

8. The method of claim 7, wherein before obtaining the ciphertext to be supervised from the blockchain, the method further comprises:

acquiring an elliptic curve common parameter disclosed by a supervisor, wherein the elliptic curve common parameter comprises a line order n of an elliptic curve;

randomly generating a random number x smaller than n, and determining the random number x as a supervision private key;

and saving the supervision private key.

9. The method of claim 6, further comprising:

acquiring a user identifier;

performing identity verification on the user identification;

if the identity authentication is successful, generating a plaintext index number corresponding to the data to be reported lost according to the user identification by adopting a Hash algorithm;

obtaining a historical ciphertext corresponding to the plaintext index number from the block chain, wherein the historical ciphertext comprises a historical first ciphertext, a historical second ciphertext and a historical third ciphertext;

calculating a second coordinate point of a second symmetric encryption key mapped on the elliptic curve according to the supervision private key, the historical second ciphertext and the historical third ciphertext;

determining a second symmetric encryption key corresponding to the second coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

decrypting the historical first ciphertext by using the second symmetric encryption key to obtain the data to be reported lost;

and generating a private data registry according to the data to be reported.

10. A user client, characterized in that the user client comprises a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the blockchain based data processing method according to any one of claims 1 to 5.

11. An administration client, characterized in that the administration client comprises a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the blockchain based data processing method according to any one of claims 6 to 9.

12. A computer-readable storage medium storing at least one instruction which, when executed by a processor, implements the blockchain-based data processing method according to any one of claims 1 to 5 or 6 to 9.

Technical Field

The present invention relates to the field of block chain technologies, and in particular, to a data processing method and related device based on a block chain.

Background

With the rise of big data, data collection, processing, trading and application are more and more frequent for various industries. However, at present, the recording of data still depends on a local centralized information system or a third-party platform, the recording scheme is not sound enough, and at the same time, the private data (such as vaccine private data) of the user is easy to be tampered or leaked, so that the security of the data is threatened.

Therefore, how to effectively record data to ensure the security of the data is a technical problem to be solved urgently.

Disclosure of Invention

In view of the foregoing, it is desirable to provide a data processing method and related apparatus based on a block chain, which can effectively record data and ensure the security of the data.

The first aspect of the present invention provides a data processing method based on a block chain, which is applied to a user client, and the method includes:

obtaining private data to be registered;

randomly generating a symmetric encryption key, and encrypting the private data by using the symmetric encryption key according to a symmetric encryption algorithm to obtain a first ciphertext;

mapping the symmetric encryption key to a public elliptic curve to obtain a first coordinate point on the elliptic curve;

randomly generating a first random number;

calculating a second ciphertext according to the first random number and a base point of the elliptic curve by adopting an asymmetric encryption algorithm, and calculating a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key;

and sending the first ciphertext, the second ciphertext, the third ciphertext and a plaintext index number corresponding to the private data to a block chain so as to store the private data on the block chain.

In one possible implementation, the method further includes:

before the obtaining of the private data to be registered, the method further comprises:

acquiring an elliptic curve public parameter and a supervision public key disclosed by a supervisor, wherein the elliptic curve public parameter comprises a base point G of an elliptic curve and a line order n of the elliptic curve;

the randomly generating a first random number includes: randomly generating a first random number k smaller than n;

the calculating a second ciphertext according to the first random number and the base point of the elliptic curve by using an asymmetric encryption algorithm, and calculating a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key comprise:

the second ciphertext and the third ciphertext are calculated using the following equations:

Figure BDA0002270067270000021

wherein M represents the first coordinate point, Y represents the supervision public key, C1 represents the second ciphertext, and C2 represents the third ciphertext.

In one possible implementation, the method further includes:

mapping the first random number into a key two-dimensional code;

outputting the secret key two-dimensional code and the plaintext index number on a private data registry

In one possible implementation, the method further includes:

acquiring a target plaintext index number to be inquired and a target secret key two-dimensional code;

sending the target plaintext index number to the block chain to obtain a target ciphertext stored on the block chain, wherein the target ciphertext comprises a target first ciphertext, a target second ciphertext and a target third ciphertext;

reading the target secret key two-dimensional code to obtain a target random number;

calculating a target coordinate point of a target symmetric encryption key mapped on the elliptic curve according to the target third ciphertext, the target random number and the supervision public key;

determining a target symmetric encryption key corresponding to the target coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and decrypting the target first ciphertext by using the target symmetric encryption key to obtain target privacy data.

In a possible implementation manner, before sending the first ciphertext, the second ciphertext, the third ciphertext, and a plaintext index number corresponding to the private data to a block chain to store the private data on the block chain, the method further includes:

acquiring a user identifier of a user to which the private data belongs;

and generating a plaintext index number corresponding to the private data according to the user identifier by adopting a Hash algorithm.

A second aspect of the present invention provides a data processing method based on a blockchain, which is applied to a supervision client, and the method includes:

acquiring ciphertext to be supervised from a block chain, wherein the ciphertext to be supervised comprises a first ciphertext, a second ciphertext and a third ciphertext;

acquiring a pre-stored supervision private key;

calculating a first coordinate point of a first symmetric encryption key mapped on an elliptic curve according to the supervision private key, the second ciphertext and the third ciphertext;

determining a first symmetric encryption key corresponding to the first coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and decrypting the first ciphertext by using the first symmetric encryption key to obtain the supervision data.

In one possible implementation, the method further includes:

the calculating a first coordinate point of a first symmetric encryption key mapped on an elliptic curve according to the supervision private key, the second ciphertext and the third ciphertext comprises:

the target coordinate point is calculated using the following formula: c2-x·C1=M;

Wherein C1 represents the second ciphertext, C2 represents the third ciphertext, x represents the supervisory private key, and M represents the first coordinate point.

In a possible implementation manner, before obtaining the ciphertext to be supervised from the blockchain, the method further includes:

acquiring an elliptic curve common parameter disclosed by a supervisor, wherein the elliptic curve common parameter comprises a line order n of an elliptic curve;

randomly generating a random number x smaller than n, and determining the random number x as a supervision private key;

and saving the supervision private key.

In one possible implementation, the method further includes:

acquiring a user identifier;

performing identity verification on the user identification;

if the identity authentication is successful, generating a plaintext index number corresponding to the data to be reported lost according to the user identification by adopting a Hash algorithm;

obtaining a historical ciphertext corresponding to the plaintext index number from the block chain, wherein the historical ciphertext comprises a historical first ciphertext, a historical second ciphertext and a historical third ciphertext;

calculating a second coordinate point of a second symmetric encryption key mapped on the elliptic curve according to the supervision private key, the historical second ciphertext and the historical third ciphertext;

determining a second symmetric encryption key corresponding to the second coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

decrypting the historical first ciphertext by using the second symmetric encryption key to obtain the data to be reported lost;

and generating a private data registry according to the data to be reported.

A third aspect of the present invention provides a user client comprising a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the method for blockchain-based data processing according to the first aspect.

A fourth aspect of the present invention provides a policing client comprising a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the blockchain based data processing method of the second aspect.

A fifth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the block chain based data processing method.

According to the technical scheme, privacy protection processing is carried out on the privacy data of the user through the symmetric encryption key and the asymmetric encryption algorithm, the first ciphertext, the second ciphertext and the third ciphertext are obtained, the fact that the privacy data can be transmitted to the block chain in a ciphertext mode is guaranteed, meanwhile, the ciphertext data are sent to the block chain for storage by means of the fact that the data on the block chain have the property of being not capable of being tampered, tracking and recording can be effectively carried out on the privacy data, accordingly, sound and effective data recording can be provided, and meanwhile, the safety of the data is guaranteed.

Drawings

Fig. 1 is a flowchart of a block chain-based data processing method according to a preferred embodiment of the present invention.

FIG. 2 is a schematic representation of a vaccination protocol disclosed herein.

Fig. 3 is a flowchart of another block chain-based data processing method according to the preferred embodiment of the present disclosure.

FIG. 4 is a functional block diagram of a preferred embodiment of a data processing apparatus according to the present disclosure.

FIG. 5 is a functional block diagram of another preferred embodiment of a data processing apparatus according to the present disclosure.

Fig. 6 is a schematic structural diagram of a user client for implementing a data processing method based on a blockchain according to a preferred embodiment of the present invention.

Fig. 7 is a schematic structural diagram of a policing client according to an embodiment of the present invention, which implements a data processing method based on a blockchain.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

The terms "first," "second," and "third" in the description and claims of this application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order, nor should they be construed to indicate or imply the relative importance thereof or the number of technical features indicated. It will be appreciated that the data so used are interchangeable under appropriate circumstances such that the embodiments described herein are capable of being carried out in other sequences than those illustrated or otherwise described herein, and that the features defined as "first", "second" or "third" may explicitly or implicitly include at least one such feature.

Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.

In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.

The user client or the supervision client is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware thereof includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like. The user client or the supervision client may be a network server, or any electronic product capable of performing human-computer interaction with a user through a keyboard, a mouse, a remote controller, a touch pad, a voice control device, or the like, for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant PDA, or the like.

Referring to fig. 1, fig. 1 is a flowchart illustrating a block chain-based data processing method according to a preferred embodiment of the present invention. The data processing method is applied to a user client, the sequence of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted.

S11, the user client acquires the private data to be registered.

The privacy data may include, but is not limited to, vaccination data, medical history data, traffic violation data, real estate transaction data, academic examination score data, academic degree data, and the like.

S12, the user client randomly generates a symmetric encryption key, and encrypts the private data by using the symmetric encryption key according to a symmetric encryption algorithm to obtain a first ciphertext.

Wherein the symmetric encryption algorithm may include, but is not limited to, AES or SM4 algorithms.

In the invention, a random number generator can be adopted to randomly generate a symmetric encryption key, and then the symmetric encryption key is used to encrypt the private data according to an AES or SM4 algorithm to obtain a first ciphertext. Through the first ciphertext, the privacy data are encrypted, and the privacy data of the user are protected.

S13, the user client maps the symmetric encryption key to a public elliptic curve to obtain a first coordinate point on the elliptic curve.

Optionally, before step S11, the method may further include:

acquiring an elliptic curve public parameter and a supervision public key disclosed by a supervisor, wherein the elliptic curve public parameter comprises a base point G of an elliptic curve and a line order n of the elliptic curve;

in the invention, the symmetric encryption key can be mapped to a public elliptic curve by using an elliptic curve mapping rule to obtain a first coordinate point on the elliptic curve.

An elliptic curve with a length of 256 bits can be selected in advance, and relevant common parameters, such as an elliptic curve base point G and an elliptic curve order n, are disclosed.

The elliptic curve mapping rule is as follows:

for example, if the data to be mapped is m, and the elliptic curve equation is y ═ f (x), then x ═ m may be substituted into the elliptic curve equation to obtain y ═ f (m), and the coordinate point (x, y) of the elliptic curve obtained finally is the coordinate point where m is mapped to the elliptic curve.

And S14, the user client randomly generates a first random number.

The user client may randomly generate a first random number by using a random number generator or a correlation algorithm, where a value k of the first random number needs to be smaller than a line order n of an elliptic curve.

Wherein the first random number may be determined as a key for encrypting the symmetric encryption key to protect the symmetric encryption key.

S15, the user client side calculates a second ciphertext according to the first random number and the base point of the elliptic curve by adopting an asymmetric encryption algorithm, and calculates a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key.

The asymmetric encryption algorithm may include, but is not limited to, an asymmetric EL Gamal encryption algorithm. Generally, the asymmetric EL Gamal encryption algorithm is based on a Discrete Logarithm Problem (DLP), and the security problem of EL Gamal is transferred to an Elliptic Curve Discrete Logarithm Problem (ECDLP) in the present invention.

Specifically, the user client calculates a second ciphertext according to the first random number and the base point of the elliptic curve by using an asymmetric encryption algorithm, and calculates a third ciphertext according to the first coordinate point, the first random number and a pre-obtained supervision public key, where the calculating includes:

the second ciphertext and the third ciphertext are calculated using the following equations:

Figure BDA0002270067270000081

wherein M represents the first coordinate point, Y represents the supervision public key, C1 represents the second ciphertext, C2 represents the third ciphertext, and k is the first random number.

S16, the user client sends the first ciphertext, the second ciphertext, the third ciphertext and the plaintext index number corresponding to the private data to a block chain, so that the private data are stored in the block chain.

Preferably, in step S16, the user client may register an account in the blockchain system in advance, obtain a public and private key, sign the first ciphertext, the second ciphertext, the third ciphertext, and the plaintext index number by using the private key, send the first ciphertext, the second ciphertext, the third ciphertext, the plaintext index number, and the signature to the blockchain together, and after the blockchain system verifies the signature by using the public key of the user client, store the first ciphertext, the second ciphertext, the third ciphertext, and the plaintext index number in the blockchain.

As an optional implementation manner, in step S16, before the user client sends the first ciphertext, the second ciphertext, the third ciphertext, and a plaintext index number corresponding to the private data to a block chain to store the private data on the block chain, the method further includes:

acquiring a user identifier of a user to which the private data belongs;

and generating a plaintext index number corresponding to the private data according to the user identifier by adopting a Hash algorithm.

The user identifier may uniquely identify the user, such as a user name, a user identification number, and the like.

Optionally, the plaintext index number may be calculated by using the following encoding method:

and obtaining a hash value according to the user name and the user identity card number by adopting a hash algorithm, and transcoding the hash value by Base58 to obtain a plaintext index number corresponding to the private data.

As an optional implementation, the method further comprises:

mapping the first random number into a key two-dimensional code;

and outputting the key two-dimensional code and the plaintext index number on a private data registry.

In this embodiment, the first random number may be mapped into a key two-dimensional code according to a two-dimensional code mapping rule, where the two-dimensional code mapping is performed according to a general two-dimensional code generation standard, such as national standard GB/T18284-2000.

The private data registry may be electronic, and for example, may be software on a terminal device (for example, a mobile phone or a computer), and outputting the key two-dimensional code and the plaintext index number on the private data registry may be issuing the key two-dimensional code and the plaintext index number to the terminal device through a network; of course, the two-dimensional code may be physical, such as paper, and if physical, the two-dimensional code of the key and the plain index number may be printed on the register by a printing device.

Such as a vaccination notebook, fig. 2 is a schematic diagram of a vaccination notebook of the type disclosed herein.

As shown in fig. 2, the vaccination protocol may include identity information of the vaccination user and a vaccination record, the identity information includes, for example, name three, identification number: xxxxxxxxxx, vaccination records such as vaccine type, date of vaccination, site number, and vaccine lot, in addition to on-chain number (i.e., plaintext index number) and key two-dimensional code. Different inoculation records correspond to different on-chain numbers and different secret key two-dimensional codes.

As an optional implementation, the method further comprises:

acquiring a target plaintext index number to be inquired and a target secret key two-dimensional code;

sending the target plaintext index number to the block chain to obtain a target ciphertext stored on the block chain, wherein the target ciphertext comprises a target first ciphertext, a target second ciphertext and a target third ciphertext;

reading the target secret key two-dimensional code to obtain a target random number;

calculating a target coordinate point of a target symmetric encryption key mapped on the elliptic curve according to the target third ciphertext, the target random number and the supervision public key;

determining a target symmetric encryption key corresponding to the target coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and decrypting the target first ciphertext by using the target symmetric encryption key to obtain target privacy data.

In this embodiment, when a data record needs to be queried, the plaintext index number and the key two-dimensional code in the private data processing book may be obtained, and the target plaintext index number may be sent to the blockchain to obtain target ciphertexts (a target first cipher text, a target second cipher text, and a target third cipher text) stored in the blockchain, and at the same time, the target key two-dimensional code may be read to obtain the target random number, where the target first cipher text, the target second cipher text, and the target third cipher text are calculated in the same manner as the first cipher text, the second cipher text, and the third cipher text described above, and the target random number is calculated in the same manner as the first random number described above, and the calculation formula C of the third cipher text described above may be referred to2M + k.Y, obtaining the formula M ═ C2-k.Y, then, let C2Substituting a formula M ═ C into a target third ciphertext, wherein k is a target random number, Y is a supervision public key, M is a target coordinate point2k.Y, target coordinate points of the target symmetric encryption key mapped on the elliptic curve can be calculated and the elliptic curve is used for carrying out the calculationAnd determining a target symmetric encryption key corresponding to the target coordinate point according to the mapping rule of the upper coordinate point, and finally decrypting the target first ciphertext by using the target symmetric encryption key to obtain target privacy data.

Wherein the decryption algorithm is the reverse process of the symmetric encryption algorithm.

In the method flow described in fig. 1, privacy protection processing may be performed on the private data of the user through a symmetric encryption key and an asymmetric encryption algorithm, so as to obtain a first ciphertext, a second ciphertext, and a third ciphertext, thereby ensuring that the private data can be transmitted to the block chain in a ciphertext form, and meanwhile, by using the property that the data on the block chain is not falsifiable, the ciphertext data is transmitted to the block chain for storage, so that tracking and recording may be effectively performed on the private data, thereby providing a sound and effective data record, and at the same time, ensuring the security of the data.

Referring to fig. 3, fig. 3 is a flowchart illustrating another block chain-based data processing method according to another preferred embodiment of the present disclosure. The data processing method is applied to a supervision client, the sequence of the steps in the flowchart can be changed according to different requirements, and some steps can be omitted.

S31, the supervision client side obtains the ciphertext to be supervised from the block chain, and the ciphertext to be supervised includes a first ciphertext, a second ciphertext and a third ciphertext.

The supervision client can obtain any ciphertext to be supervised, which needs to be supervised, from the block chain.

S32, the supervision client side obtains a pre-stored supervision private key.

As an optional implementation manner, before obtaining the ciphertext to be supervised from the blockchain in step S31, the method further includes:

acquiring an elliptic curve common parameter disclosed by a supervisor, wherein the elliptic curve common parameter comprises a line order n of an elliptic curve;

randomly generating a random number x smaller than n, and determining the random number x as a supervision private key;

and saving the supervision private key.

In this embodiment, the elliptic curve common parameters disclosed by the supervisor, such as the elliptic curve base point G and the line order n of the elliptic curve, may be obtained. The elliptic curve can be an elliptic curve with a length of 256 bits.

A random number x smaller than n may be randomly generated using a random number generator or a related algorithm and determined as a supervision private key, which may be maintained by a supervisor (e.g., a disease control center).

Furthermore, the supervision public key may be calculated according to the formula Y ═ x · G, where Y is the supervision public key, x is the supervision private key, and G is the base point of the elliptic curve. After the supervision public key is obtained through calculation, the public key can be disclosed to the outside.

S33, the supervision client calculates a first coordinate point of the first symmetric encryption key mapped on the elliptic curve according to the supervision private key, the second ciphertext and the third ciphertext.

The elliptic curve mapping rule is as follows:

for example, if the data to be mapped is m, and the elliptic curve equation is y ═ f (x), then x ═ m may be substituted into the elliptic curve equation to obtain y ═ f (m), and the coordinate point (x, y) of the elliptic curve obtained finally is the coordinate point where m is mapped to the elliptic curve.

Specifically, the calculating a first coordinate point of the first symmetric encryption key mapped on the elliptic curve according to the supervision private key, the second ciphertext and the third ciphertext includes:

the target coordinate point is calculated using the following formula: c2-x·C1=M;

Wherein C1 represents the second ciphertext, C2 represents the third ciphertext, x represents the supervisory private key, and M represents the first coordinate point.

Wherein the above formula C2-x·C1The derivation process for M is as follows:

C2-x·C1=M+k·Y-xk·G=M+xk·G-xk·G=M

wherein, the derivation process can refer to fig. 1 for the second ciphertext and the third ciphertextThe calculation method of text:

Figure BDA0002270067270000121

specifically, reference may be made to the related description in fig. 1, which is not repeated herein.

S34, the supervision client determines a first symmetric encryption key corresponding to the first coordinate point according to the mapping rule of the coordinate point on the elliptic curve.

And S35, the supervision client decrypts the first ciphertext by using the first symmetric encryption key to obtain supervision data.

The supervisor part holds the supervision key and can unlock any encrypted information, and other users cannot unlock the encrypted information under the condition that the other users do not hold the data encryption key.

As an optional implementation, the method further comprises:

acquiring a user identifier;

performing identity verification on the user identification;

if the identity authentication is successful, generating a plaintext index number corresponding to the data to be reported lost according to the user identification by adopting a Hash algorithm;

obtaining a historical ciphertext corresponding to the plaintext index number from the block chain, wherein the historical ciphertext comprises a historical first ciphertext, a historical second ciphertext and a historical third ciphertext;

calculating a second coordinate point of a second symmetric encryption key mapped on the elliptic curve according to the supervision private key, the historical second ciphertext and the historical third ciphertext;

determining a second symmetric encryption key corresponding to the second coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

decrypting the historical first ciphertext by using the second symmetric encryption key to obtain the data to be reported lost;

and generating a private data registry according to the data to be reported.

In this embodiment, when the private data of the user is lost, it can be queried by the supervisor. Specifically, the user may provide the identity of the user (such as the user name and the identification number) to the monitoring party, and after obtaining the user identity, the monitoring client may perform identity verification on the user identity, and after the verification is successful, the user may be helped to retrieve the lost private data. Specifically, the plaintext index number may be calculated according to the encoding method described above by using the user name and the user identification number, and then the history ciphertext corresponding to the plaintext index number is obtained from the block chain, and the history ciphertext is decrypted according to the decryption method described above to obtain the data to be missed (i.e., the lost private data), and finally, the private data registry may be regenerated according to the data to be missed. Where vaccination data may be taken as an example, the privacy data registry refers to the vaccination book described in figure 2.

In the method flow described in fig. 3, the supervision client may pull any ciphertext data from the blockchain, decrypt the ciphertext data using the supervision private key, obtain the privacy data of the user, and supervise the privacy data, while other users cannot unlock the ciphertext data on the blockchain on the premise of not having the supervision private key, so that the privacy data of the user may be protected.

The above description is only a specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and it will be apparent to those skilled in the art that modifications may be made without departing from the inventive concept of the present invention, and these modifications are within the scope of the present invention.

Referring to fig. 4, fig. 4 is a functional block diagram of a data processing apparatus according to a preferred embodiment of the present disclosure.

In some embodiments, the data processing apparatus runs in a user client. The data processing means may comprise a plurality of functional modules consisting of program code segments. The program codes of the program segments in the data processing apparatus may be stored in the memory and executed by at least one processor to perform part or all of the steps in the data processing method based on the block chain described in fig. 1, which please refer to the related description in fig. 1, and are not described herein again.

In this embodiment, the data processing apparatus may be divided into a plurality of functional modules according to the functions performed by the data processing apparatus. The functional module may include: the device comprises an acquisition module 401, a generation module 402, an encryption module 403, a mapping module 404, a calculation module 405 and a sending module 406. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory.

An obtaining module 401, configured to obtain private data to be registered;

a generating module 402, configured to randomly generate a symmetric encryption key;

an encrypting module 403, configured to encrypt the private data by using the symmetric encryption key to obtain a first ciphertext;

a mapping module 404, configured to map the symmetric encryption key onto a public elliptic curve to obtain a first coordinate point on the elliptic curve;

the generating module 402 is further configured to randomly generate a first random number;

a calculating module 405, configured to calculate a second ciphertext according to the first random number and the base point of the elliptic curve by using an asymmetric encryption algorithm, and calculate a third ciphertext according to the first coordinate point, the first random number, and a pre-obtained supervision public key;

a sending module 406, configured to send the first ciphertext, the second ciphertext, the third ciphertext, and a plaintext index number corresponding to the private data to a block chain, so as to store the private data in the block chain.

Optionally, the obtaining module 401 is further configured to obtain an elliptic curve common parameter and a supervision public key, which are disclosed by a supervisor, where the elliptic curve common parameter includes a base point G of an elliptic curve and a line order n of the elliptic curve;

the generating module 402 randomly generating the first random number includes: randomly generating a first random number k smaller than n;

the calculating module 405 calculates a second ciphertext according to the first random number and the base point of the elliptic curve by using an asymmetric encryption algorithm, and calculates a third ciphertext according to the first coordinate point, the first random number and a pre-obtained supervision public key, where calculating the third ciphertext includes:

the second ciphertext and the third ciphertext are calculated using the following equations:

Figure BDA0002270067270000151

wherein M represents the first coordinate point, Y represents the supervision public key, C1 represents the second ciphertext, and C2 represents the third ciphertext.

Optionally, the mapping module 404 is further configured to map the first random number into a key two-dimensional code;

the data processing apparatus further includes:

and the output module is used for outputting the key two-dimensional code and the plaintext index number on a privacy registration processing book.

Optionally, the obtaining module 401 is further configured to obtain a target plaintext index number to be queried and a target secret key two-dimensional code;

the sending module 406 is further configured to send the target plaintext index number to the block chain to obtain a target ciphertext stored in the block chain, where the target ciphertext includes a target first ciphertext, a target second ciphertext, and a target third ciphertext;

the data processing apparatus further includes:

the reading module is used for reading the target secret key two-dimensional code to obtain a target random number;

the calculating module 405 is further configured to calculate a target coordinate point of a target symmetric encryption key mapped on the elliptic curve according to the target third ciphertext, the target random number, and the supervision public key;

the determining module is used for determining a target symmetric encryption key corresponding to the target coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and the decryption module is used for decrypting the target first ciphertext by using the target symmetric encryption key to obtain target privacy data.

Optionally, the obtaining module 401 is further configured to obtain a user identifier of a user to which the private data belongs;

the generating module 402 is further configured to generate a plaintext index number corresponding to the private data according to the user identifier by using a hash algorithm.

In the data processing apparatus described in fig. 4, privacy protection processing may be performed on the private data of the user through a symmetric encryption key and an asymmetric encryption algorithm, so as to obtain a first ciphertext, a second ciphertext, and a third ciphertext, thereby ensuring that the private data can be transmitted to the block chain in a ciphertext form, and meanwhile, by using the property that the data on the block chain is not falsifiable, the ciphertext data is transmitted to the block chain for storage, so that tracking and recording may be effectively performed on the private data, thereby providing a sound and effective data record, and simultaneously, ensuring the security of the data.

Referring to fig. 5, fig. 5 is a functional block diagram of another data processing apparatus according to another preferred embodiment of the present disclosure.

In some embodiments, the data processing apparatus runs in a policing client. The data processing means may comprise a plurality of functional modules consisting of program code segments. The program codes of the program segments in the data processing apparatus may be stored in the memory and executed by at least one processor to perform part or all of the steps in the data processing method based on the block chain described in fig. 3, which please refer to the related description in fig. 3, and are not described herein again.

In this embodiment, the data processing apparatus may be divided into a plurality of functional modules according to the functions performed by the data processing apparatus. The functional module may include: an acquisition module 501, a calculation module 502, a determination module 503 and a decryption module 504. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory.

An obtaining module 501, configured to obtain ciphertext to be supervised from a block chain, where the ciphertext to be supervised includes a first ciphertext, a second ciphertext, and a third ciphertext;

the obtaining module 501 is further configured to obtain a pre-stored supervision private key;

a calculating module 502, configured to calculate, according to the supervision private key, the second ciphertext, and the third ciphertext, a first coordinate point of a first symmetric encryption key mapped on an elliptic curve;

a determining module 503, configured to determine, according to a mapping rule of a coordinate point on the elliptic curve, a first symmetric encryption key corresponding to the first coordinate point;

a decryption module 504, configured to decrypt the first ciphertext using the first symmetric encryption key to obtain the supervision data.

Optionally, the calculating module 502 calculates, according to the supervision private key, the second ciphertext and the third ciphertext, a first coordinate point of the first symmetric encryption key mapped on the elliptic curve, including:

the target coordinate point is calculated using the following formula: c2-x·C1=M;

Wherein C1 represents the second ciphertext, C2 represents the third ciphertext, x represents the supervisory private key, and M represents the first coordinate point.

Optionally, the obtaining module 501 is further configured to obtain an elliptic curve common parameter disclosed by a supervisor, where the elliptic curve common parameter includes a line order n of an elliptic curve;

the data processing apparatus further includes:

the generating module is used for randomly generating a random number x smaller than n;

the determining module 503 is further configured to determine the random number x as a supervision private key.

And the storage module is used for storing the supervision private key.

Optionally, the obtaining module 501 is further configured to obtain a user identifier;

the data processing apparatus further includes:

the verification module is used for carrying out identity verification on the user identification;

the generating module is further configured to generate a plaintext index number corresponding to the data to be reported to be lost according to the user identifier by using a hash algorithm if the identity authentication is successful;

the obtaining module 501 is further configured to obtain a history ciphertext corresponding to the plaintext index number from the block chain, where the history ciphertext includes a history first ciphertext, a history second ciphertext, and a history third ciphertext;

the calculating module 502 is further configured to calculate a second coordinate point of a second symmetric encryption key mapped on the elliptic curve according to the supervision private key, the historical second ciphertext and the historical third ciphertext;

the determining module 503 is further configured to determine a second symmetric encryption key corresponding to the second coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

the decryption module 504 is further configured to decrypt the historical first ciphertext by using the second symmetric encryption key to obtain the data to be reported;

the generating module is further used for generating a private data register according to the data to be reported.

In the data processing apparatus described in fig. 5, any ciphertext data may be pulled from the blockchain, and the supervision private key is used to decrypt the ciphertext data to obtain the privacy data of the user, and implement supervision on the privacy data, while other users cannot unlock the ciphertext data on the blockchain on the premise of not having the supervision private key, so that the privacy data of the user may be protected.

As shown in fig. 6, fig. 6 is a schematic structural diagram of a user client according to a preferred embodiment of the present invention for implementing a data processing method based on a block chain. The user client 6 comprises a memory 61, at least one processor 62, a computer program 63 stored in the memory 61 and executable on the at least one processor 62, and at least one communication bus 64.

Those skilled in the art will appreciate that the schematic diagram shown in fig. 6 is merely an example of the user client 6, and does not constitute a limitation of the user client 6, and may include more or less components than those shown, or combine some components, or different components, for example, the user client 6 may further include an input-output device, a network access device, etc.

The at least one Processor 62 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The processor 62 may be a microprocessor or the processor 62 may be any conventional processor or the like, the processor 62 being the control center of the user client 6, with various interfaces and lines connecting the various parts of the entire user client 6.

The memory 61 may be used for storing the computer programs 63 and/or modules/units, and the processor 62 may implement various functions of the user client 6 by running or executing the computer programs and/or modules/units stored in the memory 61 and calling data stored in the memory 61. The memory 61 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data) created according to the use of the user client 6, and the like. Further, the memory 61 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a flash memory Card (FlashCard), at least one magnetic disk storage device, a flash memory device, or other non-volatile solid state storage device.

With reference to fig. 1, the memory 61 in the user client 6 stores a plurality of instructions to implement a blockchain-based data processing method, and the processor 62 can execute the plurality of instructions to implement:

obtaining private data to be registered;

randomly generating a symmetric encryption key, and encrypting the private data by using the symmetric encryption key according to a symmetric encryption algorithm to obtain a first ciphertext;

mapping the symmetric encryption key to a public elliptic curve to obtain a first coordinate point on the elliptic curve;

randomly generating a first random number;

calculating a second ciphertext according to the first random number and a base point of the elliptic curve by adopting an asymmetric encryption algorithm, and calculating a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key;

and sending the first ciphertext, the second ciphertext, the third ciphertext and a plaintext index number corresponding to the private data to a block chain so as to store the private data on the block chain.

In an alternative embodiment, before the obtaining of the private data to be registered, the processor 62 may execute the plurality of instructions to implement:

acquiring an elliptic curve public parameter and a supervision public key disclosed by a supervisor, wherein the elliptic curve public parameter comprises a base point G of an elliptic curve and a line order n of the elliptic curve;

the randomly generating a first random number includes: randomly generating a first random number k smaller than n;

the calculating a second ciphertext according to the first random number and the base point of the elliptic curve by using an asymmetric encryption algorithm, and calculating a third ciphertext according to the first coordinate point, the first random number and a pre-acquired supervision public key comprise:

the second ciphertext and the third ciphertext are calculated using the following equations:

Figure BDA0002270067270000201

wherein M represents the first coordinatePoint, Y represents the supervisory public key, C1 represents the second ciphertext, and C2 represents the third ciphertext.

In an alternative embodiment, the processor 62 may execute the plurality of instructions to implement:

mapping the first random number into a key two-dimensional code;

and outputting the key two-dimensional code and the plaintext index number on a private data registry.

In an alternative embodiment, the processor 62 may execute the plurality of instructions to implement:

acquiring a target plaintext index number to be inquired and a target secret key two-dimensional code;

sending the target plaintext index number to the block chain to obtain a target ciphertext stored on the block chain, wherein the target ciphertext comprises a target first ciphertext, a target second ciphertext and a target third ciphertext;

reading the target secret key two-dimensional code to obtain a target random number;

calculating a target coordinate point of a target symmetric encryption key mapped on the elliptic curve according to the target third ciphertext, the target random number and the supervision public key;

determining a target symmetric encryption key corresponding to the target coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and decrypting the target first ciphertext by using the target symmetric encryption key to obtain target privacy data.

In an alternative embodiment, before sending the first ciphertext, the second ciphertext, the third ciphertext, and the plaintext index number corresponding to the private data to the block chain, the processor 62 may execute the plurality of instructions to:

acquiring a user identifier of a user to which the private data belongs;

and generating a plaintext index number corresponding to the private data according to the user identifier by adopting a Hash algorithm.

Specifically, the processor 62 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, and details thereof are not repeated herein.

In the user client 6 described in fig. 6, privacy protection processing may be performed on the private data of the user through a symmetric encryption key and an asymmetric encryption algorithm, so as to obtain a first ciphertext, a second ciphertext, and a third ciphertext, thereby ensuring that the private data can be transmitted to the block chain in a ciphertext form, and meanwhile, by using the property that the data on the block chain is not falsifiable, the ciphertext data is transmitted to the block chain for storage, so that tracking and recording can be effectively performed on the private data, thereby providing a sound and effective data record, and simultaneously, ensuring the security of the data.

Fig. 7 is a schematic structural diagram of a policing client according to a preferred embodiment of the present invention, which implements a data processing method based on a blockchain. The administration client 7 comprises a memory 71, at least one processor 72, a computer program 73 stored in the memory 71 and executable on the at least one processor 72, and at least one communication bus 74.

With reference to fig. 3, the memory 71 in the administrative client 7 stores a plurality of instructions to implement a block chain based data processing method, and the processor 72 can execute the plurality of instructions to implement:

acquiring ciphertext to be supervised from a block chain, wherein the ciphertext to be supervised comprises a first ciphertext, a second ciphertext and a third ciphertext;

acquiring a pre-stored supervision private key;

calculating a first coordinate point of a first symmetric encryption key mapped on an elliptic curve according to the supervision private key, the second ciphertext and the third ciphertext;

determining a first symmetric encryption key corresponding to the first coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

and decrypting the first ciphertext by using the first symmetric encryption key to obtain the supervision data.

In an alternative embodiment, the processor 72, according to the supervision private key and the second ciphertext and the third ciphertext, calculating a first coordinate point of a first symmetric encryption key mapped on an elliptic curve includes:

the target coordinate point is calculated using the following formula: c2-x·C1=M;

Wherein C1 represents the second ciphertext, C2 represents the third ciphertext, x represents the supervisory private key, and M represents the first coordinate point.

In an alternative embodiment, before obtaining the ciphertext to be supervised from the blockchain, the processor 72 may execute the plurality of instructions to:

acquiring an elliptic curve common parameter disclosed by a supervisor, wherein the elliptic curve common parameter comprises a line order n of an elliptic curve;

randomly generating a random number x smaller than n, and determining the random number x as a supervision private key;

and saving the supervision private key.

In an alternative embodiment, before obtaining the ciphertext to be supervised from the blockchain, the processor 72 may execute the plurality of instructions to:

acquiring a user identifier;

performing identity verification on the user identification;

if the identity authentication is successful, generating a plaintext index number corresponding to the data to be reported lost according to the user identification by adopting a Hash algorithm;

obtaining a historical ciphertext corresponding to the plaintext index number from the block chain, wherein the historical ciphertext comprises a historical first ciphertext, a historical second ciphertext and a historical third ciphertext;

calculating a second coordinate point of a second symmetric encryption key mapped on the elliptic curve according to the supervision private key, the historical second ciphertext and the historical third ciphertext;

determining a second symmetric encryption key corresponding to the second coordinate point according to a mapping rule of the coordinate point on the elliptic curve;

decrypting the historical first ciphertext by using the second symmetric encryption key to obtain the data to be reported lost;

and generating a private data registry according to the data to be reported.

In the supervision client 7 described in fig. 7, the supervision client may pull any ciphertext data from the blockchain, decrypt the ciphertext data using the supervision private key, obtain the privacy data of the user, and supervise the privacy data, and other users cannot unlock the ciphertext data on the blockchain on the premise of not having the supervision private key, so that the privacy data of the user may be protected.

The modules/units integrated by the user client 6/administration client 7 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer memory, and Read-only memory (ROM).

In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.

The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.

In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.

It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware.

Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

24页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:用户的认证方法、装置、代理服务器和网络服务系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类