CN112614001A - Agricultural product tracing method and system based on block chain - Google Patents

Agricultural product tracing method and system based on block chain Download PDF

Info

Publication number
CN112614001A
CN112614001A CN202011570308.1A CN202011570308A CN112614001A CN 112614001 A CN112614001 A CN 112614001A CN 202011570308 A CN202011570308 A CN 202011570308A CN 112614001 A CN112614001 A CN 112614001A
Authority
CN
China
Prior art keywords
data information
block chain
matrix
agricultural product
digital signature
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.)
Withdrawn
Application number
CN202011570308.1A
Other languages
Chinese (zh)
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.)
Xian Cresun Innovation Technology Co Ltd
Original Assignee
Xian Cresun Innovation Technology 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 Xian Cresun Innovation Technology Co Ltd filed Critical Xian Cresun Innovation Technology Co Ltd
Priority to CN202011570308.1A priority Critical patent/CN112614001A/en
Publication of CN112614001A publication Critical patent/CN112614001A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/02Agriculture; Fishing; Forestry; Mining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/45Structures or tools for the administration of authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K17/00Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2151Time stamp

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Business, Economics & Management (AREA)
  • Computational Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Bioethics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Economics (AREA)
  • Computing Systems (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Agronomy & Crop Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mining & Mineral Resources (AREA)
  • Marine Sciences & Fisheries (AREA)
  • Algebra (AREA)
  • Animal Husbandry (AREA)
  • Databases & Information Systems (AREA)
  • Storage Device Security (AREA)

Abstract

The invention relates to an agricultural product tracing method based on a block chain, which is applied to any node of a block chain cloud platform and comprises the following steps: acquiring data information of an agricultural product, calling intelligent contracts of respective corresponding types of the data information to verify the data information, and acquiring a current timestamp if the data information passes the verification of the intelligent contracts of the corresponding types of the data information to form data information containing the timestamp; encrypting the data information containing the timestamp to obtain a digital signature, and attaching the digital signature to the data information containing the timestamp to obtain encrypted agricultural product information; the digital signature is obtained by a digital signature method based on GRS codes of a finite field; and uploading the encrypted agricultural product information to a blockchain. According to the scheme, the block chain technology and the digital signature technology based on the GRS code of the finite field are adopted, so that the related data information of each node of the agricultural product supply chain is not easy to tamper, and the traceability data provided for consumers are real and reliable.

Description

Agricultural product tracing method and system based on block chain
Technical Field
The invention belongs to the technical field of product tracing, and particularly relates to a block chain-based agricultural product tracing method and system.
Background
With the improvement of living standard of people, consumption concept is also changed greatly, and attention is paid to body health and food safety. However, as agricultural products on which people live are planted and sold, a plurality of links of a supply chain are involved in the middle, any link is problematic, and finally, the agricultural products on the hands of consumers face safety problems.
Although some agricultural product tracing systems are available at present, because relevant data are based on manual intervention, time and labor are consumed, and whether the data are falsified in the processes of entry and transmission cannot be guaranteed, once the information is falsified, the tracing data finally provided for consumers does not have referential property, and even still faces the safety problem.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides an agricultural product tracing method and system based on a block chain. The technical problem to be solved by the invention is realized by the following technical scheme:
in a first aspect, an embodiment of the present invention provides an agricultural product tracing method based on a block chain, which is applied to any node of a block chain cloud platform, and includes:
acquiring data information of agricultural products, wherein the data information comprises planting data information, processing data information, storage and transportation data information and sales data information;
calling intelligent contracts of respective corresponding types of the data information to verify the data information, wherein the intelligent contracts comprise planting intelligent contracts, processing energy contracts, storage and transportation energy contracts and sales energy contracts;
if the data information passes the verification of the intelligent contract of the corresponding type, acquiring a current time stamp to form data information containing the time stamp;
encrypting the data information containing the timestamp to obtain a digital signature, and attaching the digital signature to the data information containing the timestamp to obtain encrypted agricultural product information; the digital signature is obtained by a digital signature method based on GRS codes of a finite field;
and selecting a processing node from the block chain cloud platform according to a preset consensus mechanism to construct a new block, so as to store the encrypted agricultural product information corresponding to the target agricultural product, and updating the block chain in each node of the block chain cloud platform, so as to add the new block to the tail of the block chain of each node, thereby completing the uplink.
In an embodiment of the present invention, the acquiring data information of the agricultural product includes:
the corresponding data information is obtained through the Internet of things equipment arranged on each node, and the Internet of things equipment comprises planting data acquisition equipment, processing data acquisition equipment, storage and transportation data acquisition equipment and sales data acquisition equipment.
In one embodiment of the present invention, the digital signature is obtained by a digital signature method based on a GRS code of a finite field, including:
constructing a GRS code based on a finite field;
generating a public key and a private key according to the GRS code;
performing hash operation on data information which needs to be digitally signed and contains a timestamp to obtain a digest value;
and encrypting the digest value by using the private key to obtain a digital signature.
In one embodiment of the present invention, the constructing a finite field based GRS code includes:
constructing a finite field, and constructing a GRS code with the code length of n, the dimension of k and the error correction capability of t according to the finite field, wherein n, k and t are all any positive integers and satisfy the requirement
Figure BDA0002862290100000031
In an embodiment of the present invention, the generating a public key and a private key according to the GRS code includes:
selecting an (n-k) x (n-k) nonsingular matrix, an n x n dense matrix and an n x n sparse matrix in the finite field, wherein the rank of the dense matrix is z, the average row weight and the column weight of the sparse matrix are x, z is a natural number, z is smaller than n, and x is smaller than n;
performing matrix addition operation on the dense matrix and the sparse matrix to obtain a transformation matrix;
performing matrix multiplication on the inverse matrix of the nonsingular matrix, the check matrix and the transposed matrix of the transformation matrix to obtain a public key; wherein the check matrix is a matrix of the GRS code (n-k) x n;
and taking the nonsingular matrix, the check matrix, the transformation matrix and a decoding algorithm as private keys.
In an embodiment of the present invention, the performing a hash operation on data information that needs to be digitally signed and includes a timestamp to obtain a digest value includes:
performing primary hash operation on a plaintext needing to be subjected to digital signature;
and performing the Hash operation again on the result obtained by the primary Hash operation to obtain the abstract value.
In an embodiment of the present invention, the encrypting the digest value by using the private key to obtain a digital signature includes:
multiplying the nonsingular matrix and the abstract value to obtain a syndrome to be translated;
decoding the syndrome to be decoded by using the decoding algorithm in combination with the check matrix of the private key to obtain a first error vector;
performing matrix multiplication on the first error vector and an inverse matrix of a transformation matrix of the private key to obtain a second error vector, wherein the weight of the second error vector is less than or equal to the error correction capability of the GRS code;
and using the second error vector as the digital signature.
In an embodiment of the present invention, the selecting a processing node from the blockchain cloud platform according to a preset consensus mechanism to construct a new block, so as to store the encrypted agricultural product information corresponding to the target agricultural product, and updating the blockchain in each node of the blockchain cloud platform, so as to add the new block to the tail of the blockchain of each node to complete uplink, includes;
selecting a processing node from a block chain cloud platform according to a preset practical Byzantine fault-tolerant algorithm to construct a new block, and storing the encrypted agricultural product information corresponding to the target agricultural product;
sending the encrypted agricultural product information in the new block to a block chain of each node of a block chain cloud platform through broadcasting;
each node generates a new block according to the received encrypted agricultural product information and adds the generated new block to the tail part of the corresponding block chain so as to realize the updated uplink of the corresponding block chain.
In a second aspect, an embodiment of the present invention provides an agricultural product tracing system based on a block chain, where the agricultural product tracing system includes a plurality of internet of things devices and a plurality of nodes forming a block chain cloud platform, and different nodes correspond to different internet of things devices, where each node includes a memory and a processor, where the memory stores a computer program, and the processor implements the method according to any one of the first aspect when executing the computer program.
According to the agricultural product tracing method and system based on the block chain, provided by the embodiment of the invention, the block chain technology and the digital signature technology based on the GRS code of the finite field are adopted, so that the related data information of each node of the agricultural product supply chain is not easy to be distorted, and the tracing data finally provided for consumers are real and reliable.
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Drawings
Fig. 1 is a flowchart of a method for tracing agricultural products based on a block chain according to an embodiment of the present invention;
fig. 2 is a flowchart of a digital signature method based on a GRS code of a finite field according to an embodiment of the present invention;
fig. 3 is a diagram of a feasibility simulation result of a finite field-based GRS code signature method according to an embodiment of the present invention;
fig. 4 is a diagram of a result of feasibility simulation of a finite field-based GRS code signature method under different error correction capabilities according to an embodiment of the present invention;
fig. 5 is a simulation result diagram of the finite field-based GRS code signature method under the ISD decoding attack according to the embodiment of the present invention;
fig. 6 is a diagram of a simulation result of a public key quantity of a finite field-based GRS code signature method under different error correction capabilities according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to specific examples, but the embodiments of the present invention are not limited thereto.
In order to realize traceability and tamper resistance of information of each node of an agricultural product, the embodiment of the invention provides an agricultural product traceability method and system based on a block chain.
In a first aspect, the embodiment of the invention provides a block chain-based agricultural product tracing method.
Referring to fig. 1, fig. 1 is a flowchart of an agricultural product tracing method based on a block chain according to an embodiment of the present invention; the block chain based agricultural product tracing method is applied to any node of a block chain cloud platform, and comprises the following steps:
and S11, acquiring data information of agricultural products, wherein the data information comprises planting data information, processing data information, storage and transportation data information and sales data information.
As the agricultural products are planted to sold, a plurality of links exist in the middle, each link is used as a node on a block chain, and corresponding data information generated correspondingly can be used as the basis for tracing the agricultural products. The block chain cloud platform is used as a part of an agricultural product tracing system, and data related to any node of the block chain cloud platform can be collected and managed through the Internet of things equipment corresponding to the node.
For example, the corresponding data information may be acquired through the internet of things device disposed on each node, where the internet of things device includes a planting data acquisition device, a processing data acquisition device, a storage and transportation data acquisition device, and a sales data acquisition device.
It should be noted that the acquisition of the data information of the agricultural product may be triggered by a manner that one end of the blockchain cloud platform actively sends an acquisition request to the internet of things device, or may be triggered by a manner that the internet of things device sends a data information upload request to the blockchain cloud platform.
And S12, acquiring the intelligent contracts of the respective corresponding types of the data information to verify the data information, wherein the intelligent contracts comprise planting intelligent contracts, processing energy contracts, storage and transportation energy contracts and sales energy contracts.
Different nodes correspond to different Internet of things devices, different Internet of things devices correspond to different data information types, and different nodes can upload different types of data information to block chains in the block chain cloud platform. Different nodes are usually preset with different intelligent contracts so as to verify corresponding data. An intelligent contract is a computer program that executes automatically when certain conditions are met. The data information can be verified by correspondingly determining to invoke the corresponding type of intelligent contract, usually by confirming the kind of the data information. Generally, the planting data information is corresponding to a planting intelligent contract, the processing data information is corresponding to a processing intelligent contract, the storage and transportation data information is corresponding to a storage and transportation intelligent contract, and the sales data information is corresponding to a sales intelligent contract.
And S13, if the data information passes the verification of the intelligent contract of the corresponding type, acquiring the current time stamp to form the data information containing the time stamp.
If the data message passes the verification of the called intelligent contract, the data message is indicated to be capable of performing the next operation on the data message, such as obtaining the time stamp of each data message.
An example time stamp obtaining method may include:
s131, carrying out hash operation on the data information to obtain summary information;
s132, a request of the time stamp is made, and the summary information is transmitted to a time stamp server;
s133, the timestamp server signs the digest information and the current date/time record, and generates a timestamp.
In the above method for obtaining a timestamp, the hash operation on the data information and the timestamp request are both performed at one end of the blockchain cloud platform, the timestamp is generated at one end of a timestamp server of a national time service center, and the generated timestamp is returned to the blockchain cloud platform.
The agricultural product data information of each node is stamped, the time generated by the data information is authenticated, and whether the data information is tampered after being acquired can be verified.
S14, encrypting the data information containing the time stamp to obtain a digital signature, and attaching the digital signature to the data information containing the time stamp to obtain encrypted agricultural product information; the digital signature is obtained by a digital signature method based on GRS codes of a finite field.
Referring to fig. 2, fig. 2 is a flowchart of a digital signature method for a GRS code based on a finite field according to an embodiment of the present invention. Different from the conventional digital signature method, the embodiment of the present invention employs a digital signature method based on a GRS code of a finite field, and the signature method may include S141 to S144:
and S141, constructing a GRS code based on a finite field.
By way of example, this step may include: constructing a finite field, and constructing a GRS code (generalized Reed-Solomon code) with a code length of n, a dimension of k and an error correction capability of t according to the finite field, wherein n, k and t are all any positive integers and satisfy the requirement of
Figure BDA0002862290100000081
Wherein the finite field can select a finite field F comprising q elementsqAnd selecting a positive integer m so that q satisfies q 2m
It should be noted that the embodiments of the present inventionSo that the selection is based on the finite field FqInstead of being based on the normal binary system, because the code with the same security level (such as Goppa code) is based on the finite field F when facing the ISD decoding attackqThe Goppa code of (2) has a smaller public key amount than the binary-based Goppa code. For example, a finite field based Goppa code with a security level of 128, with a public key amount of 725740 bits; and a binary Goppa code-based, public key quantity of 1537536bits with a security level of 128. In contrast, based on the finite field FqThe amount of public keys of Goppa code is nearly an order of magnitude smaller than that of the public keys based on binary Goppa code.
In addition, the GRS code is selected rather than the other codes (e.g., Goppa code) because the GRS code is a very large distance separable (MDS) code, which has good performance; the existing coder and decoder of the GRS code has a plurality of applications in various fields and good practicability; furthermore, GRS codes are more flexible than Goppa codes; and the GRS code has the advantage of stronger expandability.
And S142, generating a public key and a private key according to the GRS code.
The public key and the private key are generated based on the GRS code of the finite field, so that the public key and the private key can be ensured to have higher safety performance and smaller occupied space, and different public keys and private keys are generated aiming at different logistics information. One public key can decrypt only one encrypted tag.
In an alternative embodiment, S142 may include steps S1421 to S1424.
S1421, selecting an (n-k) × (n-k) nonsingular matrix, an n × n dense matrix and an n × n sparse matrix in a finite field, wherein the rank of the dense matrix is z, the average row weight and the column weight of the sparse matrix are x, z is a natural number, z is smaller than n, and x is smaller than n.
As an embodiment of the present invention, a dense matrix may be adopted, in which the rank z is much smaller than n, and the average row weight and column weight x of the sparse matrix are much smaller than n.
In particular, a dense matrix may be represented by the product of the transpose of the matrix and the matrix, i.e.
Figure BDA00028622901000000914
Wherein
Figure BDA00028622901000000915
Is a finite field FqTwo zxn matrices are defined above, and the rank of the matrix is z.
Optionally, in the scheme of the present invention, the following choices for selecting the parameters m, n, k, t, and x are available as reference in table 1, and there are some choices and not limited to these, but considering the correctness, feasibility, and security of the scheme, and the public key amount and signature length, the scheme of the present invention preferably adopts three sets of parameter values listed in table 1.
TABLE 1 parameter selection
m n k t x
12 4094 4074 10 1~1.1
16 65534 65516 9 1~1.1
10 1022 1002 10 1~1.1
S1422, performing matrix addition operation on the dense matrix and the sparse matrix to obtain a transformation matrix.
Specifically, the addition operation adopts formula (1):
Figure BDA0002862290100000091
wherein the content of the first and second substances,
Figure BDA0002862290100000092
a transformation matrix is represented that is,
Figure BDA0002862290100000093
a dense matrix is represented that is,
Figure BDA0002862290100000094
a sparse matrix is represented.
S1423, performing matrix multiplication on the inverse matrix of the nonsingular matrix, the check matrix and the transposed matrix of the transformation matrix to obtain a public key; wherein, the check matrix is an (n-k) x n matrix of the GRS code.
Specifically, the multiplication operation adopts formula (2):
Figure BDA0002862290100000095
wherein the content of the first and second substances,
Figure BDA0002862290100000096
which represents the public key(s),
Figure BDA0002862290100000097
representing the inverse of the non-singular matrix,
Figure BDA0002862290100000098
a check matrix is represented that is,
Figure BDA0002862290100000099
representing a transpose of the transform matrix.
S1424, converting the nonsingular matrix
Figure BDA00028622901000000910
Check matrix
Figure BDA00028622901000000911
Transformation matrix
Figure BDA00028622901000000912
And decoding algorithm
Figure BDA00028622901000000913
As the private key.
It will be appreciated that the public key is used for external disclosure and the private key is used for storage. The public key and the private key are two different parameter sets in an algorithm, but are inherently associated with each other, and are generated simultaneously but can be used independently.
And S143, carrying out hash operation on the data information containing the timestamp to obtain the abstract value.
The hash operation refers to an algorithm that can map a message with any length into a message with a fixed length, and the hash operation implemented by the present invention can adopt any one of MD4, MD5, or SHA 256. The data information containing the time stamp is used as unencrypted plaintext, the plaintext is characters which can be intuitively understood by people, the first encryption is carried out through a Hash algorithm, the plaintext with any length is mapped into a string of ciphertext with fixed length, the ciphertext is an encrypted character string, people cannot intuitively understand the meaning of the ciphertext, and the string of ciphertext is a digital abstract. In the step, through Hash operation, a digest value is generated from the data information plaintext containing the timestamp, and the digest value is used for the next encryption of the data information containing the timestamp.
In an alternative embodiment, S143 may include S1431 to S1432.
S1431, perform a primary hash operation on the data information including the timestamp that needs to be digitally signed.
If M represents the plaintext of the data information containing the time stamp, h (M) is obtained by carrying out primary hash operation on the data information containing the time stamp.
And S1432, performing hash operation on the result obtained by the primary hash operation again to obtain an abstract value.
In this step, the result h (M) obtained by the primary hash operation is subjected to the hash operation again to obtain the digest value SxI.e. calculating SxH (m) i), wherein i is 0,1,2 … …. In the embodiment of the invention, i is taken to be 0, and the abstract value S is made to bexIs a vector of length n-k.
In other embodiments, the digest value may be obtained by one or more hash operations, and the output length may be satisfied.
And S144, encrypting the digest value by using a private key to obtain a digital signature.
Illustratively, this step may include S1441-S1442:
s1441, performing multiplication operation on the nonsingular matrix and the abstract value to obtain a syndrome to be translated.
Specifically, the multiplication operation adopts formula (3):
Figure BDA0002862290100000111
wherein, S'xWhich represents the syndrome to be interpreted,
Figure BDA0002862290100000112
representing a non-singular matrix, SxRepresenting the digest value.
S1442, decoding the syndrome to be decoded and using the obtained error vector as a digital signature.
Illustratively, this step may include, in turn, S14421 to S14423:
s14421, decoding the syndrome to be decoded by using a decoding algorithm in combination with the transformation matrix of the private key to obtain a first error vector.
Any existing decoding algorithm can be selected as the decoding algorithm, and in this embodiment, the decoding algorithm is preferably an iterative decoding algorithm in the time domain, that is,: BM iterative decoding algorithms (Berlekamp-Massey), Chien search algorithms (Chien), and Forney algorithms. The decoding algorithm is fast in speed, simple to implement and easy to implement by a computer, so that the decoding algorithm is a fast decoding algorithm.
Optionally, the decoding algorithm may include the following steps:
the method comprises the following steps: calculating a syndrome;
step two: determining an error location polynomial;
step three: determining an error estimation function;
step four: and solving the error position number and the error numerical value, and correcting errors.
Completing the four steps to finish one-time decoding, and if the decoding is successful, directly decoding an error vector; otherwise, it is considered as decoding failure.
With reference to the scheme of the embodiment of the present invention, if the decoding fails, i' is changed to i +1, and the hash operation is restarted from S133 to re-decode until the decoding succeeds, so as to obtain the first error vector.
S14422, performing matrix multiplication operation on the first error vector and an inverse matrix of the transformation matrix of the private key to obtain a second error vector, wherein the weight of the second error vector is less than or equal to the error correction capability value of the GRS code.
Specifically, the multiplication operation in this step adopts formula (4):
Figure BDA0002862290100000121
wherein the content of the first and second substances,
Figure BDA0002862290100000122
which represents a second error vector, is,
Figure BDA0002862290100000123
which represents a first error vector, is shown,
Figure BDA0002862290100000124
an inverse matrix of a transformation matrix representing the private key.
S14423, the second error vector is used as a digital signature.
So far, a digital signature based on an error vector error correction code has been obtained, but the error vector occupies more bits due to the existence of a plurality of 0 elements. In order to reduce the bit number, the scheme provided by the invention can be further optimized on the basis of the embodiment.
Preferably, after obtaining the second error vector, the method further includes the following steps:
and constructing an index pair for the second error vector to obtain the index pair of the second error vector.
Specifically, the index pair of the second error vector can be obtained according to equation (5).
Figure BDA0002862290100000125
Wherein, IeRepresenting an index pair.
Extracting non-zero elements in the second error vector and marking as error values, and constructing an index pair I of the second error vector by using the error position alpha and the error position ce
Accordingly, the index pair is treated as a digital signature.
In a preferred scheme, by further establishing an index pair for the generated second error vector and using the index as a digital signature, the number of bits can be reduced, thereby reducing the signature length.
The signature partMethod based on finite field FqThe GRS code generates a public key and a private key, the plain text is subjected to two times of hash operation to obtain a digest value, and the digest value is encrypted by using the private key to obtain a digital signature. The digital signature scheme has high feasibility, and can reduce the public key amount, improve the digital signature efficiency and further improve the security.
Compared with the traditional digital signature method, the digital signature method adopting the GRS code based on the finite field has higher safety and higher signature efficiency.
Corresponding to the signature method, the block chain-based agricultural product tracing method of the invention may further include a method step of verifying data information:
(a) and decrypting the digital signature by using the public key to obtain a digest value to be verified.
Corresponding to the scheme that the obtained second error vector is used as the digital signature in the signature method, the step is to directly decrypt the second error vector by using a public key to obtain a digest value to be verified.
Corresponding to the scheme that the obtained index pair is used as the digital signature in the signature method, in the step, the second error vector needs to be restored according to the index pair, and then the public key is used for decrypting the second error vector to obtain the digest value to be verified.
In particular, the second error vector needs to be recovered from the index pair, i.e. in index pair IeMiddle alphajPosition of index by cjFilling in at αjThe positions outside the index are filled with 0's until the vector
Figure BDA0002862290100000133
Up to (n-k).
And decrypting the second error vector by using the public key, namely obtaining a digest value to be verified according to a formula (6):
Figure BDA0002862290100000131
wherein y represents the digest value to be verified.
Computing public keys
Figure BDA0002862290100000132
According to ajValue of corresponding row of index and cjAnd taking the product as the digest value to be verified.
(b) And carrying out Hash operation on the data information containing the timestamp to obtain an abstract value.
Similarly, two hash operations need to be performed on the data information including the timestamp, and the specific steps are the same as S143, which is not described herein again. The digest value y' is obtained by two hash operations, i.e., h (m) i).
(c) And comparing the abstract value to be verified with the abstract value, and if the abstract value to be verified is equal to the abstract value, the verification is successful.
In the embodiment of the invention, the digest value y to be verified is compared with the digest value y ', if y is equal to y', the digest value to be verified is equal to the digest value, the signature is verified successfully, and the data information containing the timestamp is not tampered; otherwise, the signature fails to be verified, which indicates that the data information containing the time stamp is tampered.
S15, selecting a processing node from the blockchain cloud platform according to a predetermined consensus mechanism to construct a new block, so as to store the encrypted agricultural product information corresponding to the target agricultural product, and updating the blockchain in each node of the blockchain cloud platform, so as to add the new block to the tail of the blockchain of each node, thereby completing the uplink.
By way of example, this step may include:
and S151, selecting a processing node from the block chain cloud platform according to a preset practical Byzantine fault-tolerant algorithm to construct a new block, and storing the corresponding encrypted agricultural product information of the target agricultural product.
A processing node can be selected from the block chain cloud platform through a preset practical Byzantine fault-tolerant algorithm to construct a new block, wherein the processing node can be any node in the block chain cloud platform, and the corresponding information record of the target agricultural product can be stored through the new block generated by the selected processing node.
And S152, sending the encrypted agricultural product information in the new block to the block chain of each node of the block chain cloud platform through broadcasting.
In order to realize the whole network sharing of the information record, the information record in the new block can be sent to the block chain of each node of the block chain cloud platform through broadcasting, so that all the block chains on the block chain cloud platform can be ensured to realize effective storage of the related data information.
And S153, each node generates a new block according to the received encrypted agricultural product information and adds the generated new block to the tail part of the corresponding block chain so as to realize the updated uplink of the corresponding block chain.
Each node can generate a new block according to the received information record, and can add the generated new block to the tail part of the corresponding block chain, thereby realizing the updated uplink of all the block chains. Through the specific mode, the information records of the target agricultural products can be effectively stored, so that data cannot be tampered, and traceability query is facilitated.
According to the agricultural product tracing method based on the block chain, the block chain technology and the digital signature technology based on the GRS code of the finite field are adopted, so that the related data information of each node of the agricultural product supply chain is not easy to be distorted, and the tracing data finally provided for consumers are real and reliable; the digital signature method based on the GRS code of the finite field can ensure better signature safety and higher signature efficiency.
In a second aspect, an embodiment of the present invention provides an agricultural product tracing system based on a block chain, where the agricultural product tracing system includes a plurality of internet of things devices and a plurality of nodes forming a block chain cloud platform, and different nodes correspond to different internet of things devices, where each node includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of the first aspect when executing the computer program.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be 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 device, discrete hardware component.
According to the agricultural product tracing system based on the block chain, provided by the embodiment of the invention, the block chain technology and the digital signature technology based on the GRS code of the finite field are adopted, so that the related data information of each node of the agricultural product supply chain is not easy to be distorted, and the tracing data finally provided for consumers are real and reliable; the digital signature method based on the GRS code of the finite field can ensure better signature safety and higher signature efficiency.
Because the block chain-based agricultural product tracing method and system provided by the invention both use the finite field-based GRS code digital signature method, the scheme provided by the embodiment of the invention is verified in the following aspects of the correctness, feasibility, safety, public key amount and signature length of the digital signature.
(1) Correctness:
the verification of the correctness is also the verification of whether the signature verification is successful or not, and the correctness can be proved by proving that the digest value to be verified obtained by decrypting the second error vector by using the public key is equal to the digest value obtained in the process of generating the signature. The specific process is as follows:
decrypting the second error vector by using a public key to obtain a digest value to be verified, wherein the public key is used for carrying out matrix multiplication on the basis of an inverse matrix of a nonsingular matrix, a check matrix and a transposed matrix of a change matrixObtained by operation, namely the formula (2); the second error vector is obtained by matrix multiplication based on the first error vector and the inverse matrix of the change matrix of the private key, namely, the formula (4); the digest value to be verified is based on each column in the public key according to alphajValue of corresponding row of index and cjThe product of (a) is obtained, i.e., the above formula (6).
Therefore, by substituting the formula (2) and the formula (4) into the formula (6),
Figure BDA0002862290100000171
by simplifying the formula in the above formula (7), the following can be obtained:
Figure BDA0002862290100000172
and due to
Figure BDA0002862290100000173
Thus, from equation (8):
Figure BDA0002862290100000174
wherein y represents the digest value to be verified,
Figure BDA0002862290100000175
representing the inverse, S 'of the nonsingular matrix'xRepresenting the syndrome to be translated.
The syndrome to be translated is obtained by multiplying the non-singular matrix by the digest value, i.e. the above formula (3).
Thus, according to equation (3), y is obtained as SxThat is, y' can be obtained, and the verification is successful, which indicates that the signature is correct.
(2) Feasibility:
based on a finite field FqThe total syndrome number of the GRS code is N, and N is qn-k=q2t=q2mtCan go inThe number of syndrome of row decoding is M, and
Figure BDA0002862290100000176
therefore to the digest value SxThe probability of finding success is
Figure BDA0002862290100000177
I.e. the average number of lookups is
Figure BDA0002862290100000178
Based on finite field FqThe parameter pair (m, t) of the GRS code signature is selected to ensure that the average search times is below ten million orders of magnitude, and the selection of the parameter pair cannot be too small.
Referring to fig. 3, fig. 3 is a diagram illustrating a feasibility simulation result of a finite field-based GRS code signature method according to an embodiment of the present invention. The figure shows the log of the error correction capability t and the average number of lookups2The relationship between Z. As can be seen from fig. 3, the log of the error correction capability t and the average number of lookups2Z is proportional, i.e. the average number of seeks Z is exponential to the error correction capability t.
The horizontal line in FIG. 3 represents operations of the order of tens of millions, where data x represents m and y represents log2Z。
When the value of the error correction capability t is greater than 10, the average search times will be too large, and therefore, it is more suitable that the error correction capability t is selected to be less than or equal to 10.
Referring to fig. 4, fig. 4 is a diagram of a feasibility simulation result of the finite field-based GRS code signature method under different error correction capabilities according to the embodiment of the present invention. Fig. 4 shows the relationship between m and the logarithm of the average number of lookups when the error correction capability t is 9 and 10. In the figure, x represents m, and y represents log2And Z. As can be seen from FIG. 4, when m.gtoreq.12, log increases with m2Z tends to be smooth with little change; when m is<12, the average number of lookups is increased. Therefore, m is preferably 12 or more.
In addition, two sets of data from table 2 can be obtained from fig. 4:
TABLE 2(a)
m(t=10) 6 8 10 12 14 16 18
log2Z 23.33 22.16 21.88 21.81 21.80 21.79 21.79
TABLE 2(b)
m(t=9) 6 8 10 12 14 16 18
log2Z 19.74 18.78 18.55 18.49 18.47 18.4703 18.47
The CFS signature is known to use parameter pairs (m, t) of (15,10) and (16, 9). When the parameter pair is (15,10), the logarithm value of the average search number of the CFS signature is 27.7911, based on the finite field FqThe logarithm value of the average search times of the GRS code signature is 21.7933; when the parameter pair is (16,9), the logarithm of the average number of lookups for the CFS signature is 18.4691, based on the finite field FqThe log value of the average number of lookups of the GRS code signature of (a) is 18.4703.
In contrast, under two parameter pairs, the CFS signature is based on the finite field FqThe average search times of GRS code signatures have little difference, so the invention is based on the finite field FqThe GRS code digital signature method has feasibility.
(3) Safety:
referring to fig. 5, fig. 5 is a simulation result diagram of the finite field-based GRS code signature method under the ISD decoding attack according to the embodiment of the present invention. Fig. 5 shows the relationship of m to the security level SL in the case of an ISD decoding attack.
And the product of the security level coefficient under the ISD decoding attack and m and t is in an exponential relation, and t is selected to be less than or equal to 10 based on the condition. I.e. when t is determined, the larger m, the higher the security level coefficient.
In the figure, data x represents m, and y represents SL. As can be seen from FIG. 5, based on the finite field FqThe digital signature of the GRS code of (1) can reach a security level SL of 80 when the parameter pair is selected as (10,10), the general security level has been reached, and the security level SL exceeds 128 when the parameter pair is selected as (16, 9).
Under the ISD decoding attack, when the parameter pair is (15,10), the security level coefficient SL of the CFS signature is 76.89 and is based on a finite field FqThe security level coefficient SL of the GRS code signature of is 135.42; when the parameter pair is (16,9), the security level coefficient SL of the CFS signature is 76.92 based on the finite field FqThe security level coefficient SL of the GRS code signature of (a) is 135.56.
In comparison, the finite field F-based method provided by the embodiment of the inventionqThe GRS code signature has a higher security level coefficient under the attack of ISD decoding.
In addition, the embodiment of the invention provides a finite field FqThe GRS code signature can also effectively resist the distinguishing attack, and the parameter selection of the CFS signature under the distinguishing attack has defects.
(4) Public key quantity:
in the embodiment of the invention, the check matrix of the GRS code is subjected to Gaussian elimination to obtain a row ladder type matrix, namely a public key
Figure BDA0002862290100000191
The public key quantity of (a) is k (n-k). Thus, based on the finite field FqThe public key quantity is k (n-k) log on the GRS code2q。
Referring to fig. 6, fig. 6 is a graph of a simulation result of a public key quantity of a signature method based on a finite field GRS code under different error correction capabilities according to an embodiment of the present invention. Fig. 6 shows the relationship between m and the public key amount when the error correction capability t is 9 and 10. In the figure, data x represents m, and y represents k (n-k) log2q is calculated. As can be seen from fig. 6, the public key amount has an exponential relationship with m, and the influence on the public key amount is not obvious under different error correction capabilities t. Although when m is larger, based on the finite field FqThe more secure the GRS code signature, but also the larger the amount of public keys. Therefore, a more suitable m is selected, so that the safety factor is higher and the public key quantity is smaller, for example, m is 10 or 12.
(5) Signature length:
the embodiment of the invention provides a finite field FqThe signature length of the GRS code is 2 m.tp+log2Z。
Table 3 is based on the finite field FqThe GRS code signature and the CFS signature are compared with each other in average search times, security level, public key amount and signature length under two different parameter pairs.
Table 3 parameter comparison of finite field Fq-based GRS code signature and CFS signature under different parameter pairs
Figure BDA0002862290100000201
As can be seen from table 3, the finite field F-based method provided by the embodiment of the present invention is based on different parameter pairsqThe security level coefficient of the GRS code signature is higher than that of the CFS signature, but the amount of public keys and the length of the digital signature are larger.
Therefore, selecting several different sets of parameter pairs is based on the finite field FqThe parameters of the GRS code signature of (1) were simulated, and the results are shown in table 4.
TABLE 4 different parameter pairs based on finite field FqParameter of GRS code signature
Parameter pair Average number of lookups Security Level (SL) Amount of public key Signature Length (bits)
(11,9) 18.5072 85.5239 401544 195
(10,10) 21.8829 80.3254 200400 202
(12,10) 21.8140 102.3972 977760 238
The GRS code signature based on the finite field Fq provided by the embodiment of the invention can reduce the selection of parameter pairs and reduce the public key amount and the signature length on the premise of improving the security level coefficient.
The verification shows that the digital signature scheme adopted by the invention has the effects of correctness, feasibility, safety, reduction of public key quantity, reduction of signature length and the like.
Therefore, as a more preferable scheme, the block chain-based agricultural product tracing method and system based on the digital signature method further improve the tamper resistance and the security of the agricultural product tracing data, and greatly improve the signature efficiency.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

