A method, device, equipment and medium for writing serial numbers

Automatically generate and verify the serial number through device identification, the problem of low write success rate of intelligent device serial number is solved, the write success rate is improved, and the validity and security of the serial number is improved through unique verification and encoding conversion .

CN116719977BActive Publication Date: 2024-11-08SHENZHEN BRIGHT DIAMOND TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310729982.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2024-11-08
Estimated Expiration
2043-06-16

AI Technical Summary

Technical Problem

The success rate of serial number writing in smart devices is low in the production and manufacturing process, which affects the normal operation of the device.

Method used

After obtaining the device identifier, the serial number is automatically generated and written to the target data area, character matching verification is performed to ensure that the serial number is written successfully.

Benefits of technology

It improves the success rate of serial number writing, and improves the effectiveness and security of serial number through unique verification and encoding conversion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116719977B_ABST
    Figure CN116719977B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of smart devices, and in particular to a method, device, equipment and medium for writing a serial number, the method comprising: automatically generating a serial number based on a device identifier, then writing the serial number to a target data area, reading a target serial number from the target area, and performing character matching based on the target serial number and the device identifier, and performing a write success check after the serial number is first written to the target data area, thereby improving the success rate of writing the serial number. When the match is successful, a write success message is generated and displayed on a display interface; when the match fails, a write failure message is generated and displayed on a display interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of smart devices, and in particular to a method, apparatus, device and medium for writing a serial number. Background Art

[0002] Smart devices usually need to have their serial numbers written into them when they leave the factory. The serial numbers are introduced to verify the "legal identity of the product."

[0003] At present, in the production and manufacturing process, it is usually necessary to use additional serial number writing tools to write serial numbers for smart devices. However, when writing serial numbers, related technologies may result in unsuccessful serial number writing and partial writing errors, resulting in a low success rate for serial number writing. Moreover, these situations will affect the normal operation of smart devices.

[0004] Therefore, how to improve the success rate of serial number writing is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0005] The purpose of this application is to provide a serial number writing method, device, equipment and medium to solve at least one of the above technical problems.

[0006] The above invention objectives of the present application are achieved through the following technical solutions:

[0007] In a first aspect, the present application provides a method for writing a serial number, which adopts the following technical solution:

[0008] A method for writing a serial number, comprising:

[0009] Acquire a device identification, and automatically generate a serial number based on the device identification, wherein the serial number includes the device identification;

[0010] Writing the serial number into a target data area, wherein the target data area is an area in the device that stores the serial number;

[0011] Reading a target serial number from the target data area, and performing character matching based on the target serial number and the device identifier to obtain a matching result;

[0012] When the matching result is a successful match, a write success message is generated and displayed on the display interface; when the matching result is a failed match, a write failure message is generated and displayed on the display interface.

[0013] By adopting the above technical solution, a serial number is automatically generated based on the device identification, and then after the serial number is written to the target data area, the target serial number is read from the target area, and character matching is performed based on the target serial number and the device identification. After the serial number is first written to the target data area, a write success check is performed, thereby improving the success rate of serial number writing. When the match is successful, a write success message is generated and displayed on the display interface; when the match fails, a write failure message is generated and displayed on the display interface.

[0014] In a preferred example, the present application may be further configured as follows: after automatically generating a serial number based on the device identification, the following further includes:

[0015] A uniqueness verification is performed based on the serial number. When the verification result shows that the serial number is unique, encoding is performed based on the serial number to obtain a coded serial number, wherein the coded serial number includes: a check code and a two-dimensional code corresponding to the serial number.

[0016] In a preferred example, the present application may be further configured as follows: performing character matching based on the target serial number and the device identifier to obtain a matching result includes:

[0017] Perform a verification operation based on the two-dimensional code in the target serial number and the device identification to obtain a verification operation result;

[0018] A match is performed based on the verification operation result and the verification code in the target sequence number to obtain a matching result.

[0019] In a preferred example, the present application may be further configured as follows: the automatic generation of a serial number based on the device identification includes:

[0020] Obtaining the total number of digits of the serial number and the arrangement information of the serial number, wherein the arrangement information of the serial number is used to characterize the positional relationship between the device identification and the random characters;

[0021] Determine the number of random character digits corresponding to the random character based on the total number of digits of the serial number and the number of identification digits of the device identification;

[0022] Based on the number of random character digits, a target random character is generated, and based on the serial number arrangement information, the device identifier and the target random character, a serial number is obtained.

[0023] In a preferred example, the present application may be further configured as follows: when the matching result is a successful match, after generating a write success message and displaying it on the display, it further includes:

[0024] When a serial number read request carrying user information is received, user identity authentication is performed based on the user information to determine an identity authentication result;

