A POS machine key management system and method
By adopting blockchain technology and smart contracts in POS machines, the distributed management of POS keys is achieved, and the problems of low key update efficiency and centralized management in the existing technology are solved, and the efficiency and security of key updates are improved.
Patent Information
- Application Number
- CN202510332572.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-03-20
AI Technical Summary
Existing POS machines are inefficient in key updates and cannot adapt to the high-frequency key update requirements. Due to the centralized characteristics, it is difficult to effectively prevent and control key corrections.
Using blockchain technology and smart contracts, the node address is registered in the blockchain network through the POS machine terminal equipment and backend system, blockchain transactions are carried out to generate public and private keys, and private keys are stored in the node ledger to realize distributed key management.
It realizes efficient update of POS keys, without the need for cumbersome online interaction or offline sign-in process, reduces the computing power requirement and enhances the anti-compilation and modification capabilities of the key.
Smart Images

Figure CN119863243B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data communication, and particularly to a POS machine key management system and method. Background Art
[0002] A POS machine is a payment terminal device. Due to its hardware configuration limitations, it usually does not have high computing power. Therefore, when under attack, it is difficult to effectively detect and intercept like a computer system, resulting in the leakage of transaction information and even malicious manipulation causing property losses.
[0003] Currently, to solve the communication data security problem of POS machines, an elliptic curve cryptography algorithm (ECC) based on asymmetric keys is usually used to encrypt the session process. The encryption process requires two keys, namely the public key and the private key. The sender uses the private key to encrypt the data, and the receiver uses the sender's public key to verify and decrypt the data.
[0004] However, once the key is leaked or tampered with, there will be a risk of data leakage or malicious operations using the imitated key. Currently, POS machines usually update keys by online interaction or offline signing with the regional center, which cannot meet the high-frequency key update requirements. Due to its centralized characteristics, the prevention and control measures for key tampering are also difficult to achieve good results, and it depends on the trust level of the regional center. There are still certain potential hazards in the data security of POS machines. Summary of the Invention
[0005] This application provides a POS machine key management system and method. In a first aspect, the POS machine key management system provided by this application includes a transaction trigger module and a contract module.
[0006] When the POS machine terminal device updates the key, the transaction trigger module provides the terminal node address of the POS machine terminal device to the contract module and triggers the contract module. The terminal node address is the address of the node where the POS machine terminal device is registered in the blockchain network.
[0007] The contract module conducts a blockchain transaction according to the terminal node address to generate a public key and a private key. The public key is announced in the transaction result of the blockchain transaction, and the private key is stored in the node ledger corresponding to the terminal node address and the background node address. The POS machine terminal device and the POS machine background system obtain the public key according to the transaction result and obtain the private key according to the node ledger. The background node address is the node address where the POS machine background system is registered in the blockchain network.
[0008] Specifically, the transaction trigger module is deployed in the POS terminal device, and the contract module is deployed in the POS background system.
[0009] Specifically, the system further includes a node registration module, which is used to register the POS terminal device as a terminal node in the blockchain network and register the POS background system as a background node in the blockchain network. The terminal node address of the terminal node is stored in the POS terminal device, and the background node address of the background node is stored in the POS background system.
[0010] Specifically, the node registration module is deployed in the POS background system.
[0011] Specifically, the contract module is provided with a trigger condition verification program unit, and the trigger condition verification program unit authenticates the background node address.
[0012] Specifically, a key update program unit is set in the transaction trigger module, which is used to obtain the public key from the transaction result, and obtain the private key with the generation time closest to the POS system time from the node ledger corresponding to the terminal node address of the POS terminal device in the blockchain network and delete other private keys in the node ledger.
[0013] Specifically, an automatic trigger program unit is set in the transaction trigger module, which is used to send the terminal node address and a transaction request signal to the contract module according to the set trigger conditions to trigger the contract module.
[0014] Specifically, a key update program unit and an automatic trigger program unit are set in the transaction trigger module. The automatic trigger program unit obtains the transaction status in the transaction result corresponding to the sending time from the blockchain network according to the sending time of the transaction request signal. When the transaction status is successful, the automatic trigger program unit activates the key update program unit to update the key. When the transaction status is failed, the automatic trigger program unit resends the terminal node address and the transaction request signal to the contract module.
[0015] Specifically, a key generation program unit is set in the contract module. When conducting the blockchain transaction, the key generation program unit inputs the dynamic parameter into the hash function and outputs the hash result belonging to the range [1, n - 1] k to obtain the private key, where n is the order of the preset elliptic curve base point G Calculate the hash result k and the scalar product of the elliptic curve base point G to obtain the public keyK = k · G The dynamic parameters include the timestamp when the transaction trigger module sends the terminal node address, the terminal node address, and the hash adjustment value.
[0016] In a second aspect, a POS machine key management method provided by this application operates using the system described above, and includes the following steps:
[0017] When the POS machine terminal device updates the key, obtain the terminal node address of the POS machine terminal device;
[0018] Conduct a blockchain transaction based on the terminal node address to generate a public key and a private key;
[0019] Publish the public key in the transaction result of the blockchain transaction, and store the private key in the node ledger corresponding to the terminal node address and the background node address;
[0020] The POS machine terminal device and the POS machine background system obtain the public key according to the transaction result, and obtain the private key according to the node ledger.
[0021] This application has the following technical effects:
[0022] Overcomes the problem of low key update efficiency in the prior art, provides a system in which a POS machine can update keys without a cumbersome online interaction or offline signing process, and a system that does not impose additional computing power requirements on the POS machine;
[0023] Overcomes the problem of centralized key management in the prior art, realizes distributed management of POS machine keys through the system, and enhances the anti-tampering ability of POS machine keys. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] By referring to the accompanying drawings and reading the following detailed description, the above and other objects, features, and advantages of the exemplary embodiments of this application will become easily understandable. In the drawings, several embodiments of this application are shown in an exemplary rather than restrictive manner, and the same or corresponding reference numerals represent the same or corresponding parts.
[0025] Figure 1 It is the structure diagram of the POS machine key management system in the embodiment of this application;
[0026] Figure 2 It is the flowchart of the POS machine key management method in the embodiment of this application. DETAILED DESCRIPTION
[0027] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application.
[0028] The POS machine of the present application uses a Quad-core Cortex®-A7 processor, is equipped with 1GB of running memory, and has a main frequency of 1GHz. It can run smoothly in the daily transaction scenarios of the POS machine, but it cannot handle the computing tasks during the operation of the blockchain and cannot run complex program codes. Therefore, in order not to cause an operating burden on the POS machine, only a lightweight interface program is deployed in the POS machine in this embodiment, and key data is fetched from the blockchain through the TLS network and signals are sent to the background system of the POS machine. The complete functional code of the blockchain is deployed in the background system of the POS machine, and the regional center is responsible for its operation and management.
[0029] Based on this, the POS machine key management system used in this embodiment adopts the framework as Figure 1 shown for construction, and the core functions are executed by the transaction trigger module and the contract module.
[0030] When the key of the POS machine terminal device is updated, the transaction trigger module provides the terminal node address of the POS machine terminal device to the contract module and triggers the contract module. Then, the contract module conducts a blockchain transaction according to the terminal node address to generate a public key and a private key. The public key is announced in the transaction result of the blockchain transaction, and the private key is stored in the node ledger corresponding to the terminal node address and the background node address. The POS machine terminal device and the POS machine background system obtain the public key according to the transaction result and obtain the private key according to the node ledger. The background node address is the node address registered by the POS machine background system in the blockchain network.
[0031] The blockchain used in this embodiment is the Corda private chain because its node-based architecture mode is more in line with the distribution mode of the POS machine and the POS machine background system, and the confidential node mechanism of the Corda private chain enables only the POS machine and the POS machine background system participating in the key update process to obtain transaction information, avoiding key leakage during the key transfer in the key update process.
[0032] Specifically, this embodiment is developed based on the Android platform. By adding the Corda dependency library to the Android project, the program that the POS machine sends a transaction request signal to the POS machine background is encapsulated as an interface for easy repeated invocation. And it can be automatically invoked according to set conditions. For example, when the continuous transaction times of the POS machine reach the limit value, the time since the last key update of the POS machine reaches the limit time, or it is triggered at a fixed frequency, etc. Installing a transaction trigger module with this interface in the POS machine can send a transaction request signal and the terminal node address of the POS machine to the POS machine background, thereby triggering the POS machine background to generate and distribute keys. The POS machine background, as a high-computing power node, is responsible for deploying the programs related to the contract module and handling the complex tasks of key generation and distribution. Such a design minimizes the operating burden of the POS machine, realizes automatic key update for the POS machine, does not require cumbersome manual operations, and can meet the high-frequency key update requirements.
[0033] In this embodiment, the functions of key generation and distribution are realized by using smart contracts during blockchain transactions. First, it is necessary to register the POS machine terminal device as a terminal node in the blockchain network through the node registration module, and register the POS machine background system as a background node in the blockchain network. The terminal node address of the terminal node is stored in the POS machine terminal device, and the background node address of the background node is stored in the POS machine background system. Since the Corda private chain is developed based on the Java language, the POS machine background system executes the functions of the node registration module, creates a configuration file for each POS machine in the node registration module within the area covered by the POS machine background system, including information such as the node identifier myLegalName of the POS machine, the communication address and port p2pAddress, the remote call address rpcSettings, and the database port h2port. Use the corda-tools-network-bootstrapper command to generate identity keys and digital certificates for blockchain communication for the POS machine and the POS machine background system. It should be noted that the identity keys here are used for identity verification when the POS machine and the POS machine background communicate in the blockchain network, and are not the same concept as the public key and private key finally generated by the key management system of this embodiment. Each POS machine comes with a unique and non-repeating terminal node address at the time of factory, which is stored in the hardware encryption module of the POS machine. When an attacker attempts to create a new node in the blockchain network, due to the consensus mechanism of the Corda private chain, it can only be successfully created when all the trusted nodes pass, thus effectively reducing the risk of the blockchain being attacked.
[0034] To further safeguard against malicious calls to the contract module, the contract module is also equipped with a trigger condition verification program unit that authenticates the background node address. After the POS machine sends a transaction request signal and the terminal node address to the POS machine background, the POS machine background sends the terminal node address and the background node address to the contract module via an encrypted network. The contract module first obtains the digital certificate information in the terminal node address and the background node address through the identity keys of the POS machine node and the POS machine background node. Only when the authenticity verification of the digital certificate information of the two nodes passes, will the contract module trigger a blockchain transaction according to the contract content; otherwise, an alarm signal will be directly sent to the POS machine and the POS machine background system.
[0035] After the contract module executes a blockchain transaction according to the contract content, if the transaction is successful, the contract module will announce the public key and the transaction success flag in the transaction result. If the transaction fails, the transaction failure flag will be announced in the transaction result. After the transaction is successful, the public key in the transaction result can be directly accessed and viewed by the POS machine and the POS machine background system, while the private key is stored in the node ledger by modifying the node ledgers of the POS machine and the POS machine background system. A corresponding key update program unit is set in the transaction trigger module of the POS machine to obtain the public key from the transaction result through the interface program, and obtain the private key with the generation time closest to the POS machine system time from the node ledger corresponding to the terminal node address of the POS machine terminal device in the blockchain network and delete other private keys in the node ledger. The POS machine background system directly accesses the transaction result to obtain the public key and directly accesses the node ledger of the POS machine background to obtain the private key. When accessing the node ledger, the contract module also needs to authenticate the POS machine and the POS machine background system to avoid key leakage. Since the ledger data is stored distributively in the blockchain, each block contains a hash value and a timestamp. Once the ledger data of a certain block is tampered with, its hash value and the hash values of all subsequent blocks will change accordingly, and the timestamp of this block will also become different from other blocks. Therefore, to tamper with a part of the ledger data, it is necessary to tamper with the data of the entire chain of blocks related to the ledger, which is computationally impossible to achieve. Therefore, generating public keys and private keys through blockchain transactions can effectively prevent keys from being maliciously tampered with.
[0036] According to different business requirements, the logic of automatic triggering can be set for the process triggered by transactions. In the transaction triggering module of this embodiment, an automatic triggering program unit is set, which is used to send the terminal node address and transaction request signal to the contract module according to the set triggering conditions to trigger the contract module. For example, when conditions such as the number of consecutive transactions of the POS machine reaches the limit value, the time since the last key update of the POS machine reaches the limit time, and triggering at a fixed frequency are met, the transaction triggering module automatically sends the terminal node address and transaction request signal to the contract module.
[0037] Furthermore, after the automatic triggering program unit sends the terminal node address and transaction request signal to the contract module each time, it will also call the interface to obtain the transaction status in the transaction result corresponding to the sending time from the blockchain network according to the sending time of the transaction request signal. When the transaction status is successful, the automatic triggering program unit activates the key update program unit to perform key update. When the transaction status is failed, the automatic triggering program unit resends the terminal node address and transaction request signal to the contract module.
[0038] In this embodiment, considering that under the blockchain operating conditions, the Gas consumption during contract execution should be reduced as much as possible, the inventors of this application designed such a key generation program unit in the contract module: when conducting blockchain transactions, the key generation program unit inputs dynamic parameters into the hash function to output a hash result belonging to the range [1, n -1] k to obtain the private key, where n is the order of the preset elliptic curve base point G , calculate the scalar product of the hash result k and the base point of the elliptic curve G to obtain the public key K = k · G , and the dynamic parameters include the timestamp when the transaction triggering module sends the terminal node address, the terminal node address, and the hash adjustment value. When creating a contract, create a Kotlin file under the contracts module of Corda, and define the algorithm and call flow for contract execution through the Kotlin file. In this embodiment, p-384 is selected as the prime field because the calculation efficiency of the p-384 prime field is the highest, which can further reduce the Gas consumption. The p in the p-384 prime field = , the elliptic curve is , where, b is a fixed elliptic parameter, mod pIt is the modulus of the p-384 prime field. The lengths of the private key and public key required in this embodiment should reach 256 bits. Therefore, the SHA-256 hash function of the Corda private chain is adopted. When the function runs, first, a hash object is generated according to the timestamp, the terminal node address, and the hash adjustment value (default is 1), and the function SHA-256 is called on the hash object to calculate a hash result with a length of 256 bits. Check whether the hash result belongs to the range [1, n -1]. If so, the hash result is used as the private key. If not, the hash adjustment value is adjusted until the hash result belongs to the range [1, n -1]. After testing, the Gas consumption when generating the key can be stabilized between 3000 and 35000, reducing the running consumption of the contract module.
[0039] In summary, when using the POS machine key management system provided in this embodiment for key management, it includes the execution steps as Figure 2 shown, including:
[0040] S1. When the POS machine terminal device updates the key, obtain the terminal node address of the POS machine terminal device;
[0041] S2. Conduct a blockchain transaction according to the terminal node address to generate a public key and a private key;
[0042] S3. Publish the public key in the transaction result of the blockchain transaction, and store the private key in the node ledger corresponding to the terminal node address and the background node address;
[0043] S4. The POS machine terminal device and the POS machine background system obtain the public key according to the transaction result and obtain the private key according to the node ledger.
[0044] Obviously, the above-described embodiments are part of the embodiments of this application, rather than all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of this application.
[0045] It should be understood that when the claims, the description, and the drawings of this application use terms such as "first" and "second", they are only used to distinguish different objects, rather than to describe a specific order. The terms "including" and "comprising" used in the description and claims of this application indicate the existence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
Claims
1. A POS machine key management system, characterized in that: Including transaction trigger module and contract module; When the POS terminal device updates the key, the transaction trigger module provides the terminal node address of the POS terminal device to the contract module and triggers the contract module, wherein the terminal node address is the address of the node registered by the POS terminal device in the blockchain network; The contract module performs a blockchain transaction according to the terminal node address to generate a public key and a private key. The public key is published in the transaction result of the blockchain transaction, and the private key is stored in the node account book corresponding to the terminal node address and the background node address. The POS terminal device and the POS background system obtain the public key according to the transaction result and obtain the private key according to the node account book. The background node address is the node address registered by the POS background system in the blockchain network; The transaction trigger module is provided with a key update program unit and an automatic trigger program unit. The automatic trigger program unit obtains the transaction status in the transaction result corresponding to the sending time from the blockchain network according to the sending time of the transaction request signal. When the transaction status is successful, the automatic trigger program unit activates the key update program unit to update the key. When the transaction status is failed, the automatic trigger program unit re-sends the terminal node address and the transaction request signal to the contract module.
2. The system according to claim 1, characterized in that The transaction trigger module is deployed in the POS terminal device, and the contract module is deployed in the POS backend system.
3. The system according to claim 1, characterized in that The system also includes a node registration module, which is used to register the POS terminal device as a terminal node in the blockchain network, and register the POS backend system as a backend node in the blockchain network. The terminal node address of the terminal node is stored in the POS terminal device, and the backend node address of the backend node is stored in the POS backend system.
4. The system according to claim 3, characterized in that The node registration module is deployed in the POS machine background system.
5. The system according to claim 3, characterized in that The contract module is provided with a trigger condition verification program unit, and the trigger condition verification program unit authenticates the background node address.
6. The system according to claim 1, characterized in that The transaction trigger module is provided with a key update program unit, which is used to obtain the public key from the transaction result, and obtain the private key whose generation time is closest to the POS system time from the node account book corresponding to the terminal node address of the POS terminal device in the blockchain network and delete other private keys in the node account book.
7. The system according to claim 1, characterized in that The transaction trigger module is provided with an automatic trigger program unit, which is used to send a terminal node address and a transaction request signal to the contract module according to the set trigger conditions to trigger the contract module.
8. The system according to claim 1, characterized in that The contract module is provided with a key generation program unit. When the blockchain transaction is performed, the key generation program unit inputs the dynamic parameter into the hash function output belonging to the range [1, n -1] k Get the private key, where n The preset elliptic curve base point G The hash result is calculated k The base point of the elliptic curve G The scalar product of K = k · G The dynamic parameters include the timestamp when the transaction trigger module sends the terminal node address, the terminal node address and the hash adjustment value, the hash adjustment value defaults to 1, and is used to adjust the hash result until the hash result belongs to the range [1, n -1].
9. A method for managing a POS machine key, using the system according to any one of claims 1 to 8, characterized in that: The following steps are involved: When the POS terminal device updates the key, the terminal node address of the POS terminal device is obtained; Conducting a blockchain transaction according to the terminal node address to generate a public key and a private key; The public key is published in the transaction result of the blockchain transaction, and the private key is stored in the node account book corresponding to the terminal node address and the background node address; The POS terminal device and the POS backend system obtain the public key according to the transaction result, and obtain the private key according to the node account book.
Citation Information
Patent Citations
Aggregated payment method and system for digital currencies, and edge server
CN111937020A
Pos machine settlement business data management system based on block chain
CN117592985A