Equipment legality detection method and device, storage medium and computer equipment
By generating authentication keys using device serial numbers and master keys, and combining this with symmetric encryption algorithms for legitimacy verification, the security and cost issues of device legitimacy verification in existing technologies are resolved, achieving efficient and secure device legitimacy verification.
Patent Information
- Application Number
- CN202511355324.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2025-12-12
AI Technical Summary
Existing methods for verifying the legitimacy of devices suffer from low security, vulnerability to hacking, and high deployment costs, making it difficult to meet the security needs of complex network environments and diverse device types.
By obtaining the device serial number of the target device, the authentication key generated by the device serial number and master key stored in the database is used to perform a legitimacy check. The device serial number and master key are encrypted and compared using a symmetric encryption algorithm to generate a unique authentication key, and key management is implemented at the software level.
It improves the security of device authentication, reduces the risk of being cracked, lowers deployment costs, ensures that only authorized and legitimate devices can access the system, and provides a guarantee for the secure and stable operation of the system.
Smart Images

Figure CN121125264A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data security, and particularly relates to a device legitimacy detection method and device, a storage medium and a computer device. BACKGROUND
[0002] In the existing technical system, device legitimacy detection is an important link to ensure system security and data security. With the rapid development of technologies such as the Internet of Things and cloud computing, a large number of devices are connected to the network, and the legitimacy and security of device identity have become increasingly prominent. Unauthorized or illegal device access not only may lead to security risks such as data leakage and system attacks, but also may affect the stability and reliability of the entire network.
[0003] Traditional device legitimacy detection methods often rely on simple identity verification or password verification, and these methods have problems such as being easy to crack and low security. In particular, in the face of complex network environments and diverse device types, traditional detection methods are difficult to meet the growing security needs.
[0004] In addition, some existing device legitimacy detection schemes, although they use relatively complex encryption algorithms and authentication mechanisms, often have the shortcomings of complex implementation and high cost. These schemes may require special hardware support or complex software configuration, and are difficult to be widely used in resource-limited or cost-sensitive scenarios. SUMMARY
[0005] The present application aims to at least solve one of the above technical defects, in particular, the technical defect that the device legitimacy detection method in the prior art cannot have high security, be not easy to crack, and have low deployment cost and convenient implementation.
[0006] The present application provides a device legitimacy detection method, which comprises:
[0007] When receiving a connection request sent by a target device, obtaining a device serial number of the target device contained in the connection request;
[0008] Searching a database to find whether there is a target registration record corresponding to the device serial number, wherein the database stores registration records corresponding to device serial numbers and authentication key of different devices, and the authentication key of each device is generated by encrypting the device serial number and the master key of the device;
[0009] If there is, obtaining a target authentication key in the target registration record and a target master key corresponding to the target device;
[0010] According to the device serial number, the target master key and the target authentication key, legitimacy of the target device is detected, and a detection result is obtained, and according to the detection result, whether the target device is legitimate is determined.
[0011] If not, it is determined that the target device is not legitimate, and the connection is rejected.
[0012] Optionally, the generation process of the authentication key of each device comprises:
[0013] For each device:
[0014] The device serial number of the device pre-recorded is obtained;
[0015] A 32-bit random code pre-generated by a random generator is obtained, and the 32-bit random code is used as a master key;
[0016] The device serial number and the master key are symmetrically encrypted by using a preset symmetric encryption algorithm, and an authentication key is obtained.
[0017] Optionally, the method further comprises:
[0018] The master key is encrypted by secondary disturbance, and an encrypted master key is obtained;
[0019] The encrypted master key and the corresponding decryption code are compiled into the software program.
[0020] Optionally, the target master key corresponding to the target device is obtained, comprising:
[0021] The target decryption code and the encrypted master key pre-compiled in the software program are obtained;
[0022] The target master key corresponding to the encrypted master key is restored in the memory through the target decryption code.
[0023] Optionally, according to the device serial number, the target master key and the target authentication key, legitimacy of the target device is detected, and a detection result is obtained, comprising:
[0024] The device serial number and the target master key are symmetrically encrypted by using a preset symmetric encryption algorithm, and an encryption result is obtained;
[0025] The encryption result and the target authentication key are compared to detect the legitimacy of the target device, and a detection result is obtained.
[0026] Optionally, according to the detection result, whether the target device is legitimate is determined, comprising:
[0027] If the detection result is that the encryption result is consistent with the target authentication key, it is determined that the target device is legal, and the connection is agreed;
[0028] If the detection result is that the encryption result is inconsistent with the target authentication key, it is determined that the target device is illegal, and the connection is refused.
[0029] Optionally, the method further comprises:
[0030] If there is a target registration record corresponding to the device serial number in the database, but the target device is illegal, or there is other illegal behavior, a random generator is called to generate a new 32-bit random code, and the new 32-bit random code is used as a new master key;
[0031] The device serial number and the new master key of each legal device are symmetrically encrypted by using a preset symmetric encryption algorithm to obtain a new authentication key of each legal device;
[0032] The registration record in the database is updated according to the new authentication key of each legal device, and the software program is updated according to the new master key.
[0033] The application also provides a device legality detection device, comprising:
[0034] A serial number acquisition module is configured to acquire a device serial number of a target device included in a connection request sent by the target device when the connection request is received;
[0035] A record searching module is configured to search a database to determine whether there is a target registration record corresponding to the device serial number, wherein the database stores registration records corresponding to device serial numbers and authentication keys of different devices, and the authentication key of each device is generated by encrypting the device serial number and a master key of the device;
[0036] A key acquisition module is configured to acquire a target authentication key in the target registration record and a target master key corresponding to the target device if the target registration record exists;
[0037] A legality detection module is configured to perform legality detection on the target device according to the device serial number, the target master key, and the target authentication key, and obtain a detection result, and determine whether the target device is legal according to the detection result;
[0038] A connection refusal module is configured to determine that the target device is illegal and refuse the connection if the target registration record does not exist.
[0039] The application further provides a computer readable storage medium, which stores computer readable instructions. When the computer readable instructions are executed by one or more processors, the one or more processors perform the steps of the device legitimacy detection method according to any one of the above embodiments.
[0040] The application further provides a computer device, which comprises one or more processors and a memory.
[0041] The memory stores computer readable instructions. When the computer readable instructions are executed by the one or more processors, the steps of the device legitimacy detection method according to any one of the above embodiments are performed.
[0042] From the above technical solutions, it can be seen that the embodiments of the application have the following advantages:
[0043] The device legitimacy detection method, device, storage medium and computer device provided by the application can obtain the device serial number of the target device included in the connection request when receiving the connection request sent by the target device, and find whether there is a target registration record corresponding to the device serial number in the database. The database of the application stores registration records corresponding to the device serial numbers and authentication keys of different devices. The authentication key of each device is generated by encrypting the device serial number and the master key of the device. Therefore, when there is a target registration record corresponding to the device serial number in the database, the target authentication key in the target registration record and the target master key corresponding to the target device can be obtained, and then the target device is detected for legitimacy according to the device serial number, the target master key and the target authentication key, and a detection result is obtained. According to the detection result, it is determined whether the target device is legitimate. If not, it can be directly determined that the target device is not legitimate, and the connection is refused. In this process, the application generates the authentication key by using the encryption mode of combining the device serial number and the master key, which effectively improves the security of device identity verification and reduces the risk of being cracked. At the same time, this scheme does not require additional hardware support, but can be realized through encryption algorithms and key management at the software level, thereby significantly reducing the deployment cost and improving the implementation convenience. In practical application, this method can quickly respond to the connection request of the device, efficiently complete the legitimacy detection, and ensure that only the authorized legitimate device can access the system, thereby providing a strong guarantee for the safe and stable operation of the system. BRIEF DESCRIPTION OF DRAWINGS
[0044] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 A schematic flowchart illustrating a device legality detection method provided in this application embodiment;
[0046] Figure 2 A schematic diagram illustrating the authentication key generation process provided in this application embodiment;
[0047] Figure 3 This is a schematic diagram illustrating the process of updating the master key and authentication key as provided in an embodiment of this application.
[0048] Figure 4 This is a schematic diagram of the structure of a device for detecting the legality of an application provided in an embodiment of the present application;
[0049] Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0051] In one embodiment, such as Figure 1 As shown, Figure 1 This application provides a flowchart illustrating a method for verifying the legitimacy of an equipment; the application provides a method for verifying the legitimacy of an equipment, which may include:
[0052] S110: When a connection request is received from the target device, obtain the device serial number of the target device contained in the connection request.
[0053] In this step, when the target device is powered on and connected to the system, it sends a connection request to the system. After receiving the connection request, the system can obtain the device serial number of the target device contained in the connection request. In this way, the system can perform a legality check on the target device based on the device serial number.
[0054] Among them, the target device of the present application can be determined according to the actual application scene. For example, in the vehicle management system, the target device can be a camera, an RFID reader, etc. installed at the vehicle access place; in the smart home system, the target device can be a smart door lock, a smart camera, a smart home appliance, etc.; in the industrial automation scene, the target device can be various industrial devices such as sensors, controllers, actuators, etc. After receiving the connection request, the system will first parse the specific fields in the request header or body to accurately extract the device serial number of the target device, which is the unique identifier of the device and is the key basis for subsequent legitimacy detection.
[0055] S120: Find whether there is a target registration record corresponding to the device serial number in the database.
[0056] In this step, after obtaining the device serial number contained in the connection request sent by the target device through S110, the present application can find whether there is a target registration record corresponding to the device serial number in the database, so that the legitimacy of the target device can be detected according to the content recorded in the target registration record.
[0057] Among them, the database of the present application stores the registration records corresponding to the device serial numbers and authentication keys of different devices, and the authentication key of each device is generated by encrypting the device serial number and the master key of the device. The database can be stored in a relational database or a non-relational database, and the specific selection depends on the needs of the actual application scene. The master key refers to the core key used to generate the authentication key in the device legitimacy detection system, and its generation and management comply with strict security specifications. The authentication key can be generated by encrypting the device serial number and the master key according to a preset symmetric encryption algorithm, which can be a common symmetric encryption algorithm such as AES (Advanced Encryption Standard) algorithm, DES (Data Encryption Standard) algorithm, etc. These algorithms have the characteristics of high encryption strength and fast operation speed, which can effectively protect the security of the authentication key.
[0058] Further, when finding the target registration record, the system can retrieve the record matching the device serial number in the database through a query statement, return the record if found, and take the record as the target registration record, otherwise it means that there is no registration information of the device in the database.
[0059] S130: If it exists, obtain the target authentication key in the target registration record and the target master key corresponding to the target device.
[0060] In this step, after S120 finds whether the target registration record corresponding to the device serial number exists in the database, if it exists, it means that the target registration record matching the device serial number is stored in the database. At this time, the target authentication key recorded in the target registration record can be obtained, and the target master key corresponding to the target device can also be obtained, so that the target device can be detected for legitimacy according to the device serial number, the target master key and the target authentication key.
[0061] S140: The target device is detected for legitimacy according to the device serial number, the target master key and the target authentication key, and a detection result is obtained. Whether the target device is legitimate is determined according to the detection result.
[0062] In this step, after S130 obtains the target authentication key in the target registration record and the target master key corresponding to the target device, the target device can be detected for legitimacy according to the device serial number, the target master key and the target authentication key, and whether the target device is legitimate is determined according to the detection result.
[0063] Specifically, the device serial number and the target master key can be symmetrically encrypted by using a symmetric encryption algorithm agreed in advance, so as to obtain an encryption result. Then, the encryption result is compared with the target authentication key obtained from the target registration record. If they are consistent, it means that the target device is legitimate, and the system can agree to its connection request; if they are inconsistent, it means that the target device is not legitimate, and the system should refuse its connection request. This comparison method is not only efficient, but also can accurately judge the legitimacy of the device, effectively preventing illegal devices from accessing the system.
[0064] S150: If it does not exist, it is determined that the target device is not legitimate, and the connection is refused.
[0065] In this step, after S120 finds whether the target registration record corresponding to the device serial number exists in the database, if the target registration record corresponding to the device serial number does not exist in the database, it means that the current target device is illegally accessed, i.e. the target device is not legitimate, and the connection can be refused at this time.
[0066] After the system refuses the connection, the attempt of this illegal access can also be recorded, including the time of the attempt to connect, the device serial number of the target device (if part of the information can be obtained) and other related data. These records are of great significance for subsequent security analysis and system optimization. For example, by analyzing the time law of illegal access, it can be judged whether there is an organized attack behavior; by analyzing the characteristics of the device serial number of the illegal device, the type of device that the attacker may use can be further understood, so that the security protection measures can be targetedly strengthened.
[0067] Simultaneously, the system can be configured with an alarm mechanism to promptly send alerts to the administrator upon detecting unauthorized access, enabling the administrator to take swift action and ensure the system's secure and stable operation. Furthermore, to address potential misjudgments, the system provides an appeal channel, allowing legitimate users whose devices are mistakenly identified as unauthorized to appeal. Administrators can then manually review these appeals to ensure the system's fairness and accuracy.
[0068] In the above embodiments, when a connection request is received from a target device, the device serial number of the target device contained in the connection request can be obtained, and a database can be searched to see if a target registration record corresponding to the device serial number exists. The database of this application stores registration records corresponding to the device serial numbers and authentication keys of different devices. The authentication key for each device is generated by encrypting the device serial number and master key of that device. Therefore, when a target registration record corresponding to the device serial number exists in the database, the target authentication key and the target master key corresponding to the target device in the target registration record can be obtained. Then, the legality of the target device is checked based on the device serial number, target master key, and target authentication key, and the detection result is obtained. Based on the detection result, it is determined whether the target device is legitimate. If it does not exist, the target device can be directly determined to be illegitimate, and the connection is rejected. In this process, this application effectively improves the security of device authentication and reduces the risk of being cracked by generating the authentication key using an encryption method combining the device serial number and master key. At the same time, this solution does not require additional hardware support and can be implemented only through software-level encryption algorithms and key management, thereby significantly reducing deployment costs and improving implementation convenience. In practical applications, this method can quickly respond to device connection requests, efficiently complete legitimacy checks, and ensure that only authorized legitimate devices can access the system, providing a strong guarantee for the safe and stable operation of the system.
[0069] In one embodiment, such as Figure 2 As shown, Figure 2 This is a schematic diagram illustrating the authentication key generation process provided in the embodiments of this application; the authentication key generation process for each device in S120 may include:
[0070] S210: For each device: Retrieve the pre-entered device serial number of the device.
[0071] S211: Obtain the 32-bit random code pre-generated by the random generator and use the 32-bit random code as the master key.
[0072] S212: Use a preset symmetric encryption algorithm to symmetrically encrypt the device serial number and master key to obtain the authentication key.
[0073] In this embodiment, for each device, when generating the authentication key, it is first necessary to obtain the device serial number of the device that has been pre-entered. This serial number serves as the unique identifier of the device and is the basic data for the subsequent encryption process.
[0074] Next, the system can pre-generate a 32-bit random code using a random generator, and use this random code as the master key. The randomness of the master key ensures that each generated key is highly unpredictable, thereby enhancing the system's security.
[0075] Subsequently, the system can use a preset symmetric encryption algorithm to symmetrically encrypt the device serial number and master key. The symmetric encryption algorithm is chosen based on its high encryption strength and fast processing speed, ensuring the security and integrity of data during the encryption process. Through this encryption process, the system obtains an authentication key closely related to the device serial number and master key, which will be used for subsequent device legitimacy verification.
[0076] In the above embodiments, the entire authentication key generation process is not only efficient, but also ensures that each device has a unique authentication key, thereby effectively preventing unauthorized devices from accessing the device.
[0077] In one embodiment, the method may further include:
[0078] S212: Perform secondary scrambling encryption on the master key to obtain the encrypted master key.
[0079] S213: Compile the encrypted master key and the corresponding decryption code into this software program.
[0080] In this embodiment, to further enhance the security of the master key, the system can perform secondary scrambling encryption on the master key. This encryption process employs a more complex encryption algorithm or scrambling mechanism, making the master key more difficult to steal or crack during storage and transmission. Through secondary scrambling encryption, the system obtains an encrypted master key, which has higher security than the original master key.
[0081] Subsequently, the system compiles the encrypted master key and its corresponding decryption code into the software program. This design ensures that even if the software program is illegally obtained, attackers cannot directly obtain the original master key, because they need the decryption code to decrypt the encrypted master key. The decryption code, as part of the software program, is protected by the software's own security mechanisms.
[0082] By compiling the encrypted master key and decryption code into the software program, the system achieves secure storage and transmission of the master key. In actual application, when device legitimacy detection is needed, the system can extract the encrypted master key from the software program and decrypt it using the decryption code to obtain the original master key. Subsequently, the system can use this master key to perform symmetric encryption with the device serial number to generate an authentication key and complete the subsequent device legitimacy detection process.
[0083] This embodiment not only enhances the security of the master key, but also ensures the robustness of the software program when dealing with potential security threats. By compiling the encryption and decryption code twice, the system effectively prevents the leakage and illegal use of the master key, providing more reliable security for device legitimacy detection.
[0084] In one embodiment, obtaining the target master key corresponding to the target device in S130 can include:
[0085] S131: Obtain the target decryption code pre-compiled in the software program and the encrypted master key.
[0086] S132: Restore the target master key corresponding to the encrypted master key in memory through the target decryption code.
[0087] In this embodiment, when obtaining the target master key corresponding to the target device, the system can first obtain the pre-compiled target decryption code from the software program and extract the encrypted master key. This decryption code is specifically designed to restore the target master key encrypted twice during software compilation. The system decrypts the encrypted master key in memory environment by calling this target decryption code. Since the decryption process is dynamically completed in memory, it can effectively avoid leaving traces of the decrypted master key on storage media, further enhancing the security of the system. After decryption is completed, the target decryption code and the encrypted master key in memory can be cleared to prevent core keys from being extracted.
[0088] Through the action of the target decryption code, the system successfully restores the target master key corresponding to the target device in memory. This master key will be used to compare with the target authentication key obtained from the target registration record and the device serial number to complete the legitimacy detection of the target device. This process ensures that only legitimate devices with correct decryption code and corresponding master key can pass the system's legitimacy detection and access the system, providing a solid guarantee for the overall security of the system.
[0089] In one embodiment, the legitimacy of the target device is detected according to the device serial number, the target master key and the target authentication key in S140, and a detection result is obtained, which can include:
[0090] S141: symmetrically encrypting the device serial number and the target master key using a pre-agreed symmetric encryption algorithm to obtain an encryption result.
[0091] S142: comparing the encryption result with the target authentication key to detect the legitimacy of the target device and obtain a detection result.
[0092] In this embodiment, when performing legitimacy detection, the system first symmetrically encrypts the device serial number and the target master key using a pre-agreed symmetric encryption algorithm. This encryption process is the same as the algorithm used when generating the authentication key, ensuring consistency and comparability of the encryption result. Through symmetric encryption, the system obtains an encryption result closely related to the device serial number and the target master key.
[0093] Subsequently, the system compares this encryption result with the target authentication key obtained from the target registration record. This comparison is based on the uniqueness of the encryption result and the uniqueness of the authentication key. If the encryption result is completely consistent with the target authentication key, it means that the target device is legitimate, because only legitimate devices can have an authentication key matching the device serial number and the target master key. At this time, the system can determine that the target device passes the legitimacy detection and allows it to access the system.
[0094] On the contrary, if the encryption result does not match the target authentication key, it means that the target device is not legitimate. This may be because the target device is an illegal device trying to access the system by forging the device serial number or the authentication key, or because the authentication key of the target device has expired or been revoked. In any case, the system should reject the connection request of the target device and record this attempt of illegal access for subsequent security analysis and processing.
[0095] Through this comparison method, the system can efficiently and accurately complete the legitimacy detection of the target device. This detection method not only utilizes the uniqueness of the device serial number and the master key, but also enhances the security of the detection through the encryption algorithm. At the same time, since the symmetric encryption algorithm has the characteristics of high encryption strength and fast operation speed, this detection method has high efficiency and reliability in practical application.
[0096] In one embodiment, the legitimacy of the target device is determined according to the detection result in S140, which can include:
[0097] S143: If the detection result shows that the encryption result is consistent with the target authentication key, then the target device is determined to be legitimate, and connection is agreed upon.
[0098] S144: If the detection result is that the encryption result is inconsistent with the target authentication key, then the target device is determined to be illegitimate and the connection is refused.
[0099] In this embodiment, the system can determine the legitimacy of a target device by comparing the encryption result with the target authentication key. When the encryption result is completely consistent with the target authentication key, it indicates that the target device possesses the correct device serial number and master key combination. Therefore, the system determines that the target device is a legitimate device and grants its connection request. This determination mechanism ensures that only authorized legitimate devices can access the system, thereby effectively maintaining the system's security and stability.
[0100] Conversely, if the encryption result does not match the target authentication key, the system determines the target device to be illegitimate and rejects its connection request. This inconsistency may be due to the target device being an illegitimate device attempting to access the system by forging or tampering with its serial number, master key, or authentication key; or it may be because the target device's authentication key has expired, been revoked, or exhibits other abnormalities. Regardless of the reason, the system should resolutely reject connection requests from illegitimate devices to prevent potential security threats.
[0101] Through this explicit judgment mechanism, the system can quickly and accurately complete the legitimacy detection of target devices. This not only improves the system's security protection capabilities but also provides users with a more reliable and stable system environment. Furthermore, this mechanism offers excellent flexibility and scalability, allowing for customization and optimization to meet the security requirements of different scenarios.
[0102] In one embodiment, such as Figure 3 As shown, Figure 3 This is a schematic diagram illustrating the process of updating the master key and authentication key according to an embodiment of this application; the method may further include:
[0103] S160: If a target registration record corresponding to the device serial number exists in the database, but the target device is invalid or there are other illegal behaviors, then the random generator is called to generate a new 32-bit random code, and the new 32-bit random code is used as the new master key.
[0104] S170: Use a preset symmetric encryption algorithm to symmetrically encrypt the device serial number and the new master key of each legitimate device to obtain the new authentication key for each legitimate device.
[0105] S180: Update the registration records in the database based on the new authentication keys of each legitimate device, and update the software program based on the new master key.
[0106] In this embodiment, when the system detects a target registration record in the database corresponding to a device serial number, but the target device is deemed illegitimate, or the system detects other illegal activities, the system will initiate a master key and authentication key update process to ensure the system's continued security and stability. First, the system can call its built-in random generator to generate a new 32-bit random code. This random code will serve as the new master key; its randomness ensures a high degree of unpredictability of the new key, thereby enhancing the system's security.
[0107] Next, the system uses a preset symmetric encryption algorithm to symmetrically encrypt the device serial number and the new master key of each legitimate device. This process is similar to the initial generation of the authentication key, ensuring a tight association between the new authentication key and the device serial number and the new master key. Through this encryption process, the system obtains new authentication keys for each legitimate device, which will be used for subsequent device legitimacy checks.
[0108] Subsequently, the system can update the registration records in the database based on the new authentication keys of each legitimate device. This update operation ensures that the authentication keys stored in the database are consistent with the keys actually used, thereby avoiding failure of legitimacy detection due to key inconsistencies. Simultaneously, the system can also update the software program based on the new master key, compiling the new encrypted master key and its corresponding decryption code into the software program, ensuring the robustness of the software program in the face of potential security threats.
[0109] This key update mechanism allows the system to quickly respond and update the key when it detects unauthorized activity or illegitimate devices, effectively preventing the re-access of unauthorized devices and potential security threats. This mechanism not only enhances the system's security capabilities but also provides users with a more reliable and stable system environment.
[0110] The device legality detection apparatus provided in the embodiments of this application will be described below. The device legality detection apparatus described below can be referred to in correspondence with the device legality detection method described above.
[0111] In one embodiment, such as Figure 4 As shown, Figure 4A structural schematic diagram of a device legality detection apparatus provided by an embodiment of the present application; the present application also provides a device legality detection apparatus, which can include a serial number acquisition module 210, a record searching module 220, a key acquisition module 230, a legality detection module 240 and a connection rejection module 250, and specifically includes the following:
[0112] The serial number acquisition module 210 is used for acquiring the device serial number of the target device contained in the connection request when the connection request sent by the target device is received.
[0113] The record searching module 220 is used for searching the database to find whether there is a target registration record corresponding to the device serial number, wherein the database stores registration records corresponding to the device serial numbers and authentication keys of different devices, and the authentication key of each device is generated by encrypting the device serial number and the master key of the device.
[0114] The key acquisition module 230 is used for acquiring the target authentication key in the target registration record and the target master key corresponding to the target device if the target registration record exists.
[0115] The legality detection module 240 is used for performing legality detection on the target device according to the device serial number, the target master key and the target authentication key, and obtaining a detection result, and determining whether the target device is legal according to the detection result.
[0116] The connection rejection module 250 is used for determining that the target device is not legal and rejecting the connection if the target registration record does not exist.
[0117] In the above embodiments, when receiving the connection request sent by the target device, the device serial number of the target device included in the connection request can be acquired, and it is determined whether the target registration record corresponding to the device serial number exists in the database. The database of the present application stores the registration records corresponding to the device serial numbers and the authentication keys of different devices. The authentication key of each device is generated by encrypting the device serial number and the master key of the device. Therefore, when the target registration record corresponding to the device serial number exists in the database, the target authentication key in the target registration record and the target master key corresponding to the target device can be acquired, and then the target device is detected for legitimacy according to the device serial number, the target master key and the target authentication key, and a detection result is obtained. According to the detection result, it is determined whether the target device is legitimate. If not, it is directly determined that the target device is not legitimate, and the connection is rejected. In this process, the authentication key is generated by using the encryption mode of combining the device serial number and the master key, which effectively improves the security of device identity verification and reduces the risk of being cracked. At the same time, this scheme does not require additional hardware support, and can be realized only by using encryption algorithms and key management at the software level, thereby significantly reducing the deployment cost and improving the implementation convenience. In practical applications, this method can quickly respond to the connection request of the device, efficiently complete the legitimacy detection, and ensure that only the authorized legitimate device can access the system, thereby providing a powerful guarantee for the safe and stable operation of the system.
[0118] In one embodiment, the present application further provides a computer readable storage medium, wherein computer readable instructions are stored in the computer readable storage medium, and the computer readable instructions are executed by one or more processors to make the one or more processors execute the steps of the device legitimacy detection method in any one of the above embodiments.
[0119] In one embodiment, the present application further provides a computer device, comprising one or more processors and a memory.
[0120] The memory stores computer readable instructions, and the computer readable instructions are executed by the one or more processors to execute the steps of the device legitimacy detection method in any one of the above embodiments.
[0121] As shown in Figure 5 , Figure 5 Fig. 1 shows an internal structure schematic diagram of a computer device provided by an embodiment of the present application. The computer device 300 can be provided as a server. Referring to Figure 5The computer device 300 includes a processing component 302, which further includes one or more processors, and memory resources represented by memory 301 for storing instructions, such as application programs, that can be executed by the processing component 302. The application programs stored in memory 301 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 302 is configured to execute instructions to perform the device legitimacy detection method of any of the above embodiments.
[0122] The computer device 300 may also include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate on an operating system stored in memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.
[0123] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0124] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0125] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.
[0126] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting the legality of equipment, characterized in that, The method includes: When a connection request is received from the target device, the device serial number of the target device contained in the connection request is obtained; The database is searched to see if a target registration record corresponding to the device serial number exists. The database stores registration records corresponding to device serial numbers and authentication keys of different devices. The authentication key for each device is generated by encrypting the device serial number and master key of the device. If it exists, then obtain the target authentication key from the target registration record, and the target master key corresponding to the target device; The target device is validated based on its serial number, target master key, and target authentication key. The validation result is then used to determine whether the target device is valid. If the target device does not exist, it is determined to be invalid, and the connection is refused.
2. The equipment legality detection method according to claim 1, characterized in that, The process of generating authentication keys for each device includes: For each device: Retrieve the pre-entered device serial number; Obtain the 32-bit random code pre-generated by the random generator, and use the 32-bit random code as the master key; The device serial number and the master key are symmetrically encrypted using a preset symmetric encryption algorithm to obtain the authentication key.
3. The method for detecting the legality of equipment according to claim 1 or 2, characterized in that, The method further includes: The master key is then subjected to secondary scrambling encryption to obtain the encrypted master key. The encrypted master key and the corresponding decryption code are compiled into this software program.
4. The equipment legality detection method according to claim 3, characterized in that, The step of obtaining the target master key corresponding to the target device includes: Obtain the pre-compiled target decryption code and the encrypted master key from this software program; The target decryption code is used to restore the target master key corresponding to the encrypted master key in memory.
5. The equipment legality detection method according to claim 1, characterized in that, The step of performing a legitimacy check on the target device based on the device serial number, the target master key, and the target authentication key, and obtaining the check result, includes: The device serial number and the target master key are symmetrically encrypted using a pre-agreed symmetric encryption algorithm to obtain the encryption result; The encryption result is compared with the target authentication key to perform a legitimacy check on the target device and obtain the check result.
6. The equipment legality detection method according to claim 5, characterized in that, The step of determining whether the target device is legitimate based on the detection results includes: If the detection result shows that the encryption result matches the target authentication key, then the target device is determined to be legitimate, and connection is agreed upon. If the detection result shows that the encryption result is inconsistent with the target authentication key, then the target device is determined to be illegitimate, and the connection is refused.
7. The method for detecting the legality of equipment according to claim 1 or 6, characterized in that, The method further includes: If a target registration record corresponding to the device serial number exists in the database, but the target device is illegitimate or there are other illegal behaviors, then the random generator is invoked to generate a new 32-bit random code, and the new 32-bit random code is used as the new master key. The device serial number of each legitimate device and the new master key are symmetrically encrypted using a preset symmetric encryption algorithm to obtain a new authentication key for each legitimate device. The registration records in the database are updated based on the new authentication keys of each legitimate device, and the software program is updated based on the new master key.
8. A device for detecting the legality of equipment, characterized in that, include: The serial number acquisition module is used to acquire the device serial number of the target device contained in the connection request when a connection request is received from the target device. The record search module is used to search the database for the existence of a target registration record corresponding to the device serial number. The database stores registration records corresponding to the device serial numbers and authentication keys of different devices. The authentication key of each device is generated by encrypting the device serial number and master key of the device. The key acquisition module is used to acquire, if present, the target authentication key in the target registration record and the target master key corresponding to the target device; The legitimacy detection module is used to perform legitimacy detection on the target device based on the device serial number, the target master key, and the target authentication key, obtain the detection result, and determine whether the target device is legitimate based on the detection result; The connection rejection module is used to determine that the target device is invalid and refuse connection if it does not exist.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the device legitimacy detection method as described in any one of claims 1 to 7.
10. A computer device, characterized in that, include: One or more processors, and memory; The memory stores computer-readable instructions, which, when executed by the one or more processors, perform the steps of the device legitimacy detection method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Data transmission method of Internet of Things device, Internet of things device and authentication platform
CN108833101A
Method for authenticating IoT device based on shared key
CN110571922A
Server system authentication method and device, electronic computer and storage medium
CN112347462A
Terminal authentication method and apparatus, computer device, and storage medium
WO2022111187A1