[0025] When the identity authentication result is verification passed, permission verification is performed based on the user information and the access control list to determine the permission verification result, wherein the access control list stores the corresponding relationship between user roles and permissions;

[0026] When the authority verification result is verification passed, the serial number is read, and the serial number is returned based on the serial number reading request;

[0027] When the authority verification result is a verification failure, authority matching failure information is generated, and the authority matching failure information is returned based on the serial number read request.

[0028] In a preferred example, the present application may be further configured as follows: performing permission verification based on the user information and the access control list, and determining the permission verification result, includes:

[0029] Determine the user role based on the user information, and perform permission query based on the user role and the access control list to obtain a permission query result;

[0030] Perform authority verification based on the authority query result to determine the authority verification result.

[0031] In a preferred example, the present application may be further configured as follows: after performing user identity authentication based on the user information and determining the identity authentication result, the following further includes:

[0032] When the identity authentication result is a verification failure, the read operation of the serial number read request is prohibited, and an early warning message is generated, wherein the early warning message is used to warn that there is a situation of illegal reading of the serial number.

[0033] In a second aspect, the present application provides a serial number writing device, which adopts the following technical solution:

[0034] A serial number writing device, comprising:

[0035] A serial number generation module, used to obtain a device identification and automatically generate a serial number based on the device identification, wherein the serial number includes the device identification;

[0036] A serial number writing module, used for writing the serial number into the target data area, wherein the target data area is an area in the device that stores the serial number;

[0037] A character matching module, used for reading a target serial number from the target data area, and performing character matching based on the target serial number and the device identifier to obtain a matching result;

[0038] The information display module is used to generate write success information and display it on the display interface when the matching result is a successful match; and to generate write failure information and display it on the display interface when the matching result is a failed match.

[0039] In a third aspect, the present application provides a smart device, which adopts the following technical solution:

[0040] at least one processor;

[0041] Memory;

[0042] At least one application, wherein the at least one application is stored in the memory and is configured to be executed by at least one processor, and the at least one application is configured to: execute the above-mentioned serial number writing method.

[0043] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:

[0044] A computer-readable storage medium stores a computer program, which, when executed in a computer, causes the computer to execute the above-mentioned serial number writing method.

[0045] In summary, the present application includes at least one of the following beneficial technical effects:

[0046] 1. Automatically generate a serial number based on the device identification, then write the serial number to the target data area, read the target serial number from the target area, and perform character matching based on the target serial number and the device identification. After the serial number is first written to the target data area, a write success check is performed to improve the success rate of serial number writing. When the match is successful, a write success message is generated and displayed on the display interface; when the match fails, a write failure message is generated and displayed on the display interface.

[0047] 2. Perform uniqueness verification based on the serial number to ensure the uniqueness of the serial number. When the verification result shows that the serial number is unique, encode it based on the serial number to obtain the encoded serial number. The encoded serial number includes: a check code and a QR code corresponding to the serial number. Determining the check code and the QR code improves the validity and integrity of the serial number, and converts the serial number in character form into a QR code form, so that the QR code corresponding to the serial number has the advantages of high information density, easy to read, and difficult to forge. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a flowchart of a method for writing a serial number according to one embodiment of the present application;

[0049] Figure 2 It is a structural schematic diagram of a serial number writing device in one embodiment of the present application;

[0050] Figure 3 It is a structural diagram of a smart device according to one embodiment of the present application. DETAILED DESCRIPTION

[0051] The following combination Figure 1 Figure 3 This application is further described in detail.

[0052] This specific embodiment is merely an explanation of the present application and is not a limitation of the present application. After reading this specification, a person skilled in the art may make non-creative modifications to the present embodiment as needed, but such modifications are protected by the patent law as long as they are within the scope of the present application.