Claims (10)

1. An agricultural product tracing method based on a block chain is characterized in that the agricultural product tracing method is applied to any node of a block chain cloud platform and comprises the following steps:
acquiring data information of agricultural products, wherein the data information comprises planting data information, processing data information, storage and transportation data information and sales data information;
calling intelligent contracts of respective corresponding types of the data information to verify the data information, wherein the intelligent contracts comprise planting intelligent contracts, processing energy contracts, storage and transportation energy contracts and sales energy contracts;
if the data information passes the verification of the intelligent contract of the corresponding type, acquiring a current time stamp to form data information containing the time stamp;
encrypting the data information containing the timestamp to obtain a digital signature, and attaching the digital signature to the data information containing the timestamp to obtain encrypted agricultural product information; the digital signature is obtained by a digital signature method based on GRS codes of a finite field;
and selecting a processing node from the block chain cloud platform according to a preset consensus mechanism to construct a new block, so as to store the encrypted agricultural product information corresponding to the target agricultural product, and updating the block chain in each node of the block chain cloud platform, so as to add the new block to the tail of the block chain of each node, thereby completing the uplink.
2. The agricultural product tracing method based on the block chain according to claim 1, wherein the obtaining data information of the agricultural product comprises:
the corresponding data information is obtained through the Internet of things equipment arranged on each node, and the Internet of things equipment comprises planting data acquisition equipment, processing data acquisition equipment, storage and transportation data acquisition equipment and sales data acquisition equipment.
3. The method for tracing agricultural products based on the block chain as claimed in claim 1, wherein the digital signature is obtained by a digital signature method based on GRS code of finite field, comprising:
constructing a GRS code based on a finite field;
generating a public key and a private key according to the GRS code;
performing hash operation on data information which needs to be digitally signed and contains a timestamp to obtain a digest value;
and encrypting the digest value by using the private key to obtain a digital signature.
4. The method for tracing agricultural products based on block chains according to claim 3, wherein the constructing a GRS code based on finite fields comprises:
constructing a finite field, and constructing a GRS code with the code length of n, the dimension of k and the error correction capability of t according to the finite field, wherein n, k and t are all any positive integers and satisfy the requirement
Figure FDA0002862290090000021
5. The method for tracing agricultural products based on the blockchain according to claim 4, wherein the generating a public key and a private key according to the GRS code comprises:
selecting an (n-k) x (n-k) nonsingular matrix, an n x n dense matrix and an n x n sparse matrix in the finite field, wherein the rank of the dense matrix is z, the average row weight and the column weight of the sparse matrix are x, z is a natural number, z is smaller than n, and x is smaller than n;
performing matrix addition operation on the dense matrix and the sparse matrix to obtain a transformation matrix;
performing matrix multiplication on the inverse matrix of the nonsingular matrix, the check matrix and the transposed matrix of the transformation matrix to obtain a public key; wherein the check matrix is a matrix of the GRS code (n-k) x n;
and taking the nonsingular matrix, the check matrix, the transformation matrix and a decoding algorithm as private keys.
6. The agricultural product tracing method based on the blockchain according to claim 5, wherein the performing a hash operation on the data information containing the timestamp and needing to be digitally signed to obtain the digest value comprises:
performing primary hash operation on a plaintext needing to be subjected to digital signature;
and performing the Hash operation again on the result obtained by the primary Hash operation to obtain the abstract value.
7. The blockchain-based agricultural product tracing method according to claim 6, wherein said encrypting the digest value using the private key to obtain a digital signature comprises:
multiplying the nonsingular matrix and the abstract value to obtain a syndrome to be translated;
decoding the syndrome to be decoded by using the decoding algorithm in combination with the check matrix of the private key to obtain a first error vector;
performing matrix multiplication on the first error vector and an inverse matrix of a transformation matrix of the private key to obtain a second error vector, wherein the weight of the second error vector is less than or equal to the error correction capability of the GRS code;
and using the second error vector as the digital signature.
8. The blockchain-based agricultural product traceability method according to claim 7, further comprising the following steps after obtaining the second error vector:
constructing an index pair for the second error vector to obtain the index pair of the second error vector;
correspondingly, the index pair is used as the digital signature.
9. The block chain-based agricultural product tracing method according to claim 1, wherein said selecting a processing node from the block chain cloud platform according to a predetermined consensus mechanism to construct a new block, so as to store the encrypted agricultural product information corresponding to the target agricultural product, and updating the block chain in each node of the block chain cloud platform to add the new block to the tail of the block chain of each node, thereby completing uplink, includes;
selecting a processing node from a block chain cloud platform according to a preset practical Byzantine fault-tolerant algorithm to construct a new block, and storing the encrypted agricultural product information corresponding to the target agricultural product;
sending the encrypted agricultural product information in the new block to a block chain of each node of a block chain cloud platform through broadcasting;
each node generates a new block according to the received encrypted agricultural product information and adds the generated new block to the tail part of the corresponding block chain so as to realize the updated uplink of the corresponding block chain.
10. An agricultural product tracing system based on a block chain is characterized by comprising a plurality of Internet of things devices and a plurality of nodes forming a block chain cloud platform, wherein different nodes correspond to different Internet of things devices, each node comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1-9 when executing the computer program.
CN202011570308.1A 2020-12-26 2020-12-26 Agricultural product tracing method and system based on block chain Withdrawn CN112614001A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011570308.1A CN112614001A (en) 2020-12-26 2020-12-26 Agricultural product tracing method and system based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011570308.1A CN112614001A (en) 2020-12-26 2020-12-26 Agricultural product tracing method and system based on block chain

