CN108880820B - Code management method and device - Google Patents

Code management method and device Download PDF

Info

Publication number
CN108880820B
CN108880820B CN201810558469.5A CN201810558469A CN108880820B CN 108880820 B CN108880820 B CN 108880820B CN 201810558469 A CN201810558469 A CN 201810558469A CN 108880820 B CN108880820 B CN 108880820B
Authority
CN
China
Prior art keywords
block
code file
user equipment
information
hash value
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
CN201810558469.5A
Other languages
Chinese (zh)
Other versions
CN108880820A (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.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group 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 China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN201810558469.5A priority Critical patent/CN108880820B/en
Publication of CN108880820A publication Critical patent/CN108880820A/en
Application granted granted Critical
Publication of CN108880820B publication Critical patent/CN108880820B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/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
    • 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
    • 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/104Peer-to-peer [P2P] networks
    • 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/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • 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/3297Cryptographic 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 involving time stamps, e.g. generation of time stamps

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Power Engineering (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a code management method and a code management device. The method comprises the following steps: the method comprises the steps that first user equipment receives information of at least one code file uploaded to a server by second user equipment; the information of the code file comprises a hash value corresponding to the code file; the first user equipment generates a block according to the information of at least one code file and adds the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file; the first user equipment sends the block to the server so that the server establishes a corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file. According to the embodiment of the invention, the code file is stored in the server, and the information of the code file is stored in the block chain, so that the information of the code file can be prevented from being tampered, and the safety of the code file is ensured.

Description

Code management method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a code management method and apparatus.
Background
In the internet industry, after a code developer develops a program code, the program code or a compiling result needs to be deployed on a server to run, so that a service can be indirectly provided for a user, and the process is called code publishing.
Currently, the storage and release of codes are generally realized by a version control System (SVN), a GIT, and an integration tool software Jinkens. However, in the process of storing and releasing the code in the above manner, the code is easily tampered and attacked, and the security cannot be guaranteed.
Disclosure of Invention
The invention provides a code management method and a code management device, which are used for improving the safety in the code storage and release process.
In a first aspect, the present invention provides a code management method, including:
the method comprises the steps that first user equipment receives information of at least one code file uploaded to a server by second user equipment; the information of the code file comprises a hash value corresponding to the code file;
the first user equipment generates a block according to the information of at least one code file and adds the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the first user equipment sends the block to the server so that the server establishes a corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file.
In a second aspect, the present invention provides a code management method, including:
the server receives at least one code file uploaded by the second user equipment;
the server receives the block sent by the first user equipment; the block is generated according to the information of at least one code file; the information of the code file includes: the hash value corresponding to the code file; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the server establishes and stores the corresponding relation among the blocks, the hash values corresponding to the code files and the storage paths of the code files.
In a third aspect, the present invention provides a code management apparatus, including:
the receiving module is used for receiving information of at least one code file uploaded to the server by the second user equipment; the information of the code file comprises a hash value corresponding to the code file;
the processing module is used for generating a block according to the information of at least one code file and adding the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the sending module is used for sending the block to the server so that the server establishes the corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file.
In a fourth aspect, the present invention provides a code management apparatus, including:
the receiving module is used for receiving at least one code file uploaded by the second user equipment;
the receiving module is further configured to receive a block sent by the first user equipment; the block is generated according to the information of at least one code file; the information of the code file includes: the hash value corresponding to the code file; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the processing module is used for establishing and storing the corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file.
According to the code management method and device provided by the embodiment of the invention, the first user equipment receives the information of at least one code file uploaded to the server by the second user equipment; the information of the code file comprises a hash value corresponding to the code file; the first user equipment generates a block according to the information of at least one code file and adds the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file; the first user equipment sends the block to the server, so that the server establishes a corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file, the code file is stored in the server, and the information of the code file is stored in a block chain, so that the information of the code file can be prevented from being tampered, the authenticity of the code file in the server can be verified through the information of the code file in the block, and the safety of the code file is guaranteed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flowchart illustrating a code management method according to an embodiment of the present invention;
FIG. 2 is a block chain diagram illustrating a code management method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another embodiment of a code management method according to the present invention;
FIG. 4 is a flowchart illustrating a code management method according to another embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an embodiment of a code management apparatus provided in the present invention;
FIG. 6 is a schematic structural diagram of another embodiment of a code management apparatus provided in the present invention;
fig. 7 is a schematic structural diagram of a first user equipment embodiment provided in the present invention;
fig. 8 is a schematic structural diagram of an embodiment of a server provided in the present invention.
With the foregoing drawings in mind, certain embodiments of the disclosure have been shown and described in more detail below. These drawings and written description are not intended to limit the scope of the disclosed concepts in any way, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of methods and apparatus consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terms "comprising" and "having," and any variations thereof, in the description and claims of this invention and the drawings described herein are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
First, the nouns and scenarios related to the present invention are introduced:
each developer of the research and development team corresponds to one node in the block chain to form the P2P peer-to-peer network. Specifically, all nodes can be in the same local area Network through a Virtual Private Network (VPN for short), and all nodes in the Network can equally access the Network, so as to form a P2P peer-to-peer Network.
Furthermore, a public key and a private key of the node can be generated through an asymmetric encryption algorithm to uniquely identify each developer. The private key is used for uniquely identifying the node, and the public key is used for verifying the validity of the node, for example, when the node is accessed to a network or in the process of regularly checking the network.
Any node can report the codes to the server and can view the codes in the block chain. In the peer-to-peer network, each node is a peer-to-peer individual and participates in the recording, storing, maintaining and the like of codes on the block chain together. Furthermore, the blocks in the block chain have the property of being not tampered with once generated.
The block chain can adopt a private chain form to limit read-write permission or external open permission. The read-write permission on the block chain is formulated according to rules predetermined by a research and development team, for example, a node corresponding to a certain developer only has the read permission, and the like. The whole peer-to-peer network is commonly maintained by each node, network access can be realized through the gateway of each node, and the consensus process is controlled by the preselected nodes.
Fig. 1 is a flowchart illustrating a code management method according to an embodiment of the present invention. As shown in fig. 1, the method provided by this embodiment includes:
step 101, a first user device receives information of at least one code file uploaded to a server by a second user device; the information of the code file includes a hash value corresponding to the code file.
Specifically, the first user equipment is user equipment corresponding to a node selected through a preset consensus mechanism. The second user equipment is the user equipment corresponding to any node in the peer-to-peer network.
After a new code file is generated or modified, the second user equipment uploads at least one code file to the server and broadcasts the information of the code file to other nodes in the network; information of at least one code file is received by a first user device. The information of the code file comprises a hash value corresponding to the code file, and the hash value is obtained by a hash algorithm according to the code file. Once the code file is tampered, the corresponding hash value of the code file is changed, so that whether the code file is tampered or not can be verified according to the hash value.
102, generating a block by the first user equipment according to the information of at least one code file, and adding the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to the at least one code file.
Specifically, the first user equipment may collect information of all code files within a preset duration, generate a block according to the received information of the code files, add the block to the block chain, and connect the block to the end of the block chain.
Wherein the first user equipment records information of the code file into a block body of the block.
The chunk includes a chunk header and at least one chunk body, as shown in fig. 2, and the chunk header in fig. 2 includes an identification ID, a hash value of a last chunk, a mercker tree root, a timestamp, and an index of the chunk body, as one example; the block main body includes: department number + research and development group number + project number, data identification ID, metadata description and data provider and related information list (data provider is, for example, developer who uploads code files), employee number (i.e., code developer's number), code name, version number and hash value corresponding to code file, and node identification ID (node ID of uploaded code file) corresponding to each code file.
Wherein the ID in the chunk header and the data ID in the chunk body may be randomly generated. The hash value of the block can be obtained by calculating the root of the mercker tree and the hash value of the previous block, and is written into the block header of the next block. The timestamp indicates the time at which the block was generated. The mercker tree root is a summary of all the information on the block body.
In the above scheme, the code file is uploaded to the server for storage, and the information generation block corresponding to the code file is stored to the block chain, so that tampering of the information of the code file can be prevented, and the authenticity of the code file in the server can be verified through the information of the code file in the block.
And 103, the first user equipment sends the block to the server so that the server establishes a corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file.
Specifically, the first user equipment sends the generated information of the block to the server, and the server establishes a corresponding relationship among the block, the hash value corresponding to the code file and the storage path of the code file.
When the node in the network checks the code file corresponding to the information of the code file in the block chain, the node can find the code file according to the corresponding relation between the storage path of the code file and the code file stored in the server.
The method of the embodiment of the invention saves the information of the code file in a block chain mode, utilizes the characteristics of decentralization, openness and transparency and tamper prevention of the block chain, and utilizes the characteristics of high transaction speed, privacy protection and extremely low transaction cost of a private chain to realize the safe storage and release of the code file.
In the method of this embodiment, a first user equipment receives information of at least one code file uploaded to a server by a second user equipment; the information of the code file comprises a hash value corresponding to the code file; the first user equipment generates a block according to the information of at least one code file and adds the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file; the first user equipment sends the block to the server, so that the server establishes a corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file, the code file is stored in the server, and the information of the code file is stored in a block chain, so that the information of the code file can be prevented from being tampered, the authenticity of the code file in the server can be verified through the information of the code file in the block, and the safety of the code file is guaranteed.
On the basis of the foregoing embodiment, optionally, before adding the block into the block chain, the method further includes:
the first user equipment broadcasts the block to other user equipment except the first user equipment in the peer-to-peer network P2P so that the other user equipment can verify the block;
adding blocks into a block chain, comprising:
and if the first user equipment receives the indication information which is sent by other user equipment and passes the verification, adding the block into the block chain.
Specifically, after the first ue generates the block, the first ue may broadcast the block to other ues in the network, and the other ues perform authenticity verification on the block; and the first user equipment connects the block to the tail end of the block chain after receiving the indication information that the verification is passed.
The verification of the block can be realized by verifying the hash value in the block header, that is, verifying whether the hash value is the hash value of the previous block.
On the basis of the foregoing embodiment, further, if at least one of the code files is a distribution package, step 102 may be specifically implemented by the following steps:
the first user equipment generates the block according to the information of the publishing packet and adds the block into the block chain; the information of the issuing packet comprises a hash value corresponding to the issuing packet;
step 102 may be specifically realized by the following steps:
and the first user equipment sends the block to the server so that the server establishes a corresponding relation among the block, the hash value corresponding to the release packet and the storage path of the release packet.
Specifically, if the release package needs to be released, the developer may generate the release package according to the code file, upload the release package to the server through the second user equipment, and broadcast the information of the release package to the network through the second user equipment. The first user equipment generates a block according to the received information of the distribution packet, and adds the block into a block chain, wherein the information of the distribution packet comprises a hash value corresponding to the distribution packet.
And the first user equipment sends the generated information of the block to a server, and the server establishes a corresponding relation among the block, the hash value corresponding to the release packet and the storage path of the release packet.
When the node in the network checks the publishing packet corresponding to the information of the publishing packet in the blockchain, the publishing packet can be found according to the corresponding relation between the storage path of the publishing packet and the storage path stored in the server.
In this embodiment, the release package is uploaded to the server for storage, and the information generation block of the release package is stored in the block chain, so that tampering of the information of the release package can be prevented, and authenticity of the release package in the server can be verified through the information of the release package in the block.
Fig. 3 is a flowchart illustrating another embodiment of a code management method according to the present invention. As shown in fig. 3, the method provided by this embodiment includes:
step 301, a server receives at least one code file uploaded by second user equipment;
specifically, after a new code file is generated or modified, the second user equipment uploads at least one code file to the server and broadcasts the information of the code file to other nodes in the network; information of at least one code file is received by a first user device. The information of the code file comprises a hash value corresponding to the code file, and the hash value is obtained by a hash algorithm according to the code file. Once the code file is tampered, the corresponding hash value of the code file is changed, so that whether the code file is tampered or not can be verified according to the hash value.
Step 302, the server receives the block sent by the first user equipment; the block is generated according to the information of at least one code file; the information of the code file includes: a hash value corresponding to the code file; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
specifically, the first user equipment may collect information of all code files within a preset duration, generate a block according to the received information of the code files, add the block to the block chain, and connect the block to the end of the block chain.
Wherein the first user equipment records information of the code file into a block body of the block.
The chunk includes a chunk header and at least one chunk body, as shown in fig. 2, and the chunk header in fig. 2 includes an identification ID, a hash value of a last chunk, a mercker tree root, a timestamp, and an index of the chunk body, as one example; the block main body includes: department number + research and development group number + project number, data identification ID, metadata description and data provider and related information list (data provider is, for example, developer who uploads code files), employee number (i.e., code developer's number), code name, version number and hash value corresponding to code file, and node identification ID (node ID of uploaded code file) corresponding to each code file.
Wherein the ID in the chunk header and the data ID in the chunk body may be randomly generated. The hash value of the block can be obtained by calculating the root of the mercker tree and the hash value of the previous block, and is written into the block header of the next block. The timestamp indicates the time at which the block was generated. The mercker tree root is a summary of all the information on the block body.
In the above scheme, the code file is uploaded to the server for storage, and the information generation block corresponding to the code file is stored to the block chain, so that tampering of the information of the code file can be prevented, and the authenticity of the code file in the server can be verified through the information of the code file in the block.
Step 303, the server establishes and stores the corresponding relationship among the block, the hash value corresponding to the code file, and the storage path of the code file.
Specifically, the server establishes and stores the corresponding relationship among the blocks, the hash values corresponding to the code files, and the storage paths of the code files, and when the nodes in the network check the code files corresponding to the information of the code files in the block chain, the code files can be searched according to the corresponding relationship between the code files and the storage paths stored in the server.
Optionally, the block head further includes: mercker tree root and timestamp; the block main body further includes: identification information and metadata description information of the second user equipment.
Optionally, the method further includes:
and determining whether the hash value is consistent with the hash value corresponding to the code file in the block corresponding to the code file or not according to the obtained hash value corresponding to the code file.
Specifically, if the code file is an issuing package, the server determines whether the hash value is consistent with the hash value corresponding to the issuing package included in the block corresponding to the issuing package according to the obtained hash value corresponding to the issuing package in the above step.
Specifically, after the release package is released to the formal environment, the server may compare the hash value of the release package with the hash value corresponding to the release package stored in the blockchain, and check whether the hash values are consistent. Specifically, the hash value of each code file in the distribution package may be compared with the hash values of the code files recorded in the blockchain. If the two are consistent, the publishing package can be deployed.
Further, the server can also provide an interface query code file.
The method of this embodiment, which has the similar implementation principle and technical effect to the method shown in fig. 1, is not described herein again.
Fig. 4 is a flowchart illustrating a code management method according to another embodiment of the present invention. As shown in fig. 4, the method provided by this embodiment includes:
step 401, the second user equipment uploads at least one code file to the server;
step 402, the second user equipment sends the information of the at least one code file to the first user equipment, so that the first user equipment generates a block according to the information of the at least one code file, and adds the block into a block chain; the information of the code file comprises a hash value corresponding to the code file; the block comprises a block head and a block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to the at least one code file.
Optionally, the block head further includes: mercker tree root and timestamp; the block main body further includes: identification information and metadata description information of the second user equipment.
The method of this embodiment, which has the similar implementation principle and technical effect to the method shown in fig. 1, is not described herein again.
Fig. 5 is a structural diagram of an embodiment of a code management apparatus provided in the present invention, and as shown in fig. 5, the code management apparatus of the embodiment is disposed in a first user equipment, and includes:
a receiving module 501, configured to receive information of at least one code file uploaded to a server by a second user equipment; the information of the code file comprises a hash value corresponding to the code file;
a processing module 502, configured to generate a block according to information of at least one code file, and add the block to a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
a sending module 503, configured to send the chunk to the server, so that the server establishes a correspondence between the chunk, the hash value corresponding to the code file, and the storage path of the code file.
Optionally, the sending module 503 is further configured to:
the first user equipment broadcasts the block to other user equipment except the first user equipment in a peer-to-peer network P2P so that the other user equipment can verify the block;
the processing module 502 is specifically configured to:
and if the first user equipment receives the indication information which is sent by the other user equipment and passes the verification, adding the block into the block chain.
Optionally, if at least one of the code files is a distribution package, the processing module 502 is specifically configured to:
the first user equipment generates the block according to the information of the publishing packet and adds the block into the block chain; the information of the issuing packet comprises a hash value corresponding to the issuing packet;
the sending module 503 is specifically configured to:
and the first user equipment sends the block to the server so that the server establishes a corresponding relation among the block, the hash value corresponding to the release packet and the storage path of the release packet.
Optionally, the block head further includes: mercker tree root and timestamp; the block main body further includes: identification information and metadata description information of the second user equipment.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 6 is a structural diagram of another embodiment of the code management apparatus provided in the present invention, and as shown in fig. 6, the code management apparatus of the present embodiment is provided in a server, and the code management apparatus includes:
a receiving module 601, configured to receive at least one code file uploaded by a second user equipment;
the receiving module 601 is further configured to receive a block sent by the first user equipment; the block is generated according to the information of at least one code file; the information of the code file includes: the hash value corresponding to the code file; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
the processing module 602 is configured to establish and store a corresponding relationship among the block, the hash value corresponding to the code file, and the storage path of the code file.
Optionally, the processing module 602 is further configured to:
and determining whether the hash value is consistent with the hash value corresponding to the code file in the block corresponding to the code file or not according to the obtained hash value corresponding to the code file.
Optionally, the block head further includes: mercker tree root and timestamp; the block main body further includes: identification information and metadata description information of the second user equipment.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Another embodiment of the present invention further provides a code management apparatus, where the code management apparatus is disposed in a second user equipment, and the apparatus includes:
the sending module is used for uploading at least one code file to the server;
the sending module is further configured to send information of at least one code file to the first user equipment, so that the first user equipment generates a block according to the information of the at least one code file, and adds the block to a block chain; the information of the code file comprises a hash value corresponding to the code file; the block comprises a block head and a block body, wherein the block head comprises the hash value of the last block; the block body comprises at least one hash value corresponding to each code file.
Optionally, the block head further includes: mercker tree root and timestamp; the block main body further includes: identification information and metadata description information of the second user equipment.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 7 is a structural diagram of a first user equipment according to an embodiment of the present invention, and as shown in fig. 7, the first user equipment includes:
a processor 701, and a memory 702 for storing executable instructions for the processor 701.
Optionally, a communication interface 703 may also be included for communicating with other devices.
The processor 701 is configured to execute the corresponding method in the foregoing method embodiment by executing the executable instruction, and the specific implementation process of the method may refer to the foregoing method embodiment, which is not described herein again.
Fig. 8 is a structural diagram of an embodiment of a server provided in the present invention, and as shown in fig. 8, the server includes:
a processor 801, and a memory 802 for storing executable instructions for the processor 801.
Optionally, a communication interface 803 may also be included for communicating with other devices.
The processor 801 is configured to execute the corresponding method in the foregoing method embodiment by executing the executable instruction, and the specific implementation process of the method may refer to the foregoing method embodiment, which is not described herein again.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the method in the foregoing method embodiment is implemented.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A code management method, comprising:
the method comprises the steps that first user equipment receives information of at least one code file uploaded to a server by second user equipment; the information of the code file comprises a hash value corresponding to the code file;
the first user equipment generates a block according to the information of at least one code file and adds the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the first user equipment sends the block to the server so that the server establishes a corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file.
2. The method of claim 1, wherein prior to adding the block to a block chain, further comprising:
the first user equipment broadcasts the block to other user equipment except the first user equipment in a peer-to-peer network P2P so that the other user equipment can verify the block;
the adding the block into a block chain comprises:
and if the first user equipment receives the indication information which is sent by the other user equipment and passes the verification, adding the block into the block chain.
3. The method according to claim 1 or 2, wherein if at least one of the code files is a distribution package, the first ue generates a block according to information of the at least one code file, and adds the block to a block chain, including:
the first user equipment generates the block according to the information of the publishing packet and adds the block into the block chain; the information of the issuing packet comprises a hash value corresponding to the issuing packet;
the first user equipment sends the block to the server, so that the server establishes a correspondence between the block, the hash value corresponding to the code file and the storage path of the code file, including:
and the first user equipment sends the block to the server so that the server establishes a corresponding relation among the block, the hash value corresponding to the release packet and the storage path of the release packet.
4. The method of claim 1 or 2, wherein the block header further comprises: mercker tree root and timestamp; the block main body further includes: identification information and metadata description information of the second user equipment.
5. A code management method, comprising:
the server receives at least one code file uploaded by the second user equipment;
the server receives a block sent by first user equipment; the block is generated according to the information of at least one code file; the information of the code file includes: the hash value corresponding to the code file; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the server establishes and stores the corresponding relation among the blocks, the hash values corresponding to the code files and the storage paths of the code files.
6. The method of claim 5, further comprising:
and the server determines whether the hash value is consistent with the hash value corresponding to the code file in the block corresponding to the code file according to the obtained hash value corresponding to the code file.
7. The method of claim 5 or 6, wherein the block header further comprises: mercker tree root and timestamp; the block main body further includes: identification information and metadata description information of the second user equipment.
8. A code management apparatus, comprising:
the receiving module is used for receiving information of at least one code file uploaded to the server by the second user equipment; the information of the code file comprises a hash value corresponding to the code file;
the processing module is used for generating a block according to the information of at least one code file and adding the block into a block chain; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the sending module is used for sending the block to the server so that the server establishes the corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file.
9. A code management apparatus, comprising:
the receiving module is used for receiving at least one code file uploaded by the second user equipment;
the receiving module is further configured to receive a block sent by the first user equipment; the block is generated according to the information of at least one code file; the information of the code file includes: the hash value corresponding to the code file; the block comprises a block head and at least one block body, wherein the block head comprises the hash value of the last block; the block body comprises hash values corresponding to at least one code file;
and the processing module is used for establishing and storing the corresponding relation among the block, the hash value corresponding to the code file and the storage path of the code file.
10. The apparatus of claim 9, wherein the processing module is further configured to:
and determining whether the hash value is consistent with the hash value corresponding to the code file in the block corresponding to the code file or not according to the obtained hash value corresponding to the code file.
CN201810558469.5A 2018-06-01 2018-06-01 Code management method and device Active CN108880820B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810558469.5A CN108880820B (en) 2018-06-01 2018-06-01 Code management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810558469.5A CN108880820B (en) 2018-06-01 2018-06-01 Code management method and device

Publications (2)

Publication Number Publication Date
CN108880820A CN108880820A (en) 2018-11-23
CN108880820B true CN108880820B (en) 2021-06-15

Family

ID=64336110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810558469.5A Active CN108880820B (en) 2018-06-01 2018-06-01 Code management method and device

Country Status (1)

Country Link
CN (1) CN108880820B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110417781B (en) * 2019-07-30 2021-11-19 中国工商银行股份有限公司 Block chain-based document encryption management method, client and server
CN110889137B (en) * 2019-11-21 2023-04-07 盛世智云(云南)软件有限公司 Data exchange method based on block chain
CN112948827A (en) * 2021-01-11 2021-06-11 杭州复杂美科技有限公司 Source code compiling verification method, system, equipment and storage medium
CN113608777B (en) * 2021-07-30 2023-09-29 广东全塑智联科技有限公司 Project code version control method and system based on blockchain
CN116450250B (en) * 2023-06-16 2023-09-19 天津金城银行股份有限公司 Dynamic scenario execution method, system and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106407795A (en) * 2016-09-05 2017-02-15 北京众享比特科技有限公司 Data existence authentication system, authentication method and verification method
WO2017167550A1 (en) * 2016-03-30 2017-10-05 British Telecommunications Public Limited Company Blockchain state reliability determination
CN107330701A (en) * 2017-07-28 2017-11-07 中链科技有限公司 The method and apparatus of the intelligent contract of implantation
CN107800795A (en) * 2017-10-30 2018-03-13 中国联合网络通信集团有限公司 The processing method and processing device of block information
CN109314642A (en) * 2016-02-23 2019-02-05 区块链控股有限公司 Counting system and method for secure voting and distribution implemented with blockchain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109314642A (en) * 2016-02-23 2019-02-05 区块链控股有限公司 Counting system and method for secure voting and distribution implemented with blockchain
WO2017167550A1 (en) * 2016-03-30 2017-10-05 British Telecommunications Public Limited Company Blockchain state reliability determination
CN106407795A (en) * 2016-09-05 2017-02-15 北京众享比特科技有限公司 Data existence authentication system, authentication method and verification method
CN107330701A (en) * 2017-07-28 2017-11-07 中链科技有限公司 The method and apparatus of the intelligent contract of implantation
CN107800795A (en) * 2017-10-30 2018-03-13 中国联合网络通信集团有限公司 The processing method and processing device of block information

Also Published As

Publication number Publication date
CN108880820A (en) 2018-11-23

Similar Documents

Publication Publication Date Title
CN108880820B (en) Code management method and device
US10630463B2 (en) Meta block chain
CN109190410B (en) Log behavior auditing method based on block chain in cloud storage environment
CN109417479B (en) Cryptographic logic rewritable block chains
CN107480555B (en) Database access authority control method and device based on block chain
CN106230851B (en) Data security method and system based on block chain
CN108334753B (en) Pirate application verification method and distributed server node
EP3709568A1 (en) Deleting user data from a blockchain
CN109583885A (en) Bout controls rewritable block chain
KR20200013679A (en) Script-based Blockchain Interaction
JP6495346B2 (en) Information processing system
KR20180089670A (en) Method for generating and verifying an digital signature or message authentication code based on a block chain that does not require key management
CN108256354B (en) Test data-based storage method and storage medium
CN111899019A (en) Method and system for cross validation and sharing of blacklist and multiple parties
CN109428892A (en) Multistage rewritable block chain
US11620272B2 (en) Trusted ledger management systems and methods
CN110826091B (en) File signature method and device, electronic equipment and readable storage medium
CN111709047B (en) Information management system and method thereof
CN108256351B (en) File processing method and device, storage medium and terminal
CN112214464A (en) Evidence preservation method and system based on block chain
KR20190027207A (en) System and method for verifying integrity of personal information
CN111885088A (en) Log monitoring method and device based on block chain
CN113515726B (en) Method and device for preventing enterprise product authorization file from leaking
CN109905408A (en) Network safety protection method, system, readable storage medium storing program for executing and terminal device
CN112948847B (en) Block chain-based data sharing system and data correctness verification method

Legal Events

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