[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.

[0055] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.

[0056] The present application embodiment provides a method for writing a serial number, which is executed by a smart device, such as Figure 1 As shown, the method includes step S101, step S102, step S103 and step S104, wherein:

[0057] Step S101: Acquire a device identification, and automatically generate a serial number based on the device identification, wherein the serial number includes the device identification.

[0058] For the embodiments of the present application, when writing the serial number, there is no need to use a serial number writing tool other than the smart device, that is, the smart device can automatically generate the serial number and write it. A program for automatically generating the serial number is pre-set inside the smart device, that is, the program automatically generates the serial number based on the device identification, wherein the device identification is a unique identification of the hardware device and has uniqueness. For the production and manufacturing of personalized production, the program for automatically generating the serial number is universal and can be applied to various types of smart devices. Therefore, compared with the prior art method of manually entering the serial number using a serial number writing tool, the embodiments of the present application reduce the complexity of the device operation of writing the serial number.

[0059] There are many ways to automatically generate serial numbers for programs, and the embodiments of the present application are no longer limited, as long as a serial number that uniquely identifies a smart device can be generated. Preferably, the serial number includes a device identifier, and the rest of the serial number is filled with random characters. The use of a serial number including a device identifier can ensure the uniqueness and validity of the serial number, and the strong correlation between the device identifier and the serial number can prevent illegal users from accessing data in the smart device by forging a serial number, thereby ensuring the security of the smart device and the integrity of the data.

[0060] Step S102: writing the serial number into the target data area, wherein the target data area is an area in the device that stores the serial number.

[0061] For the embodiment of the present application, different types of smart devices and different applications of smart devices will have their own corresponding target data areas, wherein the target data area includes but is not limited to: software license files, databases, hardware devices, cloud services and registry. When the smart device is produced, the specific location of the target data area is determined, so the automatically generated serial number is written to the target data area. Preferably, the write location and format are determined based on the target data area, and the target data area is accessed through file operations, network transmission, etc. to check whether the target area is writable. When the target area is not writable, a write failure alarm is processed; when the target area is writable, the serial number is stored in a data structure, wherein the data structure includes but is not limited to: hash tables, arrays, etc. Then, the serial number stored in the data structure is encrypted to obtain an encrypted serial number, and the encrypted serial number is written to the target data area. Encrypting the serial number and then writing it to the target data area can ensure the security of the serial number writing.

[0062] Step S103: reading the target serial number from the target data area, and performing character matching based on the target serial number and the device identifier to obtain a matching result;

[0063] Step S104: When the matching result is a successful match, a write success message is generated and displayed on the display interface; when the matching result is a failed match, a write failure message is generated and displayed on the display interface.

[0064] For the embodiment of the present application, when the serial number is written into the target data area, there will be situations where the writing is unsuccessful and partial writing errors occur. These situations will have an adverse effect on the normal operation of the device. Therefore, after the serial number is written into the target data area, the embodiment of the present application reads the target serial number from the target data area, and performs character matching based on the target serial number and the device identification to determine whether the serial number is successfully and correctly written into the target data area. Specifically, since the serial number includes the device identification, if the serial number is successfully and correctly written into the target data area, the target serial number and the device identification can successfully match the characters; if the serial number fails to write or partially writes an error, the target serial number and the device identification will fail to match the characters. Furthermore, when the match is successful, a write success message is generated and displayed on the display interface; when the match fails, a write failure message is generated and displayed on the display interface. Both the write success message and the write failure message are used to inform the user of the write status of the serial number, so as to facilitate subsequent processing according to the write status. After the serial number is first written into the target data area, a write success check is performed, which improves the success rate of the serial number writing.

[0065] It can be seen that in the embodiment of the present application, the serial number is automatically generated based on the device identification, and then, after the serial number is written to the target data area, the target serial number is read from the target area, and character matching is performed based on the target serial number and the device identification, and a write success check is performed after the serial number is first written to the target data area, thereby improving the success rate of the serial number writing. When the match is successful, a write success message is generated and displayed on the display interface; when the match fails, a write failure message is generated and displayed on the display interface.

[0066] Furthermore, in order to improve the validity and integrity of the serial number, in the embodiment of the present application, after the serial number is automatically generated based on the device identification, the following steps are also included:

[0067] Uniqueness verification is performed based on the serial number. When the verification result shows that the serial number is unique, encoding is performed based on the serial number to obtain a coded serial number, wherein the coded serial number includes: a check code and a QR code corresponding to the serial number.

[0068] For the embodiment of the present application, the serial number is used for operations such as item authentication, anti-counterfeiting and activation, and should have the characteristics of uniqueness. Therefore, the uniqueness verification is performed based on the serial number. Specifically, the program that automatically generates the serial number generates a serial number each time, and stores it in the serial number database after the serial number is successfully written. When the uniqueness verification is performed, the serial number is matched with all the assigned serial numbers in the serial number database. When the match fails, the serial number is determined to be unique; when the match is successful, the serial number is determined to be not unique, and the serial number is not unique information is generated to control the smart device to regenerate the serial number. When the verification result is that the serial number is unique, it is encoded based on the serial number to obtain a coded serial number, wherein the coded serial number includes: a check code and a QR code corresponding to the serial number. The check code and the QR code are determined to improve the validity and integrity of the serial number. The check code is used to determine whether the information corresponding to the serial number written into the target data area is accurate, and the character-based serial number is converted into a QR code form, so that the QR code corresponding to the serial number has the advantages of high information density, easy to read, and difficult to forge. There are many ways to generate a check code. For example, a hash algorithm is used to generate a check code. That is, the device ID is first converted into a byte string, and then the sha256() method or md5() method in the hashlib library is used to perform a hash calculation to obtain the check code. Preferably, a hash calculation is performed using the device ID and serial number to obtain the check code.

[0069] Further, the coded serial number is written into the target data area, and the serial number in the form of a two-dimensional code improves the information density of the serial number and increases the difficulty of counterfeiting the two-dimensional code. Then, a verification match is performed based on the target code and the device identification to obtain a matching result, wherein the target code is the information stored in the target data area, and there are multiple situations in the process of writing the two-dimensional code and the check code into the target data area. When the target code is successfully and correctly written, the two-dimensional code and the check code of the target code are respectively the same as the check code and the two-dimensional code written; when the writing is unsuccessful or the writing is wrong, the two-dimensional code and the check code of the target code are different from the check code and the two-dimensional code written. There are many ways to verify the matching, and the embodiments of the present application are no longer limited. It is sufficient to be able to check whether the two-dimensional code and the check code corresponding to the target code are respectively the same as the check code and the two-dimensional code written. For example, when the check code is determined by hash calculation of the device identification and the serial number, a hash calculation is performed based on the two-dimensional code and the device identification corresponding to the target code to obtain a hash calculation result. When the hash calculation result is the same as the check code corresponding to the target code, it is determined that the match is successful, otherwise, it is determined that the match fails.

[0070] It can be seen that in the embodiments of the present application, uniqueness verification is performed based on the serial number to ensure the uniqueness of the serial number. When the verification result is that the serial number is unique, encoding is performed based on the serial number to obtain a coded serial number, wherein the coded serial number includes: a check code and a QR code corresponding to the serial number. Determining the check code and the QR code improves the validity and integrity of the serial number, and converts the serial number in character form into a QR code form, so that the QR code corresponding to the serial number has the advantages of high information density, easy to read, and difficult to forge.

[0071] Further, in the embodiment of the present application, character matching is performed based on the target serial number and the device identifier to obtain a matching result, including:

[0072] Perform verification operation based on the QR code and device identification in the target serial number to obtain a verification operation result;

[0073] A match is performed based on the verification operation result and the verification code in the target serial number to obtain a matching result.

[0074] For the embodiment of the present application, the verification code is obtained by encoding and calculating the device identification and the serial number, so that there is a strong correlation between the verification code, the serial number and the device identification, thereby improving the accuracy of the matching result, wherein the encoding calculation method includes but is not limited to: a hash algorithm, a cyclic redundancy check algorithm and an encryption algorithm. Therefore, when performing verification matching, a verification operation is performed based on the two-dimensional code and the device identification in the target serial number to obtain a verification operation result, wherein the verification operation is the same as the encoding calculation, that is, when the verification code is obtained by calculating the device identification and the serial number using a hash algorithm, then a hash algorithm is performed based on the two-dimensional code and the device identification to obtain a verification operation result. Then, matching is performed based on the verification operation result and the verification code in the target serial number. When the verification operation result is the same as the verification code in the target serial number, the matching result is determined to be a successful match, otherwise, the matching result is determined to be a failed match.

[0075] It can be seen that in the embodiment of the present application, the verification code is obtained by encoding and calculating the device identification and the serial number, so that there is a strong correlation between the verification code, the serial number and the device identification, thereby improving the accuracy of the matching result. Then, a verification operation is performed based on the QR code and the device identification in the target serial number to obtain a verification operation result; and matching is performed based on the verification operation result and the verification code in the target serial number to obtain a matching result.

[0076] Furthermore, in an embodiment of the present application, automatically generating a serial number based on a device identification includes:

[0077] Obtain the total number of digits of the serial number and the arrangement information of the serial number, wherein the arrangement information of the serial number is used to characterize the positional relationship between the device identification and the random characters;

[0078] Determine the number of random character digits corresponding to the random character based on the total number of digits of the serial number and the number of identification digits of the device identification;

[0079] Based on the number of random character digits, a target random character is generated, and based on the serial number arrangement information, the device identification and the target random character, a serial number is obtained.

[0080] For the embodiment of the present application, the serial number is composed of a device identifier and random characters, and the serial number arrangement information is used to characterize the positional relationship between the device identifier and the random characters, wherein the total number of serial number digits and the serial number arrangement information are pre-set and stored in the smart device, and the user can determine them as needed. Then, based on the total number of serial number digits minus the number of identifier digits, the number of random character digits corresponding to the random character is determined. Then, a random number generation method is used to generate a target random character with a random character digit number, for example, a random library is used to generate a target random character, and the target random character includes but is not limited to: numbers, letters, and symbols. Finally, according to the serial number arrangement information, the device identifier and the target random character are arranged to obtain a serial number.

[0081] The target random characters are generated based on the number of random character digits. Preferably, the meaning of the random character digits is divided, the number of digits corresponding to each character segment is determined, and the corresponding random number generation rules are determined for each character segment. Then, partial random characters are generated for the random number generation rules and digits corresponding to each character segment, and the partial random characters corresponding to each character segment are integrated to obtain the target random characters. For example, when dividing the meaning, the production batch, manufacturer, and sales channel are divided to obtain the number of digits corresponding to each production batch, manufacturer, and sales channel, and then, partial random characters are determined according to the random number generation rules of each character segment. The specific content of the random number generation rules is no longer limited in the embodiment of the present application. For example, the partial random characters of the production batch character segment are presented in the form of a combination of letters and numbers; the partial random characters of the manufacturer character segment are presented in the form of capital letters; and the partial random characters of the sales channel character segment are presented in the form of a combination of symbols. Then, the target random characters are integrated based on all partial random characters. When generating the target random characters, different character segments are divided in advance and the corresponding random number generation rules are set, so that the serial number composed of the target random characters has a high information density and the difficulty of illegally forging the serial number is high, so that the security of the serial number is higher.

[0082] It can be seen that in the embodiment of the present application, the number of random character digits corresponding to the random character is determined based on the total number of digits of the serial number and the number of digits of the device identification, and then, based on the number of random character digits, the target random character is generated, and the serial number is obtained based on the serial number arrangement information, the device identification and the target random character. When generating the target random character, different character segments are pre-divided and the corresponding random number generation rules are set, so that the serial number composed of the target random characters has a high information density and the difficulty of illegally forging the serial number is high, so that the security of the serial number is higher.

[0083] Further, in order to reduce the probability that an illegal user successfully reads the serial number by illegal means, in the embodiment of the present application, when the matching result is a successful match, after generating a write success message and displaying it on the display, it also includes:

[0084] When a serial number read request carrying user information is received, user identity authentication is performed based on the user information to determine the identity authentication result;

[0085] When the identity authentication result is verification passed, permission verification is performed based on the user information and the access control list to determine the permission verification result, wherein the access control list stores the corresponding relationship between user roles and permissions;

[0086] When the permission verification result is verification passed, the serial number is read and the serial number is returned based on the serial number read request;

[0087] When the permission verification result is a verification failure, permission matching failure information is generated, and the permission matching failure information is returned based on the serial number read request.

[0088] For the embodiment of the present application, after the serial number is successfully written into the target data area of ​​the smart device, the situation of reading the serial number often occurs during the normal operation of the smart device. However, not all users have the authority to read the serial number. In order to ensure the safety of the serial number, the embodiment of the present application performs user identity authentication and authority verification in the process of reading the serial number, reducing the probability of illegal users successfully reading the serial number by illegal means. Specifically, when a serial number reading request carrying user information is received, user identity authentication is performed based on the user information to determine the identity authentication result. There are many ways to authenticate the user, for example, obtaining the user account and password when the user logs in, and judging whether the user logs in legally based on the user account and password. When it is a legal login, the identity authentication result is determined to be a verification pass, otherwise, the identity authentication result is determined to be a verification failure, and then the serial number reading request is intercepted, and the user is marked as an abnormal user. When the identity authentication result is a verification pass, the authority verification is performed based on the user information and the access control list to determine the authority verification result, wherein the corresponding relationship between user roles and authorities is stored in the access control list. That is, the permission query result corresponding to the user information is screened out in the access control list. When the permission query result includes the permission to read the serial number, the permission verification result is determined to be passed, and the serial number is read. The serial number read request includes the first position information returned by the serial number, so the serial number is returned to the first position information. When the permission query result does not include the permission to read the serial number, the permission verification result is determined to be failed, indicating that the user does not have the permission to access the serial number, and permission matching failure information is generated. The serial number read request includes the second position information returned by the information, so the permission matching failure information is returned to the second position information, wherein the permission matching failure information is used to notify the user who reads the serial number that he does not have the permission to read the serial number.

[0089] It can be seen that in the embodiment of the present application, when a serial number read request carrying user information is received, user identity verification is performed based on the user information, and when the identity verification result is verification passed, permission verification is performed based on the user information and the access control list. When the permission verification result is verification passed, the serial number is read, and the serial number is returned based on the serial number read request; when the permission verification result is verification failure, permission matching failure information is generated, and permission matching failure information is returned based on the serial number read request. The embodiment of the present application performs user identity verification and permission verification in the process of reading the serial number, reducing the probability that an illegal user successfully reads the serial number by illegal means.

[0090] Further, in order to improve the accuracy of the permission verification result, in an embodiment of the present application, permission verification is performed based on user information and an access control list, and the permission verification result is determined, including:

[0091] Determine the user role based on the user information, and perform permission query based on the user role and access control list to obtain the permission query result;

[0092] Perform permission verification based on the permission query result and determine the permission verification result.

[0093] For the embodiment of the present application, the user rights of different user roles are not the same, so the corresponding relationship between each role and the permission is stored in the access control list. Preferably, the corresponding relationship defines the resource type that the role can access, the way to access each resource (access methods include: read, write, modify, delete and execute) and the access time, wherein the role is divided according to the preset role division standard, for example, the role includes: administrator role, ordinary user role, developer role, tester role, project administrator role, etc. The user information includes but is not limited to: position, department, job responsibilities, project team information, etc., and then, the user role is determined based on the user information, and the permission query result corresponding to the user role is screened in the access control list. Then, it is determined whether there is permission to read the serial number in the permission query result. When there is permission to read the serial number, the permission verification result is determined to be verification passed; when there is no permission to read the serial number, the permission verification result is determined to be verification failed. Preferably, when the access time is defined in the corresponding relationship, the request time of the serial number read request is obtained, and a match is performed based on the request time and the access time corresponding to the target role's serial number read permission. Only when the time match is successful and the permission exists, is it determined that the verification is passed, and all other cases are determined to be verification failures.

[0094] It can be seen that in the embodiment of the present application, the user role is determined based on the user information, and the permission query is performed based on the user role and the access control list, and then the permission verification is performed based on the permission query result to determine the permission verification result. By matching the role permissions, the accuracy of the permission verification result is improved.

[0095] Further, in order to improve the security of the serial number, in the embodiment of the present application, after performing user identity authentication based on the user information and determining the identity authentication result, it also includes:

[0096] When the identity authentication result is a verification failure, the read operation of the serial number read request is prohibited, and a warning message is generated, wherein the warning message is used to warn that there is an illegal reading of the serial number.

[0097] For the embodiment of the present application, when the identity authentication result is a verification failure, it indicates that the user is not authorized and logs in and obtains the serial number through informal means. In order to improve the security of the serial number and reduce the probability of the serial number being illegally stolen, the embodiment of the present application prohibits the read operation of the serial number read request when the identity authentication result is a verification failure, and generates a warning message. Of course, the user information can also be marked as an abnormal user. If there is a subsequent request to access the serial number, it will be directly prohibited.

[0098] It can be seen that in the embodiment of the present application, when the identity authentication result is a verification failure, the read operation of the serial number read request is prohibited, and a warning message is generated to improve the security of the serial number and reduce the probability of the serial number being illegally stolen.

[0099] The above embodiment introduces a serial number writing method from the perspective of method flow, and the following embodiment introduces a serial number writing device from the perspective of a virtual module or a virtual unit. For details, please refer to the following embodiment.

[0100] The present application embodiment provides a serial number writing device, such as Figure 2 As shown, the serial number writing device may specifically include:

[0101] A serial number generation module 210, used to obtain a device identification and automatically generate a serial number based on the device identification, wherein the serial number includes the device identification;

[0102] The serial number writing module 220 is used to write the serial number into the target data area, wherein the target data area is an area in the device that stores the serial number;

[0103] The character matching module 230 is used to read the target serial number from the target data area, and perform character matching based on the target serial number and the device identification to obtain a matching result;

[0104] The information display module 240 is used to generate write success information and display it on the display interface when the matching result is a successful match; and to generate write failure information and display it on the display interface when the matching result is a failed match.

[0105] For the embodiment of the present application, the serial number generation module 210 automatically generates a serial number based on the device identification. After the serial number writing module 220 writes the serial number to the target data area, the character matching module 230 reads the target serial number from the target area and performs character matching based on the target serial number and the device identification. After the serial number is initially written to the target data area, a write success check is performed, thereby improving the success rate of the serial number writing. When the match is successful, the information display module 240 generates a write success message and displays it on the display interface; when the match fails, a write failure message is generated and displayed on the display interface.

[0106] In a possible implementation of the embodiment of the present application, the serial number writing device further includes:

[0107] The verification coding module is used to perform uniqueness verification based on the serial number. When the verification result is that the serial number is unique, encoding is performed based on the serial number to obtain a coded serial number, wherein the coded serial number includes: a check code and a QR code corresponding to the serial number.

[0108] In a possible implementation of the embodiment of the present application, when the character matching module 230 performs character matching based on the target serial number and the device identification to obtain a matching result, it is used to:

[0109] Perform verification operation based on the QR code and device identification in the target serial number to obtain a verification operation result;

[0110] A match is performed based on the verification operation result and the verification code in the target serial number to obtain a matching result.

[0111] In a possible implementation of the embodiment of the present application, when the serial number generation module 210 automatically generates a serial number based on a device identification, it is used to:

[0112] Obtain the total number of digits of the serial number and the arrangement information of the serial number, wherein the arrangement information of the serial number is used to characterize the positional relationship between the device identification and the random characters;

[0113] Determine the number of random character digits corresponding to the random character based on the total number of digits of the serial number and the number of identification digits of the device identification;

[0114] Based on the number of random character digits, a target random character is generated, and based on the serial number arrangement information, the device identification and the target random character, a serial number is obtained.

[0115] In a possible implementation of the embodiment of the present application, the serial number writing device further includes:

[0116] The serial number reading module is used to perform user identity verification based on the user information and determine the identity verification result when receiving a serial number reading request carrying user information;

[0117] When the identity authentication result is verification passed, permission verification is performed based on the user information and the access control list to determine the permission verification result, wherein the access control list stores the corresponding relationship between user roles and permissions;

[0118] When the permission verification result is verification passed, the serial number is read and the serial number is returned based on the serial number read request;

[0119] When the permission verification result is a verification failure, permission matching failure information is generated, and the permission matching failure information is returned based on the serial number read request.

[0120] In a possible implementation of the embodiment of the present application, when the serial number reading module performs permission verification based on user information and the access control list and determines the permission verification result, it is used to:

[0121] Determine the user role based on the user information, and perform permission query based on the user role and access control list to obtain the permission query result;

[0122] Perform permission verification based on the permission query result and determine the permission verification result.

[0123] In a possible implementation of the embodiment of the present application, the serial number writing device further includes:

[0124] The prohibition request module is used to prohibit the reading operation of the serial number reading request when the identity authentication result is a verification failure, and generate an early warning message, wherein the early warning message is used to warn of the existence of illegal reading of the serial number.

[0125] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the serial number writing device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0126] In an embodiment of the present application, a smart device is provided, such as Figure 3 As shown, Figure 3 The smart device 300 shown includes: a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, such as through a bus 302. Optionally, the smart device 300 may also include a transceiver 304 and a display 305. It should be noted that in actual applications, the transceiver 304 is not limited to one, and the structure of the smart device 300 does not constitute a limitation on the embodiments of the present application.