Publications (1)

Publication Number Publication Date
CN112614001A true CN112614001A (en) 2021-04-06

Family

ID=75247989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011570308.1A Withdrawn CN112614001A (en) 2020-12-26 2020-12-26 Agricultural product tracing method and system based on block chain

Country Status (1)

Country Link
CN (1) CN112614001A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116976919A (en) * 2023-09-25 2023-10-31 国品优选(北京)品牌管理有限公司 Block chain-based anti-counterfeiting traceability method and system for oral liquid

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116976919A (en) * 2023-09-25 2023-10-31 国品优选(北京)品牌管理有限公司 Block chain-based anti-counterfeiting traceability method and system for oral liquid
CN116976919B (en) * 2023-09-25 2024-01-02 国品优选(北京)品牌管理有限公司 Block chain-based anti-counterfeiting traceability method and system for oral liquid

Similar Documents

Publication Publication Date Title
US11182247B2 (en) Encoding and storage node repairing method for minimum storage regenerating codes for distributed storage systems
US10360392B2 (en) Generating shares of secret data
CN107426165B (en) Bidirectional secure cloud storage data integrity detection method supporting key updating
Rossi et al. A side-channel assisted cryptanalytic attack against QcBits
RU2680350C2 (en) Method and system of distributed storage of recoverable data with ensuring integrity and confidentiality of information
US10885814B2 (en) Share recovery system, share recovery apparatus, share recovery method, and program
BR112012003688B1 (en) METHODS AND EQUIPMENT USING FEC CODES WITH PERMANENT DISABLING OF SYMBOLS FOR CODING AND DECODING PROCESSES
CN104769675B (en) data processing
CN112635009A (en) Medical data encryption method based on block chain
WO2022134119A1 (en) Blockchain-based electronic medical record sharing method and electronic device
CN112635008A (en) Medical examination report generation method based on digital signature
CN112613760A (en) Product quality evaluation method and system based on block chain technology
CN112614001A (en) Agricultural product tracing method and system based on block chain
Balmany et al. Dynamic proof of retrievability based on public auditing for coded secure cloud storage
CN112613008A (en) Student identity online authentication method and system
KR102211648B1 (en) Electronic device capable of data communication through electronic signatures based on syndrome and operating method thereof
Yang et al. Secure cloud storage based on RLWE problem
CN108432170A (en) Device and method for multi-code distributed storage
CN112614558A (en) Electronic medical record sharing method based on block chain and electronic equipment
CN112769573B (en) Digital signature method, signature verification method and device based on GRS code
CN112631992A (en) Electronic file filing method and system
CN112613078A (en) Document electronic signature method, signature verification method and device
CN112633712A (en) Online bidding method and system based on GRS codes
CN112634092A (en) Contract authentication method and device based on block chain and electronic equipment
CN112614557A (en) Electronic medical record encryption archiving method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20210406