A method, device, equipment and medium for determining pirated equipment
By obtaining the information and ciphertext of the device firmware and using public key decryption to generate the device fingerprint for comparison, the problem of low accuracy of pirated devices in the prior art is solved, and accurate identification of pirated devices and rejection of copy signal generation is achieved.
Patent Information
- Application Number
- CN202311511439.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-13
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2043-11-13
AI Technical Summary
In the prior art, the accuracy of pirated equipment is low and it is impossible to effectively distinguish between legal equipment and pirated equipment.
By obtaining the information and ciphertext of the actual device where the device firmware is located, using the public key to decrypt the target fingerprint to generate the key, generate the device fingerprint based on the key and device information, and compare it with the expected fingerprint. If it does not match, it is determined to be pirated. equipment.
Improve the accurate judgment of pirated devices, avoid the risk of unauthorized users obtaining fingerprints to generate keys, and achieve higher accuracy.
Smart Images

Figure CN117436060B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of chip data processing, and in particular to a method, apparatus, device and medium for determining pirated devices. Background Art
[0002] With the advancement and development of science and technology, smart devices have been widely used in people's lives. The device firmware in smart devices is responsible for controlling the interaction between the various components and parts of the hardware devices, and can coordinate the work between the hardware devices and the software system. It can be seen that the device firmware plays an important role in the normal operation of smart devices.
[0003] In the related art, the CPU identifier of the device firmware is directly used as the unique number, and the above unique number is matched with the device's authorization certificate file of the device firmware, wherein each unique number corresponds to a unique authorization certificate file. When the unique number and the authorization certificate file match successfully, then; however, the unique number of the device firmware can be changed using a hook function to complete the matching of the unique number and the authorization certificate file of the actual device, and the pirated device is determined as a non-pirated device. It can be seen that the accuracy of determining pirated devices in the related art is low. Summary of the invention
[0004] In order to improve the accuracy of identifying pirated devices, the present application provides a pirated device identification method, apparatus, device and medium.
[0005] In a first aspect, the present application provides a method for determining a pirated device, which adopts the following technical solution:
[0006] A method for determining a pirated device, comprising:
[0007] When it is detected that the device where the device firmware is actually located is started, first device information and ciphertext of the device where the device firmware is actually located are obtained;
[0008] Obtaining a public key, and decrypting based on the public key and the ciphertext to obtain a target fingerprint generation key in the ciphertext, where the target fingerprint generation key is an authorized fingerprint generation key capable of generating a device fingerprint;
[0009] generating a first device fingerprint based on the target fingerprint generation key and the first device information;
[0010] Obtaining a second device fingerprint, and determining whether the first device fingerprint is the same as the second device fingerprint;
[0011] If the first device fingerprint is different from the second device fingerprint, it is determined that the actual device is a pirated device, and a copy rejection signal is generated.
[0012] In a preferred example, the present application may be further configured as follows: generating a first device fingerprint based on the target fingerprint generating key and the first device information includes:
[0013] Using the target fingerprint to generate a key, a hash operation is performed on the first device information to obtain an initial hash value;
[0014] Acquire the production information of the actual device, and encrypt the production information to obtain a password string corresponding to the production information;
[0015] A combined character string is generated based on the password string and the initial hash value, and a hash operation is performed on the combined character string to obtain a second hash value, and then the first device fingerprint is generated according to the second hash value.
[0016] In a preferred example, the present application may be further configured as follows: generating a combined string based on the password string and the initial hash value includes:
[0017] Placing the password string at a first preset combination position and the initial hash value at a second preset combination position to obtain an initial combination string;
[0018] Performing a hash operation on the initial combined character string to obtain a third hash value;
[0019] The third Hash value is combined with the initial Hash value to generate the combined character string.
[0020] In a preferred example, the present application may be further configured as follows: before generating a combined string based on the password string and the initial hash value, the application may further include:
[0021] Identify the initial hash value to obtain the character length value of the initial hash value and the occurrence frequencies of all characters respectively;
[0022] Based on the correspondence between the preset length value and the character conversion quantity and the character length value, determining the target character conversion quantity corresponding to the character length value;
[0023] Determining a number of target characters based on the occurrence frequencies corresponding to all the characters and the number of target character conversions;
[0024] Convert the target character in the initial hash value to obtain a converted initial hash value;
[0025] Accordingly, the generating of a combined string based on the password string and the initial hash value includes:
[0026] A combined character string is generated based on the password string and the converted initial hash value.
[0027] In a preferred example, the present application may be further configured to obtain first device information of the device where the device firmware is actually located, including:
[0028] Acquire multiple pieces of first initial device information of the actual device and their corresponding update attributes;
[0029] Based on the update attributes corresponding to the plurality of first initial device information, a plurality of second initial device information is screened out from the plurality of first initial device information, wherein the second initial device information is fixed device information;
[0030] Obtaining weight values corresponding to each of the plurality of second initial device information, and determining target device information from the plurality of second initial device information according to the weight values corresponding to each of the plurality of second initial device information;
[0031] The target device information is determined as the first device information.
[0032] In a preferred example, the present application may be further configured as follows: before generating a key based on the target fingerprint and generating the first device fingerprint based on the first device information, the method further includes:
[0033] Determine the device information character length of the first device information;
[0034] Determining a target conversion format corresponding to the first device information length based on a preset correspondence between character length and conversion format and the device information character length;
[0035] Converting the current format of the first device information into the target conversion format;
[0036] Accordingly, generating a first device fingerprint based on the target fingerprint generation key and the first device information includes:
[0037] A first device fingerprint is generated based on the target fingerprint generation key and the first device information after format conversion.
[0038] In a preferred example, the present application may be further configured as follows: after obtaining the first device information and ciphertext of the device where the device firmware is actually located, the method further includes:
[0039] Get multiple stored device information;
[0040] Based on the plurality of stored device information and the first device information, determining whether there is target stored device information, the target stored device information being the same as the first device information;
[0041] If so, a copy rejection signal is generated; otherwise, the public key acquisition is performed.
[0042] In a second aspect, the present application provides a device for determining a pirated device, which adopts the following technical solution:
[0043] A device for determining a pirated device, comprising:
[0044] An acquisition module, configured to acquire first device information and ciphertext of the device actually containing the device firmware when detecting that the device actually containing the device firmware is started;
[0045] A target fingerprint generation key acquisition module is used to obtain a public key, and decrypt based on the public key and the ciphertext to obtain a target fingerprint generation key in the ciphertext, where the target fingerprint generation key is an authorized fingerprint generation key capable of generating a device fingerprint;
[0046] A first device fingerprint generating module, configured to generate a first device fingerprint based on the target fingerprint generating key and the first device information;
[0047] A judgment module, used for obtaining a second device fingerprint and determining whether the first device fingerprint is the same as the second device fingerprint; if the first device fingerprint is different from the second device fingerprint, triggering a pirated device determination module;
[0048] The pirated device determination module is used to determine that the actual device is a pirated device and generate a copy rejection signal.
[0049] In a third aspect, the present application provides an electronic device, which adopts the following technical solution:
[0050] at least one processor;
[0051] Memory;
[0052] 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 pirated device determination method as described in any one of the first aspects.
[0053] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:
[0054] A computer-readable storage medium stores a computer program, which, when executed in a computer, causes the computer to execute the pirated device identification method as described in any one of the first aspects.
[0055] In summary, this application includes the following beneficial technical effects:
[0056] Obtaining first device information, ciphertext and public key, using the public key to decrypt the ciphertext and obtain a target fingerprint generation key, can effectively prevent unauthorized users, i.e. users who do not have a public key, from obtaining the target fingerprint generation key; then using the decrypted target fingerprint generation key and the first device information to generate a first device fingerprint to ensure the accuracy of the first device fingerprint, and then making a judgment based on the accurate first device fingerprint and the second device fingerprint. When it is determined that the first device fingerprint is different from the second device fingerprint, it is determined that the actual device is a pirated device, so as to achieve accurate judgment of the pirated device. Compared with the related art that directly uses the CPU identifier as a unique number and matches it, the present application generates an accurate first device fingerprint under the use of a target fingerprint generation key with fingerprint generation rights, and judges the pirated device based on the accurate first device fingerprint, thereby achieving the purpose of accurately judging the pirated device, and further solving the problem of low accuracy in judging pirated devices in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A flowchart of a method for determining a pirated device provided in an embodiment of the present application.
[0058] Figure 2 A schematic diagram of a process for generating a second device fingerprint provided in an embodiment of the present application.
[0059] Figure 3 A schematic diagram of the structure of a pirated device identification apparatus provided in an embodiment of the present application.
[0060] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The following is combined with Figure 1 To Attachment Figure 4 This application is described in further detail.
[0062] 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.
[0063] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application are clearly and completely described. 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.
[0064] In addition, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, the pirated device determination and / or B can represent: the pirated device determination exists alone, the pirated device determination and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship.
[0065] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0066] The embodiment of the present application provides a method for determining a pirated device, which is executed by an electronic device, which can be a server or a terminal device, wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The terminal device can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The terminal device and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present application. Figure 1 As shown, the method includes step S101, step S102, step S103, step S104 and step S105, wherein:
[0067] Step S101: when it is detected that the device where the device firmware is actually located is started, first device information and ciphertext of the device where the device firmware is actually located are obtained.
[0068] Specifically, the startup of the actual device can be determined by boot pin detection or boot address detection, wherein the achievable method of determining the startup of the actual device according to the boot pin detection includes: reading the state of the boot pin, when the state of the boot pin is in the startup state, it can be determined that the actual device is in the startup state, otherwise, it is in the non-startup state. In another achievable method, the achievable method of determining the startup of the actual device according to the boot address detection includes: setting a reading program to read a preset startup address, and obtaining a reading result, and the reading result includes: the actual device is started or the actual device is not started. Among them, the embodiment of the present application does not limit the above-mentioned preset startup address, and the user can set it by himself. The acquisition of device information can be realized by a preset calling function. In the embodiment of the present application, preferably, the preset calling function is an API (Application Programming InterfAce, application program interface) function. In the embodiment of the present application, the first device information is multiple, including at least: device MAC address, device serial number, device model, device function, device manufacturer and device operating system, etc. The device function includes at least: USB interface and wireless function. Further, multiple first device information and ciphertext can be obtained from the storage chip of the actual device, and the target first device information can be determined from the above multiple first device information. The feasible method of determining the target first device information can refer to the following embodiment; the first device information can be obtained from the device information database, and the above device information database stores multiple device identifiers and the first device information corresponding to each device, so the device identifier of the actual device can be matched with the device identifier in the above device information database one by one to obtain the first device information. Among them, the ciphertext is the target fingerprint generation key encrypted with the preset private key.
[0069] Step S102: Obtain the public key, and decrypt based on the public key and the ciphertext to obtain the target fingerprint generation key in the ciphertext, where the target fingerprint generation key is an authorized fingerprint generation key that can generate a device fingerprint.
[0070] Specifically, it can be obtained from a preset universal password KEY library, which is pre-set by a technician and input into the electronic device, and the public key is a public key corresponding to the private key in step S101. In the embodiment of the present application, the RSA algorithm is preferably used to generate the private key and the public key. The embodiment of the present application does not limit the decryption process, and the target fingerprint generation key can be obtained. It is understandable that by using the public key corresponding to the private key to decrypt, unauthorized users or devices can be prevented from obtaining the target fingerprint generation key, so as to effectively improve the security of the target fingerprint generation key.
[0071] Step S103: Generate a first device fingerprint based on the target fingerprint generation key and the first device information.
[0072] Specifically, generating a key based on the target fingerprint and generating a first device fingerprint based on the first device information can refer to the following embodiments. It can be understood that the above-mentioned first device information is fixed device information, and the first device information will not change with the upgrade or replacement of the device. Generating the first device fingerprint based on the fixed device information can ensure the uniqueness and fixity of the first device fingerprint, and avoid the problem of the first device fingerprint not matching the first device information due to changes in the first device information.
[0073] Step S104: Obtain the second device fingerprint, and determine whether the first device fingerprint is the same as the second device fingerprint.
[0074] Specifically, the second device fingerprint is the device where the device firmware is expected to be located, that is, a non-pirated device, which can be obtained from the storage chip where the device firmware is located, wherein the second device fingerprint is generated based on the second device information, the second device information is the device information corresponding to the device where the device firmware is expected to be located, and the second device fingerprint is generated in the same manner as the first device fingerprint in this application. By generating the device fingerprint in the same manner, it is possible to avoid the problem of generating an erroneous device fingerprint due to different device fingerprint generation methods, and causing incorrect judgments. It can be understood that the second device fingerprint is generated by the second device fingerprint device, and the second device fingerprint device can use the above-mentioned private key to encrypt the fingerprint generation key to generate the above-mentioned ciphertext; further, the above-mentioned private key can be stored by the second device fingerprint to reduce the incidence of the second device fingerprint being stolen due to the theft of the private key. Figure 2 A flow chart of generating a second device fingerprint provided in an embodiment of the present application; wherein, a character matching algorithm can be used to implement the judgment of the first device fingerprint and the second device fingerprint, and the embodiment of the present application does not limit the specific process of the above character matching algorithm. When the first device fingerprint is the same as the second device fingerprint, it can be determined that the device where the memory is actually located is the preset expected device; otherwise, step S105 is executed, indicating that the actual device where the device firmware is located is not the preset expected device. In the embodiment of the present application, the device can be an AP (Access Point) or a router, and the device includes: an expected device or an actual device.
[0075] Step S105: If the first device fingerprint is different from the second device fingerprint, it is determined that the actual device is a pirated device, and a copy rejection signal is generated.
[0076] Specifically, when it is determined that the device where the memory is actually located is not the expected device, it indicates that the memory has a high probability of being stolen. Furthermore, a copy rejection reminder signal can be generated to remind the relevant operator that the device is a stolen device and prohibit the operator from continuing to perform the copy operation. If the first device fingerprint is the same as the second device fingerprint, it indicates that the actual device is not a pirated device.
[0077] In the embodiment of the present application, the first device information, ciphertext and public key are obtained, the ciphertext is decrypted using the public key to obtain the target fingerprint generation key, which can effectively prevent unauthorized users, i.e. users who do not have the public key, from obtaining the fingerprint generation key; the fingerprint generation key obtained after decryption and the first device information are then used to generate the first device fingerprint to ensure the accuracy of the first device fingerprint, and then a judgment is made based on the accurate first device fingerprint and the second device fingerprint. When it is determined that the first device fingerprint is different from the second device fingerprint, it is determined that the actual device is a pirated device, so as to achieve accurate judgment of the pirated device. Compared with the related art that directly uses the CPU identifier as the unique number and matches it, the present application generates an accurate first device fingerprint under the use of a target fingerprint generation key with fingerprint generation rights, and judges the pirated device based on the accurate first device fingerprint, thereby achieving the purpose of accurately judging the pirated device, and further solving the problem of low accuracy in judging pirated devices in the related art.
[0078] In a possible implementation of the embodiment of the present application, step S102 generates a first device fingerprint based on a target fingerprint generation key and first device information, including:
[0079] Using the target fingerprint to generate a key, a hash operation is performed on the first device information to obtain an initial hash value;
[0080] Obtain the actual production information of the device, encrypt the production information, and obtain the password string corresponding to the production information;
[0081] A combined character string is generated based on the password string and the initial hash value, and a hash operation is performed on the combined character string to obtain a second hash value, and then a first device fingerprint is generated according to the second hash value.
[0082] Specifically, the embodiment of the present application does not limit the specific process of the hash operation of the first device information, and the user can set it by himself to obtain the initial hash value. The production information can be a manufacturer identification, or a number corresponding to the manufacturer. The encryption of the production information can be achieved using a preset encryption algorithm, which can be: a hash operation encryption method, a symmetric encryption method, or an asymmetric encryption method. The embodiment of the present application does not limit the specific preset encryption algorithm and encryption process, and the user can set it by himself, and can obtain a password string, which is a string composed of several characters. The achievable method of combining the password string with the first device information can refer to the following embodiment, and then a combined string can be obtained. It can be understood that, compared with a single first device information, by combining the password string with the first device information, the complexity of the combined string can be effectively improved to further improve security. And the production information of each actual device is unique, and the information with fixed attributes is combined with the first device information to further improve the complexity of the string. The password string is then combined with the initial hash value. The specific combination method can refer to the following embodiment; the embodiment of the present application does not limit the specific hash operation process of the combined character string, and the user can set it by himself to obtain the second hash value; the specific implementation method of generating the first device fingerprint according to the second hash value includes: using a preset encoding method to encode the second hash value to generate the first device fingerprint, preferably, using a pirated device to determine the encoding method.
[0083] In an embodiment of the present application, a target fingerprint is used to generate a key to perform a hash operation on the first device information to obtain an initial hash value; the production information of the actual device is obtained, and the production information is encrypted to obtain a password string to improve the security of the production information; a combined character string is generated based on the password string and the initial hash value, and a hash operation is performed to obtain a second hash value. The production information of the device will not change, so the complexity of the character string can be further improved by combining and hashing the encrypted production information and the initial hash value, and then the first device fingerprint is generated based on the second hash value with higher complexity to effectively improve the complexity and security of the first device fingerprint.
[0084] A possible implementation of the embodiment of the present application is to combine the password string with the initial hash value to obtain a combined string, specifically including:
[0085] Placing the password string at a first preset combination position and the initial hash value at a second preset combination position to obtain an initial combination string;
[0086] Performing a hash operation on the initial combined string to obtain a third hash value;
[0087] The third hash value is combined with the initial hash value to generate a combined string.
[0088] Specifically, the first preset combination position and the second preset combination position are pre-set, and the combined string obtained according to the first preset combination position and the second preset combination position is: password string + initial hash value. The embodiment of the present application does not limit the hash operation process of the initial combined string, and the user can set it by himself. Then, the third hash value and the initial hash value are combined according to the preset combination method. In the embodiment of the present application, the preset combination method can be "third hash value + initial hash value" or "initial hash value + third hash value" to obtain the combined combined string.
[0089] In an embodiment of the present application, the password string is placed in a first preset combination position and the initial hash value is placed in a second preset combination position to obtain an initial combination string, so that the password string and the initial hash value can be combined in a correct combination manner, and then the initial combination string is hashed to obtain a third hash value, so as to improve the security of the initial combination string through the hash operation, and then the third hash value is combined with the initial hash value to generate a combination string, so as to further improve the security of the combination string.
[0090] A possible implementation of the embodiment of the present application further includes, before generating the combined character based on the password string and the initial hash value:
[0091] Identify the initial hash value to obtain the character length value of the initial hash value and the corresponding occurrence frequency of all characters;
[0092] Determine the target character conversion number corresponding to the character length value based on the correspondence between the preset length value and the character conversion number and the character length value;
[0093] Determine a number of target characters based on the corresponding occurrence frequencies of all characters and the number of target character conversions;
[0094] Convert the target character in the initial hash value to obtain a converted initial hash value;
[0095] Accordingly, a combined string is generated based on the password string and the initial hash value, including:
[0096] Generate a combined string based on the password string and the converted initial hash value.
[0097] Specifically, the character length value and the frequency of occurrence in the initial hash value can be identified by a character recognition algorithm, and the embodiment of the present application does not limit the specific identification process. The correspondence between the preset length value and the number of character conversions is pre-set and input by the technician, and the embodiment of the present application does not limit the specific content of the above correspondence, but as the length value increases, the number of character conversions also increases, and the complexity of the initial hash value can be further improved by converting the characters in the initial hash value. All characters are sorted in order from high to low in frequency of occurrence, and the target characters corresponding to the sorting ranking are determined according to the number of target character conversions. For example, if the number of target character conversions is 2, the characters ranked first and second in frequency of occurrence are selected as the target characters. It can be understood that in the process of generating device fingerprints, characters with higher frequency of occurrence represent specific information of the device, that is, a certain device information may appear in a certain specific mode, so selecting characters corresponding to higher frequency of occurrence as characters to be converted can ensure the uniqueness of the device fingerprint after character conversion, and avoid the situation where the device fingerprint is the same due to character conversion.
[0098] In an embodiment of the present application, the initial hash value is identified to obtain a character length value and the corresponding frequency of occurrence of all characters. The longer the character length value is, the more characters to be converted in the initial hash value are, so as to avoid the initial hash value no longer being unique due to the small number of characters to be converted. The frequency of character occurrence can represent that a certain device information may appear in a certain specific pattern, so that converting characters with a higher frequency of occurrence can still ensure the uniqueness of the initial hash value. Furthermore, a combined character string is generated according to the converted hash value and the password string to increase the complexity of the combined character string.
[0099] In a possible implementation of the embodiment of the present application, step S101 obtains first device information of the device where the device firmware is actually located, which may specifically include:
[0100] Acquire multiple pieces of first initial device information of the actual device and the corresponding update attributes;
[0101] Based on the update attributes corresponding to the multiple first initial device information, multiple second initial device information is screened out from the multiple first initial device information, where the second initial device information is fixed device information;
[0102] Obtaining weight values corresponding to each of the plurality of second initial device information, and determining target device information from the plurality of second initial device information according to the weight values corresponding to each of the plurality of second initial device information;
[0103] The target device information is determined as the first device information.
[0104] Specifically, the first initial device information at least includes: device MAC address, device serial number, device function module, device identification, device system identification and device hardware identification. Each first initial device information and the corresponding update attribute are pre-set, and the first initial device information and the update attribute can be obtained by calling the API function. The update attribute includes the first sub-update attribute or the second sub-update attribute. When the update attribute of the first initial device information is the first sub-update attribute, it indicates that the first initial device information will be updated with the upgrade of the device. When the update attribute of the first initial device information is the second sub-update attribute, it indicates that the first initial device information will not be updated with the upgrade of the device. The first initial device information with the second sub-update attribute is used as the second initial device information, which can avoid the problem of inaccurate device fingerprints due to changes in device information. The weight value corresponding to each second initial device information is pre-set by the technician based on experience and input into the electronic device; it can be arranged in descending order according to the weight value, and the second initial device information with a preset number of device information can be screened out from the second initial device information arranged in descending order. The preset number of device information is pre-set by the technician. The embodiment of the present application does not limit the preset number of device information. By screening the device information of the preset number of device information, it is possible to avoid the problem of decreased calculation efficiency due to too much second initial device information and poor calculation accuracy due to too little device information.
[0105] In an embodiment of the present application, multiple first initial device information and their corresponding update attributes are obtained, and then multiple second initial device information are determined based on their corresponding update attributes to screen out first initial device information that will not change with device updates; different second initial device information has different representativeness, so it is necessary to obtain the weight value corresponding to the second initial device information, and determine the target device information from the multiple second initial device information based on the weight value, and by taking the device information that plays a key role as a reference, the accuracy of device fingerprint generation is effectively improved.
[0106] A possible implementation of the embodiment of the present application further includes, before generating the first device fingerprint based on the fingerprint generation key and the first device information:
[0107] Determine the device information character length of the first device information;
[0108] Based on the preset correspondence between the character length and the conversion format and the character length of the device information, determining a target conversion format corresponding to the character length of the device information;
[0109] Converting the current format of the first device information into a target conversion format;
[0110] Accordingly, generating a first device fingerprint based on the fingerprint generation key and the first device information includes:
[0111] A first device fingerprint is generated based on the fingerprint generation key and the format-converted first device information.
[0112] Specifically, the character length of the device information is the character length value corresponding to the first device information, such as "mac address": "08:9b:4b:00:00:01", "sn": "12345678", "model": "ikuai-device-x1", "have_usb": 1, "have_wifi": 1, then the corresponding first device information is 08:9b:4b:00:00:01_12345678_ ikuai-device-x1_1_1, and the corresponding device information character length value is 45. The correspondence between the preset character length and the conversion format is pre-entered and stored in the electronic device by the technician, and the above correspondence is pre-set by the technician based on experience. The embodiment of the present application does not limit the above target conversion format, which may include TLV format, XML format or CSV format, etc. The character length in the above correspondence may be a length value range; it can be understood that as the character length of the device information increases, the complexity of the format conversion also increases, so converting different character lengths into different formats can effectively reduce the amount of calculation. Furthermore, the first device information is converted one by one into the corresponding target conversion formats, and correspondingly, the fingerprint generation key is used to generate the first device fingerprint for each converted first device information.
[0113] In the embodiment of the present application, as the character length of the device information increases, the complexity of the conversion of the first device information also increases. In order to reduce the complexity of the format conversion and improve the conversion efficiency, it is necessary to determine the target conversion format based on the correspondence between the preset character length and the conversion format and the character length of the device information, so as to convert the first device information into the target conversion format; and then generate the first device fingerprint based on the first device information after the format conversion, thereby further improving the generation accuracy of the first device fingerprint.
[0114] In a possible implementation of the embodiment of the present application, after step S103 obtains the first device information and ciphertext of the device where the device firmware is actually located, the method further includes:
[0115] Get multiple stored device information;
[0116] Based on the plurality of stored device information and the first device information, determining whether there is target stored device information, the target stored device information being the same as the first device information;
[0117] If so, a copy rejection signal is generated; otherwise, the public key acquisition is performed.
[0118] Specifically, the stored device information can be obtained from the preset storage device information library. When the storage device is installed on other devices other than the expected device, that is, the pirated device, the storage device can automatically record and store the device information of the other devices; multiple stored device information and the first device information are matched one by one, and then it can be determined whether the target stored device exists; it can be understood that when other users try to copy the data in the storage device on a certain device many times, by matching the device information, and when the device information is the same as the stored device information, it can avoid continuing to generate the first device fingerprint, and make a judgment based on the device fingerprint, so as to effectively improve the judgment efficiency. Further, if yes, it indicates that the user has copied data on this device before, and generates a copy rejection information; otherwise, it indicates that the user has not copied data on this device before, so it is necessary to obtain the first device information and generate the first device fingerprint for matching and judgment.
[0119] In an embodiment of the present application, multiple stored device information is obtained, and it is determined whether there is device information that is the same as the first device information based on the multiple stored device information and the first device information. When the target stored device information exists, it indicates that the memory has performed a copy operation on the device corresponding to the first device information. At this time, a copy rejection signal can be directly generated, which can effectively avoid obtaining the device information again and generating a device fingerprint for matching, thereby effectively improving the judgment efficiency.
[0120] The above-mentioned embodiment introduces a method for determining a pirated device from the perspective of a method flow, and the following embodiment introduces a device for determining a pirated device from the perspective of a virtual module or a virtual unit. Please refer to the following embodiment for details.
[0121] The present application embodiment provides a device for determining a pirated device, such as Figure 3 As shown, the pirated device determination device may specifically include:
[0122] An acquisition module 210 is used to acquire first device information and ciphertext of the device where the device firmware is actually located when it is detected that the device where the device firmware is actually located is started;
[0123] The target fingerprint generation key acquisition module 220 is used to obtain the public key and decrypt the public key and the ciphertext to obtain the target fingerprint generation key in the ciphertext. The target fingerprint generation key is an authorized fingerprint generation key that can generate device fingerprints.
[0124] A first device fingerprint generation module 230, configured to generate a first device fingerprint based on a target fingerprint generation key and first device information;
[0125] The judgment module 240 is used to obtain the second device fingerprint and determine whether the first device fingerprint is the same as the second device fingerprint; if the first device fingerprint is different from the second device fingerprint, the pirated device determination module is triggered;
[0126] The pirated device determination module 250 is used to determine that the actual device is a pirated device and generate a copy rejection signal.
[0127] In the embodiment of the present application, the first device information, ciphertext and public key are obtained, the ciphertext is decrypted using the public key to obtain the target fingerprint generation key, which can effectively prevent unauthorized users, i.e. users who do not have the public key, from obtaining the fingerprint generation key; the fingerprint generation key obtained after decryption and the first device information are then used to generate the first device fingerprint to ensure the accuracy of the first device fingerprint, and then a judgment is made based on the accurate first device fingerprint and the second device fingerprint. When it is determined that the first device fingerprint is different from the second device fingerprint, it is determined that the actual device is a pirated device, so as to achieve accurate judgment of the pirated device. Compared with the related art that directly uses the CPU identifier as the unique number and matches it, the present application generates an accurate first device fingerprint under the use of a target fingerprint generation key with fingerprint generation rights, and judges the pirated device based on the accurate first device fingerprint, thereby achieving the purpose of accurately judging the pirated device, and further solving the problem of low accuracy in judging pirated devices in the related art.
[0128] In a possible implementation of the embodiment of the present application, when the first device fingerprint generation module 230 generates the first device fingerprint based on the target fingerprint to generate the key and the first device information, it is specifically used to:
[0129] Using the target fingerprint to generate a key, a hash operation is performed on the first device information to obtain an initial hash value;
[0130] Obtain the actual production information of the device, encrypt the production information, and obtain the password string corresponding to the production information;
[0131] A combined character string is generated based on the password string and the initial hash value, and a hash operation is performed on the combined character string to obtain a second hash value, and then a first device fingerprint is generated according to the second hash value.
[0132] In a possible implementation of the embodiment of the present application, when the first device fingerprint generation module 230 generates a combined string based on the password string and the initial hash value, it is specifically used to:
[0133] Placing the password string at a first preset combination position and the initial hash value at a second preset combination position to obtain an initial combination string;
[0134] Performing a hash operation on the initial combined string to obtain a third hash value;
[0135] The third hash value is combined with the initial hash value to generate a combined string.
[0136] In a possible implementation manner of the embodiment of the present application, the apparatus for determining a pirated device further includes:
[0137] Character conversion module, used to:
[0138] Identify the initial hash value to obtain the character length value of the initial hash value and the corresponding occurrence frequency of all characters;
[0139] Determine the target character conversion number corresponding to the character length value based on the correspondence between the preset length value and the character conversion number and the character length value;
[0140] Determine a number of target characters based on the corresponding occurrence frequencies of all characters and the number of target character conversions;
[0141] Convert the target character in the initial hash value to obtain a converted initial hash value;
[0142] Accordingly, when the first device fingerprint generation module 230 generates a combined string based on the password string and the initial hash value, it is used to:
[0143] Generate a combined string based on the password string and the converted initial hash value.
[0144] In a possible implementation of the embodiment of the present application, the apparatus for determining a pirated device further includes:
[0145] The first device information acquisition module is used to:
[0146] Acquire multiple pieces of first initial device information of the actual device and the corresponding update attributes;
[0147] Based on the update attributes corresponding to the multiple first initial device information, multiple second initial device information is screened out from the multiple first initial device information, where the second initial device information is fixed device information;
[0148] Obtaining weight values corresponding to each of the plurality of second initial device information, and determining target device information from the plurality of second initial device information according to the weight values corresponding to each of the plurality of second initial device information;
[0149] The target device information is determined as the first device information.
[0150] In a possible implementation of the embodiment of the present application, the apparatus for determining a pirated device further includes:
[0151] Format conversion module, used for:
[0152] Determine the device information character length of the first device information;
[0153] Determining a target conversion format corresponding to the first device information length based on a preset correspondence between character length and conversion format and the device information character length;
[0154] Converting the current format of the first device information into a target conversion format;
[0155] Accordingly, when the first device fingerprint generation module 230 generates the first device fingerprint based on the fingerprint generation key and the first device information, it is used to:
[0156] A first device fingerprint is generated based on the fingerprint generation key and the format-converted first device information.
[0157] In a possible implementation of the embodiment of the present application, the apparatus for determining a pirated device further includes:
[0158] Inspection module for:
[0159] Get multiple stored device information;
[0160] Based on the plurality of stored device information and the first device information, determining whether there is target stored device information, the target stored device information being the same as the first device information;
[0161] If so, a copy rejection signal is generated; otherwise, the public key acquisition is performed.
[0162] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device for determining a pirated device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0163] An electronic device is provided in an embodiment of the present application, such as Figure 4 As shown, Figure 4 The electronic device 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 electronic device may further include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one, and the structure of the electronic device does not constitute a limitation on the embodiments of the present application.
[0164] The processor 301 may be a CPU (CentrAl Processing Unit), a general processor, a DSP (DigitAl SignAl Processor), an ASIC (Application Specific Integrated Circuit), a Field Programmable Gate Array (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 a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0165] 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 EIS (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.
[0166] 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 (Electric Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0167] 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.
[0168] The electronic devices include but are not limited to: mobile phones, laptops, digital broadcast receivers, PDs (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 4 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0169] The embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when it is run on a computer, the computer can execute the corresponding content in the above method embodiment. Compared with the related art, the present application obtains the first device information, ciphertext and public key, uses the public key to decrypt the ciphertext and obtains the target fingerprint generation key, which can effectively prevent unauthorized users, i.e. users without public keys, from obtaining the fingerprint generation key; then the fingerprint generation key obtained after decryption and the first device information are used to generate the first device fingerprint to ensure the accuracy of the first device fingerprint, and then the judgment is made based on the accurate first device fingerprint and the second device fingerprint. When it is determined that the first device fingerprint is different from the second device fingerprint, it is determined that the actual device is a pirated device, so as to achieve accurate judgment of the pirated device. Compared with the related art that directly uses the CPU identifier as a unique number and matches it, the present application generates an accurate first device fingerprint under the use of a target fingerprint generation key with fingerprint generation rights, and judges the pirated device based on the accurate first device fingerprint, thereby achieving the purpose of accurately judging the pirated device, and thus solving the problem of low accuracy in judging pirated devices in the related art.
[0170] 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.
[0171] The above description is only a partial implementation method 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 determining a pirated device, characterized in that: include: When it is detected that the device where the device firmware is actually located is started, first device information and ciphertext of the device where the device firmware is actually located are obtained; Obtaining a public key, and decrypting based on the public key and the ciphertext to obtain a target fingerprint generation key in the ciphertext, where the target fingerprint generation key is an authorized fingerprint generation key capable of generating a device fingerprint; generating a first device fingerprint based on the target fingerprint generation key and the first device information; Obtaining a second device fingerprint, and determining whether the first device fingerprint is the same as the second device fingerprint; If the first device fingerprint is different from the second device fingerprint, determining that the actual device is a pirated device, and generating a copy rejection signal; The generating a first device fingerprint based on the target fingerprint generating key and the first device information includes: Using the target fingerprint to generate a key, a hash operation is performed on the first device information to obtain an initial hash value; Acquire the production information of the actual device, and encrypt the production information to obtain a password string corresponding to the production information; Identify the initial hash value to obtain the character length value of the initial hash value and the occurrence frequencies of all characters respectively; Based on the correspondence between the preset length value and the character conversion quantity and the character length value, determining the target character conversion quantity corresponding to the character length value; Determining a number of target characters based on the occurrence frequencies corresponding to all the characters and the number of target character conversions; Convert the target character in the initial hash value to obtain a converted initial hash value; A combined character string is generated based on the password string and the converted initial hash value, and a hash operation is performed on the combined character string to obtain a second hash value, and then the first device fingerprint is generated according to the second hash value.
2. The method for determining a pirated device according to claim 1, characterized in that: The generating a combined character string based on the password string and the initial hash value comprises: Placing the password string at a first preset combination position and the initial hash value at a second preset combination position to obtain an initial combination string; Performing a hash operation on the initial combined character string to obtain a third hash value; The third Hash value is combined with the initial Hash value to generate the combined character string.
3. The method for determining a pirated device according to claim 1, characterized in that: Acquiring first device information of the device where the device firmware is actually located, including: Acquire multiple pieces of first initial device information of the actual device and their corresponding update attributes; Based on the update attributes corresponding to the plurality of first initial device information, a plurality of second initial device information is screened out from the plurality of first initial device information, where the second initial device information is fixed device information; Obtaining weight values corresponding to each of the plurality of second initial device information, and determining target device information from the plurality of second initial device information according to the weight values corresponding to each of the plurality of second initial device information; The target device information is determined as the first device information.
4. The method for determining a pirated device according to claim 1, characterized in that: Before generating a key based on the target fingerprint and the first device information to generate a first device fingerprint, the method further includes: Determine the device information character length of the first device information; Determining a target conversion format corresponding to the first device information length based on a preset correspondence between character length and conversion format and the device information character length; Converting the current format of the first device information into the target conversion format; Accordingly, generating a first device fingerprint based on the target fingerprint generation key and the first device information includes: A first device fingerprint is generated based on the fingerprint generation key and the first device information after format conversion.
5. The method for determining a pirated device according to claim 1, characterized in that: After obtaining the first device information and ciphertext of the device where the device firmware is actually located, the method further includes: Get multiple stored device information; Based on the plurality of stored device information and the first device information, determining whether there is target stored device information, the target stored device information being the same as the first device information; If so, a copy rejection signal is generated; otherwise, the public key acquisition is performed.
6. A device for determining a pirated device, characterized in that: include: An acquisition module, configured to acquire first device information and ciphertext of the device actually containing the device firmware when detecting that the device actually containing the device firmware is started; A target fingerprint generation key acquisition module is used to obtain a public key, and decrypt based on the public key and the ciphertext to obtain a target fingerprint generation key in the ciphertext, where the target fingerprint generation key is an authorized fingerprint generation key capable of generating a device fingerprint; A first device fingerprint generating module, configured to generate a first device fingerprint based on the target fingerprint generating key and the first device information; A judgment module, used for obtaining a second device fingerprint and determining whether the first device fingerprint is the same as the second device fingerprint; if the first device fingerprint is different from the second device fingerprint, triggering a pirated device determination module; A pirated device determination module, used to determine that the actual device is a pirated device and generate a copy rejection signal; The first device fingerprint generation module is specifically configured to perform a hash operation on the first device information using the target fingerprint generation key to obtain an initial hash value; Acquire the production information of the actual device, and encrypt the production information to obtain a password string corresponding to the production information; Identify the initial hash value to obtain the character length value of the initial hash value and the occurrence frequencies of all characters respectively; Based on the correspondence between the preset length value and the character conversion number and the character length value, determining the target character conversion number corresponding to the character length value; based on the occurrence frequencies corresponding to all the characters and the target character conversion number, determining a number of target characters; converting the target characters in the initial hash value to obtain the converted initial hash value; A combined character string is generated based on the password string and the converted initial hash value, and a hash operation is performed on the combined character string to obtain a second hash value, and then the first device fingerprint is generated according to the second hash value.
7. An electronic 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 pirated device determination method according to any one of claims 1 to 5.
8. 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 pirated device identification method according to any one of claims 1 to 5.