[0127] The processor 301 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0128] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but it does not mean that there is only one bus or only one type of bus.

[0129] The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.

[0130] The memory 303 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the contents shown in the above method embodiment.

[0131] Among them, smart devices include but are not limited to: mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Figure 3 The smart device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0132] The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when it is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment. Compared with the related art, the embodiment of the present application automatically generates a serial number based on a device identification, and then, after the serial number is written to the target data area, the target serial number is read from the target area, and character matching is performed based on the target serial number and the device identification, and a write success check is performed after the serial number is first written to the target data area, thereby improving the success rate of the serial number writing. When the match is successful, a write success message is generated and displayed on the display interface; when the match fails, a write failure message is generated and displayed on the display interface.

[0133] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0134] The above are only some implementation methods of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for writing a sequence number, characterized in that: Executed by a smart device, wherein a program for automatically generating a serial number is pre-set inside the smart device, including: Acquire a device identification, and automatically generate a serial number based on the device identification, wherein the serial number includes the device identification; Writing the serial number into a target data area, wherein the target data area is an area in the device that stores the serial number, and the target data area includes: software license files, databases, hardware devices, cloud services, and registry tables; Reading a target serial number from the target data area, and performing character matching based on the target serial number and the device identifier to obtain a matching result; When the matching result is a successful match, a write success message is generated and displayed on the display interface; when the matching result is a failed match, a write failure message is generated and displayed on the display interface; After the serial number is automatically generated based on the device identification, the method further includes: Performing uniqueness verification based on the serial number, and when the verification result shows that the serial number is unique, encoding is performed based on the serial number to obtain a coded serial number, wherein the coded serial number includes: a check code and a two-dimensional code corresponding to the serial number; The automatically generating a serial number based on the device identification includes: Obtaining the total number of digits of the serial number and the arrangement information of the serial number, wherein the arrangement information of the serial number is used to characterize the positional relationship between the device identification and the random characters; Determine the number of random character digits corresponding to the random character based on the total number of digits of the serial number and the number of identification digits of the device identification; Generate a target random character based on the number of random character digits, and obtain a serial number based on the serial number arrangement information, the device identifier and the target random character; The generating a target random character based on the number of random character bits comprises: Divide the meaning of the random character digits to determine the digits corresponding to each character segment, and determine the corresponding random number generation rule for each character segment; Generate partial random characters according to the random number generation rule and the number of digits corresponding to each character segment, and integrate the partial random characters corresponding to each character segment to obtain the target random characters; The character matching based on the target serial number and the device identifier to obtain a matching result includes: Perform a verification operation based on the two-dimensional code in the target serial number and the device identification to obtain a verification operation result; Matching is performed based on the verification operation result and the verification code in the target sequence number to obtain a matching result; When the matching result is a successful match, after generating a write success message and displaying it on the display, the method further includes: When a serial number read request carrying user information is received, user identity authentication is performed based on the user information to determine an identity authentication result; When the identity authentication result is verification passed, permission verification is performed based on the user information and the access control list to determine the permission verification result, wherein the access control list stores the corresponding relationship between user roles and permissions; When the authority verification result is verification passed, the serial number is read, and the serial number is returned based on the serial number reading request; When the authority verification result is a verification failure, authority matching failure information is generated, and the authority matching failure information is returned based on the serial number read request; The performing permission verification based on the user information and the access control list and determining the permission verification result includes: Determine the user role based on the user information, and perform permission query based on the user role and the access control list to obtain a permission query result; Performing authority verification based on the authority query result and determining the authority verification result; After performing user identity authentication based on the user information and determining the identity authentication result, the method further includes: When the identity authentication result is a verification failure, the read operation of the serial number read request is prohibited, and an early warning message is generated, wherein the early warning message is used to warn that there is an illegal reading of the serial number.

