A method for generating and managing enterprise chain codes
Through the design of enterprise chain code of blockchain + QR code, the use of a two-layer structure and public key digital signature, combined with redis database storage, the problem of difficulty in identifying QR codes in enterprise applications is solved, and efficient and secure enterprise information management is achieved.
Patent Information
- Application Number
- CN202110313692.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-24
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-03-24
AI Technical Summary
During the generation and use of existing QR codes, there are problems such as large amount of data, resulting in difficulty in identification and low security. Especially for corporate users, data leakage risk is high and sensitive information cannot be effectively protected.
The enterprise chain code design adopts blockchain + QR code, and through a two-layer structure and public key-based digital signature, combined with Redis database storage, generate and manage enterprise chain codes to ensure data security and timeliness.
It improves the efficiency and security of QR code identification, reduces the risk of data leakage, realizes effective protection and permission control of enterprise information, and ensures the immutability and timeliness of data.
Smart Images

Figure CN113128245B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain, and particularly to a method for generating and managing enterprise chain codes. Background Art
[0002] With the large-scale application of intelligent terminals (such as smart phones, barcode scanners), as two-dimensional codes carrying certain information, the usage scenarios of identifying information and sharing information by "scanning" two-dimensional codes are increasing, which also provides great convenience for users.
[0003] However, some problems also arise during the use of two-dimensional codes: 1. The generation of a two-dimensional code is to form an image from a string of characters through encoding technology. When the data volume of the string for generating the two-dimensional code is too large, the encoded image will be very dense and difficult to quickly identify during scanning; 2. There are various two-dimensional code encoding technologies, and there is no formal legal regulation and industry standard for unification and standardization. Many two-dimensional codes generated disclose data information to a certain extent, and anyone can parse and obtain the data therein, posing a security risk.
[0004] For enterprise users, because enterprises may need to display more content, require a larger amount of data, and have more places and higher requirements for confidentiality of certain enterprise information. Therefore, when enterprise users use two-dimensional codes for enterprise promotion, access, login, etc., the above problems will become more prominent. Summary of the Invention
[0005] The main purpose of the present invention is to overcome the disadvantages and deficiencies of the prior art, and provide a method for generating and managing enterprise chain codes. An enterprise chain code is a scan recognition code for registering the enterprise identity established by blockchain + two-dimensional code.
[0006] The purpose of the present invention is achieved through the following technical solutions:
[0007] A method for generating and managing enterprise chain codes includes the following steps in sequence:
[0008] S1. After a scanning user requests to scan an enterprise chain code, the enterprise chain code user presents the enterprise chain code to the user: The front end of the enterprise chain code requests the generation parameters of the enterprise chain code from the back end. The back end queries the corresponding public key information on the blockchain according to the account address of the enterprise chain code user, and digitally signs the update time and public key with the private key. The back end of the enterprise chain code stores the public key, update time, and digital signature in the redis database with the module identifier + UUID as the key value, and at the same time returns the key value to the front end of the enterprise chain code as the generation parameters of the enterprise chain code. The front end of the enterprise chain code splices the link according to the parameters returned by the back end of the enterprise chain code and generates the enterprise chain code, and then presents it;
[0009] S2. After the scanning user scans the enterprise chain code, the enterprise chain code front end requests the scanning result from the enterprise chain code back end. The enterprise chain code back end queries the redis database according to the parameters, returns the corresponding public key, update time and digital signature and returns it to the enterprise chain code front end. The enterprise chain code front end re-joins the new link according to the returned data and initiates a request to the enterprise chain code back end. The enterprise chain code back end verifies whether the digital signature has been tampered with according to the request parameters. If the verification is successful, the scanning result of the enterprise chain code is returned. The scanning result includes the enterprise business card, and the enterprise chain code front end displays the relevant enterprise information to the scanning user.
[0010] The enterprise chain code adopts a two-layer design, including a scanning layer and a translation layer; the scanning layer is used for the same generation and parsing process as ordinary QR codes, and the translation layer is used for further encryption and decryption of the QR code during the parsing process; the Key value in the scanning layer is used as a key parameter to associate the scanning layer and the translation layer. When the scanning is successful, this key is used as the translation key of the translation layer to obtain the final translation result.
[0011] Ordinary QR code generation and scanning are completed in one step, that is, the user can obtain the scanning result after successfully scanning the code, while the enterprise chain code adds one step on the basis of the original QR code. In order to ensure the security and efficiency of the QR code, the enterprise chain code adopts a two-layer design, namely the scanning layer and the translation layer; and the generation and scanning of the enterprise chain code are somewhat different from ordinary QR codes.
[0012] The key value is set to Token. When designing Token, the Token is stored in the redis database with the token as the key. The actual translated address is saved as the value in the redis database. When the token is stored as the key in redis, the project prefix needs to be added to prevent the duplication of keys of different projects. The Token comes out of the code scanning layer, and the Token is used as the unique identifier generated by the enterprise chain code. The above method can ensure timeliness and will expire after the specified time. At the same time, it ensures uniqueness. It should be unique in the entire system to ensure that it will not be repeated with tokens of other modules. Token is the key parameter connecting the code scanning layer and the translation layer.
[0013] The timeliness of the enterprise chain code is divided into three stages: the code display stage, the code scanning stage, and the execution stage. Among them, within the validity period of the code display stage, the customer can scan the code unlimited times to obtain the result. After the validity period, the client automatically updates the token and generates a new enterprise chain code. Within the validity period of the code scanning stage, the customer can only scan the code once to obtain the result, and at the same time, the token will be invalidated. Scanning the code again will result in a scanning failure, indicating that the token has expired. In the execution stage, this is the stage after the code is scanned and the result is executed, that is, the enterprise business card page of the enterprise chain code is displayed. In this stage, only publicly available content is displayed. The publicly available content includes the business license and industrial and commercial information, and the digital assets on the chain are not displayed.
[0014] When the enterprise chain code is scanned by a dedicated tool, the parameters of the tool user can be supplemented, which is convenient for controlling the data viewing permissions of the code scanner. When using a dedicated enterprise chain code scanning tool to scan the code, the user identification of the code scanner and the user's account address will be added. That is, there are two more parameters during the code scanning process, which are only used as records of the code scanner and do not participate in the translation layer.
[0015] The generation rule of the enterprise chain code adopts the generation method of website + routing + token. This approach can improve the code scanning effect and reduce the content data volume of the enterprise chain code.
[0016] After the code scanning user scans the enterprise chain code, the public key, update time, and signature data signed by the ED25519 algorithm of the scanned person can be obtained through the token. As the signature encryption algorithm of the blockchain, the ED25519 algorithm has extremely high signature and verification performance, extremely high security, and small signature data, making it very suitable as the signature verification algorithm for two-dimensional codes. After the user scans the code and the backend confirms that the signature data is correct, it will enter the enterprise business card page to display the trusted information of the enterprise.
[0017] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0018] 1. The enterprise chain code of the present invention supports scanning by third-party tools such as WeChat, and then opens a website to display the enterprise business card. For example, when scanning the code with third-party tools such as WeChat, they already have the function of parsing two-dimensional codes. We are equivalent to just providing a link so that WeChat can jump after scanning the code.
[0019] 2. The enterprise chain code generated by the present invention has timeliness, which can reduce the risk of dissemination. The present invention uses the redis database as the storage database for the enterprise chain code parameters, which can ensure that the parameters for generating the enterprise chain code will be deleted after the specified time and the data cannot be obtained.
[0020] 3. The enterprise chain code of the present invention can prevent tampering. Even if one knows the rules of the enterprise chain code content, it cannot be generated in an external system. The enterprise chain code of the present invention adopts a two-layer design and performs digital signature on the enterprise chain code data based on public and private keys. In an external system, the translated enterprise chain code data cannot be obtained, and without the user's public and private keys, it is also impossible to perform digital signature on the enterprise chain code data.
[0021] 4. When using the dedicated tool to scan the code, parameters of the tool user can be supplemented, which is convenient for controlling the permission of the code scanner to view data. When using a dedicated enterprise chain code scanning tool to scan the code, the user identification of the code scanner and the user's account address will be newly added, that is, two more parameters are added during the code scanning process, which are only used as records of the code scanner.
[0022] 5. The content of the enterprise chain code of the present invention does not contain any value that can reflect the current data volume, such as the auto-increment ID of the enterprise table. The present invention adopts uuid, a unique identification code. Uuid is a unique and non-repeating string, which does not contain any information reflecting the current data volume.
[0023] 6. The two-dimensional code / bar code has timeliness and is valid only once. The timeliness of the enterprise chain code of the present invention is divided into three stages, namely the code display period, the code scanning period, and the execution period. In this process, the redis cache database is still used to ensure that the parameters for generating the enterprise chain code will expire after a certain period of time. During the use of the enterprise chain code, we will record the number of code scans. After the first code scan after the expiration of the effective time of the code display stage, that is, only one code scan after the expiration of the effective time of the code display stage.
[0024] 7. The data volume of the two-dimensional code content cannot be too large, otherwise it will affect the code scanning effect. The two-layer design adopted by the present invention stores the scanning layer in the redis database with the module identification + UUID as the key value and the public key, update time, and digital signature as the value. Among them, uuid is used as the token to generate the enterprise chain code, and the token is used as a parameter to translate the enterprise chain code in the translation layer, and finally the correct link is returned. During the generation stage of the enterprise chain code, the token used by us is a relatively short string, which will not make the content data of the enterprise chain code too large. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a partial flowchart of the method for generating and managing an enterprise chain code according to the present invention. At this time, it is the process of a code scanning user requesting to scan the enterprise chain code.
[0026] Figure 2 is a partial flowchart of the method for generating and managing an enterprise chain code according to the present invention. At this time, it is the process after the code scanning user scans the enterprise chain code. DETAILED DESCRIPTION OF THE INVENTION
[0027] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.
[0028] A method for generating and managing enterprise chain codes comprises the following steps in order:
[0029] S1, such as Figure 1 , when the code scanning user requests to scan the enterprise chain code, the enterprise chain code user will present the enterprise chain code to him: the enterprise chain code front end requests the generation parameters of the enterprise chain code from the back end. The back end queries the corresponding public key information on the blockchain based on the account address of the enterprise chain code user, and digitally signs the update time and public key with the private key. The enterprise chain code back end uses the module identifier + UUID as the key value, and stores the public key, update time, and digital signature as the value in the redis database. At the same time, the key value is returned to the enterprise chain code front end as the generation parameter of the enterprise chain code. The enterprise chain code front end splices the link and generates the enterprise chain code according to the parameters returned by the enterprise chain code back end, and presents it;
[0030] S2, such as Figure 2 After the scanning user scans the enterprise chain code, the enterprise chain code front end requests the scanning result from the enterprise chain code back end. The enterprise chain code back end queries the redis database according to the parameters, returns the corresponding public key, update time and digital signature and returns it to the enterprise chain code front end. The enterprise chain code front end re-assembles the new link according to the returned data and initiates a request to the enterprise chain code back end. The enterprise chain code back end verifies whether the digital signature has been tampered with according to the request parameters to the blockchain. If the verification is successful, the scanning result of the enterprise chain code is returned. The scanning result includes the enterprise business card, and the enterprise chain code front end displays the relevant enterprise information to the scanning user.
[0031] The specific instructions are as follows:
[0032] 1. Timeliness
[0033] As shown in Table 1, the timeliness of the enterprise chain code is divided into three stages, namely the code display stage, the code scanning stage, and the execution stage. In the code display stage, the enterprise chain code is valid for one minute. During this minute, the client can scan the code to obtain the result an unlimited number of times. After one minute, the client updates the token and generates a new enterprise chain code; in the code scanning stage, the enterprise chain code is valid for ten minutes. During these ten minutes, the client can only scan the code once to obtain the result. At the same time, the token will be invalidated. The result of scanning the code again is that the code scanning fails and the token has expired; in the execution stage, this is the execution result after scanning the code, that is, the enterprise business card page that displays the enterprise chain code. At this stage, only publicly available content is displayed, such as business licenses and industrial and commercial information, and digital assets on the chain are not displayed.
[0034] Table 1
[0035]
[0036] 2. Timeliness reference comparison, as shown in Table 2.
[0037] Table 2
[0038] QR code tool Code display valid time Code scanning valid time Code scanning valid times 1 Guangdong Business Code One minute 2 WeChat payment code Three minutes 3 Alipay payment code One minute
[0039] 3. Design description
[0040] For ordinary QR code generation and scanning, it is completed in one step, that is, the user can obtain the scanning result after successful scanning. However, enterprise chain code adds one more step on the basis of the original QR code. To ensure the security and efficiency of the QR code, the enterprise chain code adopts a two-layer design, namely the scanning layer and the translation layer; moreover, the generation and scanning of enterprise chain code are different from those of ordinary QR codes to some extent.
[0041] When the scanning user requests to scan the QR code, the enterprise chain code user shows the enterprise chain code to the user: the front end of the enterprise chain code requests the generation parameters of the enterprise chain code from the back end. The back end queries the corresponding public key information on the blockchain according to the account address of the enterprise chain code user, and digitally signs the update time and public key through the private key. The back end uses the module identifier + UUID as the key value, and stores the public key, update time, and digital signature as the value in the redis database, and at the same time returns the key value to the front end as the generation parameter of the QR code. The front end splices the link according to the parameters returned by the back end and generates the enterprise chain code.
[0042] After the scanning user scans the enterprise chain code, the front end of the enterprise chain code requests the scanning result from the back end. The back end queries according to the parameters in the redis database, returns the corresponding public key, update time, and digital signature and returns them to the front end. The front end splices a new link again according to the returned data and requests the back end. The back end verifies whether the digital signature has been tampered with on the blockchain according to the request parameters. If the verification passes, it returns the scanning result of the enterprise chain code, including enterprise business card and other information, and the front end of the enterprise chain code shows the relevant enterprise information to the scanning user.
[0043] The specific scanning flow chart is as Figure 1 .
[0044] 4. Token design
[0045] The Token serves as the unique identifier for generating QR codes. We require it to meet the following requirements: Ensure timeliness, it will expire after the specified time, and ensure uniqueness. It should be unique throughout the system and ensure that it does not duplicate the tokens of other modules. Therefore, when designing the token, we store the token in the Redis database, using the token as the key and the actual translated address as the value in the Redis database. When the token exists in Redis as the key, the project prefix needs to be added to prevent key duplication across different projects.
[0046] 5. Design of the translated address
[0047] (1) Parameter description, as shown in Table 3.
[0048] Table 3
[0049]
[0050] update_time, sign_data, request_user, request_address, public_key. These parameters all belong to the parameters after translation of the enterprise chain code, that is, the data stored as the value in step S1. And the key value in step S1 is the parameter that associates the scanning code layer and the translation layer. Among them, for the two parameters of request_user and request_address, these two data will only be returned when scanning the code with a dedicated scanning tool.
[0051] (2) Private key, public key, address
[0052] Generate private key:
[0053] Generating the private key requires the use of multiple algorithms such as random algorithms and SHA256. Generating the private key includes the following steps:
[0054] 1. Use a random algorithm to generate a 256-bit random number (the private key in the mathematical sense), obtaining a byte array, that is, the raw private key, as shown below:
[0055] [17,236,24,183,207,250,207,180,108,87,224,39,189,99,246,85,138,120,236,78,228,233,41,192,124,109,156,104,235,66,194,24]
[0056] 2. Add a 3-byte prefix (Prefix) in front of the raw private key, then add a 1-byte version number (Version), and append a 1-byte fill bit (Fill) at the end to obtain a new byte array as follows:
[0057] [218,55,159,1,17,236,24,183,207,250,207,180,108,87,224,39,189,99,246,85,138,120,236,78,228,233,41,192,124,109,156,104,235,66,194,24,0]
[0058] 3. Perform two SHA256 calculations on the byte array obtained in step 2, and take the first 4 bytes of the operation result to obtain the byte array of the checksum (Checksum) as follows:
[0059] [30,19,80,117]
[0060] 4. Concatenate the byte array in step 2 and the checksum byte array in step 3 in sequence to obtain a new byte array as follows:
[0061] [218,55,159,1,17,236,24,183,207,250,207,180,108,87,224,39,189,99,246,85,138,120,236,78,228,233,41,192,124,109,156,104,235,66,194,24,0,30,19,80,117]
[0062] 5. Perform Base58 encoding on the byte array generated in step 4 to obtain a string starting with "priv", which is the private key, as follows:
[0063] privbsGZFUoRv8aXZbSGd3bwzZWFn3L5QKq74RXAQYcmfXhhZ54CLr9z Thus, the generation of the private key is completed.
[0064] Generate the public key:
[0065] The generation of the public key can only be achieved after the generation of the private key and requires the use of the ED25519 algorithm. The generation of the public key includes the following steps:
[0066] 1. Process the raw private key through the ED25519 algorithm to generate a 32-byte array, namely the raw public key.
[0067] For example, the private key is:
[0068] privbsGZFUoRv8aXZbSGd3bwzZWFn3L5QKq74RXAQYcmfXhhZ54CLr9z,
[0069] Its raw public key is as follows:
[0070] [21, 118, 76, 208, 23, 224, 218, 117, 50, 113, 250, 38, 205, 82, 148, 81, 162, 27, 130, 83, 208, 1, 240, 212, 54, 18, 225, 158, 198, 50, 87, 10];
[0071] 2. Add a 1-byte prefix (Prefix) in front of the raw public key, and then add a 1-byte version number (Version) to obtain a new byte array, as follows:
[0072] [176, 1, 21, 118, 76, 208, 23, 224, 218, 117, 50, 113, 250, 38, 205, 82, 148, 81, 162, 27, 130, 83, 208, 1, 240, 212, 54, 18, 225, 158, 198, 50, 87, 10];
[0073] 3. Perform two SHA256 calculations on the byte array in step 2, and take the first 4 bytes of the operation result to obtain the byte array of the checksum (Checksum), as follows:
[0074] [116, 171, 22, 107];
[0075] 4. Concatenate the byte array in step 2 and the checksum byte array in step 3 in sequence to obtain a new byte array, as follows:
[0076] [176, 1, 21, 118, 76, 208, 23, 224, 218, 117, 50, 113, 250, 38, 205, 82, 148, 81, 162, 27, 130, 83, 208, 1, 240, 212, 54, 18, 225, 158, 198, 50, 87, 10, 116, 171, 22, 107];
[0077] 5. Encode the byte array in step 4 into a hexadecimal string, which is the public key (publickey), as shown below:
[0078] b00115764cd017e0da753271fa26cd529451a21b8253d001f0d43612e19ec632570a74ab166b;
[0079] Thus, the generation of the public key is completed.
[0080] Generate address:
[0081] After generating the private key and public key, the address can be further generated through an algorithm. The generation of the address includes the following steps:
[0082] 1. Process the raw private key through the ED25519 algorithm to generate a 32-bit byte array, which is the raw public key.
[0083] For example, the private key is:
[0084] privbsGZFUoRv8aXZbSGd3bwzZWFn3L5QKq74RXAQYcmfXhhZ54CLr9z,
[0085] Its raw public key is as follows:
[0086] [21,118,76,208,23,224,218,117,50,113,250,38,205,82,148,81,162,27,130,83,208,1,240,212,54,18,225,158,198,50,87,10];
[0087] 2. Perform a SHA256 operation on the raw public key and take the last 20 bytes of the operation result to obtain a byte array, as shown below:
[0088] [173,148,59,51,183,193,55,160,1,133,247,80,65,13,67,190,164,114,18,220];
[0089] 3. Add a 2-byte prefix (Prefix) in front of the byte array generated in step 2, and then add a 1-byte version number (Version) to obtain a new byte array, as shown below:
[0090] [5,53,1,173,148,59,51,183,193,55,160,1,133,247,80,65,13,67,190,164,114,18,220];
[0091] 4. Perform two SHA256 calculations on the byte array in step 3, and take the first 4 bytes of the operation result to obtain the byte array of the checksum, as follows:
[0092] [167,127,34,35];
[0093] 5. Concatenate the byte array in step 3 and the checksum byte array in step 4 in sequence to obtain a new byte array, as follows:
[0094] [1,86,1,173,148,59,51,183,193,55,160,1,133,247,80,65,13,67,190,164,114,18,220,167,127,34,35];
[0095] 6. Perform Base58 encoding on the byte array generated in step 5 to obtain a string starting with hp, which is the address, as follows:
[0096] hpQmWJrdYJP5CPKTbkQUqscwvTGaU44dord8;
[0097] Thus, the generation of the address is completed.
[0098] (3) Digital Signature
[0099] The integrity of a digitally signed file is easily verifiable (no need for split seals, split signatures, or handwriting experts), and digital signatures have non-repudiation (non-deniability).
[0100] Simply put, a digital signature is some data appended to a data unit or a cryptographic transformation performed on the data unit. This data or transformation allows the recipient of the data unit to verify the origin and integrity of the data unit and protect the data from being forged by others (such as the recipient). It is a method of signing messages in electronic form, and a signed message can be transmitted in a communication network. Digital signatures can be obtained based on both public-key cryptosystems and private-key cryptosystems, mainly those based on public-key cryptosystems. They include ordinary digital signatures and special digital signatures. Ordinary digital signature algorithms include RSA, ElGamal, Fiat-Shamir, Guillou-Quisquarter, Schnorr, Ong-Schnorr-Shamir digital signature algorithm, Des / DSA, elliptic curve digital signature algorithm, and finite automaton digital signature algorithm, etc. Special digital signatures include blind signatures, proxy signatures, group signatures, undeniable signatures, fair blind signatures, threshold signatures, signatures with message recovery functions, etc., which are closely related to specific application environments. Obviously, the application of digital signatures involves legal issues, and the US federal government has developed its own Digital Signature Standard (DSS) based on the discrete logarithm problem over finite fields.
[0101] (4) Signature verification
[0102] The sender first encrypts the original text with its own private key to obtain the digital signature, and then sends the original text and the digital signature to the recipient together. The recipient decrypts the digital signature with the sender's public key and finally compares it with the original text. Using digital signature technology can verify whether the original text of the file has changed during the transmission process, ensuring the integrity, authenticity, and non-repudiation of the transmitted electronic file.
[0103] 6. Enterprise chain code display
[0104] (1) Display method
[0105] The content displayed by the chain code includes the enterprise name, enterprise QR code, and update time. Users can quickly share the enterprise's trusted information by presenting this QR code. After successful scanning, the scanner can view the enterprise's trusted information; the QR code is generated in the way of combining a website and a token. The token consists of a project prefix and a UUID code to ensure that each token is unique. After scanning the code, the scanner can obtain the public key of the scanned person, the update time, and the signature data signed by the ED25519 algorithm. As the signature encryption algorithm of the blockchain, the ED25519 algorithm has extremely high signature and verification performance, extremely high security, and small signature data, making it very suitable as the signature verification algorithm for QR codes. After the user scans the code and the backend confirms that the signature data is correct, it will enter the enterprise business card page to display the enterprise's trusted information.
[0106] (2) Update Frequency
[0107] The update frequency of the QR code displayed here is once a minute
[0108] (3) Timeliness description, the same as above
[0109] (4) Scanning the code with a third-party tool (WeChat)
[0110] When the user scans the code with a third-party tool. To reduce the risk of transmission, and also because WeChat cannot guarantee user security, so when scanning the code through WeChat, the enterprise chain code only displays the enterprise business card information, and the chain code user can manage the external display information of the enterprise business card in the chain code management
[0111] (5) Scanning the code with a professional tool (enterprise chain code)
[0112] When the user scans the code with a professional tool, that is, the enterprise chain code, the user information of the current code scanner can be obtained, so the security is relatively high. After the code scanning user scans the code successfully, the information of the current enterprise can be obtained, including the enterprise business card, enterprise basic information, enterprise portrait, business status, business data, chain code information, and credit information
[0113] BCS is a blockchain service system, an intermediate service that realizes the docking between upper-layer applications and the blockchain. BCS reduces the business complexity of accessing the blockchain, reduces the development difficulty and cost of accessing the blockchain, and enriches the blockchain information query
[0114] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications made without departing from the spirit and principle of the present invention shall be equivalent replacement methods and are all included in the protection scope of the present invention
Claims
1. A method for generating and managing enterprise chain codes, characterized in that, The steps include the following sequence: S1. When the code scanning user requests to scan the enterprise chain code, the enterprise chain code user will present the enterprise chain code to the user: the enterprise chain code front end requests the generation parameters of the enterprise chain code from the back end. The back end queries the corresponding public key information on the blockchain based on the account address of the enterprise chain code user, and digitally signs the update time and public key with the private key. The enterprise chain code back end uses the module identifier + UUID as the key value, and stores the public key, update time, and digital signature as the value in the redis database. At the same time, the key value is returned to the enterprise chain code front end as the generation parameter of the enterprise chain code. The enterprise chain code front end splices the link and generates the enterprise chain code according to the parameters returned by the enterprise chain code back end, and presents it. S2. After the scanning user scans the enterprise chain code, the enterprise chain code front end requests the scanning result from the enterprise chain code back end. The enterprise chain code back end queries the redis database according to the parameters, returns the corresponding public key, update time and digital signature and returns it to the enterprise chain code front end. The enterprise chain code front end reassembles the new link according to the returned data and initiates a request to the enterprise chain code back end. The enterprise chain code back end verifies whether the digital signature has been tampered with according to the request parameters. If the verification is successful, the scanning result of the enterprise chain code is returned. The enterprise chain code front end displays the relevant enterprise information to the scanning user; The enterprise chain code adopts a two-layer design, including a scanning layer and a translation layer; the scanning layer is used for the same generation and parsing process as ordinary QR codes, and the translation layer is used for further encryption and decryption of the QR code during the parsing process; the Key value in the scanning layer is used as a key parameter to associate the scanning layer and the translation layer. When the scanning is successful, this key is used as the translation key of the translation layer to obtain the final translation result.
2. The method for generating and managing enterprise chain codes according to claim 1, wherein The key value is set to Token. When designing Token, the Token is stored in the redis database with token as the key. The actual translated address is saved as the value in the redis database. When token is stored as a key in redis, the project prefix needs to be added to prevent duplication of keys for different projects.
3. The method for generating and managing enterprise chain codes according to claim 1, wherein The timeliness of the enterprise chain code is divided into three stages: code display stage, code scanning stage, and execution stage; among them, during the validity period of the code display stage, the customer can scan the code to obtain the result an unlimited number of times. After the validity period, the client automatically updates the token and generates a new enterprise chain code; during the validity period of the code scanning stage, the customer can only scan the code once to obtain the result, and the token will be invalidated. The result of scanning the code again is that the code scanning fails and the token has expired; in the execution stage, this is the execution result after scanning the code, that is, the enterprise business card page that displays the enterprise chain code. At this stage, only publicly available content is displayed.
4. The method for generating and managing enterprise chain codes according to claim 1, wherein When the enterprise chain code is scanned by a dedicated tool, parameters of the tool user can be supplemented, which facilitates controlling the permission of the scanner to view data; when scanning with a dedicated enterprise chain code scanning tool, the user identifier of the scanner and the user's account address will be newly added, that is, there are two more parameters during the scanning process, which are only used as records of the scanner and do not participate in the translation layer.
5. The method for generating and managing enterprise chain codes according to claim 1, wherein The generation rule of the enterprise chain code adopts the generation method of website + route + token.
6. The method for generating and managing enterprise chain codes according to claim 1, wherein After the scanning user scans the enterprise chain code, the public key of the scanned person, the update time and the signature data signed by the ED25519 algorithm can be obtained through the token.
Citation Information
Patent Citations
Method and system for providing product tracing
CN107704493A
Block chain wallet signature right confirmation method, device and system
CN111275419A
Log-in control method and system based on two-dimension code
CN103067378A
Food label unique code publishing and circulation traceability method based on block chain main and auxiliary chain technology
CN110335051A