HK40104466A - Block chain-based production material management method, device and electronic equipment - Google Patents

Block chain-based production material management method, device and electronic equipment Download PDF

Info

Publication number
HK40104466A
HK40104466A HK42024092949.7A HK42024092949A HK40104466A HK 40104466 A HK40104466 A HK 40104466A HK 42024092949 A HK42024092949 A HK 42024092949A HK 40104466 A HK40104466 A HK 40104466A
Authority
HK
Hong Kong
Prior art keywords
server
user
data
private key
digital signature
Prior art date
Application number
HK42024092949.7A
Other languages
Chinese (zh)
Other versions
HK40104466B (en
Inventor
李浩天
丁东照
王筵村
郝增
张彤
Original Assignee
香港字节方舟有限公司
Filing date
Publication date
Application filed by 香港字节方舟有限公司 filed Critical 香港字节方舟有限公司
Publication of HK40104466A publication Critical patent/HK40104466A/en
Publication of HK40104466B publication Critical patent/HK40104466B/en

Links

Description

基于区块链的生产资料管理方法、装置及电子设备Blockchain-based methods, devices, and electronic equipment for managing means of production.

技术领域Technical Field

本申请涉及区块链的技术领域,具体涉及基于区块链的生产资料管理方法、装置及电子设备。This application relates to the technical field of blockchain, specifically to blockchain-based methods, apparatus, and electronic devices for managing means of production.

背景技术Background Technology

生产资料是指企业在生产过程中用于制造产品或提供服务的各种资源和设备,通常包括物质和非物质两个方面。非物质生产资料则包括技术、专利、品牌、人力资源等,这些因素在生产过程中发挥重要作用,但并非具体的物质形式。物质生产资料主要包括原材料、设备、工具、建筑物等,它们是直接用于生产过程的实体物品。原材料是产品的基础成分,设备和工具用于加工和制造,建筑物提供生产和办公场所。企业的生产资料是实现生产目标和提高生产效率的基础,其合理配置和管理对企业的发展至关重要。Means of production refer to the various resources and equipment used by an enterprise in the production process to manufacture products or provide services, generally including both tangible and intangible aspects. Intangible means of production include technology, patents, brands, and human resources; these factors play an important role in the production process but are not in concrete material form. Tangible means of production mainly include raw materials, equipment, tools, and buildings; these are physical items directly used in the production process. Raw materials are the basic components of products, equipment and tools are used for processing and manufacturing, and buildings provide production and office space. An enterprise's means of production are the foundation for achieving production goals and improving production efficiency; their rational allocation and management are crucial to the enterprise's development.

传统的生产资料管理方法在很大程度上依赖人工操作、文档和集中式计划,存在效率低、数据不准确、反应慢等问题。随着信息技术的发展,现代企业越来越倾向于采用先进的数字化和自动化技术,例如物联网、大数据分析、人工智能等,以提高生产资料管理的效率和准确性。Traditional methods of managing means of production rely heavily on manual operations, documentation, and centralized planning, resulting in low efficiency, inaccurate data, and slow response times. With the development of information technology, modern enterprises are increasingly adopting advanced digital and automation technologies, such as the Internet of Things, big data analytics, and artificial intelligence, to improve the efficiency and accuracy of means of production management.

但是,企业即使采用了先进的数字化和自动化技术来管理生产资料,仍然存在生产资料管理的准确性较低的问题。因为中心化的管理方式过度依赖于中心管理设备,一旦中心管理设备遭到攻击,导致生产资料管理的被篡改,产生了虚假的数据变更。从而生产资料的安全性降低,甚至可能引发生产中断和其他不良后果。因此,需要一种方法提高生产资料管理的安全性。However, even with advanced digital and automation technologies, enterprises still face challenges in the accuracy of production resource management. This is because centralized management relies excessively on central management equipment; if this equipment is attacked, production resource data can be tampered with, resulting in false data changes. This reduces the security of production resources and could even lead to production interruptions and other adverse consequences. Therefore, a method to improve the security of production resource management is needed.

发明内容Summary of the Invention

本申请提供基于区块链的生产资料管理方法、装置及电子设备,具有提高生产资料管理的安全性的效果。This application provides a blockchain-based method, apparatus, and electronic device for managing means of production, which improves the security of means of production management.

在本申请的第一方面提供了基于区块链的生产资料管理方法,应用于第一服务器,所述第一服务器为区块链管理系统包含的多个服务器中的任意一个服务器,多个所述服务器相互连接,所述方法包括:The first aspect of this application provides a blockchain-based method for managing means of production, applied to a first server, wherein the first server is any one of a plurality of servers included in a blockchain management system, and the plurality of servers are interconnected. The method includes:

获取用户输入的针对生产资料的变更数据,所述变更数据为所述生产资料的增减数据;Obtain user-inputted change data for production materials, wherein the change data is the increase or decrease data of the production materials;

采用所述用户的用户私钥对所述变更数据进行加密,生成数字签名;The changed data is encrypted using the user's private key to generate a digital signature;

采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据,所述服务器公钥为第二服务器对应的公钥,所述第二服务器为多个所述服务器中除所述第一服务器外的服务器;The changed data is encrypted using the public keys of each server to generate encrypted data. The public key of each server is the public key of the second server, which is a server other than the first server among the multiple servers.

分别发送所述数字签名至各个所述第二服务器;The digital signatures are sent to each of the second servers respectively;

接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,发送所述加密数据至各个所述第二服务器,以使各个所述第二服务器同步所述变更数据。After receiving the verification information for the digital signature sent by each of the second servers, the encrypted data is sent to each of the second servers so that each of the second servers can synchronize the changed data.

通过采用上述技术方案,用户需要对生产资料进行变更时,第一服务器需要基于变更数据生成数字签名,用于第二服务器对数字签名进行验证。并且将加密后的数据发送至各第二服务器,确保了各个第二服务器能够验证数据的真实性和完整性。一旦数字签名验证通过,第二服务器就能够同步加密数据,确保了数据的一致性。并且本申请采用区块链去中心化的分布式账本,每个服务器都有拷贝变更数据。相比传统中心化管理,去中心化降低了对单一中心管理设备的依赖,减少了出现单点故障和遭到攻击的风险。每个服务器都参与变更数据验证和存储,降低了生产资料的数据被恶意篡改造成虚假变更的可能性,提高了生产资料的安全性。By adopting the above technical solution, when a user needs to modify production materials, the first server generates a digital signature based on the modified data, which is then verified by the second server. The encrypted data is then sent to each of the second servers, ensuring that each server can verify the authenticity and integrity of the data. Once the digital signature verification is successful, the second server can synchronously encrypt the data, ensuring data consistency. Furthermore, this application uses a decentralized distributed ledger based on blockchain, with each server having a copy of the modified data. Compared to traditional centralized management, decentralization reduces reliance on a single central management device, minimizing the risk of single points of failure and attacks. Each server participates in the verification and storage of modified data, reducing the possibility of production material data being maliciously tampered with into false changes, thus improving the security of production materials.

可选的,所述采用所述用户的用户私钥对所述变更数据进行加密,生成数字签名,具体包括:Optionally, the step of encrypting the changed data using the user's private key to generate a digital signature specifically includes:

对所述变更数据进行哈希运算,得到所述变更数据的哈希值;Perform a hash operation on the changed data to obtain the hash value of the changed data;

采用所述用户私钥对所述哈希值进行加密,得到所述数字签名,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述数字签名进行解密,得到所述哈希值。The hash value is encrypted using the user's private key to obtain the digital signature, so that the second server can decrypt the digital signature using the user's public key corresponding to the user's private key to obtain the hash value.

通过采用上述技术方案,首先,对变更数据进行哈希运算,得到哈希值。哈希运算是一种单向函数,将变更数据转化为固定长度的唯一哈希值,这有助于确保变更数据的唯一性和不可逆性。接着,采用用户的私钥对哈希值进行加密,生成数字签名。这个数字签名是私钥对哈希值进行加密得到的,只有用户的公钥才能解密。这一步骤实现了对变更数据的数字签名,确保了签名的唯一性和用户身份的真实性。By employing the above technical solution, firstly, a hash operation is performed on the changed data to obtain a hash value. A hash operation is a one-way function that transforms changed data into a unique hash value of fixed length, which helps ensure the uniqueness and irreversibility of the changed data. Next, the hash value is encrypted using the user's private key to generate a digital signature. This digital signature, obtained by encrypting the hash value with the private key, can only be decrypted using the user's public key. This step achieves the digital signature of the changed data, ensuring the uniqueness of the signature and the authenticity of the user's identity.

可选的,所述采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据,具体包括:Optionally, the step of encrypting the changed data using the public keys of each server to generate encrypted data specifically includes:

采用目标公钥对所述变更数据进行加密,得到中间加密数据,以使目标服务器能够采用所述目标公钥对应的目标私钥对所述中间加密数据进行解密,得到所述变更数据,所述目标公钥为所述目标服务器对应的公钥,所述目标服务器为多个所述第二服务器中的任意一个第二服务器;The changed data is encrypted using the target public key to obtain intermediate encrypted data, so that the target server can decrypt the intermediate encrypted data using the target private key corresponding to the target public key to obtain the changed data. The target public key is the public key corresponding to the target server, and the target server is any one of a plurality of second servers.

采用所述用户私钥对所述中间加密数据进行加密,得到所述加密数据,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述加密数据进行解密,得到所述中间加密数据。The intermediate encrypted data is encrypted using the user's private key to obtain the encrypted data, so that the second server can decrypt the encrypted data using the user's public key corresponding to the user's private key to obtain the intermediate encrypted data.

通过采用上述技术方案,采用目标公钥对变更数据进行加密,得到中间加密数据。这个中间加密数据是使用目标服务器的公钥加密得到的,只有目标服务器拥有相应的私钥才能够解密。这一步实现了对变更数据的目标服务器身份认证和机密性保护。采用用户的私钥对中间加密数据进行再次加密,得到最终的加密数据。这个加密数据在传输过程中保护了中间加密数据的机密性,只有用户的公钥才能够解密。这一步实现了对加密数据的用户身份认证和再次加密的双重保护。By employing the above technical solution, the changed data is encrypted using the target's public key to obtain intermediate encrypted data. This intermediate encrypted data is encrypted using the target server's public key, and only the target server with the corresponding private key can decrypt it. This step achieves target server authentication and confidentiality protection for the changed data. The intermediate encrypted data is then encrypted again using the user's private key to obtain the final encrypted data. This encrypted data protects the confidentiality of the intermediate encrypted data during transmission, and only the user's public key can decrypt it. This step achieves dual protection for the encrypted data through user authentication and re-encryption.

可选的,所述接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,具体包括:Optionally, receiving the verification pass information for the digital signature sent by each of the second servers specifically includes:

接收所述目标服务器发送的针对所述数字签名的比对通过信息,其中,所述目标服务器采用所述用户私钥对应的用户公钥对所述数字签名进行解密得到所述哈希值,所述目标服务器采用所述目标私钥对所述加密数据进行解密,并对解密结果进行哈希运算,将运算结果与所述哈希值进行比对,若确定所述运算结果与所述哈希值一致,则生成所述比对通过信息;The system receives a comparison pass message for the digital signature sent by the target server. The target server decrypts the digital signature using the user's public key corresponding to the user's private key to obtain the hash value. The target server decrypts the encrypted data using the target private key and performs a hash operation on the decryption result. The operation result is compared with the hash value. If it is determined that the operation result is consistent with the hash value, the comparison pass message is generated.

将所述比对通过信息确定所述验证通过信息。The verification pass information is determined by comparing the information.

通过采用上述技术方案,目标服务器接收所述数字签名的比对通过信息。目标服务器使用用户的公钥对数字签名进行解密,得到哈希值。通过用户私钥和目标公钥的配对,确保了数字签名的有效性。只有用户的私钥和目标服务器的公钥能够正确解密和验证数字签名,防止了未授权的签名验证。随后,目标服务器使用目标私钥对加密数据进行解密,同时对解密结果进行哈希运算,生成新的哈希值。最后,将新生成的哈希值与解密得到的哈希值进行比对,如果一致,则生成比对通过信息。目标服务器使用目标私钥对加密数据进行解密,并对解密结果进行哈希运算。将哈希值与数字签名中解密得到的哈希值进行比对,确保了数据的完整性和真实性。这防范了未经授权的数据解密和篡改。By employing the above technical solution, the target server receives the verification information for the digital signature. The target server decrypts the digital signature using the user's public key to obtain a hash value. The pairing of the user's private key and the target public key ensures the validity of the digital signature. Only the user's private key and the target server's public key can correctly decrypt and verify the digital signature, preventing unauthorized signature verification. Subsequently, the target server decrypts the encrypted data using the target private key and performs a hash operation on the decryption result to generate a new hash value. Finally, the newly generated hash value is compared with the decrypted hash value; if they match, a verification message is generated. The target server decrypts the encrypted data using the target private key and performs a hash operation on the decryption result. Comparing the hash value with the hash value obtained from decrypting the digital signature ensures the integrity and authenticity of the data. This prevents unauthorized data decryption and tampering.

可选的,在所述接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,发送所述加密数据至各个所述第二服务器之后,所述方法还包括:Optionally, after receiving the verification pass information for the digital signature sent by each of the second servers and sending the encrypted data to each of the second servers, the method further includes:

接收各个所述第二服务器发送的同步完成信息,确定所述生产资料变更完成,其中,所述第二服务器采用所述服务器私钥对所述加密数据进行解密,并对所述数字签名验证通过后,生成所述同步完成信息。The system receives synchronization completion information from each of the second servers to determine that the production data change is complete. The second server decrypts the encrypted data using the server private key and generates the synchronization completion information after verifying the digital signature.

通过采用上述技术方案,第一服务器通过将加密数据发送至各个第二服务器,确保了变更数据在所有服务器上的同步。各个第二服务器接收并解密数据后,验证数字签名通过,生成同步完成信息,标志着变更数据在各服务器上的成功同步。这有助于确保所有参与方都获得相同的、经过验证的变更数据,提高了数据的一致性和可信度。并且各个第二服务器在接收加密数据后,使用服务器私钥进行解密,并对数字签名进行验证。只有在数字签名验证通过的情况下,才生成同步完成信息。这确保了数据在传输和存储中的完整性和真实性,防范了数据被篡改或伪造的风险。By employing the above technical solution, the first server ensures the synchronization of changed data across all second servers by sending encrypted data to them. Each second server receives and decrypts the data, verifies the digital signature, and generates a synchronization completion message, signifying successful synchronization of the changed data across all servers. This helps ensure that all participants receive the same, verified changed data, improving data consistency and trustworthiness. Furthermore, each second server, upon receiving the encrypted data, decrypts it using its private key and verifies the digital signature. Only when the digital signature verification is successful does the synchronization completion message generate. This ensures the integrity and authenticity of the data during transmission and storage, preventing the risk of data tampering or forgery.

可选的,在所述采用所述用户私钥对所述哈希值进行加密,得到所述数字签名,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述数字签名进行解密,得到所述哈希值之前,所述方法还包括:Optionally, before encrypting the hash value using the user's private key to obtain the digital signature, so that the second server can decrypt the digital signature using the user's public key corresponding to the user's private key to obtain the hash value, the method further includes:

对所述用户的身份信息代码进行哈希运算,得到运算结果;Perform a hash operation on the user's identity information code to obtain the result;

将所述运算结果设置为所述用户私钥;Set the result of the calculation as the user's private key;

根据所述用户私钥,采用非对称加密算法生成所述用户公钥。The user's public key is generated using an asymmetric encryption algorithm based on the user's private key.

通过采用上述技术方案,用户的身份信息代码经过哈希运算,得到一个唯一的、不可逆的哈希结果。这有助于确保用户的身份信息的安全性和不可篡改性,为后续步骤提供了安全的基础。将身份信息哈希结果设置为用户的私钥。这个私钥是通过哈希运算得到的,具有唯一性和不可逆性,能够保护用户的身份信息。私钥的生成是一个安全的过程,增加了用户身份信息的保密性。基于生成的私钥,采用非对称加密算法生成用户的公钥。这个公钥是私钥的对应项,用于后续的数字签名生成和验证。非对称加密算法保障了公私钥对的安全性,确保只有私钥持有者能够生成与之对应的数字签名。By employing the above technical solution, the user's identity information code is hashed to obtain a unique and irreversible hash result. This helps ensure the security and immutability of the user's identity information, providing a secure foundation for subsequent steps. The hash result of the identity information is set as the user's private key. This private key, obtained through hashing, is unique and irreversible, protecting the user's identity information. Generating the private key is a secure process, increasing the confidentiality of the user's identity information. Based on the generated private key, an asymmetric encryption algorithm is used to generate the user's public key. This public key is the counterpart to the private key and is used for subsequent digital signature generation and verification. The asymmetric encryption algorithm ensures the security of the public-private key pair, guaranteeing that only the private key holder can generate the corresponding digital signature.

可选的,在所述采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据之前,所述方法还包括:Optionally, before encrypting the changed data using the public keys of each server to generate encrypted data, the method further includes:

生成多个随机正整数以及多个随机字母;Generate multiple random positive integers and multiple random letters;

获取所述目标服务器的设备标识;Obtain the device identifier of the target server;

将多个所述随机正整数以及多个所述随机字母插入所述设备标识,得到所述目标私钥;The target private key is obtained by inserting multiple random positive integers and multiple random letters into the device identifier;

根据所述目标私钥,采用非对称加密算法生成所述目标公钥。Based on the target private key, the target public key is generated using an asymmetric encryption algorithm.

通过采用上述技术方案,多个随机正整数和随机字母的生成增加了目标私钥的复杂性和随机性。这样的设计可以有效防止恶意攻击者通过猜测或推测获取目标私钥,提高了私钥的安全性。获取目标服务器的设备标识,将随机正整数和随机字母插入设备标识中,形成目标私钥。这样的设计使目标私钥与目标服务器的特定设备标识关联,增强了私钥的唯一性和设备标识的安全性。基于生成的目标私钥,采用非对称加密算法生成目标公钥。这确保了目标服务器能够使用生成的目标私钥对应的目标公钥进行数据解密,同时防范了未经授权的解密尝试。By employing the above technical solution, the generation of multiple random positive integers and random letters increases the complexity and randomness of the target private key. This design effectively prevents malicious attackers from obtaining the target private key through guessing or speculation, thus improving the security of the private key. The target server's device identifier is obtained, and random positive integers and random letters are inserted into the device identifier to form the target private key. This design associates the target private key with the specific device identifier of the target server, enhancing the uniqueness of the private key and the security of the device identifier. Based on the generated target private key, an asymmetric encryption algorithm is used to generate the target public key. This ensures that the target server can use the target public key corresponding to the generated target private key to decrypt data, while preventing unauthorized decryption attempts.

在本申请的第二方面提供了基于区块链的生产资料管理装置,所述装置为第一服务器,包括获取模块、加密模块以及发送模块,其中:A second aspect of this application provides a blockchain-based production materials management device, wherein the device is a first server, including an acquisition module, an encryption module, and a sending module, wherein:

所述获取模块,用于获取用户输入的针对生产资料的变更数据,所述变更数据为所述生产资料的增减数据;The acquisition module is used to acquire change data for production materials input by the user, wherein the change data is the increase or decrease data of the production materials;

所述加密模块,用于采用所述用户的用户私钥对所述变更数据进行加密,生成数字签名;The encryption module is used to encrypt the changed data using the user's private key and generate a digital signature;

所述加密模块,用于采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据,所述服务器公钥为第二服务器对应的公钥,所述第二服务器为多个所述服务器中除所述第一服务器外的服务器;The encryption module is used to encrypt the changed data using the public keys of each server to generate encrypted data. The public key of the server is the public key corresponding to the second server, and the second server is a server other than the first server among the multiple servers.

所述发送模块,用于分别发送所述数字签名至各个所述第二服务器;The sending module is used to send the digital signature to each of the second servers respectively;

所述发送模块,用于接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,发送所述加密数据至各个所述第二服务器,以使各个所述第二服务器同步所述变更数据。The sending module is configured to receive the verification information for the digital signature sent by each of the second servers, and then send the encrypted data to each of the second servers so that each of the second servers can synchronize the changed data.

在本申请的第三方面提供了一种电子设备,包括处理器、存储器、用户接口以及网络接口,所述存储器用于存储指令,所述用户接口和所述网络接口均用于与其他设备通信,所述处理器用于执行所述存储器中存储的指令,以使所述电子设备执行如上述任意一项所述的方法。A third aspect of this application provides an electronic device including a processor, a memory, a user interface, and a network interface, wherein the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any of the foregoing.

在本申请的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有指令,当所述指令被执行时,执行如上述任意一项所述的方法。A fourth aspect of this application provides a computer-readable storage medium storing instructions that, when executed, perform the method described in any of the preceding descriptions.

综上所述,本申请实施例中提供的一个或多个技术方案,至少具有如下技术效果或优点:In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

用户需要对生产资料进行变更时,第一服务器需要基于变更数据生成数字签名,用于第二服务器对数字签名进行验证。并且将加密后的数据发送至各第二服务器,确保了各个第二服务器能够验证数据的真实性和完整性。一旦数字签名验证通过,第二服务器就能够同步加密数据,确保了数据的一致性。并且本申请采用区块链去中心化的分布式账本,每个服务器都有拷贝变更数据。相比传统中心化管理,去中心化降低了对单一中心管理设备的依赖,减少了出现单点故障和遭到攻击的风险。每个服务器都参与变更数据验证和存储,降低了生产资料的数据被恶意篡改造成虚假变更的可能性,提高了生产资料的安全性。When a user needs to modify production materials, the first server generates a digital signature based on the modified data, which is then verified by the second server. The encrypted data is then sent to each of the second servers, ensuring that each server can verify the authenticity and integrity of the data. Once the digital signature verification is successful, the second server can synchronously encrypt the data, ensuring data consistency. Furthermore, this application uses a decentralized distributed ledger based on blockchain, with each server having a copy of the modified data. Compared to traditional centralized management, decentralization reduces reliance on a single central management device, minimizing the risk of single points of failure and attacks. Each server participates in the verification and storage of modified data, reducing the possibility of production material data being maliciously tampered with into false changes, thus improving the security of production materials.

附图说明Attached Figure Description

图1是本申请实施例公开的基于区块链的生产资料管理方法的流程示意图;Figure 1 is a flowchart illustrating the blockchain-based production materials management method disclosed in an embodiment of this application;

图2是本申请实施例公开的基于区块链的生产资料管理方法的应用场景示意图;Figure 2 is a schematic diagram of an application scenario of the blockchain-based production materials management method disclosed in the embodiments of this application;

图3是本申请实施例公开的一种对变更数据进行加密以及生成数字签名的流程示意图;Figure 3 is a schematic diagram of a process for encrypting changed data and generating a digital signature disclosed in an embodiment of this application;

图4是本申请实施例公开的一种对加密数据进行解密以及验证的流程示意图;Figure 4 is a schematic diagram of a process for decrypting and verifying encrypted data disclosed in an embodiment of this application;

图5是本申请实施例公开的基于区块链的生产资料管理装置的结构示意图;Figure 5 is a schematic diagram of the structure of the blockchain-based production materials management device disclosed in the embodiments of this application;

图6是本申请实施例公开的一种电子设备的结构示意图。Figure 6 is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.

附图标记说明:501、获取模块;502、加密模块;503、发送模块;601、处理器;602、通信总线;603、用户接口;604、网络接口;605、存储器。Explanation of reference numerals in the attached drawings: 501, acquisition module; 502, encryption module; 503, transmission module; 601, processor; 602, communication bus; 603, user interface; 604, network interface; 605, memory.

具体实施方式Detailed Implementation

为了使本领域的技术人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

在本申请实施例的描述中,“例如”或者“举例来说”等词用于表示作例子、例证或说明。本申请实施例中被描述为“例如”或者“举例来说”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“例如”或者“举例来说”等词旨在以具体方式呈现相关概念。In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

在本申请实施例的描述中,术语“多个”的含义是指两个或两个以上。例如,多个系统是指两个或两个以上的系统,多个屏幕终端是指两个或两个以上的屏幕终端。此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

生产资料是指企业在生产过程中用于制造产品或提供服务的各种资源和设备,通常包括物质和非物质两个方面。非物质生产资料则包括技术、专利、品牌、人力资源等,这些因素在生产过程中发挥重要作用,但并非具体的物质形式。物质生产资料主要包括原材料、设备、工具、建筑物等,它们是直接用于生产过程的实体物品。原材料是产品的基础成分,设备和工具用于加工和制造,建筑物提供生产和办公场所。企业的生产资料是实现生产目标和提高生产效率的基础,其合理配置和管理对企业的发展至关重要。Means of production refer to the various resources and equipment used by an enterprise in the production process to manufacture products or provide services, generally including both tangible and intangible aspects. Intangible means of production include technology, patents, brands, and human resources; these factors play an important role in the production process but are not in concrete material form. Tangible means of production mainly include raw materials, equipment, tools, and buildings; these are physical items directly used in the production process. Raw materials are the basic components of products, equipment and tools are used for processing and manufacturing, and buildings provide production and office space. An enterprise's means of production are the foundation for achieving production goals and improving production efficiency; their rational allocation and management are crucial to the enterprise's development.

传统的生产资料管理方法在很大程度上依赖人工操作、文档和集中式计划,存在效率低、数据不准确、反应慢等问题。随着信息技术的发展,现代企业越来越倾向于采用先进的数字化和自动化技术,例如物联网、大数据分析、人工智能等,以提高生产资料管理的效率和准确性。Traditional methods of managing means of production rely heavily on manual operations, documentation, and centralized planning, resulting in low efficiency, inaccurate data, and slow response times. With the development of information technology, modern enterprises are increasingly adopting advanced digital and automation technologies, such as the Internet of Things, big data analytics, and artificial intelligence, to improve the efficiency and accuracy of means of production management.

但是,企业即使采用了先进的数字化和自动化技术来管理生产资料,仍然存在生产资料管理的准确性较低的问题。因为中心化的管理方式过度依赖于中心管理设备,一旦中心管理设备遭到攻击,导致生产资料管理的被篡改,产生了虚假的数据变更。从而生产资料的安全性降低,甚至可能引发生产中断和其他不良后果。因此,需要一种方法提高生产资料管理的安全性。However, even with advanced digital and automation technologies, enterprises still face challenges in the accuracy of production resource management. This is because centralized management relies excessively on central management equipment; if this equipment is attacked, production resource data can be tampered with, resulting in false data changes. This reduces the security of production resources and could even lead to production interruptions and other adverse consequences. Therefore, a method to improve the security of production resource management is needed.

本实施例公开了基于区块链的生产资料管理方法,参照图1,包括如下步骤S110-S150:This embodiment discloses a blockchain-based method for managing production materials. Referring to Figure 1, it includes the following steps S110-S150:

S110,获取用户输入的针对生产资料的变更数据。S110, Obtain the change data for production materials input by the user.

本申请实施例公开的基于区块链的生产资料管理方法应用于第一服务器,第一服务器为区块链管理系统包含的多个服务器中的任意一个服务器。服务器包括但不限于诸如手机、平板电脑、可穿戴设备、PC(Personal Computer,个人计算机)等电子设备,也可以是运行基于区块链的生产资料管理方法的后台服务器。服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The blockchain-based production materials management method disclosed in this application is applied to a first server, which is any one of multiple servers included in the blockchain management system. The server includes, but is not limited to, electronic devices such as mobile phones, tablets, wearable devices, and PCs (Personal Computers), and can also be a backend server running the blockchain-based production materials management method. The server can be implemented using a standalone server or a server cluster composed of multiple servers.

基于区块链的原理以及思路,根据生产资料管理这一实际需求,本申请公开一种区块链管理系统,区块链管理系统包含的服务器类似于传统区块链系统的管理节点,参照图2,多个服务器之间均相互连接,以通过有线或无线通信彼此通信。这种通信可以采用可靠的协议,例如传输控制协议/网际协议(TCP/IP)。以实现相互之间的数据传输与同步。服务器是区块链管理系统网络中的一个基本组成部分,负责维护和运行该网络。在区块链管理系统中,服务器通过互联网连接到区块链网络,并承担多种关键职责,包括数据传输、数据存储以及数据更新等。Based on the principles and concepts of blockchain, and considering the practical needs of production materials management, this application discloses a blockchain management system. The blockchain management system includes servers similar to the management nodes of a traditional blockchain system. Referring to Figure 2, multiple servers are interconnected to communicate with each other via wired or wireless communication. This communication can employ reliable protocols, such as Transmission Control Protocol/Internet Protocol (TCP/IP), to achieve data transmission and synchronization. The server is a fundamental component of the blockchain management system network, responsible for maintaining and operating the network. In the blockchain management system, the server connects to the blockchain network via the Internet and undertakes several key responsibilities, including data transmission, data storage, and data updates.

并且在传统公有链中,节点之间通常是相互匿名的,这意味着,尽管每个节点的交易历史和区块链数据都是公开透明的,但是节点本身(比如运行节点的个人或机构)的身份通常是不公开的。但是对于生产资料的管理,则不需要强匿名性,因为在生产资料的数据出现问题时,不进行匿名有利于对处理过程进行溯源。进而意味着在本申请的区块链管理系统中多个服务器之间彼此身份是已知,能够获取对方的设备标识信息确定对方身份。Furthermore, in traditional public blockchains, nodes are typically anonymous to each other. This means that while each node's transaction history and blockchain data are publicly transparent, the identity of the node itself (such as the individual or organization running the node) is usually not disclosed. However, for the management of production materials, strong anonymity is not necessary because, in the event of problems with the production material data, not being anonymous facilitates tracing the processing. This further implies that in the blockchain management system of this application, the identities of multiple servers are known to each other, and they can obtain each other's device identification information to determine each other's identities.

同时本申请还运用了区块链的其它相关技术或者思路,包括但不限于非对称加密、数字签名以及哈希运算等等,并结合生产资料管理这一场景进行适应性调整,具体实施方式将在下文进行详细介绍。This application also utilizes other blockchain-related technologies or ideas, including but not limited to asymmetric encryption, digital signatures, and hash operations, and makes adaptive adjustments to suit the scenario of production materials management. Specific implementation methods will be described in detail below.

对于包括技术、专利、品牌、人力资源、原材料、设备、工具、建筑物等在内的生产资料,对其进行变更的主要变更内容包括但不限于增加生产资料数量、减少生产资料数量、替换生产资料等。根据变更生产资料的变更内容,生成对应的变更数据。For means of production, including technology, patents, brands, human resources, raw materials, equipment, tools, and buildings, the main changes include, but are not limited to, increasing the quantity of means of production, decreasing the quantity of means of production, and replacing means of production. Based on the changes to the means of production, corresponding change data is generated.

举例来说,假设一个制造公司决定更新其生产线,这包括增加新的生产设备数量(例如购买了五台新的自动化装配机器),减少旧设备数量(移除了三台过时的机器),以及替换某些关键的技术组件(例如用更先进的传感器更新现有的机器)。首先,这些变更信息会被详细记录下来,包括每项资料的数量、类型、规格、购买日期、淘汰日期等。然后,这些变更数据会被格式化成特定的数据结构,比如一个电子表格或数据库条目。For example, suppose a manufacturing company decides to upgrade its production line. This includes adding new production equipment (e.g., purchasing five new automated assembly machines), reducing the number of old equipment (removing three obsolete machines), and replacing certain key technical components (e.g., updating existing machines with more advanced sensors). First, this change information is recorded in detail, including the quantity, type, specifications, purchase date, and obsolescence date of each item. Then, this change data is formatted into a specific data structure, such as a spreadsheet or database entry.

最后,这些变更数据会被存储,以用于更新库存记录、财务报表,以及对生产能力的评估,进而可能用于实现生产目标和提高生产效率。因此需要对生产资料的变更数据进行存储,并且需要保证变更数据存储的安全性,防止数据被篡改。Finally, this change data is stored to update inventory records, financial statements, and assess production capacity, which may then be used to achieve production targets and improve efficiency. Therefore, it is necessary to store change data for production materials and ensure the security of this data storage to prevent tampering.

第一服务器需要有一个界面或方法来接收用户输入的数据,这可以是一个表单、一个API接口或任何其他允许用户输入数据的方式。在用对输入的变更数据进行验证后,以确保其格式正确,符合预期的数据类型和范围,通过API接口或其它输入接口向第一服务器输入生产资料的变更数据。The first server needs an interface or method to receive user input data. This could be a form, an API, or any other way that allows users to input data. After validating the input change data to ensure it is correctly formatted and conforms to the expected data type and range, the change data for production materials is input to the first server via the API or other input interface.

S120,采用用户的用户私钥对变更数据进行加密,生成数字签名。S120 uses the user's private key to encrypt the changed data and generate a digital signature.

第一服务器根据设定的哈希函数,将用户输入的整体变更数据进行哈希运算,生成一个固定长度的唯一字符串(哈希值)。而哈希函数的选择则需要根据用户对于加密的需求,选择合适的哈希函数,例如SHA-256,对此本实施例不做具体限定。The first server performs a hash operation on the user-inputted change data according to the set hash function, generating a unique string (hash value) of fixed length. The choice of hash function depends on the user's encryption requirements; a suitable hash function, such as SHA-256, is selected. This embodiment does not impose specific limitations on this.

举例来说,假设有一家公司,需要记录其生产资料的变更数据。这些变更数据可能包括新增的机器设备、淘汰的工具或者原材料的存量变化等信息。例如,该公司新增了5台3D打印机,淘汰了10台旧的铣床,并购入了1000公斤的塑料颗粒。变更数据可以表示为一个数据结构,例如一个JSON对象,则上述内容可以表示为:{"新增设备":{"3D打印机":5},"淘汰设备":{"铣床":10},"新增原材料":{"塑料颗粒":"1000公斤"}}。接着为了生成变成数据的哈希值,需要使用一个设定的哈希函数如SHA-256。以生成的JSON对象作为哈希函数的输入,生成一个固定长度的唯一字符串,即哈希值。由于哈希运算仅为相关技术领域常规技术手段,且运算过程非常复杂,因此在此不做具体解释。执行上述哈希运算后,输出的哈希值将是一个长度固定且唯一的字符串,例如“83b2ac5b6f......a8b6e43a”。这个哈希值代表了原始变更数据的唯一指纹。即使是微小的数据变化,比如新增设备数量的改变,都会生成一个完全不同的哈希值。For example, suppose a company needs to record changes in its production data. This change data might include information such as newly added machinery, obsolete tools, or changes in raw material inventory. For instance, the company added 5 3D printers, obsolete 10 old milling machines, and purchased 1000 kg of plastic granules. This change data can be represented as a data structure, such as a JSON object, then the above content could be represented as: {"New Equipment":{"3D Printers":5},"Obsolete Equipment":{"Milling Machines":10},"New Raw Materials":{"Plastic Granules":"1000 kg"}}. Next, to generate the hash value of the data, a defined hash function, such as SHA-256, is needed. Using the generated JSON object as input to the hash function, a fixed-length unique string, i.e., the hash value, is generated. Since hashing is only a common technique in related technical fields and the process is very complex, it will not be explained in detail here. After performing the above hash operation, the output hash value will be a fixed-length and unique string, such as "83b2ac5b6f......a8b6e43a". This hash value represents a unique fingerprint of the original changed data. Even minor data changes, such as a change in the number of new devices, will generate a completely different hash value.

哈希函数是不可逆的,这意味着无法通过哈希值反推出原始的变更数据。并且哈希函数通常具有强对抗性,即对变更数据中的某个数值进行微调,计算得到的哈希函数也会大不相同。举例来说,对变更资料中某批物资的数量进行修改,修改前后通过哈希运算得到的结果会差别很大。需要说明的是,由于此处不便于对哈希函数进行具体限定,并且哈希运算也属于相关技术领域的常规技术手段,在此不再做进一步赘述。Hash functions are irreversible, meaning it's impossible to deduce the original changed data from the hash value. Furthermore, hash functions are typically highly adversarial; even minor adjustments to a value in the changed data will result in a significantly different hash function. For example, modifying the quantity of a batch of materials in the change data will yield vastly different hash results before and after the modification. It should be noted that, since it's not convenient to specify a particular hash function here, and hash operations are a standard technique in the relevant technical field, further details will not be provided.

然后使用用户私钥对上一步中得到的哈希值进行数字签名,即通过用户私钥,采用非对称加密算法对哈希值进行加密。用户私钥作为数据加密过程中的关键,通常只对应的所有者(用户)才能持有用户私钥。当第一服务器需要对哈希值进行加密生成数字签名时,根据提前设定的签名算法,如RSA、ECDSA等,这个算法定义了如何使用私钥来加密哈希值,不同算法有不同的特性和安全级别,选择时应考虑变更数据的安全性需求。Then, the hash value obtained in the previous step is digitally signed using the user's private key. This involves encrypting the hash value using an asymmetric encryption algorithm with the user's private key. The user's private key is crucial in the data encryption process and is typically held only by the corresponding owner (user). When the first server needs to encrypt the hash value to generate a digital signature, it uses a pre-defined signature algorithm, such as RSA or ECDSA. This algorithm defines how to use the private key to encrypt the hash value. Different algorithms have different characteristics and security levels; the security requirements of the changed data should be considered when selecting one.

将生成的哈希值作为输入,使用选定的签名算法和用户私钥进行加密。在技术上,这通常不是传统意义上的“加密”,而是生成一个只有相应用户私钥才能产生的唯一输出,这个输出即是数字签名。加密过程通常通过加密库或工具自动完成,用户只需通过相关的输入接口提供用户私钥即可。数字签名是私钥对哈希值进行加密得到的,通常为一串字母和数字的组合,用于验证后续验证变更数据的真实性和完整性,确保变更数据的防篡改。The generated hash value is taken as input and encrypted using a selected signature algorithm and the user's private key. Technically, this is not "encryption" in the traditional sense, but rather generates a unique output that can only be produced by the corresponding user's private key; this output is the digital signature. The encryption process is usually automated by encryption libraries or tools; the user only needs to provide their private key through the relevant input interface. The digital signature, obtained by encrypting the hash value with the private key, is typically a combination of letters and numbers, used to verify the authenticity and integrity of subsequently modified data, ensuring the tamper-proof nature of the modified data.

举例来说,在上述示例中得到的哈希值为“83b2ac5b6f......a8b6e43a”,如果使用RSA算法进行签名,假设用户拥有以下RSA私钥“5s5f96sdf174d”。接下来,使用RSA私钥对上述哈希值进行数字签名。这个过程通常通过加密软件或编程库实现。例如,使用OpenSSL命令行工具,该命令简要内容可能如下:“echo-n"83b2ac5b6f...a8b6e43a"|openssl dgst-SHA256-sign user_private_key“5s5f96sdf174d”pem”这个命令将产生一个数字签名,它是对哈希值的加密表示。执行上述命令后,将输出一个数字签名,比如:“5f4dcc3b5a......6e309e”。For example, the hash value obtained in the above example is "83b2ac5b6f......a8b6e43a". If we use the RSA algorithm for signing, assume the user has the following RSA private key: "5s5f96sdf174d". Next, we use the RSA private key to digitally sign the hash value. This process is usually implemented through encryption software or programming libraries. For example, using the OpenSSL command-line tool, the command might look like this: "echo -n "83b2ac5b6f...a8b6e43a"|openssl dgst-SHA256-sign user_private_key "5s5f96sdf174d" pem". This command will generate a digital signature, which is a cryptographic representation of the hash value. After executing the above command, a digital signature will be output, such as "5f4dcc3b5a......6e309e".

在此之前需要根据生产一对密钥,包括用户公钥和用户私钥,首先获取用户的身份信息,用户的身份信息可以是用户的身份ID、指纹或其他唯一标识符,此信息将被用作用户身份的唯一标识。第一服务器使用哈希函数对用户的身份信息进行哈希运算,生成一个固定长度的哈希值。同理当用户的身份信息输入错误时,例如输错身份ID,则输出的哈希值会发生改变。并且输错任意一个字符,输出的哈希值也会发生较大改变,举例来说,对于身份ID“123456789”,哈希运算后输出的结果可能是“4dd51fg4yrs300ssd”。而对于身份ID“023456789”,哈希运算后输出的结果可能是“fh452sr52sfg”。Before proceeding, a key pair, including a public key and a private key, needs to be generated. First, the user's identity information needs to be obtained. This information can be the user's ID, fingerprint, or other unique identifier, and will be used as the unique identifier for the user. The first server uses a hash function to perform a hash operation on the user's identity information, generating a fixed-length hash value. Similarly, if the user's identity information is entered incorrectly, such as an incorrect ID, the output hash value will change. Furthermore, entering even a single incorrect character will significantly alter the output hash value. For example, for the ID "123456789", the hash output might be "4dd51fg4yrs300ssd". And for the ID "023456789", the hash output might be "fh452sr52sfg".

哈希运算是单向的,即不能通过哈希值逆向还原出原始的身份信息,进一步将上一步得到的哈希值用作用户的用户私钥。但是在实际应用中,这个哈希值可能需要进一步转换或格式化以适应特定的加密算法要求,在此不做进一步赘述。Hash operations are one-way, meaning the original identity information cannot be reconstructed from the hash value and then used as the user's private key. However, in practical applications, this hash value may need further conversion or formatting to adapt to specific encryption algorithm requirements, which will not be elaborated further here.

接着使用非对称加密算法(例如RSA)根据用户的私钥生成对应的公钥。公钥的生成通常涉及复杂的数学运算,确保用户公钥和用户私钥的匹配。在通常在加密系统中,这个过程是自动进行的,用户只需提供私钥,加密库或框架会处理公钥的生成。在这个过程中,用户私钥和用户公钥是一对密钥,具有特殊的数学关系,保证只有用户私钥持有者能够对由用户公钥加密的信息进行解密,或者只有用户公钥持有者能够对由用户私钥加密的信息进行解密。Next, an asymmetric encryption algorithm (such as RSA) is used to generate a corresponding public key based on the user's private key. Public key generation typically involves complex mathematical operations to ensure a match between the user's public and private keys. In most encryption systems, this process is automated; the user only needs to provide their private key, and the encryption library or framework handles the public key generation. During this process, the user's private and public keys form a key pair with a specific mathematical relationship, guaranteeing that only the holder of the user's private key can decrypt information encrypted with the user's public key, or vice versa.

用户的身份信息代码经过哈希运算,得到一个唯一的、不可逆的哈希结果。这有助于确保用户的身份信息的安全性和不可篡改性,为后续步骤提供了安全的基础。将身份信息哈希结果设置为用户的私钥。这个私钥是通过哈希运算得到的,具有唯一性和不可逆性,能够保护用户的身份信息。私钥的生成是一个安全的过程,增加了用户身份信息的保密性。基于生成的私钥,采用非对称加密算法生成用户的公钥。这个公钥是私钥的对应项,用于后续的数字签名生成和验证。非对称加密算法保障了公私钥对的安全性,确保只有私钥持有者能够生成与之对应的数字签名。The user's identity information code is hashed to obtain a unique and irreversible hash result. This helps ensure the security and immutability of the user's identity information, providing a secure foundation for subsequent steps. The hash result of the identity information is set as the user's private key. This private key, obtained through hashing, is unique and irreversible, protecting the user's identity information. Generating the private key is a secure process, increasing the confidentiality of the user's identity information. Based on the generated private key, an asymmetric encryption algorithm is used to generate the user's public key. This public key is the counterpart to the private key and is used for subsequent digital signature generation and verification. The asymmetric encryption algorithm ensures the security of the public-private key pair, ensuring that only the private key holder can generate the corresponding digital signature.

生成数字签名后,第一服务器发送数字签名至各个第二服务器,确保每个第二服务器都收到对变更数据的用户签名,第二服务器为区块链管理系统中多个服务器中除第一服务器外的服务器。或者第一服务器将数字签名发送至部分第二服务器,然后这一部分第二服务器将数字签名发送给其它第二服务器,实现数字签名在所有第二服务器的同步。每个第二服务器使用用户的公钥对收到的数字签名进行解密,得到哈希值。由于数字签名是通过用户私钥加密得到的,只有用户公钥能够解密,所以哈希值的解密确保了这个哈希值是由用户签名生成的。并且由于用户公钥用于验证由用户私钥生成的数字签名,当用户使用用户私钥对信息进行数字签名时,任何人都可以使用用户公钥来验证这个签名的真实性。这证明信息确实是由用户私钥的持有者发送的,并且在传输过程中没有被篡改,因此用户公钥是能够对外公开的,在区块链管理系统中的任意一个服务器均可以存储用户公钥,以直接用于对数字签名进行解密。After generating a digital signature, the first server sends the digital signature to each of the second servers, ensuring that each second server receives the user's signature on the changed data. The second servers are any servers in the blockchain management system other than the first server. Alternatively, the first server sends the digital signature to some of the second servers, and these second servers then send the digital signature to the other second servers, achieving synchronization of the digital signature across all second servers. Each second server uses the user's public key to decrypt the received digital signature, obtaining a hash value. Since the digital signature is encrypted using the user's private key, only the user's public key can decrypt it. Therefore, the decryption of the hash value ensures that the hash value was generated by the user's signature. Furthermore, since the user's public key is used to verify the digital signature generated by the user's private key, when a user digitally signs information using their private key, anyone can use the user's public key to verify the authenticity of the signature. This proves that the information was indeed sent by the holder of the user's private key and has not been tampered with during transmission. Therefore, the user's public key can be publicly disclosed, and any server in the blockchain management system can store the user's public key for direct use in decrypting digital signatures.

首先,对变更数据进行哈希运算,得到哈希值。哈希运算是一种单向函数,将变更数据转化为固定长度的唯一哈希值,这有助于确保变更数据的唯一性和不可逆性。接着,采用用户的私钥对哈希值进行加密,生成数字签名。这个数字签名是私钥对哈希值进行加密得到的,只有用户的公钥才能解密。这一步骤实现了对变更数据的数字签名,确保了签名的唯一性和用户身份的真实性。First, a hash operation is performed on the changed data to obtain a hash value. A hash operation is a one-way function that transforms changed data into a unique hash value of fixed length, which helps ensure the uniqueness and irreversibility of the changed data. Next, the hash value is encrypted using the user's private key to generate a digital signature. This digital signature, obtained by encrypting the hash value with the private key, can only be decrypted using the user's public key. This step implements the digital signature of the changed data, ensuring the uniqueness of the signature and the authenticity of the user's identity.

S130,采用各个服务器公钥分别对变更数据进行加密,生成加密数据。S130 uses the public keys of each server to encrypt the changed data, generating encrypted data.

类似于用户公钥与用户私钥,需要根据各个第二服务器的设备标识,生成一对密钥,用于加密和解密。本申请公开一种基于随机数的密钥生成方法,具体实施过程如下:Similar to the user's public and private keys, a key pair needs to be generated based on the device identifiers of each second server for encryption and decryption. This application discloses a key generation method based on random numbers, the specific implementation process of which is as follows:

首先使用随机数生成器生成所需数量的随机正整数,确保生成的整数具有足够的随机性和均匀性。随机选择字母表中的字母,生成所需数量的随机字母,可以通过随机数生成器选择字母表中的索引来实现。从目标服务器获取其设备标识,设备标识是设备的唯一标识符,用于标识设备的信息,可以是MAC地址或其他用于标识设备的信息。First, use a random number generator to generate the required number of random positive integers, ensuring that the generated integers have sufficient randomness and uniformity. Then, randomly select letters from the alphabet to generate the required number of random letters; this can be achieved by using a random number generator to select an index from the alphabet. Next, obtain the device identifier from the target server. The device identifier is a unique identifier used to identify the device; it can be a MAC address or other information used to identify the device.

将生成的随机正整数和随机字母插入到设备标识中,生成目标私钥。这可以通过将随机数和字母按照一定规则插入到设备标识的不同位置来实现。举例来说,设备标识为"ABC123XYZ",插入的随机正整数为"456",随机字母为"MNO",插入规则可以是每个数字或字母插入到设备标识的两个字符之间,得到类似"AB4C56MNO123XYZ"的目标私钥。最后使用非对称加密算法(例如RSA)根据生成的目标私钥生成对应的目标公钥。这通常涉及到选择素数、计算模数、选择公钥指数等步骤,确保生成的密钥对是强度足够的非对称密钥对。The generated random positive integer and random letter are inserted into the device identifier to generate the target private key. This can be achieved by inserting random numbers and letters into different positions in the device identifier according to certain rules. For example, if the device identifier is "ABC123XYZ", the inserted random positive integer is "456", and the random letter is "MNO". The insertion rule could be that each number or letter is inserted between two characters of the device identifier, resulting in a target private key like "AB4C56MNO123XYZ". Finally, an asymmetric encryption algorithm (such as RSA) is used to generate the corresponding target public key based on the generated target private key. This typically involves steps such as selecting prime numbers, calculating the modulus, and selecting the public key exponent to ensure that the generated key pair is a sufficiently strong asymmetric key pair.

多个随机正整数和随机字母的生成增加了目标私钥的复杂性和随机性。这样的设计可以有效防止恶意攻击者通过猜测或推测获取目标私钥,提高了私钥的安全性。获取目标服务器的设备标识,将随机正整数和随机字母插入设备标识中,形成目标私钥。这样的设计使目标私钥与目标服务器的特定设备标识关联,增强了私钥的唯一性和设备标识的安全性。基于生成的目标私钥,采用非对称加密算法生成目标公钥。这确保了目标服务器能够使用生成的目标私钥对应的目标公钥进行数据解密,同时防范了未经授权的解密尝试。The generation of multiple random positive integers and random letters increases the complexity and randomness of the target private key. This design effectively prevents malicious attackers from obtaining the target private key through guessing or speculation, thus improving its security. The target server's device identifier is obtained, and random positive integers and random letters are inserted into the device identifier to form the target private key. This design associates the target private key with the specific device identifier of the target server, enhancing the uniqueness of the private key and the security of the device identifier. Based on the generated target private key, an asymmetric encryption algorithm is used to generate the target public key. This ensures that the target server can use the target public key corresponding to the generated target private key to decrypt data, while preventing unauthorized decryption attempts.

对于每个第二服务器,第一服务器获取其对应的服务器公钥。以多个第二服务器中的任意一个第二服务器,目标服务器进行举例说明,目标服务器同样提前设置一对密钥,目标公钥和目标私钥,其中目标公钥用于加密,目标私钥用于解密。第一服务器对变更数据采用目标服务器的目标公钥进行加密,生成中间加密数据。这确保只有目标服务器能够使用其目标私钥解密这些数据。然后使用用户私钥对上一步得到的中间加密数据进行再次加密,生成最终的加密数据。For each second server, the first server obtains its corresponding public key. Taking any one of the multiple second servers as an example, the target server also pre-sets a key pair: a target public key and a target private key. The target public key is used for encryption, and the target private key is used for decryption. The first server encrypts the changed data using the target server's target public key, generating intermediate encrypted data. This ensures that only the target server can decrypt this data using its target private key. Then, the intermediate encrypted data obtained in the previous step is re-encrypted using the user's private key to generate the final encrypted data.

采用目标公钥对变更数据进行加密,得到中间加密数据。这个中间加密数据是使用目标服务器的公钥加密得到的,只有拥有目标服务器相应的目标私钥才能够解密。这一步实现了对变更数据的目标服务器身份认证和机密性保护。采用用户的私钥对中间加密数据进行再次加密,得到最终的加密数据。这个加密数据在传输过程中保护了中间加密数据的机密性,只有用户的公钥才能够解密。这一步实现了对加密数据的用户身份认证和再次加密的双重保护。The modified data is encrypted using the target's public key to obtain intermediate encrypted data. This intermediate encrypted data is encrypted using the target server's public key and can only be decrypted using the corresponding target private key. This step achieves target server authentication and confidentiality protection for the modified data. The intermediate encrypted data is then encrypted again using the user's private key to obtain the final encrypted data. This encrypted data protects the confidentiality of the intermediate encrypted data during transmission and can only be decrypted using the user's public key. This step achieves dual protection for the encrypted data through user authentication and re-encryption.

S140,分别发送数字签名至各个第二服务器。S140, send the digital signature to each of the second servers respectively.

由于第一服务器根据各服务器公钥对变更数据进行加密得到数字签名,因此,可以根据服务器公钥作为地址,而在服务器公钥与服务器标识建立映射关系的前提下,通过服务器公钥将数字签名发送给所有第二服务器,确保每个服务器都收到对变更数据的用户签名。Since the first server encrypts the changed data to obtain a digital signature based on the public keys of each server, the digital signature can be sent to all second servers using the server's public key as the address, provided that a mapping relationship is established between the server's public key and the server identifier. This ensures that each server receives the user's signature on the changed data.

随后,目标服务器对用户签名进行验证,而由于数字签名是通过用户私钥进行加密的,如果目标服务器未得到用户公钥,或者接收到的数字签名是被篡改后的数字签名,则目标服务器无法成功解密数字签名,进而无法对数字签名验证成功。Subsequently, the target server verifies the user's signature. However, since the digital signature is encrypted using the user's private key, if the target server does not obtain the user's public key, or if the received digital signature is tampered with, the target server cannot successfully decrypt the digital signature and therefore cannot successfully verify it.

具体来说,即使恶意攻击者得到了用户公钥,但是无法通过用户公钥反推出用户私钥,原因在于非对称加密算法的数学基础。这些算法,如RSA、ECC(椭圆曲线加密)等,都是基于数学问题的复杂性构建的。举例来说,在RSA算法中,公钥和私钥是通过两个大质数的乘积生成的。公钥包含这个乘积(称为模数n),而私钥则与这两个质数的具体值相关。虽然乘法(计算模数n)是相对容易的,但是对一个大数进行质因数分解(即从n找到这两个原始质数)在计算上是极其困难的。目前没有已知的高效算法可以在实际时间内解决这个问题,尤其是当涉及到非常大的数字时。这些数学问题的复杂性保证了即使攻击者拥有用户公钥,他们也无法在实际的时间内计算出相应的用户私钥。这种计算上的不可行性是构建安全的非对称加密系统的关键,使得用户公钥可以安全地公开,而用户私钥则保持安全。Specifically, even if a malicious attacker obtains a user's public key, they cannot deduce the user's private key from it. This is due to the mathematical foundation of asymmetric encryption algorithms. These algorithms, such as RSA and ECC (Elliptic Curve Cryptography), are built upon the complexity of mathematical problems. For example, in the RSA algorithm, the public and private keys are generated by multiplying two large prime numbers. The public key contains this product (called the modulus n), while the private key is associated with the specific values of these two prime numbers. While multiplication (calculating the modulus n) is relatively easy, prime factorization of a large number (i.e., finding the two original prime numbers from n) is computationally extremely difficult. Currently, there is no known efficient algorithm that can solve this problem in real time, especially when dealing with very large numbers. The complexity of these mathematical problems ensures that even if an attacker possesses the user's public key, they cannot compute the corresponding user's private key in real time. This computational infeasibility is key to building secure asymmetric encryption systems, allowing the user's public key to be securely disclosed while the user's private key remains secure.

基于上述原理,由于数字签名是采用用户私钥加密的,因此目标服务器只要尝试通过用户公钥对数字签名进行解密,判断能否解密成功。如果无法解密成功,得到一组哈希值,则表明数字签名可能被篡改。反之,如果目标服务器对数字签名解密成功,则对数字签名的验证通过。Based on the above principles, since digital signatures are encrypted using the user's private key, the target server only needs to attempt to decrypt the digital signature using the user's public key to determine if decryption is successful. If decryption fails and a hash value is obtained, it indicates that the digital signature may have been tampered with. Conversely, if the target server successfully decrypts the digital signature, the verification of the digital signature is successful.

S150,接收到各个第二服务器发送的针对数字签名的验证通过信息后,发送加密数据至各个第二服务器。S150: After receiving the verification information for the digital signature sent by each of the second servers, send encrypted data to each of the second servers.

多个第二服务器(包括目标服务器)对数字签名验证通过后,根据通信地址返回验证通过信息至第一服务器。根据预设的规则,当第一服务器接收的验证通过信息的数量超过预设阈值后,第一服务器根据第二服务器的服务器公钥,将加密数据发送给所有第二服务器,以使各个第二服务器同步变更数据。After multiple secondary servers (including the target server) verify the digital signature, they return verification information to the primary server based on the communication address. According to preset rules, when the number of verification messages received by the primary server exceeds a preset threshold, the primary server sends encrypted data to all secondary servers based on the secondary servers' public keys, so that each secondary server can synchronously change the data.

而只有在第二服务器对数字签名验证通过,并发送验证通过信息至第一服务器,第一服务器才将加密数据发送至第二服务器,其原因为第二服务器只有在获取用户公钥的情况下才能得到数字签名,并且第一服务器只有在用户第二服务器的服务器公钥的情况下,才能发送数字签名至第二服务器。这意味着第二服务器必须是已知且安全的服务器前提下,才能与第一服务器相互拥有对方的公钥,进而第一服务器才能发送加密数据至该第二服务器。Only after the second server verifies the digital signature and sends a verification confirmation message to the first server will the first server send the encrypted data to the second server. This is because the second server can only obtain the digital signature if it has the user's public key, and the first server can only send the digital signature to the second server if it has the user's public key. This means that the second server must be a known and secure server for it to possess the public key of the first server, and only then can the first server send encrypted data to the second server.

进一步地,第一服务器首先发送数字签名至第二服务器,第二服务器可以验证数据是否确实来自于合法的第一服务器。数字签名是用第一服务器的私钥加密的,只有对应的公钥才能验证其真实性。这种机制确保了数据源头的安全和可信。如果第二服务器无法验证数字签名,说明数据可能来自不可信的来源或已被篡改。在这种情况下,拒绝接收加密数据可以防止接收并处理无效或恶意的数据,从而提高整个区块链管理系统的安全性。Furthermore, the first server first sends a digital signature to the second server, which can verify that the data indeed originated from the legitimate first server. The digital signature is encrypted using the first server's private key, and only the corresponding public key can verify its authenticity. This mechanism ensures the security and trustworthiness of the data source. If the second server cannot verify the digital signature, it indicates that the data may have originated from an untrusted source or has been tampered with. In this case, refusing to receive encrypted data prevents the receipt and processing of invalid or malicious data, thereby enhancing the security of the entire blockchain management system.

由于加密数据是使用各个服务器的公钥加密的,只有对应的服务器使用服务器私钥才能解密和读取这些数据。如果还采用了用户公钥对数据进行了二次加密,同样还需要用户私钥对加密数据进行解密。每个第二服务器使用自己的私钥解密收到的加密数据,并处理这些数据,使得各个服务器在数据上保持同步。这可能包括更新本地数据库、触发相应的生产资料管理操作等。第二服务器对加密数据进行解密,并且完成对数字签名的验证后,发送同步完成信息至第一服务器。第一服务器接收到同步完成信息,确定生产资料的变更完成。Since the encrypted data is encrypted using the public keys of each server, only the corresponding server can decrypt and read this data using its private key. If the data is further encrypted using the user's public key, the user's private key is also required to decrypt the encrypted data. Each second server uses its own private key to decrypt the received encrypted data and processes it, ensuring that the servers remain synchronized. This may include updating the local database and triggering corresponding production data management operations. After decrypting the encrypted data and verifying the digital signature, the second server sends a synchronization completion message to the first server. Upon receiving the synchronization completion message, the first server confirms that the change to the production data is complete.

第一服务器通过将加密数据发送至各个第二服务器,确保了变更数据在所有服务器上的同步。各个第二服务器接收并解密数据后,验证数字签名通过,生成同步完成信息,标志着变更数据在区块链管理系统的各服务器上的成功同步。这有助于确保所有参与方都获得相同的、经过验证的变更数据,提高了数据的一致性和可信度。并且各个第二服务器在接收加密数据后,使用服务器私钥进行解密,并对数字签名进行验证。只有在数字签名验证通过的情况下,才生成同步完成信息。这确保了数据在传输和存储中的完整性和真实性,防范了数据被篡改或伪造的风险。The first server ensures the synchronization of changed data across all servers by sending encrypted data to each of the second servers. Each second server receives and decrypts the data, verifies the digital signature, and generates a synchronization completion message, signifying successful synchronization of the changed data across all servers in the blockchain management system. This helps ensure that all participants receive the same, verified changed data, improving data consistency and trustworthiness. Furthermore, each second server, upon receiving the encrypted data, decrypts it using its private key and verifies the digital signature. A synchronization completion message is only generated if the digital signature verification is successful. This ensures the integrity and authenticity of data during transmission and storage, preventing the risk of data tampering or forgery.

通过采用上述技术方案,用户需要对生产资料进行变更时,第一服务器需要基于变更数据生成数字签名,用于第二服务器对数字签名进行验证。并且将加密后的数据发送至各第二服务器,确保了各个第二服务器能够验证数据的真实性和完整性。一旦数字签名验证通过,第二服务器就能够同步加密数据,确保了数据的一致性。并且本申请采用区块链去中心化的分布式账本,每个服务器都有拷贝变更数据。相比传统中心化管理,去中心化降低了对单一中心管理设备的依赖,减少了出现单点故障和遭到攻击的风险。每个服务器都参与变更数据验证和存储,降低了生产资料的数据被恶意篡改造成虚假变更的可能性,提高了生产资料的安全性。By adopting the above technical solution, when a user needs to modify production materials, the first server generates a digital signature based on the modified data, which is then verified by the second server. The encrypted data is then sent to each of the second servers, ensuring that each server can verify the authenticity and integrity of the data. Once the digital signature verification is successful, the second server can synchronously encrypt the data, ensuring data consistency. Furthermore, this application uses a decentralized distributed ledger based on blockchain, with each server having a copy of the modified data. Compared to traditional centralized management, decentralization reduces reliance on a single central management device, minimizing the risk of single points of failure and attacks. Each server participates in the verification and storage of modified data, reducing the possibility of production material data being maliciously tampered with into false changes, thus improving the security of production materials.

在一种可能的实施方式中,参照图3,当用户需要对生产资料的变更数据进行加密管理时,首先对变更数据进行哈希运算,得到一组唯一的哈希值。然后向第一服务器输入用户私钥,对哈希值进行加密以生成数字签名。同时第一服务器通过第二服务器的服务器公钥对变更数据进行加密,得到中间加密数据,仅能通过服务器公钥对应的服务器私钥,从中间加密数据解密得到变更数据。再通过用户私钥对中间加密数据进行二次加密得到最终的加密数据。在区块链管理系统的多个第二服务器对数字签名验证通过后,即确定通过用户公钥对数字签名进行解密,发送验证通过信息至第一服务器。第一服务器在接收到验证通过信息后,第一服务器根据通信地址传输加密数据至第二服务器。In one possible implementation, referring to Figure 3, when a user needs to manage changes in production data using encryption, the changed data is first hashed to obtain a unique hash value. Then, the user's private key is input into the first server to encrypt the hash value and generate a digital signature. Simultaneously, the first server encrypts the changed data using the public key of the second server, obtaining intermediate encrypted data. This intermediate encrypted data can only be decrypted using the private key corresponding to the server's public key. The intermediate encrypted data is then further encrypted using the user's private key to obtain the final encrypted data. After multiple second servers in the blockchain management system verify the digital signature, it is determined that the digital signature has been decrypted using the user's public key, and a verification pass message is sent to the first server. Upon receiving the verification pass message, the first server transmits the encrypted data to the second servers according to the communication address.

进一步地,任意一个第二服务器的使用者想解密并验证加密数据时,参照图4,第二服务器通过用户公钥对数字签名进行解密,得到一组哈希值。第二服务器的使用者首先需要在得到用户的允许下,即用户输入用户私钥,第二服务器才能使用用户私钥对接收到的加密数据进行解密,得到中间加密数据。进一步再使用当前第二服务器的服务器私钥对中间加密数据进行解密,得到变更数据,最后对变更数据进行哈希运算得到一组哈希值。如果加密数据未被篡改,并且数字签名也未被篡改,那么得到的两组哈希值应该相同,因为这两组哈希值都应该是基于变更数据采用用户私钥进行加密得到的。反之,一旦两组哈希值不同,表明加密数据被篡改或者数字签名被篡改。Furthermore, when any user of the second server wants to decrypt and verify the encrypted data, referring to Figure 4, the second server decrypts the digital signature using the user's public key to obtain a hash value. The user of the second server must first obtain permission from the user, i.e., the user must input their private key, before the second server can use the user's private key to decrypt the received encrypted data, obtaining intermediate encrypted data. Then, the second server's private key is used to decrypt the intermediate encrypted data to obtain the modified data. Finally, a hash operation is performed on the modified data to obtain a hash value. If the encrypted data has not been tampered with, and the digital signature has also not been tampered with, then the two hash values should be the same, because both hash values should be obtained by encrypting the modified data using the user's private key. Conversely, if the two hash values are different, it indicates that the encrypted data has been tampered with, or the digital signature has been tampered with.

本实施例还公开了基于区块链的生产资料管理装置,装置为第一服务器,参照图5,包括获取模块501、加密模块502以及发送模块503,其中:This embodiment also discloses a blockchain-based production materials management device. The device is a first server, and as shown in Figure 5, it includes an acquisition module 501, an encryption module 502, and a sending module 503, wherein:

获取模块501,用于获取用户输入的针对生产资料的变更数据,变更数据为生产资料的增减数据。The acquisition module 501 is used to acquire the change data of production materials input by the user, which is the increase or decrease data of production materials.

加密模块502,用于采用用户的用户私钥对变更数据进行加密,生成数字签名。The encryption module 502 is used to encrypt the changed data using the user's private key and generate a digital signature.

加密模块502,用于采用各个服务器公钥分别对变更数据进行加密,生成加密数据,服务器公钥为第二服务器对应的公钥,第二服务器为多个服务器中除第一服务器外的服务器。The encryption module 502 is used to encrypt the changed data using the public keys of each server to generate encrypted data. The public key of the server is the public key of the second server, which is a server other than the first server among multiple servers.

发送模块503,用于分别发送数字签名至各个第二服务器。The sending module 503 is used to send digital signatures to each of the second servers respectively.

发送模块503,用于接收到各个第二服务器发送的针对数字签名的验证通过信息后,发送加密数据至各个第二服务器,以使各个第二服务器同步变更数据。The sending module 503 is used to send encrypted data to each of the second servers after receiving the verification information for the digital signature sent by each second server, so that each second server can synchronously change the data.

在一种可能的实施方式中,加密模块502,用于对变更数据进行哈希运算,得到变更数据的哈希值。In one possible implementation, the encryption module 502 is used to perform a hash operation on the changed data to obtain the hash value of the changed data.

加密模块502,用于采用用户私钥对哈希值进行加密,得到数字签名,以使第二服务器能够采用用户私钥对应的用户公钥对数字签名进行解密,得到哈希值。The encryption module 502 is used to encrypt the hash value using the user's private key to obtain a digital signature, so that the second server can decrypt the digital signature using the user's public key corresponding to the user's private key to obtain the hash value.

在一种可能的实施方式中,加密模块502,用于采用目标公钥对变更数据进行加密,得到中间加密数据,以使目标服务器能够采用目标公钥对应的目标私钥对中间加密数据进行解密,得到变更数据,目标公钥为目标服务器对应的公钥,目标服务器为多个第二服务器中的任意一个第二服务器。In one possible implementation, the encryption module 502 is used to encrypt the changed data using the target public key to obtain intermediate encrypted data, so that the target server can decrypt the intermediate encrypted data using the target private key corresponding to the target public key to obtain the changed data. The target public key is the public key corresponding to the target server, and the target server is any one of a plurality of second servers.

加密模块502,用于采用用户私钥对中间加密数据进行加密,得到加密数据,以使第二服务器能够采用用户私钥对应的用户公钥对加密数据进行解密,得到中间加密数据。The encryption module 502 is used to encrypt intermediate encrypted data using the user's private key to obtain encrypted data, so that the second server can decrypt the encrypted data using the user's public key corresponding to the user's private key to obtain intermediate encrypted data.

在一种可能的实施方式中,获取模块501,用于接收目标服务器发送的针对数字签名的比对通过信息,其中,目标服务器采用用户私钥对应的用户公钥对数字签名进行解密得到哈希值,目标服务器采用目标私钥对加密数据进行解密,并对解密结果进行哈希运算,将运算结果与哈希值进行比对,若确定运算结果与哈希值一致,则生成比对通过信息。In one possible implementation, the acquisition module 501 is used to receive the comparison pass information for the digital signature sent by the target server. The target server uses the user's public key corresponding to the user's private key to decrypt the digital signature to obtain a hash value. The target server uses the target private key to decrypt the encrypted data and performs a hash operation on the decryption result. The operation result is compared with the hash value. If it is determined that the operation result is consistent with the hash value, the comparison pass information is generated.

发送模块503,用于将比对通过信息确定验证通过信息。The sending module 503 is used to determine the verification pass information by sending the comparison pass information.

在一种可能的实施方式中,获取模块501,用于接收各个第二服务器发送的同步完成信息,确定生产资料变更完成,其中,第二服务器采用服务器私钥对加密数据进行解密,并对数字签名验证通过后,生成同步完成信息。In one possible implementation, the acquisition module 501 is used to receive synchronization completion information sent by each second server to determine that the change of production data is completed. The second server uses its private key to decrypt the encrypted data and generates synchronization completion information after the digital signature is verified.

在一种可能的实施方式中,加密模块502,用于对用户的身份信息代码进行哈希运算,得到运算结果。In one possible implementation, the encryption module 502 is used to perform a hash operation on the user's identity information code to obtain the result.

加密模块502,用于将运算结果设置为用户私钥。Encryption module 502 is used to set the calculation result as the user's private key.

加密模块502,用于根据用户私钥,采用非对称加密算法生成用户公钥。The encryption module 502 is used to generate a user public key based on the user's private key using an asymmetric encryption algorithm.

在一种可能的实施方式中,获取模块501,用于生成多个随机正整数以及多个随机字母。In one possible implementation, the acquisition module 501 is used to generate multiple random positive integers and multiple random letters.

获取模块501,用于获取目标服务器的设备标识。The acquisition module 501 is used to acquire the device identifier of the target server.

加密模块502,用于将多个随机正整数以及多个随机字母插入设备标识,得到目标私钥。Encryption module 502 is used to insert multiple random positive integers and multiple random letters into the device identifier to obtain the target private key.

加密模块502,用于根据目标私钥,采用非对称加密算法生成目标公钥。The encryption module 502 is used to generate the target public key based on the target private key using an asymmetric encryption algorithm.

需要说明的是:上述实施例提供的装置在实现其功能时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置和方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that the above embodiments of the apparatus are only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

本实施例还公开了一种电子设备,参照图6,电子设备可以包括:至少一个处理器601,至少一个通信总线602,用户接口603,网络接口604,至少一个存储器605。This embodiment also discloses an electronic device. Referring to FIG6, the electronic device may include: at least one processor 601, at least one communication bus 602, user interface 603, network interface 604, and at least one memory 605.

其中,通信总线602用于实现这些组件之间的连接通信。The communication bus 602 is used to enable communication between these components.

其中,用户接口603可以包括显示屏(Display)、摄像头(Camera),可选用户接口603还可以包括标准的有线接口、无线接口。The user interface 603 may include a display screen and a camera. Optionally, the user interface 603 may also include a standard wired interface and a wireless interface.

其中,网络接口604可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。The network interface 604 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

其中,处理器601可以包括一个或者多个处理核心。处理器601利用各种接口和线路连接整个服务器内的各个部分,通过运行或执行存储在存储器605内的指令、程序、代码集或指令集,以及调用存储在存储器605内的数据,执行服务器的各种功能和处理数据。The processor 601 may include one or more processing cores. The processor 601 connects to various parts of the server using various interfaces and lines, and performs various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 605, and by calling data stored in the memory 605.

其中,存储器605可以包括随机存储器605(Random Access Memory,RAM),也可以包括只读存储器605(Read-Only Memory)。如图所示,作为一种计算机存储介质的存储器605中可以包括操作系统、网络通信模块、用户接口603模块以及基于区块链的生产资料管理方法的应用程序。The memory 605 may include random access memory (RAM) or read-only memory (ROM). As shown in the figure, the memory 605, as a computer storage medium, may include an operating system, a network communication module, a user interface module 603, and an application program for a blockchain-based production materials management method.

在图6所示的电子设备中,用户接口603主要用于为用户提供输入的接口,获取用户输入的数据;而处理器601可以用于调用存储器605中存储基于区块链的生产资料管理方法的应用程序,当由一个或多个处理器601执行时,使得电子设备执行如上述实施例中一个或多个的方法。In the electronic device shown in Figure 6, the user interface 603 is mainly used to provide an input interface for the user and obtain the user input data; while the processor 601 can be used to call the application program stored in the memory 605 that is based on the blockchain-based production materials management method. When executed by one or more processors 601, the electronic device executes one or more methods as described in the above embodiments.

以上所述者,仅为本公开的示例性实施例,不能以此限定本公开的范围。即但凡依本公开教导所作的等效变化与修饰,皆仍属本公开涵盖的范围内。本领域技术人员在考虑说明书及实践真理的公开后,将容易想到本公开的其他实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未记载的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的范围和精神由权利要求限定。The foregoing description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of other embodiments of this disclosure upon considering the specification and the disclosure of practical truth. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims (5)

1.基于区块链的生产资料管理方法,其特征在于,应用于第一服务器,所述第一服务器为区块链管理系统包含的多个服务器中的任意一个服务器,多个所述服务器相互连接,所述方法包括:1. A production materials management method based on blockchain, characterized in that it is applied to a first server, wherein the first server is any one of multiple servers included in the blockchain management system, and the multiple servers are interconnected, the method comprising: 获取用户输入的针对生产资料的变更数据,所述变更数据为所述生产资料的增减数据;Obtain user-inputted change data for production materials, wherein the change data is the increase or decrease data of the production materials; 采用所述用户的用户私钥对所述变更数据进行加密,生成数字签名;The changed data is encrypted using the user's private key to generate a digital signature; 采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据,所述服务器公钥为第二服务器对应的公钥,所述第二服务器为多个所述服务器中除所述第一服务器外的服务器;The changed data is encrypted using the public keys of each server to generate encrypted data. The public key of each server is the public key of the second server, which is a server other than the first server among the multiple servers. 分别发送所述数字签名至各个所述第二服务器;The digital signatures are sent to each of the second servers respectively; 接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,发送所述加密数据至各个所述第二服务器,以使各个所述第二服务器同步所述变更数据;After receiving the verification information for the digital signature sent by each of the second servers, the encrypted data is sent to each of the second servers so that each of the second servers can synchronize the changed data; 所述采用所述用户的用户私钥对所述变更数据进行加密,生成数字签名,具体包括:The step of encrypting the changed data using the user's private key to generate a digital signature specifically includes: 对所述变更数据进行哈希运算,得到所述变更数据的哈希值;Perform a hash operation on the changed data to obtain the hash value of the changed data; 采用所述用户私钥对所述哈希值进行加密,得到所述数字签名,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述数字签名进行解密,得到所述哈希值;The hash value is encrypted using the user's private key to obtain the digital signature, so that the second server can decrypt the digital signature using the user's public key corresponding to the user's private key to obtain the hash value. 所述采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据,具体包括:The step of encrypting the changed data using the public keys of each server to generate encrypted data specifically includes: 采用目标公钥对所述变更数据进行加密,得到中间加密数据,以使目标服务器能够采用所述目标公钥对应的目标私钥对所述中间加密数据进行解密,得到所述变更数据,所述目标公钥为所述目标服务器对应的公钥,所述目标服务器为多个所述第二服务器中的任意一个第二服务器;The changed data is encrypted using the target public key to obtain intermediate encrypted data, so that the target server can decrypt the intermediate encrypted data using the target private key corresponding to the target public key to obtain the changed data. The target public key is the public key corresponding to the target server, and the target server is any one of a plurality of second servers. 采用所述用户私钥对所述中间加密数据进行加密,得到所述加密数据,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述加密数据进行解密,得到所述中间加密数据;The intermediate encrypted data is encrypted using the user's private key to obtain the encrypted data, so that the second server can decrypt the encrypted data using the user's public key corresponding to the user's private key to obtain the intermediate encrypted data. 在所述接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,发送所述加密数据至各个所述第二服务器之后,所述方法还包括:After receiving verification information for the digital signature from each of the second servers, and after sending the encrypted data to each of the second servers, the method further includes: 接收各个所述第二服务器发送的同步完成信息,确定所述生产资料变更完成,其中,所述第二服务器采用服务器私钥对所述加密数据进行解密,并对所述数字签名验证通过后,生成所述同步完成信息;The system receives synchronization completion information from each of the second servers to determine that the production data change is complete. The second server decrypts the encrypted data using its private key and generates the synchronization completion information after verifying the digital signature. 在所述采用所述用户私钥对所述哈希值进行加密,得到所述数字签名,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述数字签名进行解密,得到所述哈希值之前,所述方法还包括:Before encrypting the hash value using the user's private key to obtain the digital signature, so that the second server can decrypt the digital signature using the user's public key corresponding to the user's private key to obtain the hash value, the method further includes: 对所述用户的身份信息代码进行哈希运算,得到运算结果;Perform a hash operation on the user's identity information code to obtain the result; 将所述运算结果设置为所述用户私钥;Set the result of the calculation as the user's private key; 根据所述用户私钥,采用非对称加密算法生成所述用户公钥;The user's public key is generated using an asymmetric encryption algorithm based on the user's private key. 在所述采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据之前,所述方法还包括:Before encrypting the changed data using the public keys of each server to generate encrypted data, the method further includes: 生成多个随机正整数以及多个随机字母;Generate multiple random positive integers and multiple random letters; 获取所述目标服务器的设备标识;Obtain the device identifier of the target server; 将多个所述随机正整数以及多个所述随机字母插入所述设备标识,得到所述目标私钥;The target private key is obtained by inserting multiple random positive integers and multiple random letters into the device identifier; 根据所述目标私钥,采用非对称加密算法生成所述目标公钥。Based on the target private key, the target public key is generated using an asymmetric encryption algorithm. 2.根据权利要求1所述的基于区块链的生产资料管理方法,其特征在于,所述接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,具体包括:2. The production materials management method based on blockchain according to claim 1, characterized in that, after receiving the verification information for the digital signature sent by each of the second servers, it specifically includes: 接收所述目标服务器发送的针对所述数字签名的比对通过信息,其中,所述目标服务器采用所述用户私钥对应的用户公钥对所述数字签名进行解密得到所述哈希值,所述目标服务器采用所述目标私钥对所述加密数据进行解密,并对解密结果进行哈希运算,将运算结果与所述哈希值进行比对,若确定所述运算结果与所述哈希值一致,则生成所述比对通过信息;The system receives a comparison pass message for the digital signature sent by the target server. The target server decrypts the digital signature using the user's public key corresponding to the user's private key to obtain the hash value. The target server decrypts the encrypted data using the target private key and performs a hash operation on the decryption result. The operation result is compared with the hash value. If it is determined that the operation result is consistent with the hash value, the comparison pass message is generated. 将所述比对通过信息确定所述验证通过信息。The verification pass information is determined by comparing the information. 3.基于区块链的生产资料管理装置,其特征在于,所述装置用于执行如权利要求1-2任意一项所述的基于区块链的生产资料管理方法,所述装置为第一服务器,包括获取模块(501)、加密模块(502)以及发送模块(503),其中:3. A blockchain-based means of production management device, characterized in that the device is used to execute the blockchain-based means of production management method as described in any one of claims 1-2, the device being a first server, comprising an acquisition module (501), an encryption module (502), and a sending module (503), wherein: 所述获取模块(501),用于获取用户输入的针对生产资料的变更数据,所述变更数据为所述生产资料的增减数据;The acquisition module (501) is used to acquire the change data of the production materials input by the user, wherein the change data is the increase or decrease data of the production materials; 所述加密模块(502),用于采用所述用户的用户私钥对所述变更数据进行加密,生成数字签名;The encryption module (502) is used to encrypt the changed data using the user's private key and generate a digital signature; 所述加密模块(502),用于采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据,所述服务器公钥为第二服务器对应的公钥,所述第二服务器为多个所述服务器中除所述第一服务器外的服务器;The encryption module (502) is used to encrypt the changed data using the public keys of each server to generate encrypted data. The public key of the server is the public key corresponding to the second server, and the second server is a server other than the first server among the multiple servers. 所述发送模块(503),用于分别发送所述数字签名至各个所述第二服务器;The sending module (503) is used to send the digital signature to each of the second servers respectively; 所述发送模块(503),用于接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,发送所述加密数据至各个所述第二服务器,以使各个所述第二服务器同步所述变更数据;The sending module (503) is used to send the encrypted data to each of the second servers after receiving the verification information for the digital signature sent by each of the second servers, so that each of the second servers can synchronize the changed data. 所述加密模块(502),用于所述采用所述用户的用户私钥对所述变更数据进行加密,生成数字签名,具体用于对所述变更数据进行哈希运算,得到所述变更数据的哈希值;采用所述用户私钥对所述哈希值进行加密,得到所述数字签名,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述数字签名进行解密,得到所述哈希值;The encryption module (502) is used to encrypt the changed data using the user's private key to generate a digital signature. Specifically, it is used to perform a hash operation on the changed data to obtain a hash value of the changed data; and to encrypt the hash value using the user's private key to obtain the digital signature, so that the second server can decrypt the digital signature using the user's public key corresponding to the user's private key to obtain the hash value. 所述加密模块(502),用于所述采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据,具体用于采用目标公钥对所述变更数据进行加密,得到中间加密数据,以使目标服务器能够采用所述目标公钥对应的目标私钥对所述中间加密数据进行解密,得到所述变更数据,所述目标公钥为所述目标服务器对应的公钥,所述目标服务器为多个所述第二服务器中的任意一个第二服务器;采用所述用户私钥对所述中间加密数据进行加密,得到所述加密数据,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述加密数据进行解密,得到所述中间加密数据;The encryption module (502) is used to encrypt the changed data using the public keys of each server to generate encrypted data. Specifically, it is used to encrypt the changed data using the target public key to obtain intermediate encrypted data, so that the target server can decrypt the intermediate encrypted data using the target private key corresponding to the target public key to obtain the changed data. The target public key is the public key corresponding to the target server, and the target server is any one of a plurality of second servers. It also uses the user private key to encrypt the intermediate encrypted data to obtain the encrypted data, so that the second server can decrypt the encrypted data using the user public key corresponding to the user private key to obtain the intermediate encrypted data. 所述发送模块(503),用于在所述接收到各个所述第二服务器发送的针对所述数字签名的验证通过信息后,发送所述加密数据至各个所述第二服务器之后,所述发送模块(503),还用于接收各个所述第二服务器发送的同步完成信息,确定所述生产资料变更完成,其中,所述第二服务器采用所述服务器私钥对所述加密数据进行解密,并对所述数字签名验证通过后,生成所述同步完成信息;The sending module (503) is used to send the encrypted data to each of the second servers after receiving the verification information for the digital signature sent by each of the second servers. The sending module (503) is also used to receive the synchronization completion information sent by each of the second servers to determine that the change of production data is completed. The second server uses the server private key to decrypt the encrypted data and generates the synchronization completion information after verifying the digital signature. 所述加密模块(502),用于在所述采用所述用户私钥对所述哈希值进行加密,得到所述数字签名,以使所述第二服务器能够采用所述用户私钥对应的用户公钥对所述数字签名进行解密,得到所述哈希值之前,所述发送模块(503),还用于对所述用户的身份信息代码进行哈希运算,得到运算结果;将所述运算结果设置为所述用户私钥;根据所述用户私钥,采用非对称加密算法生成所述用户公钥;The encryption module (502) is used to encrypt the hash value using the user's private key to obtain the digital signature, so that the second server can decrypt the digital signature using the user's public key corresponding to the user's private key to obtain the hash value. Before this, the sending module (503) is also used to perform a hash operation on the user's identity information code to obtain the operation result; set the operation result as the user's private key; and generate the user's public key using an asymmetric encryption algorithm based on the user's private key. 所述加密模块(502),用于在所述采用各个服务器公钥分别对所述变更数据进行加密,生成加密数据之前,所述发送模块(503),还用于生成多个随机正整数以及多个随机字母;获取所述目标服务器的设备标识;将多个所述随机正整数以及多个所述随机字母插入所述设备标识,得到所述目标私钥;根据所述目标私钥,采用非对称加密算法生成所述目标公钥。The encryption module (502) is used to generate multiple random positive integers and multiple random letters before the encrypted data is generated by encrypting the changed data using the public keys of each server. The sending module (503) is also used to generate multiple random positive integers and multiple random letters; obtain the device identifier of the target server; insert the multiple random positive integers and multiple random letters into the device identifier to obtain the target private key; and generate the target public key using an asymmetric encryption algorithm based on the target private key. 4.一种电子设备,其特征在于,包括处理器(601)、存储器(605)、用户接口(603)以及网络接口(604),所述存储器(605)用于存储指令,所述用户接口(603)和所述网络接口(604)均用于与其他设备通信,所述处理器(601)用于执行所述存储器(605)中存储的指令,以使所述电子设备执行如权利要求1-2任意一项所述的方法。4. An electronic device, characterized in that it comprises a processor (601), a memory (605), a user interface (603), and a network interface (604), wherein the memory (605) is used to store instructions, the user interface (603) and the network interface (604) are both used to communicate with other devices, and the processor (601) is used to execute the instructions stored in the memory (605) to cause the electronic device to perform the method as described in any one of claims 1-2. 5.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有指令,当所述指令被执行时,执行如权利要求1-2任意一项所述的方法。5. A computer-readable storage medium, characterized in that the computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-2.
HK42024092949.7A 2024-06-19 Block chain-based production material management method, device and electronic equipment HK40104466B (en)

Publications (2)

Publication Number Publication Date
HK40104466A true HK40104466A (en) 2024-07-26
HK40104466B HK40104466B (en) 2024-10-18

Family

ID=

Similar Documents

Publication Publication Date Title
US11842317B2 (en) Blockchain-based authentication and authorization
Bera et al. Designing blockchain-based access control protocol in IoT-enabled smart-grid system
US12278899B2 (en) Blockchain-implemented method and system
US10846372B1 (en) Systems and methods for trustless proof of possession and transmission of secured data
EP4120114A1 (en) Data processing method and apparatus, smart device and storage medium
CN114357492B (en) A medical data privacy fusion method and device based on blockchain
CN113626802B (en) Login verification system and method for equipment password
US20220094519A1 (en) Preserving aggregation using homomorphic encryption and trusted execution environment, secure against malicious aggregator
US11676111B1 (en) Apparatuses and methods for determining and processing dormant user data in a job resume immutable sequential listing
TW202015378A (en) Cryptographic operation, method for creating working key, cryptographic service platform and equipment
US20240348592A1 (en) Apparatus and method for managing credentials
CN120380719B (en) Key derivation for account management
Lapmoon et al. A verifiable and secure industrial IoT data deduplication scheme with real-time data integrity checking in fog-assisted cloud environments
CN116170228B (en) Authentication methods, devices, storage media and equipment for terminal identification devices
Zhang et al. Bring your device group (BYDG): Efficient and privacy-preserving user-device authentication protocol in multi-access edge computing
US20250343675A1 (en) Key shard verification for key storage devices
CN110784318B (en) Group key updating method, device, electronic equipment, storage medium and communication system
CN115361147A (en) Device registration method and device, computer device and storage medium
CN117574408B (en) Production materials management method, device and electronic equipment based on blockchain
HK40104466A (en) Block chain-based production material management method, device and electronic equipment
HK40104466B (en) Block chain-based production material management method, device and electronic equipment
CN118199884A (en) Task execution method and device based on blockchain
Khalili et al. Towards Secure and Transparent Global Authentication: A Blockchain-based System Integrating Biometrics and Subscriber Identification Module
CN114117388A (en) Device registration method, device registration apparatus, electronic device, and storage medium
Seye et al. Enhanced modelling of authenticated key exchange security