2. A serial number writing device, characterized in that: include: A serial number generation module, used to obtain a device identification and automatically generate a serial number based on the device identification, wherein the serial number includes the device identification; A serial number writing module, used to write the serial number to a target data area, wherein the target data area is an area in the device that stores serial numbers, and the target data area includes: software license files, databases, hardware devices, cloud services, and registry tables; A character matching module, used for reading a target serial number from the target data area, and performing character matching based on the target serial number and the device identifier to obtain a matching result; An information display module, used for generating a write success message and displaying it on a display interface when the matching result is a successful match; and generating a write failure message and displaying it on a display interface when the matching result is a failed match; A verification coding module, used for performing uniqueness verification based on the serial number, and when the verification result shows that the serial number is unique, encoding is performed based on the serial number to obtain a coded serial number, wherein the coded serial number includes: a check code and a two-dimensional code corresponding to the serial number; When the serial number generation module automatically generates a serial number based on the device identification, it is used to: Obtaining the total number of digits of the serial number and the arrangement information of the serial number, wherein the arrangement information of the serial number is used to characterize the positional relationship between the device identification and the random characters; Determine the number of random character digits corresponding to the random character based on the total number of digits of the serial number and the number of identification digits of the device identification; Generate a target random character based on the number of random character digits, and obtain a serial number based on the serial number arrangement information, the device identifier and the target random character; When executing the generation of the target random characters based on the number of random character digits, the serial number generation module is used to: divide the meaning of the random character digits, determine the number of digits corresponding to each character segment, and determine the corresponding random number generation rule for each character segment; generate partial random characters according to the random number generation rule and number of digits corresponding to each character segment, and integrate the partial random characters corresponding to each character segment to obtain the target random characters; When the character matching module performs character matching based on the target serial number and the device identifier to obtain a matching result, it is used to: Perform a verification operation based on the two-dimensional code in the target serial number and the device identification to obtain a verification operation result; Matching is performed based on the verification operation result and the verification code in the target sequence number to obtain a matching result; A serial number reading module, configured to, upon receiving a serial number reading request carrying user information, perform user identity verification based on the user information and determine an identity verification result; When the identity authentication result is verification passed, permission verification is performed based on the user information and the access control list to determine the permission verification result, wherein the access control list stores the corresponding relationship between user roles and permissions; When the authority verification result is verification passed, the serial number is read, and the serial number is returned based on the serial number reading request; When the authority verification result is a verification failure, authority matching failure information is generated, and the authority matching failure information is returned based on the serial number read request; When performing the permission verification based on the user information and the access control list and determining the permission verification result, the serial number reading module is used to: Determine the user role based on the user information, and perform permission query based on the user role and the access control list to obtain a permission query result; Performing authority verification based on the authority query result and determining the authority verification result; The prohibition request module is used to prohibit the reading operation of the serial number reading request when the identity authentication result is a verification failure, and generate an early warning message, wherein the early warning message is used to warn that there is an illegal reading of the serial number.

3. A smart device, characterized in that: include: at least one processor; Memory; At least one application, wherein the at least one application is stored in a memory and configured to be executed by at least one processor, and the at least one application is configured to: execute the serial number writing method according to claim 1.

4. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the serial number writing method described in claim 1.