Device authentication method, device, electronic device and storage medium
Through double authentication of the device's hardware serial number and network address, a key that is not easy to be cracked is generated, which solves the problem of reduced security of software authentication, ensures that the software can still be used safely after reinstalling the system, and prevents remote network access. risk.
Patent Information
- Application Number
- CN202011476655.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-15
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-12-15
AI Technical Summary
Existing software authentication methods reduce software security after the license key is leaked or the client reinstalls the system, and the stolen software can be used online in other places.
Generate a hardware identification code by obtaining the device's motherboard serial number, central processing unit serial number and hard disk serial number, and perform authentication based on the current network address to ensure double authentication of device information and generate a key that is not easily cracked to improve security.
It effectively avoids the problem that the device can still use the software after reinstalling the system, and prevents the stolen software from being used on the Internet in other places, improving the security of the software.
Smart Images

Figure CN112487502B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of security protection technology, and in particular to a device authentication method, device, electronic device and storage medium. Background Art
[0002] At present, the client where the software is located is authenticated through the license issued by the merchant. Since the license or the key of the encrypted license is easily leaked during the process of sending or storing, the software is stolen. The stolen software can still be used normally after connecting to the Internet in a different location, which reduces the security of the software. In addition, under the existing authentication method, the client can still use the software normally after reinstalling the system, which reduces the security of the software. Summary of the invention
[0003] In view of the above, it is necessary to provide a device authentication method, apparatus, electronic device and storage medium, which can improve the safe use of software on the device.
[0004] In one aspect, the present invention provides a device authentication method, the device authentication method comprising:
[0005] When receiving an authentication request, determining a device to be authenticated according to the authentication request;
[0006] Obtaining the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and reading the key value corresponding to the preset key from the registry of the device to be authenticated;
[0007] Generate a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, and use the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the motherboard serial number, the CPU serial number and the hard disk serial number;
[0008] Obtaining the current network address to which the device to be authenticated is connected, and determining the organization identification code of the organization where the device to be authenticated is located;
[0009] Querying authorization information corresponding to the organization identification code, the authorization information including a target hardware identification code and a target network address;
[0010] The hardware identification code to be authenticated and the current network address are authenticated according to the authorization information to obtain an authentication result, and the authentication request is responded to with the authentication result.
[0011] According to a preferred embodiment of the present invention, determining the device to be authenticated according to the authentication request includes:
[0012] Parsing the authentication request message to obtain data information carried by the authentication request;
[0013] Acquire a first preset tag and a second preset tag from the preset tag table, wherein the first preset tag is used to indicate a position, and the second preset tag is used to indicate a sequence number;
[0014] Acquire information corresponding to the first preset tag from the data information as a storage location, and acquire information corresponding to the second preset tag from the data information as a target code;
[0015] Obtaining an authentication device table from the storage location, and obtaining a device identifier corresponding to the target code from the authentication device table;
[0016] The device to be authenticated is determined according to the device identification.
[0017] According to a preferred embodiment of the present invention, the method further comprises:
[0018] When the key value corresponding to the preset key does not exist in the registration table, obtaining the current timestamp;
[0019] Processing the CPU serial number, the hard disk serial number and the current timestamp using a hash algorithm to obtain a universal unique identification code;
[0020] The hardware identification code of the device to be authenticated is generated by combining the motherboard serial number, the central processing unit serial number, the hard disk serial number and the universal unique identification code;
[0021] The generated hardware identification code is encrypted using the key to obtain a ciphertext corresponding to the generated hardware identification code, and the ciphertext is stored in a space corresponding to the preset key.
[0022] According to a preferred embodiment of the present invention, generating a key according to the motherboard serial number, the central processing unit serial number and the hard disk serial number includes:
[0023] Concatenate the motherboard serial number, the central processing unit serial number and the hard disk serial number to obtain a concatenated sequence;
[0024] Filling the spliced sequence until the length of the padded spliced sequence reaches a first preset value, thereby obtaining a target sequence;
[0025] Segmenting the target sequence according to the preset positions to obtain a plurality of segmentation sequences and a segmentation order, and determining a target segmentation sequence from the plurality of segmentation sequences according to the segmentation order;
[0026] Calculating the target segmentation sequence to obtain a first calculation result, and performing calculations based on other segmentation sequences in the plurality of segmentation sequences and the first calculation result to obtain a second calculation result;
[0027] The first N bits of information are extracted from the second operation result as the key, where N is a second preset value.
[0028] According to a preferred embodiment of the present invention, the querying of the authorization information corresponding to the organization identification code, the authorization information including the target hardware identification code and the target network address includes:
[0029] Determine an authentication table corresponding to the authentication request, and determine an idle thread from a preset thread pool;
[0030] Utilizing the idle thread to query the authentication table for a target list corresponding to the organization identification code;
[0031] The information in the target list is extracted as the authorization information.
[0032] According to a preferred embodiment of the present invention, the method further comprises:
[0033] When no list corresponding to the organization identification code is found in the authentication table, determining the number of bound devices of the organization and obtaining the binding threshold number of the organization;
[0034] comparing the number of bound devices with the binding threshold number;
[0035] When the number of bound devices is less than the binding threshold number, storing the organization identification code, the hardware identification code to be authenticated and the current network address in the authentication table;
[0036] When the number of bound devices is greater than or equal to the binding threshold number, it is determined that the device to be authenticated fails authentication.
[0037] According to a preferred embodiment of the present invention, the authentication of the hardware identification code to be authenticated and the current network address according to the authorization information to obtain the authentication result includes:
[0038] Traversing the authorization information, and matching the traversed authorization information with all public network addresses in the public network address database;
[0039] When the traversed authorization information matches any public network address among all the public network addresses, the traversed authorization information is determined as the target network address, and the remaining authorization information is determined as the target hardware identification code;
[0040] Calculating a first similarity between the hardware identification code to be authenticated and the target hardware identification code, and calculating a second similarity between the current network address and the target network address;
[0041] When the first similarity is greater than or equal to a similarity threshold, and the second similarity is greater than or equal to the similarity threshold, the authentication result is that the device to be authenticated passes the authentication; or
[0042] When the first similarity is less than the similarity threshold, or the second similarity is less than the similarity threshold, the authentication result is that the device to be authenticated fails the authentication.
[0043] On the other hand, the present invention further provides a device authentication apparatus, the device authentication apparatus comprising:
[0044] A determination unit, configured to determine a device to be authenticated according to the authentication request when an authentication request is received;
[0045] A reading unit, used to obtain the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and read the key value corresponding to the preset key from the registration table of the device to be authenticated;
[0046] a decryption unit, configured to generate a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, and use the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the motherboard serial number, the CPU serial number and the hard disk serial number;
[0047] The determination unit is further configured to obtain a current network address to which the device to be authenticated is connected, and determine an organization identification code of an organization where the device to be authenticated is located;
[0048] A query unit, used to query the authorization information corresponding to the organization identification code, the authorization information including the target hardware identification code and the target network address;
[0049] The authentication unit is used to authenticate the hardware identification code to be authenticated and the current network address according to the authorization information, obtain an authentication result, and respond to the authentication request with the authentication result.
[0050] On the other hand, the present invention further provides an electronic device, comprising:
[0051] a memory storing computer readable instructions; and
[0052] A processor executes the computer-readable instructions stored in the memory to implement the device authentication method.
[0053] On the other hand, the present invention further proposes a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the device authentication method.
[0054] It can be seen from the above technical solutions that the present invention can accurately determine the device that needs to be authenticated through the authentication request, and then by generating a key that is not easily cracked, the security of the key value can be improved. By authenticating the hardware identification code to be authenticated, the problem that the device to be authenticated can still use the software after reinstalling the system can be avoided. By authenticating the current network address, the problem that the software can still be used normally in a remote network after being stolen can be avoided. By double authenticating the device information on the device to be authenticated, the security of software use can be ensured. The present invention can improve the safe use of software on the device by authenticating the information on the device to be authenticated. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flow chart of a preferred embodiment of the device authentication method of the present invention.
[0056] Figure 2 The present invention is a flowchart of an embodiment of determining a device to be authenticated.
[0057] Figure 3 It is a flow chart of an embodiment of the present invention for generating a key.
[0058] Figure 4 It is a flow chart of an embodiment of querying authorization information of the present invention.
[0059] Figure 5 It is a flow chart of an embodiment of the device of the present invention for determining the authentication result.
[0060] Figure 6 It is a functional module diagram of a preferred embodiment of the device authentication device of the present invention.
[0061] Figure 7 It is a schematic diagram of the structure of an electronic device of a preferred embodiment of the device authentication method of the present invention. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0063] like Figure 1 FIG. 1 is a flow chart of a preferred embodiment of the device authentication method of the present invention. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
[0064] The device authentication method is applied to one or more electronic devices, and the electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored computer-readable instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0065] The electronic device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0066] The electronic device may include a network device and / or a user device. The network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of multiple network electronic devices, or a cloud consisting of a large number of hosts or network electronic devices based on cloud computing.
[0067] The network where the electronic device is located includes, but is not limited to: the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0068] S10: When an authentication request is received, a device to be authenticated is determined according to the authentication request.
[0069] In at least one embodiment of the present invention, the data information carried in the authentication request includes storage location, target code, etc.
[0070] The device to be authenticated refers to a client installed with software that needs to be authorized.
[0071] See also Figure 2 , Figure 2 is a flow chart of an embodiment of the present invention for determining a device to be authenticated. In at least one embodiment of the present invention, the electronic device determines the device to be authenticated according to the authentication request, including:
[0072] S100, parsing the authentication request message to obtain data information carried in the authentication request.
[0073] The data information includes, but is not limited to: a first preset tag, a storage location, a second preset tag, a target code, etc.
[0074] S101, obtaining a first preset tag and a second preset tag from a preset tag table, wherein the first preset tag is used to indicate a position, and the second preset tag is used to indicate a sequence number.
[0075] The preset tag table stores a plurality of predefined preset tags.
[0076] S102, obtaining information corresponding to the first preset tag from the data information as a storage location, and obtaining information corresponding to the second preset tag from the data information as a target code.
[0077] The storage location is used to store the location of the authentication device table. The target code is used to indicate the device identification that needs to be authenticated.
[0078] S103, obtaining an authentication device table from the storage location, and obtaining a device identification corresponding to the target code from the authentication device table.
[0079] The authentication device table stores identifiers corresponding to multiple devices. The device identifier is used to indicate the device that needs to be authenticated.
[0080] S104: Determine the device to be authenticated according to the device identifier.
[0081] By parsing the message of the authentication request without parsing the entire authentication request, the parsing efficiency of the authentication request is improved. In addition, since the data information carried by the authentication request is the storage location of the authentication device table and the target code of the device identifier in the authentication device table, the security of the authentication request can be ensured.
[0082] S11, obtaining the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and reading the key value corresponding to the preset key from the registration table of the device to be authenticated.
[0083] In at least one embodiment of the present invention, the mainboard serial number is used to indicate the mainboard of the device to be authenticated.
[0084] The central processor serial number is used to indicate the central processor of the device to be authenticated, and the hard disk serial number is used to indicate the hard disk of the device to be authenticated.
[0085] The preset key is used to indicate a hardware identification code.
[0086] In at least one embodiment of the present invention, the manner in which the electronic device obtains the mainboard serial number, the central processing unit serial number, and the hard disk serial number belongs to the prior art, and the present invention does not limit this.
[0087] In at least one embodiment of the present invention, the electronic device reading a key value corresponding to a preset key from a registration table of the device to be authenticated comprises:
[0088] traversing the registry;
[0089] When the preset key is traversed from the registration table, the key value is obtained from the space corresponding to the preset key.
[0090] S12, generating a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, using the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the motherboard serial number, the CPU serial number and the hard disk serial number.
[0091] In at least one embodiment of the present invention, the method further comprises:
[0092] When the key value corresponding to the preset key does not exist in the registration table, obtaining the current timestamp;
[0093] Processing the CPU serial number, the hard disk serial number and the current timestamp using a hash algorithm to obtain a universal unique identification code;
[0094] The hardware identification code of the device to be authenticated is generated by combining the motherboard serial number, the central processing unit serial number, the hard disk serial number and the universal unique identification code;
[0095] The generated hardware identification code is encrypted using the key to obtain a ciphertext corresponding to the generated hardware identification code, and the ciphertext is stored in a space corresponding to the preset key.
[0096] According to the above implementation, since the key value corresponding to the preset key does not exist in the registration table, that is, the device to be authenticated is not authorized, the hardware identification code is generated to authorize the device to be authenticated.
[0097] See also Figure 3 , Figure 3 is a flow chart of an embodiment of the present invention for generating a key. In at least one embodiment of the present invention, the electronic device generates a key according to the motherboard serial number, the central processing unit serial number and the hard disk serial number, including:
[0098] S120, concatenating the mainboard serial number, the central processing unit serial number, and the hard disk serial number to obtain a concatenated sequence.
[0099] In this embodiment, the electronic device can arbitrarily splice the mainboard serial number, the central processing unit serial number and the hard disk serial number to obtain the splicing sequence. The present invention does not limit the splicing order of the mainboard serial number, the central processing unit serial number and the hard disk serial number.
[0100] S121, padding the concatenated sequence until the length of the padded concatenated sequence reaches a first preset value, thereby obtaining a target sequence.
[0101] In this embodiment, the electronic device fills the lower bits of the splicing sequence with a set value, wherein the set value may be 0.
[0102] S122, dividing the target sequence according to preset positions to obtain a plurality of divided sequences and a dividing order, and determining a target divided sequence from the plurality of divided sequences according to the dividing order.
[0103] In this embodiment, the electronic device determines the segmentation sequence with the segmentation order being the first as the target segmentation sequence.
[0104] S123, computing the target segmentation sequence to obtain a first computing result, and computing according to other segmentation sequences in the plurality of segmentation sequences and the first computing result to obtain a second computing result.
[0105] In this embodiment, the electronic device may obtain the first operation result by performing an XOR operation on the target segmentation sequence, and may obtain the second operation result by performing an AND-NOT operation on the other segmentation sequences and the first operation result.
[0106] S124, extracting the first N bits of information from the second operation result as the key, where N is a second preset value.
[0107] Through the above implementation, a key that is not easily cracked can be generated, thereby improving the security of the key value.
[0108] In at least one embodiment of the present invention, the manner in which the electronic device uses the key to decrypt the key value is reversible to the manner in which the electronic device uses the key to encrypt the generated hardware identification code.
[0109] S13, obtaining the current network address to which the device to be authenticated is connected, and determining the organization identification code of the organization where the device to be authenticated is located.
[0110] In at least one embodiment of the present invention, the current network address refers to a public network address, and the organization may be any organization, for example: Hospital A, Clinic B, etc.
[0111] In at least one embodiment of the present invention, the electronic device obtains the current network address from a network list in the device to be authenticated.
[0112] In at least one embodiment of the present invention, the electronic device obtains the target software in the device to be authenticated and obtains the license of the target software. Furthermore, the electronic device determines the organization corresponding to the license as the organization where the device to be authenticated is located, and obtains the identification code corresponding to the organization where the device to be authenticated is located as the organization identification code.
[0113] Through the above implementation, the organization where the device to be authenticated is located can be accurately determined, and then the organization identification code can be accurately determined.
[0114] S14, querying the authorization information corresponding to the organization identification code, wherein the authorization information includes a target hardware identification code and a target network address.
[0115] In at least one embodiment of the present invention, the target hardware identification code is a hardware identification code confirmed and registered by the manufacturer, and the target network address is a network address confirmed and registered by the manufacturer.
[0116] See also Figure 4 , Figure 4 is a flow chart of an embodiment of the present invention for querying authorization information. In at least one embodiment of the present invention, the electronic device queries the authorization information corresponding to the organization identification code, and the authorization information includes the target hardware identification code and the target network address including:
[0117] S140, determining an authentication table corresponding to the authentication request, and determining an idle thread from a preset thread pool.
[0118] S141, using the idle thread to query the authentication table for a target list corresponding to the organization identification code.
[0119] S142: extract the information in the target list as the authorization information.
[0120] Through the above implementation, since there is no need to wait for the idle thread to process other requests, the query efficiency of the target list can be improved, and the authorization information can be accurately determined through the mapping relationship between the organization identification code and the target list.
[0121] In at least one embodiment of the present invention, the method further comprises:
[0122] When no list corresponding to the organization identification code is found in the authentication table, determining the number of bound devices of the organization and obtaining the binding threshold number of the organization;
[0123] comparing the number of bound devices with the binding threshold number;
[0124] When the number of bound devices is less than the binding threshold number, storing the organization identification code, the hardware identification code to be authenticated and the current network address in the authentication table;
[0125] When the number of bound devices is greater than or equal to the binding threshold number, it is determined that the device to be authenticated fails authentication.
[0126] Through the above implementation, the number of device bindings of the organization can be controlled, thereby avoiding redundant devices in the organization from using the software, thereby improving the safety of software use.
[0127] S15, authenticating the hardware identification code to be authenticated and the current network address according to the authorization information, obtaining an authentication result, and responding to the authentication request with the authentication result.
[0128] It should be emphasized that in order to further ensure the privacy and security of the above authentication results, the above authentication results can also be stored in a node of a blockchain.
[0129] In at least one embodiment of the present invention, the authentication result includes that the device to be authenticated passes the authentication, and that the device to be authenticated fails the authentication.
[0130] See also Figure 5 , Figure 5 The flowchart of an embodiment of the device of the present invention determining the authentication result. In at least one embodiment of the present invention, the electronic device authenticates the hardware identification code to be authenticated and the current network address according to the authorization information, and the authentication result obtained includes:
[0131] S150, traversing the authorization information, and matching the traversed authorization information with all public network addresses in the public network address database.
[0132] Wherein, the public network address library stores multiple public network addresses.
[0133] S151, when the traversed authorization information matches any public network address among all the public network addresses, the traversed authorization information is determined as the target network address, and the remaining authorization information is determined as the target hardware identification code.
[0134] Since the authorization information includes the target network address and the target hardware identification code, the electronic device can determine the target network address from the authorization information, and further can quickly determine the target hardware identification code from the authorization information.
[0135] S152, calculating a first similarity between the hardware identification code to be authenticated and the target hardware identification code, and calculating a second similarity between the current network address and the target network address.
[0136] In this embodiment, the electronic device may calculate the first similarity and the second similarity by using a cosine distance formula.
[0137] S153: When the first similarity is greater than or equal to a similarity threshold, and the second similarity is greater than or equal to the similarity threshold, the authentication result is obtained that the device to be authenticated passes the authentication.
[0138] The similarity threshold may be set according to the application scenario, and the present invention does not limit the value of the similarity threshold.
[0139] S154: When the first similarity is less than the similarity threshold, or the second similarity is less than the similarity threshold, the authentication result is that the device to be authenticated fails the authentication.
[0140] Through the above implementation, by authenticating the hardware identification code to be authenticated, the problem that the device to be authenticated can still use the software after reinstalling the system can be avoided. By authenticating the current network address, the problem that the software can still be used normally in a remote network after being stolen can be avoided, thereby improving the security of software use.
[0141] It can be seen from the above technical solutions that the present invention can accurately determine the device that needs to be authenticated through the authentication request, and then by generating a key that is not easily cracked, the security of the key value can be improved. By authenticating the hardware identification code to be authenticated, the problem that the device to be authenticated can still use the software after reinstalling the system can be avoided. By authenticating the current network address, the problem that the software can still be used normally in a remote network after being stolen can be avoided. By double authenticating the device information on the device to be authenticated, the security of software use can be ensured. The present invention can improve the safe use of software on the device by authenticating the information on the device to be authenticated.
[0142] like Figure 6, which is a functional module diagram of a preferred embodiment of the device authentication device of the present invention. The device authentication device 11 includes a determination unit 110, a reading unit 111, a decryption unit 112, a query unit 113, an authentication unit 114, an acquisition unit 115, a calculation unit 116, a splicing unit 117, a storage unit 118 and a comparison unit 119. The module / unit referred to in the present invention refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can complete a fixed function, which is stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0143] When receiving an authentication request, the determining unit 110 determines a device to be authenticated according to the authentication request.
[0144] In at least one embodiment of the present invention, the data information carried in the authentication request includes storage location, target code, etc.
[0145] The device to be authenticated refers to a client installed with software that needs to be authorized.
[0146] In at least one embodiment of the present invention, the determining unit 110 determines the device to be authenticated according to the authentication request, including:
[0147] Parse the authentication request message to obtain data information carried in the authentication request.
[0148] The data information includes, but is not limited to: a first preset tag, a storage location, a second preset tag, a target code, etc.
[0149] A first preset tag and a second preset tag are obtained from the preset tag table, wherein the first preset tag is used to indicate a position, and the second preset tag is used to indicate a sequence number.
[0150] The preset tag table stores a plurality of predefined preset tags.
[0151] Information corresponding to the first preset tag is obtained from the data information as a storage location, and information corresponding to the second preset tag is obtained from the data information as a target code.
[0152] The storage location is used to store the location of the authentication device table. The target code is used to indicate the device identification that needs to be authenticated.
[0153] An authentication device table is obtained from the storage location, and a device identification corresponding to the target code is obtained from the authentication device table.
[0154] The authentication device table stores identifiers corresponding to multiple devices. The device identifier is used to indicate the device that needs to be authenticated.
[0155] The device to be authenticated is determined according to the device identification.
[0156] By parsing the message of the authentication request without parsing the entire authentication request, the parsing efficiency of the authentication request is improved. In addition, since the data information carried by the authentication request is the storage location of the authentication device table and the target code of the device identifier in the authentication device table, the security of the authentication request can be ensured.
[0157] The reading unit 111 obtains the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and reads a key value corresponding to a preset key from a registration table of the device to be authenticated.
[0158] In at least one embodiment of the present invention, the mainboard serial number is used to indicate the mainboard of the device to be authenticated.
[0159] The central processor serial number is used to indicate the central processor of the device to be authenticated, and the hard disk serial number is used to indicate the hard disk of the device to be authenticated.
[0160] The preset key is used to indicate a hardware identification code.
[0161] In at least one embodiment of the present invention, the manner in which the reading unit 111 obtains the mainboard serial number, the central processing unit serial number, and the hard disk serial number belongs to the prior art, and the present invention does not limit this.
[0162] In at least one embodiment of the present invention, the reading unit 111 reads the key value corresponding to the preset key from the registration table of the device to be authenticated, including:
[0163] traversing the registry;
[0164] When the preset key is traversed from the registration table, the key value is obtained from the space corresponding to the preset key.
[0165] The decryption unit 112 generates a key according to the mainboard serial number, the central processing unit serial number and the hard disk serial number, and uses the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the mainboard serial number, the central processing unit serial number and the hard disk serial number.
[0166] In at least one embodiment of the present invention, when the key value corresponding to the preset key does not exist in the registration table, the acquisition unit 115 acquires the current timestamp;
[0167] The computing unit 116 processes the CPU serial number, the hard disk serial number and the current timestamp using a hash algorithm to obtain a universal unique identification code;
[0168] The splicing unit 117 splices the mainboard serial number, the central processing unit serial number, the hard disk serial number and the universal unique identification code to generate a hardware identification code of the device to be authenticated;
[0169] The storage unit 118 encrypts the generated hardware identification code using the key to obtain a ciphertext corresponding to the generated hardware identification code, and stores the ciphertext in a space corresponding to the preset key.
[0170] According to the above implementation, since the key value corresponding to the preset key does not exist in the registration table, that is, the device to be authenticated is not authorized, the hardware identification code is generated to authorize the device to be authenticated.
[0171] In at least one embodiment of the present invention, the decryption unit 112 generates a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, including:
[0172] The mainboard serial number, the central processing unit serial number and the hard disk serial number are concatenated to obtain a concatenated sequence.
[0173] In this embodiment, the decryption unit 112 can arbitrarily splice the mainboard serial number, the central processing unit serial number and the hard disk serial number to obtain the splicing sequence. The present invention does not limit the splicing order of the mainboard serial number, the central processing unit serial number and the hard disk serial number.
[0174] The spliced sequence is padded until the length of the padded spliced sequence reaches a first preset value, thereby obtaining a target sequence.
[0175] In this embodiment, the decryption unit 112 fills the lower bits of the splicing sequence with a set value, wherein the set value may be 0.
[0176] The target sequence is segmented according to the preset positions to obtain a plurality of segmentation sequences and a segmentation order, and a target segmentation sequence is determined from the plurality of segmentation sequences according to the segmentation order.
[0177] In this embodiment, the decryption unit 112 determines the segmentation sequence with the segmentation order being the first as the target segmentation sequence.
[0178] The target segmentation sequence is operated to obtain a first operation result, and other segmentation sequences in the plurality of segmentation sequences and the first operation result are operated to obtain a second operation result.
[0179] In this embodiment, the decryption unit 112 may obtain the first operation result by performing an XOR operation on the target segmentation sequence, and the decryption unit 112 may obtain the second operation result by performing an AND-NOT operation on the other segmentation sequences and the first operation result.
[0180] The first N bits of information are extracted from the second operation result as the key, where N is a second preset value.
[0181] Through the above implementation, a key that is not easily cracked can be generated, thereby improving the security of the key value.
[0182] In at least one embodiment of the present invention, the decryption unit 112 uses the key to decrypt the key value and the storage unit 118 uses the key to encrypt the generated hardware identification code are reversible.
[0183] The determining unit 110 obtains the current network address to which the device to be authenticated is connected, and determines the organization identification code of the organization where the device to be authenticated is located.
[0184] In at least one embodiment of the present invention, the current network address refers to a public network address, and the institution may be any institution, for example: Hospital A, Clinic B, etc.
[0185] In at least one embodiment of the present invention, the determining unit 110 obtains the current network address from a network list in the device to be authenticated.
[0186] In at least one embodiment of the present invention, the determination unit 110 obtains the target software in the device to be authenticated and obtains the license of the target software. Further, the determination unit 110 determines the organization corresponding to the license as the organization where the device to be authenticated is located, and obtains the identification code corresponding to the organization where the device to be authenticated is located as the organization identification code.
[0187] Through the above implementation, the organization where the device to be authenticated is located can be accurately determined, and then the organization identification code can be accurately determined.
[0188] The query unit 113 queries the authorization information corresponding to the organization identification code, and the authorization information includes a target hardware identification code and a target network address.
[0189] In at least one embodiment of the present invention, the target hardware identification code is a hardware identification code confirmed and registered by the manufacturer, and the target network address is a network address confirmed and registered by the manufacturer.
[0190] In at least one embodiment of the present invention, the query unit 113 queries the authorization information corresponding to the organization identification code, and the authorization information includes the target hardware identification code and the target network address including:
[0191] An authentication table corresponding to the authentication request is determined, and an idle thread is determined from a preset thread pool.
[0192] The idle thread is used to query the target list corresponding to the organization identification code from the authentication table.
[0193] The information in the target list is extracted as the authorization information.
[0194] Through the above implementation, since there is no need to wait for the idle thread to process other requests, the query efficiency of the target list can be improved, and the authorization information can be accurately determined through the mapping relationship between the organization identification code and the target list.
[0195] In at least one embodiment of the present invention, when no list corresponding to the organization identification code is found from the authentication table, the acquisition unit 115 determines the number of bound devices of the organization and acquires the binding threshold number of the organization;
[0196] The comparing unit 119 compares the number of bound devices with the binding threshold number;
[0197] When the number of bound devices is less than the binding threshold number, the storage unit 118 stores the organization identification code, the hardware identification code to be authenticated and the current network address in the authentication table;
[0198] When the number of bound devices is greater than or equal to the binding threshold number, the determining unit 110 determines that the device to be authenticated fails authentication.
[0199] Through the above implementation, the number of device bindings of the organization can be controlled, thereby avoiding redundant devices in the organization from using the software, thereby improving the safety of software use.
[0200] The authentication unit 114 authenticates the hardware identification code to be authenticated and the current network address according to the authorization information, obtains an authentication result, and responds to the authentication request with the authentication result.
[0201] It should be emphasized that in order to further ensure the privacy and security of the above authentication results, the above authentication results can also be stored in a node of a blockchain.
[0202] In at least one embodiment of the present invention, the authentication result includes that the device to be authenticated passes the authentication, and that the device to be authenticated fails the authentication.
[0203] In at least one embodiment of the present invention, the authentication unit 114 authenticates the hardware identification code to be authenticated and the current network address according to the authorization information, and obtains the authentication result including:
[0204] The authorization information is traversed, and the traversed authorization information is matched with all public network addresses in the public network address library.
[0205] Wherein, the public network address library stores multiple public network addresses.
[0206] When the traversed authorization information matches any public network address among all the public network addresses, the traversed authorization information is determined as the target network address, and the remaining authorization information is determined as the target hardware identification code.
[0207] Since the authorization information includes the target network address and the target hardware identification code, the authentication unit 114 determines the target network address from the authorization information, and further can quickly determine the target hardware identification code from the authorization information.
[0208] A first similarity between the hardware identification code to be authenticated and the target hardware identification code is calculated, and a second similarity between the current network address and the target network address is calculated.
[0209] In this embodiment, the authentication unit 114 may calculate the first similarity and the second similarity by using a cosine distance formula.
[0210] When the first similarity is greater than or equal to a similarity threshold, and the second similarity is greater than or equal to the similarity threshold, the authentication result is that the device to be authenticated passes the authentication.
[0211] The similarity threshold may be set according to the application scenario, and the present invention does not limit the value of the similarity threshold.
[0212] When the first similarity is less than the similarity threshold, or the second similarity is less than the similarity threshold, the authentication result is that the device to be authenticated fails the authentication.
[0213] Through the above implementation, by authenticating the hardware identification code to be authenticated, the problem that the device to be authenticated can still use the software after reinstalling the system can be avoided. By authenticating the current network address, the problem that the software can still be used normally in a remote network after being stolen can be avoided, thereby improving the security of software use.
[0214] It can be seen from the above technical solutions that the present invention can accurately determine the device that needs to be authenticated through the authentication request, and then by generating a key that is not easily cracked, the security of the key value can be improved. By authenticating the hardware identification code to be authenticated, the problem that the device to be authenticated can still use the software after reinstalling the system can be avoided. By authenticating the current network address, the problem that the software can still be used normally in a remote network after being stolen can be avoided. By double authenticating the device information on the device to be authenticated, the security of software use can be ensured. The present invention can improve the safe use of software on the device by authenticating the information on the device to be authenticated.
[0215] like Figure 7 FIG. 1 is a schematic diagram of the structure of an electronic device of a preferred embodiment of the device authentication method of the present invention.
[0216] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer-readable instructions stored in the memory 12 and executable on the processor 13, such as a device authentication program.
[0217] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the electronic device 1 may also include input and output devices, network access devices, buses, etc.
[0218] The processor 13 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 13 is the computing core and control center of the electronic device 1, and uses various interfaces and lines to connect various parts of the entire electronic device 1, and executes the operating system of the electronic device 1 and various installed applications, program codes, etc.
[0219] Exemplarily, the computer-readable instructions may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer-readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into a determination unit 110, a reading unit 111, a decryption unit 112, a query unit 113, an authentication unit 114, an acquisition unit 115, a calculation unit 116, a splicing unit 117, a storage unit 118, and a comparison unit 119.
[0220] The memory 12 can be used to store the computer-readable instructions and / or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12, and calling the data stored in the memory 12. The memory 12 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device, etc. The memory 12 can include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.
[0221] The memory 12 may be an external memory and / or an internal memory of the electronic device 1. Furthermore, the memory 12 may be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.
[0222] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware to complete it through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned various method embodiments can be implemented.
[0223] The computer-readable instructions include computer-readable instruction codes, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).
[0224] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0225] Combination Figure 1 The memory 12 in the electronic device 1 stores computer-readable instructions to implement a device authentication method, and the processor 13 can execute the computer-readable instructions to implement:
[0226] When receiving an authentication request, determining a device to be authenticated according to the authentication request;
[0227] Obtaining the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and reading the key value corresponding to the preset key from the registry of the device to be authenticated;
[0228] Generate a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, and use the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the motherboard serial number, the CPU serial number and the hard disk serial number;
[0229] Obtaining the current network address to which the device to be authenticated is connected, and determining the organization identification code of the organization where the device to be authenticated is located;
[0230] Querying authorization information corresponding to the organization identification code, the authorization information including a target hardware identification code and a target network address;
[0231] The hardware identification code to be authenticated and the current network address are authenticated according to the authorization information to obtain an authentication result, and the authentication request is responded to with the authentication result.
[0232] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer readable instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0233] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0234] The computer-readable storage medium stores computer-readable instructions, wherein the computer-readable instructions are used to implement the following steps when executed by the processor 13:
[0235] When receiving an authentication request, determining a device to be authenticated according to the authentication request;
[0236] Obtaining the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and reading the key value corresponding to the preset key from the registry of the device to be authenticated;
[0237] Generate a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, and use the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the motherboard serial number, the CPU serial number and the hard disk serial number;
[0238] Obtaining the current network address to which the device to be authenticated is connected, and determining the organization identification code of the organization where the device to be authenticated is located;
[0239] Querying authorization information corresponding to the organization identification code, the authorization information including a target hardware identification code and a target network address;
[0240] The hardware identification code to be authenticated and the current network address are authenticated according to the authorization information to obtain an authentication result, and the authentication request is responded to with the authentication result.
[0241] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0242] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0243] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0244] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the present invention can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0245] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A device authentication method, characterized in that: The device authentication method comprises: When receiving an authentication request, determining a device to be authenticated according to the authentication request, wherein the device to be authenticated refers to a client having software to be authorized installed; Obtaining the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and reading the key value corresponding to the preset key from the registry of the device to be authenticated; Generate a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, and use the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the motherboard serial number, the CPU serial number and the hard disk serial number; Obtaining the current network address to which the device to be authenticated is connected, and determining the organization identification code of the organization where the device to be authenticated is located, including: obtaining the target software in the device to be authenticated, and obtaining the license of the target software, determining the organization corresponding to the license as the organization where the device to be authenticated is located, and obtaining the identification code corresponding to the organization where the device to be authenticated is located as the organization identification code, wherein the current network address refers to the public network address; Querying authorization information corresponding to the organization identification code, the authorization information including a target hardware identification code and a target network address; The hardware identification code to be authenticated and the current network address are authenticated according to the authorization information to obtain an authentication result, and the authentication request is responded to with the authentication result.
2. The device authentication method according to claim 1, characterized in that: Determining the device to be authenticated according to the authentication request includes: Parsing the authentication request message to obtain data information carried by the authentication request; Acquire a first preset tag and a second preset tag from the preset tag table, wherein the first preset tag is used to indicate a position, and the second preset tag is used to indicate a sequence number; Acquire information corresponding to the first preset tag from the data information as a storage location, and acquire information corresponding to the second preset tag from the data information as a target code; Obtaining an authentication device table from the storage location, and obtaining a device identifier corresponding to the target code from the authentication device table; The device to be authenticated is determined according to the device identification.
3. The device authentication method according to claim 1, characterized in that: The method further comprises: When the key value corresponding to the preset key does not exist in the registration table, obtaining the current timestamp; Processing the CPU serial number, the hard disk serial number and the current timestamp using a hash algorithm to obtain a universal unique identification code; The hardware identification code of the device to be authenticated is generated by combining the motherboard serial number, the central processing unit serial number, the hard disk serial number and the universal unique identification code; The generated hardware identification code is encrypted using the key to obtain a ciphertext corresponding to the generated hardware identification code, and the ciphertext is stored in a space corresponding to the preset key.
4. The device authentication method according to claim 1, characterized in that: Generating a key according to the motherboard serial number, the CPU serial number and the hard disk serial number includes: Concatenate the motherboard serial number, the central processing unit serial number and the hard disk serial number to obtain a concatenated sequence; Filling the spliced sequence until the length of the padded spliced sequence reaches a first preset value, thereby obtaining a target sequence; Segmenting the target sequence according to the preset positions to obtain a plurality of segmentation sequences and a segmentation order, and determining a target segmentation sequence from the plurality of segmentation sequences according to the segmentation order; Calculating the target segmentation sequence to obtain a first calculation result, and performing calculations based on other segmentation sequences in the plurality of segmentation sequences and the first calculation result to obtain a second calculation result; The first N bits of information are extracted from the second operation result as the key, where N is a second preset value.
5. The device authentication method according to claim 1, characterized in that: The query for authorization information corresponding to the organization identification code, the authorization information including the target hardware identification code and the target network address includes: Determine an authentication table corresponding to the authentication request, and determine an idle thread from a preset thread pool; Utilizing the idle thread to query the authentication table for a target list corresponding to the organization identification code; The information in the target list is extracted as the authorization information.
6. The device authentication method according to claim 5, characterized in that: The method further comprises: When no list corresponding to the organization identification code is found in the authentication table, determining the number of bound devices of the organization and obtaining the binding threshold number of the organization; comparing the number of bound devices with the binding threshold number; When the number of bound devices is less than the binding threshold number, storing the organization identification code, the hardware identification code to be authenticated and the current network address in the authentication table; When the number of bound devices is greater than or equal to the binding threshold number, it is determined that the device to be authenticated fails authentication.
7. The device authentication method according to claim 1, characterized in that: The authentication result of authenticating the hardware identification code to be authenticated and the current network address according to the authorization information includes: Traversing the authorization information, and matching the traversed authorization information with all public network addresses in the public network address database; When the traversed authorization information matches any public network address among all the public network addresses, the traversed authorization information is determined as the target network address, and the remaining authorization information is determined as the target hardware identification code; Calculating a first similarity between the hardware identification code to be authenticated and the target hardware identification code, and calculating a second similarity between the current network address and the target network address; When the first similarity is greater than or equal to a similarity threshold, and the second similarity is greater than or equal to the similarity threshold, the authentication result is obtained that the device to be authenticated passes the authentication; or When the first similarity is less than the similarity threshold, or the second similarity is less than the similarity threshold, the authentication result is that the device to be authenticated fails the authentication.
8. A device authentication device, characterized in that: The device authentication device comprises: A determination unit, configured to determine, when receiving an authentication request, a device to be authenticated according to the authentication request, wherein the device to be authenticated refers to a client having software to be authorized installed thereon; A reading unit, used to obtain the motherboard serial number, the central processing unit serial number and the hard disk serial number of the device to be authenticated, and read the key value corresponding to the preset key from the registration table of the device to be authenticated; a decryption unit, configured to generate a key according to the motherboard serial number, the CPU serial number and the hard disk serial number, and use the key to decrypt the key value to obtain a hardware identification code to be authenticated, wherein the hardware identification code to be authenticated is generated according to the motherboard serial number, the CPU serial number and the hard disk serial number; The determination unit is further used to obtain the current network address to which the device to be authenticated is connected, and determine the organization identification code of the organization where the device to be authenticated is located, including: obtaining the target software in the device to be authenticated, and obtaining the license of the target software, determining the organization corresponding to the license as the organization where the device to be authenticated is located, and obtaining the identification code corresponding to the organization where the device to be authenticated is located as the organization identification code, wherein the current network address refers to the public network address; A query unit, used to query the authorization information corresponding to the organization identification code, the authorization information including the target hardware identification code and the target network address; The authentication unit is used to authenticate the hardware identification code to be authenticated and the current network address according to the authorization information, obtain an authentication result, and respond to the authentication request with the authentication result.
9. An electronic device, characterized in that: The electronic device comprises: a memory storing computer-readable instructions; and A processor executes computer-readable instructions stored in the memory to implement the device authentication method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the device authentication method as described in any one of claims 1 to 7.
