CN115567550B - File information data storage method based on blockchain and cryptographic algorithm - Google Patents

File information data storage method based on blockchain and cryptographic algorithm Download PDF

Info

Publication number
CN115567550B
CN115567550B CN202211161053.2A CN202211161053A CN115567550B CN 115567550 B CN115567550 B CN 115567550B CN 202211161053 A CN202211161053 A CN 202211161053A CN 115567550 B CN115567550 B CN 115567550B
Authority
CN
China
Prior art keywords
file
node
data
block
block chain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211161053.2A
Other languages
Chinese (zh)
Other versions
CN115567550A (en
Inventor
司鹏搏
周宇泽
李萌
杨睿哲
孙艳华
张延华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Technology
Original Assignee
Beijing University of Technology
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 Beijing University of Technology filed Critical Beijing University of Technology
Priority to CN202211161053.2A priority Critical patent/CN115567550B/en
Publication of CN115567550A publication Critical patent/CN115567550A/en
Application granted granted Critical
Publication of CN115567550B publication Critical patent/CN115567550B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/22Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks comprising specially adapted graphical user interfaces [GUI]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Human Computer Interaction (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a file information data storage method based on a blockchain and a cryptographic algorithm, which aims to store files more safely and conveniently, prevent the files from being tampered and protect personal privacy and interests of users. The blockchain and the cryptographic algorithm are combined, and the decentralised public ledger blockchain is used as a storage tool. The hash value is generated by using the SM3 hash algorithm of the national password, file information is extracted, and key information can be recorded in a small storage space. And the data is safely and rapidly transmitted by adopting a POST request mode. The Kafka algorithm is used in the block chain background system to efficiently complete the consensus among nodes, so that data cannot be tampered once being uploaded. And constructing a front end by using HTML\CSS\JavaScript, inquiring the data and displaying the corresponding block information on a front end interface. And finally, file information data can be safely, effectively and conveniently stored.

Description

File information data storage method based on blockchain and cryptographic algorithm
Technical Field
The invention belongs to the technical fields of blockchain, computer network communication, JAVA software development and the like, and the system technology is applied to the fields of file data storage, data transmission and file key information extraction.
Background
With the continuous increase of the popularity of the internet and the rapid development of communication technology, the security problem of key information data has attracted extensive attention to society. Computer files are a necessity in people's daily life work, storing security concerns about the personal privacy of the user and the economic benefits of the personnel entity, even involving some key entity's core secrets. In the environment where data storage technology is continuously being reformed and innovated, security of data storage is a major concern. That is, users want to use a storage system with a secure quality guarantee and a simple, convenient and efficient storage manner.
Blockchains are essentially a de-centralized public ledger. The system uses distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and an intelligent contract to ensure the fairness of the platform, and has the characteristics of decentralization, incapability of tampering, whole-course trace, traceability, collective maintenance, openness, transparency, multi-node interactive sharing and the like. Data that grows over time is packed into blocks, all of which are concatenated in time order to form a chain. Based on the security requirements of the file and the realizability of the technology, hyperLedgerFabric alliance chains are used as blockchain platforms, and the file content is saved and uplink in the form of hash values. The transaction contents are bound in the block by hash values, and the hash values of the files in the transaction correspond to the file contents one by one, so that the file contents recorded on the chain are not tamperable, and the traceability is realized. Therefore, the file storage method based on the combination of the block chain technology and the file hash processing is realized, and the reliability of the file is ensured.
The domestic cipher hash function (Cryptographic hash function, SM 3) is a cipher hash function standard adopted in China, and is mainly used for digital signature and verification, message authentication code generation and verification, random number generation and the like. The hash value verification technology is a verification algorithm based on characteristic values, and the characteristic values of the electronic file are obtained by operating the electronic file through a specific algorithm, so that the electronic file is just like a fingerprint of a person. The characteristic values of different electronic files are different. The method is mainly used for digital signature and verification, message authentication code generation and verification, random number generation and the like. In information security, there are many important applications that are implemented using cryptographic hash functions, such as digital signatures, message authentication codes.
An ideal cryptographic hash function should have four main characteristics: for any given message, it is easy to calculate the hash value. It is difficult to extrapolate the original message from a known hash value. Modifying the message content is not feasible without changing the hash value. For two different messages, it cannot give the same hash value. For messages m of length n (n < 264) bits, the SM3 hash algorithm generates a hash value of length 256 bits by padding and iterative compression. Assume that message m is n bits in length. Bit "1" is first added to the end of the message, followed by k "0" s, k being the smallest non-negative integer satisfying n+1+k≡448mod 512. A further 64-bit string is then added, which is a binary representation of length nl. The bit length of the padded message m' is a multiple of 512. And then carrying out iterative compression, message expansion and compression function, and encrypting the message m in a mode of generating a hash value.
The operation process is not limited by the format of the electronic file, and the algorithm can be used for calculating the characteristic value in any electronic file. Data is sent in POST requests of HTTP and converted into a standard format for uploading to the blockchain using node. Js.
The front-end visualization page is built using hypertext markup language (Hyper Text Markup Language, HTML), cascading style sheets (CASCADING STYLE SHEETS, CSS), JS scripting language (JavaScript, JS). HTML is a markup language that can specify words, graphics, animations, sounds, forms, links, etc. CSS is a computer language used to represent the style of HTML files. JavaScript is a lightweight, interpreted or just-in-time programming language with functional prioritization.
Disclosure of Invention
The invention aims to combine the two technologies to build a storage system with safety quality assurance and a simple, convenient and efficient file information storage system. At present, the development of modern internet technology promotes the quality and the security of file information data storage to be influenced by multiple factors, so that the establishment of safe file key data information extraction and transmission and a storage system are effective means for guaranteeing the data security and the user interests. The traditional file storage system has the problems of low safety, easy tampering, limited storage space, greatly reduced file storage quantity, storage quality, safety and the like.
In order to solve the problems, the invention provides a file information storage method based on a blockchain and a cryptographic algorithm file. The system supports file submission, which comprises five steps of hash value calculation, file name and file path extraction, file ID generation, client side transmission, server receiving, data processing and uplink. The configuration client uses a national cipher SM3 algorithm to generate a hash value, extracts a file name and a file path, generates a file ID, transmits file related data, and receives a return value (information such as block height, block creation time (file uplink time), a block hash value, a previous block hash value, uplink use intelligent contracts and the like). And realizing connection of two ends through POST transceiving in the HTTP protocol. The server is used for receiving the file related data, judging and processing the data, then uploading the data, and carrying out consensus and storage in the block chain. Only storing key information such as file hash values can occupy less storage space, improve transmission efficiency, and can further improve file confidentiality without directly storing files. The visual front end provides the functions of inquiring the key data information of the file and the corresponding block information.
The browser visualization front end is realized by using a development framework of JavaScript/HTML/CSS, and a front end visualization interface is established for the file query function. In the page layout, the block chain information is displayed respectively, and the user manages and inquires the file. In the query page, three methods of querying through file hash value, querying through file name and querying through file ID can be used for querying respectively. And the data result after the keyword is input and retrieved includes a file hash value, a file name, a file path and a file ID. Clicking the view button can see the block information of the block corresponding to the piece of information, including the block height, the block creation time (file uplink time), the block hash value, the previous block hash value, and the uplink use of the intelligent contract. The implementation of the blockchain front-end system provides an intuitive and reliable file data blockchain query platform for users. The change condition of the key information of the file can be checked through the display of the data, so that the first time when the data is changed can be found and recorded. The system block diagram is shown in fig. 1.
The system architecture is roughly divided into three parts, namely a data access layer (JAVA transmitting end), a data service layer (blockchain back-end data interface) and a data application layer (blockchain visualization front-end interface).
The function of the data access layer comprises selecting files, generating hash values, transmitting key information to a receiving end and the like, and the specific flow is as follows:
1. Data access layer
Step 1: the file to be stored (any kind of electronic file may be dragged in), the SM3 algorithm is used to calculate a file hash value, and the hash calculated value is only related to the file content, such as text content in a text file, video recording in a video file, and the like. Independent of file name, file path, file format; and starting software at the JAVA transmitting end, clicking the 'generate hash value' to enter a file selection interface, selecting a file and confirming transmission.
Step 1.1: files that need to be stored to the blockchain system are selected.
Step 1.2: and generating a file hash value by adopting an SM3 algorithm. And extracting the file name and the file path to generate a file ID.
Take the test1.Zip under the C \Users\ zyz \desktop path as an example.
The hash value generation format is as follows: the hexadecimal string of ED54A4DDDE624302F278ABB740CCE073627383C6D7643481E 6D.
The extracted file names and file paths are as follows: test1.zip C: \Users\ zyz \Desktop
The generated file ID is: 12345ABCDEabcde
Step 2: transmitting and receiving feedback: and starting file monitoring, and sending a POST request through an HTTP protocol.
Step 2.1: and sending the four data of the file hash value, the file name, the file path and the file ID to the blockchain background interface.
Step 2.2: and receiving return values of the background of the block chain, wherein the return values comprise block height, block creation time (file uplink time), block hash value, previous block hash value and uplink use intelligent contract.
2. Data service layer
At the data service layer (blockchain), the data will be received up-link and return values will be sent to the sender:
Step 3: and (3) receiving: the server side acquires request parameters in a req.params mode and monitors data in real time;
Step 3.1: the listening port 8088 is opened in the blockchain background and request parameters are acquired in req.params.
Step 4: and processing the data, converting the received data into hexadecimal character strings, performing urlencode coding, and generating JSON data which can be uplinked after processing.
Step 4.1: since the data format uploaded to the blockchain must be JSON strings, the received data is first processed. Urlencode encoding the received file path, and carrying out the following steps: the special notation of "\" is converted to "%3A", "%5C", with the result that: c%3a%5cusers%5czyz%5cdesktop%5ctest1.Zip. And then converted into hexadecimal strings.
Step 4.2: and converting the received file name into a 16-system character string.
Step 4.3: since the received file hash value and file ID are already 16-ary character strings, no processing is performed.
Step 4.4: and splicing the file hash value, the file path, the file name and the file ID to generate a new unique identity information code of the data file.
Step 4.5: defining a JSON array, including file hash value, file path, file name, file ID and unique identity information code of data file. The JSON array is uploaded from the node to the blockchain.
Examples of uplink data formats:
"hashval":"ED54A4DDDE624302F278ABB740CC99953C2AA1B5BE073627383C6D7643481E6D",
"filepath":"C%3A%5CUsers%5Czyz%5CDesktop%5Ctest1.zip",
"fileName":"test1.zip",
"fileID":"12345ABCDEabcde"
"fileOnlyId":"ED54A4DDDE624302F278ABB740CC99953C2AA1B5BE073627383C6D7643481E6DC%3A%5CUsers%5Czyz%5CDesktop%5Ctest1.ziptest1.zip12345ABCDEabcde"
Step 5: and (3) uplink: the processed data is uplink, and three nodes are arranged in total in the block chain;
step 5.1: the block chain background sends a transaction (transaction content comprises five data of a file hash value, a file path, a file name, a file ID and a file unique identity information code) to an endorsement node (node one), the endorsement node verifies the transaction, and an execution result signed by the endorsement node (node one) is returned to the block chain background.
Step 5.2: the blockchain background sends the transaction to the ordering service. The ordering service generates new blocks.
Step 5.3: writing the file hash value, the file name, the file path, the file ID and the unique identification information code of the file into the block, encrypting the block, generating a block hash value, and transmitting the block hash value to a master node (node one).
Step 5.4: the master node (node one) sends the block which receives the written data to the Kafka cluster, and performs consensus through a Kafka consensus algorithm. In the step, the first node is a submitting node, which is used as a producer of topic, and the second node and the third node are used as consumers.
Step 5.5: the partitions are set in the topic so that the partitions are uniformly distributed on the nodes, and each consumer (node two and node three) is at least allocated one partition.
Step 5.6: and delivering the block containing the file hash value, the file path, the file name, the file ID and the file unique identity information code data to a designated partition allocated for the second node and the third node.
Step 5.7: and the node pulls blocks containing file hash values, file paths, file names, file IDs and file unique identity information data from the Kafka cluster by reading the data in the partition, and synchronizes and consensus after the detection is completed.
Step 5.8: the node three-way reads the data in the partition, pulls the block containing the file hash value, the file path, the file name, the file ID and the file unique identity information code data from the Kafka cluster, and synchronizes and consensus after the detection is completed.
Step 5.9: after each node completes consensus, adding the block written with the file hash value, the file path, the file name, the file ID and the unique identification information data of the file into the blockchain.
Step 6: returning: and feeding back the information of the newly-entered block, and sending a return value to a sending end, wherein the return value comprises the block height, the block creation time (file uplink time), the block hash value, the previous block hash value and the uplink use intelligent contract.
3. Data application layer
The data application layer is used for an administrator to inquire file information in the blockchain in three modes:
step 7: the front end inquires file key data and corresponding block information.
Step 7.1: and starting the port 3000 at the background of the block chain, entering the visual front end, and calling a rich query method provided in the intelligent contract at the background according to a query mode selected at the front end to query the key data information and the corresponding block information of the file through the key words.
Step 7.2: after inquiring the result, after url decoding, time zone conversion and data display format optimization (converting the data converted into hexadecimal character strings back to the original format), the data are displayed on the front-end interface. A block chain visualization system operational logic block diagram is shown in fig. 2.
Because the development of the blockchain in the system uses the node.js language, for the node.js language, the browser server and the blockchain server of the data visualization use the same hardware server address and establish respective Web servers under different ports by self support of directly establishing the Web server back end locally.
Specific fields are shown in tables 1,2, and 3.
TABLE 1 JAVA sender generated and extracted data
Table 2 uplink data
Table 3 block information (return value) data
Drawings
FIG. 1 is a block chain system block diagram.
FIG. 2 is block chain system operation logic.
Figure 3 is a screen shot of the successful start of the listening upper link end.
FIG. 4 is a block chain start flow.
Fig. 5 is a JAVA client sender flow.
FIG. 6 is a schematic diagram of the Kafka system.
Fig. 7 is a return value example.
FIG. 8 is a block chain background consensus uplink flow.
Fig. 9 is a flow chart of the visual front-end query logic.
Detailed Description
The invention is further illustrated by the following examples in connection with figures 3-9:
The invention realizes a file data key information storage system built based on a block chain hash algorithm.
Step 1: and building a block chain, starting each node in the block chain system, and ensuring normal consensus function. The invention adopts a block chain structure of a master node and two slave nodes.
Step 1.1: and starting the node I, starting a certificate service and a sequencing service, calling a certificate service (CA) service, registering and registering, and acquiring an identity certificate. The first node is used as an endorsement node, a submitting node and a master node and is responsible for consensus with other two nodes.
Step 1.2: starting the second node, starting the ordering service, and forming a block chain structure with the first node and the third node to perform consensus.
Step 1.3: starting node three, starting the ordering service, and forming a block chain structure with node one and node three to perform consensus.
Step 2: create and join a channel.
Step 2.1: a channel is created, a channel mechanism is adopted to enable a specific node in the blockchain to join the channel for interaction, and an application program can directly communicate with the node through the channel. The relatively independent environment of the channels can greatly increase throughput and transaction rate.
Step 2.2: three nodes are respectively operated to be added into the channel.
Step 3: and installing the intelligent contract.
Step 3.1: the key data of each file stored in the blockchain is set in the intelligent contract, and three inquiry methods of hash value, file name and file ID are set for the user.
Step 3.2: according to the functions of voting, inquiring, uploading and the like in the Fabric chain code, corresponding functions are realized in the intelligent contract script, and a plurality of inquiry interfaces are provided for a user in a rich inquiry mode. And the docking of the blockchain and the front-end visual interface is completed.
Step 3.3: the intelligent contracts are deployed in the blockchain in a point-to-point mode, each node in the blockchain receives a valid contract and performs instantiation, and the valid contract is stored in a corresponding block, so that each node can safely and effectively use the intelligent contracts.
Step 4: and setting two monitoring ports in the background of the block chain by using node. Js, and respectively opening ports for a receiving data port and a front end so as to be connected with a transmitting end and a visual front end.
Step 4.1: and opening a monitoring port 8088 in the background of the block chain server, acquiring request parameters in a req.params mode, receiving data and uploading the data. The result of successful opening of the real-time monitoring data is shown in fig. 3.
Step 4.2: and starting a 3000 port in the background of the block chain server, starting a front end and interacting with a front end interface.
The blockchain initiation flow is shown in fig. 4.
Step 5: and starting software at the JAVA transmitting end, clicking the 'generate hash value' to enter a file selection interface, selecting a file and confirming transmission.
Step 5.1: files that need to be stored to the blockchain system are selected.
Step 5.2: and generating a file hash value by adopting a national cipher SM3 algorithm. And extracting the file name and the file path to generate a file ID.
Take the test1.Zip under the C \Users\ zyz \desktop path as an example.
The hash value generation format is as follows: the hexadecimal string of ED54A4DDDE624302F278ABB740CCE073627383C6D7643481E 6D.
The extracted file names and file paths are as follows: test1.zip C: \Users\ zyz \Desktop
The generated file ID is: 12345ABCDEabcde
Step 5.3: and sending data to the blockchain background interface through a POST request of HTTP. The JAVA client sender flow is shown in fig. 5.
Step 6: the block chain background monitoring port 8088 receives data from a receiving port, converts the data into hexadecimal character strings, carries out urlencode coding, and generates JSON data which can be uplinked after processing.
Step 6.1: since the data format uploaded to the blockchain must be JSON strings, the received data is first processed. Urlencode encoding the received file path, and carrying out the following steps: the special notation of "\" is converted to "%3A", "%5C", with the result that: c%3a%5cusers%5czyz%5cdesktop%5ctest1.Zip. And then converted into hexadecimal strings.
Step 6.2: and converting the received file name into a 16-system character string.
Step 6.3: since the received file hash value and file ID are already 16-ary character strings, no processing is performed.
Step 6.4: and splicing the file hash value, the file path, the file name and the file ID to generate a new unique identity information code of the data file. The purpose of generating the file unique identity information code is to prevent that some or more data of the uploaded file hash value, file path, file name and file ID may be duplicated, so that the file unique identity information code which is unlikely to be duplicated is used when querying the block information.
Step 6.5: defining a JSON array, including file hash value, file path, file name, file ID and unique identity information code of data file. The JSON array is uploaded from node one (commit node) to the blockchain.
Step 7: a Fabric blockchain platform is used.
Step 7.1: the block chain background sends a transaction (transaction content comprises five data of a file hash value, a file path, a file name, a file ID and a file unique identity information code) to an endorsement node (node one), the endorsement node verifies the transaction, and an execution result signed by the endorsement node (node one) is returned to the block chain background.
Step 7.2: the blockchain background sends the transaction to the ordering service. The ordering service generates new blocks.
Step 7.3: writing the file hash value, the file name, the file path, the file ID and the unique identification information code of the file into the block, encrypting the block, generating a block hash value, and transmitting the block hash value to a master node (node one).
Step 7.4: the master node (node one) sends the block which receives the written data to the Kafka cluster, and performs consensus through a Kafka consensus algorithm.
Kafka is essentially a message processing system that uses a classical publish-subscribe model. The consumer of the message subscribes to a specific topic in order to be notified of the new message, and the producer is responsible for the publishing of the message, and the Kafka system is schematically shown in fig. 6. The core is transaction ordering services and additional crash tolerance capability. The first node is used as a producer to send blocks containing file hash values, file paths, file names, file IDs and file unique identity information code data which need to be uploaded to the blockchain to the Kafka cluster. The message sent to the Kafka cluster would belong to a topic. Each topic may have multiple producers sending messages to it, or multiple consumers consuming messages from it. In the step, the first node is a submitting node, which is used as a producer of topic, and the second node and the third node are used as consumers.
Step 7.5: the partitions are set in the topic so that the partitions are uniformly distributed on the nodes, and each consumer (node two and node three) is at least allocated one partition.
Step 7.6: and delivering the block containing the file hash value, the file path, the file name, the file ID and the file unique identity information code data to a designated partition allocated for the second node and the third node.
Step 7.7: and the node pulls blocks containing file hash values, file paths, file names, file IDs and file unique identity information data from the Kafka cluster by reading the data in the partition, and synchronizes and consensus after the detection is completed.
Step 7.8: the node three-way reads the data in the partition, pulls the block containing the file hash value, the file path, the file name, the file ID and the file unique identity information code data from the Kafka cluster, and synchronizes and consensus after the detection is completed.
Step 7.9: after each node completes consensus, adding the block written with the file hash value, the file path, the file name, the file ID and the unique identification information data of the file into the blockchain.
Once the block is linked, the data stored in the block cannot be tampered, so that the safety of the data is ensured. Conventional file storage systems store entire files directly. The key information of the stored file in the method not only saves the storage space, but also can be found out in time when the file is tampered. The blockchain background consensus uplink flow is shown in fig. 7.
Step 8: the return value is sent from the blockchain background 8088 port, an example of which is shown in fig. 8.
Step 9: and a front-end interface is built to provide the functions of inquiring the key data of the file and the corresponding block information.
Step 9.1: by utilizing HTML, CSS, javaScript to build a front-end page, a user can inquire file data and block information according to three inquiry methods of hash values, file names and file IDs provided by an intelligent contract.
Step 9.2: and starting the port 3000 at the background of the block chain, entering the visual front end, and calling a rich query method provided in the intelligent contract at the background according to a query mode selected at the front end to query file data information and corresponding block information through keywords.
Step 9.3: after inquiring the result, after url decoding, time zone conversion and data display format optimization (converting the data converted into hexadecimal character strings back to the original format), the data are displayed on the front-end interface. The visualization front-end query logic flow is shown in fig. 9.

Claims (1)

1. The file information data storage method based on the blockchain and the cryptographic algorithm is characterized by comprising the following steps of:
step 1: building a block chain, starting each node in the block chain system, and ensuring normal consensus function; adopting a block chain structure of a master node and two slave nodes;
Step 1.1: starting a node I, starting a certificate service and a sequencing service, calling a certificate service CA service, registering and registering, and acquiring an identity certificate; the first node is used as an endorsement node, a submitting node and a master node and is responsible for consensus with other two nodes;
step 1.2: starting a node II, starting a sequencing service, and forming a block chain structure with the node I and the node III to perform consensus;
step 1.3: starting a node III, starting a sequencing service, and forming a block chain structure with the node I and the node II to perform consensus;
Step 2: creating and joining a channel; step 2.1: creating a channel, and enabling a specific node in the blockchain to join the channel to interact by adopting a channel mechanism, wherein an application program directly communicates with the node through the channel; the channels increase throughput and transaction rate relative to an independent environment;
Step 2.2: respectively operating three nodes to be added into the channel;
step 3: installing an intelligent contract; step 3.1: setting key data of each file stored in a block chain in an intelligent contract, and setting three query methods of hash value, file name and file ID for a user;
Step 3.2: according to voting, inquiring and uploading functions in the Fabric chain code, corresponding functions are realized in the intelligent contract script, and a plurality of inquiry interfaces are provided for a user in a rich inquiry mode; completing the butt joint of the block chain and the front-end visual interface;
Step 3.3: the intelligent contracts are deployed in the block chain in a point-to-point mode, each node in the block chain receives an effective contract and carries out instantiation, and the effective contract is stored in a corresponding block, so that each node safely and effectively uses the intelligent contracts;
Step 4: setting two monitoring ports in a block chain background by using node. Js, and opening the ports for a data receiving port and a front end respectively; step 4.1: starting a monitoring port 8088 in a background of a block chain server, acquiring request parameters in a req.params mode, receiving data and uploading the data;
Step 4.2: starting a 3000 port in a background of the block chain server, starting a front end, and interacting with a front end interface;
Step 5: starting software at a JAVA transmitting end, clicking a hash value to enter a file selection interface, selecting a file and confirming transmission; step 5.1: selecting files to be stored in the blockchain system;
Step 5.2: generating a file hash value by adopting a national cipher SM3 algorithm; extracting a file name and a file path to generate a file ID;
step 5.3: sending data to a blockchain background interface through a POST request of HTTP;
step 6: the block chain background monitoring port 8088 receives data, converts the data into hexadecimal character strings, carries out urlencode coding, and generates JSON data which can be uplinked after processing; step 6.1: because the data format uploaded to the blockchain must be JSON string, the received data is first processed; urlencode encoding the received file path, and carrying out the following steps: the special notation of "\" is converted to "%3A", "%5C", with the result that: c%3a%5cusers%5czyz%5cdesktop%5ctest1.Zip; then converting the character string into hexadecimal character strings;
step 6.2: converting the received file name into a 16-system character string;
step 6.3: since the received file hash value and the file ID are 16-system character strings, no processing is performed;
Step 6.4: splicing the file hash value, the file path, the file name and the file ID to generate a new unique identity information code of the data file;
Step 6.5: defining a JSON array, wherein the JSON array comprises a file hash value, a file path, a file name, a file ID and a unique identity information code of a data file; uploading the JSON array from the node to the blockchain;
Step 7: using a Fabric blockchain platform; step 7.1: the block chain background sends a transaction to an endorsement node, the endorsement node verifies the transaction, and an execution result signed by the endorsement node is returned to the block chain background;
step 7.2: the block chain background sends transactions to the sequencing service; the ordering service generates a new block;
Step 7.3: writing the file hash value, the file name, the file path, the file ID and the unique identification information code of the file into the block, encrypting the block, generating a block hash value, and transmitting the block hash value to the master node;
step 7.4: the master node sends the block which has received the written data to a Kafka cluster, and carries out consensus through a Kafka consensus algorithm;
The node I is used as a producer to send a block containing file hash values, file paths, file names, file IDs and file unique identity information code data which need to be uploaded to a block chain to a Kafka cluster; the message sent to the Kafka cluster would belong to a topic; each topic has a plurality of producers sending messages to it and a plurality of consumers consuming the messages therein; the first node is a submitting node which is used as a producer of topic, and the second node and the third node are used as consumers;
Step 7.5: setting partitions in the topic, so that the partitions are uniformly distributed on the nodes, and at least one partition is distributed to each consumer, namely a second node and a third node;
step 7.6: delivering blocks containing file hash values, file paths, file names, file IDs and file unique identity information code data to designated partitions allocated for the second node and the third node;
Step 7.7: the node II pulls blocks containing file hash values, file paths, file names, file IDs and file unique identity information data from the Kafka cluster by reading the data in the partition, and synchronizes and consensus is carried out after the detection is completed;
step 7.8: the node three-way reads the data in the partition, pulls the block containing the file hash value, the file path, the file name, the file ID and the file unique identity information code data from the Kafka cluster, and synchronizes and consensus after the detection is completed;
Step 7.9: after each node completes consensus, adding the block written with the file hash value, the file path, the file name, the file ID and the unique file identity information data into a block chain;
Step 8: sending a return value from node one 8088 port;
Step 9: a front-end interface is built, and the functions of inquiring file key data and corresponding block information are provided;
Step 9.1: setting up a front page by HTML, CSS, javaScript, and allowing a user to inquire file data and block information according to three inquiry methods of hash values, file names and file IDs provided by intelligent contracts;
Step 9.2: starting a port 3000 at the background of the block chain, entering a visual front end, and calling a rich query method provided in the intelligent contract at the background according to a query mode selected at the front end, and querying file data information and corresponding block information through keywords;
Step 9.3: after inquiring the result, the time zone is converted through url decoding, and the data display format is optimized and then displayed on the front-end interface.
CN202211161053.2A 2022-09-22 2022-09-22 File information data storage method based on blockchain and cryptographic algorithm Active CN115567550B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211161053.2A CN115567550B (en) 2022-09-22 2022-09-22 File information data storage method based on blockchain and cryptographic algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211161053.2A CN115567550B (en) 2022-09-22 2022-09-22 File information data storage method based on blockchain and cryptographic algorithm

Publications (2)

Publication Number Publication Date
CN115567550A CN115567550A (en) 2023-01-03
CN115567550B true CN115567550B (en) 2024-06-21

Family

ID=84741578

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211161053.2A Active CN115567550B (en) 2022-09-22 2022-09-22 File information data storage method based on blockchain and cryptographic algorithm

Country Status (1)

Country Link
CN (1) CN115567550B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116502272B (en) * 2023-06-21 2023-09-08 北京探索者软件股份有限公司 Method and device for saving CAD metafile of computer aided design

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110061838A (en) * 2019-04-28 2019-07-26 广州大学 A kind of the decentralization storage system and its realization, information retrieval method of DNS resource record
CN110912937A (en) * 2019-12-23 2020-03-24 杭州中科先进技术研究院有限公司 Block chain-based digital certificate storage platform and certificate storage method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102020128685A1 (en) * 2020-10-30 2022-05-05 Bundesdruckerei Gmbh Blockchain-based digital document system
CN114666060B (en) * 2022-03-14 2024-03-12 北京工业大学 Hyperledger Fabric-based electronic data security method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110061838A (en) * 2019-04-28 2019-07-26 广州大学 A kind of the decentralization storage system and its realization, information retrieval method of DNS resource record
CN110912937A (en) * 2019-12-23 2020-03-24 杭州中科先进技术研究院有限公司 Block chain-based digital certificate storage platform and certificate storage method

Also Published As

Publication number Publication date
CN115567550A (en) 2023-01-03

Similar Documents

Publication Publication Date Title
CN113407640B (en) Cross-chain method and system based on multi-chain NFT (network File transfer)
CN103078881B (en) Internet resources Download Info share control system and method
CN102208060B (en) Integrated electronic record, signature and fingerprint system
US20030021416A1 (en) Encrypting a messaging session with a symmetric key
US11164182B2 (en) Methods and systems for safe creation, custody, recovery, and management of a digital asset
US20070239726A1 (en) Systems and methods of transforming data for web communities and web applications
CN113127916A (en) Data set processing method, data processing device and storage medium
CN115567550B (en) File information data storage method based on blockchain and cryptographic algorithm
WO2010061847A1 (en) User-associated information providing server
CN115208665B (en) Germplasm resource data safe sharing method and system based on blockchain
JP2011215826A (en) Form creation apparatus, control method for form creation apparatus and program
US20030090502A1 (en) Method and apparatus for indicating information
CN109800557A (en) Integrated processing method, device, server, equipment and medium based on block chain
CN101739421A (en) XML-based data integration information exchange platform
CN101212301A (en) Authentication device and method
CN114172655A (en) Secure multi-party computing data system, method, equipment and data processing terminal
US20030023850A1 (en) Verifying messaging sessions by digital signatures of participants
Liu Design and implementation of heterogeneous data exchange platform based on web technology
JP2007233695A (en) Annotation management device, web display terminal, annotation management method and web display method
CN108989409A (en) Communication means and system, client, the server of mixed mode mobile application
JP2007200272A (en) Electronic document exchange system and web server used for it
JP2005316640A (en) Method and system for verifying download input business form
JP4319331B2 (en) Service linkage system and information diversion device
JP2003108911A (en) Information processing device and information processing terminal
Karantjias et al. An innovative platform architecture for complex secure e/m-governmental services

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant