Disclosure of Invention
The application provides a method, a device and a system for generating equipment identification information, which aim to solve the problem that personal information in user application software is leaked due to the fact that equipment identification is easy to tamper.
In a first aspect, an embodiment of the present application provides a method for generating device identification information, including:
acquiring a seed parameter of equipment where application software is located and a salt parameter of the equipment, wherein the seed parameter is a parameter acquired according to self information of the equipment, and the salt parameter is a parameter acquired according to information of an equipment manufacturer;
calculating a fingerprint parameter of the device using the seed parameter and the salt parameter;
splicing the fingerprint parameters, the fingerprint parameter generation time and the version number of the SDK packet integrating the fingerprint parameters to obtain identification information of the equipment;
carrying out AES encryption on the identification information by using the salt parameter to obtain an encrypted file;
and storing the encrypted file in a storage space inside the application software.
With reference to the first aspect, in an implementation manner of the first aspect, the step of obtaining the seed parameter of the device where the application software is located includes:
if the MAC address of the equipment is obtained, taking the MAC address as the seed parameter;
if the MAC address of the equipment is not acquired, the Android ID of the equipment is acquired;
if the Android ID of the equipment is obtained, the Android ID is used as the seed parameter;
if the Android ID of the equipment is not acquired, acquiring an equipment serial number of the equipment in an Android system;
and taking the equipment serial number as the seed parameter.
With reference to the first aspect, in an implementation manner of the first aspect, the step of obtaining the salt parameter of the device includes:
obtaining the manufacturer name of the equipment;
MD5 calculation was performed on the manufacturer name to obtain the salt parameters of the device.
With reference to the first aspect, in an implementation manner of the first aspect, the step of calculating the fingerprint parameter of the device using the seed parameter and the salt parameter includes:
performing MD5 calculation on the seed parameters to obtain a first calculated value;
calculating the sum of the first calculated value and the value of the salt parameter to obtain a second calculated value;
and performing MD5 calculation on the second calculated value to obtain a fingerprint parameter.
With reference to the first aspect, in an implementation manner of the first aspect, an Android Keystore system is used to provide a saving mechanism for the encrypted file for the application software.
In a second aspect, an embodiment of the present application provides an apparatus for generating device identification information, including:
the acquisition module is used for acquiring a seed parameter of equipment where the application software is located and a salt parameter of the equipment, wherein the seed parameter is a parameter acquired according to information of the equipment, and the salt parameter is a parameter acquired according to information of an equipment manufacturer;
the calculating module is used for calculating the fingerprint parameter of the equipment by utilizing the seed parameter and the salt parameter;
the splicing module is used for splicing the fingerprint parameters, the fingerprint parameter generation time and the version number of the SDK packet integrating the fingerprint parameters to obtain the identification information of the equipment;
the encryption module is used for carrying out AES encryption on the identification information by utilizing the salt parameter to obtain an encrypted file;
and the storage module is used for storing the encrypted file in a storage space inside the application software.
With reference to the second aspect, in an implementation manner of the second aspect, the obtaining module includes:
an address obtaining unit, configured to, if an MAC address of a device is obtained, use the MAC address as the seed parameter;
the ID obtaining unit is used for obtaining the Android ID of the equipment if the MAC address of the equipment is not obtained; if the Android ID of the equipment is obtained, the Android ID is used as the seed parameter;
the serial number obtaining unit is used for obtaining the equipment serial number of the equipment in the Android system if the Android ID of the equipment is not obtained; and taking the equipment serial number as the seed parameter.
With reference to the second aspect, in an implementation manner of the second aspect, the obtaining module further includes:
the manufacturer name acquisition unit is used for acquiring the manufacturer name of the equipment;
and the salt parameter calculation unit is used for performing MD5 calculation on the manufacturer name to obtain the salt parameter of the equipment.
With reference to the second aspect, in an implementable manner of the second aspect, the computing module includes:
the first calculating unit is used for performing MD5 calculation on the seed parameters to obtain a first calculated value;
a second calculation unit for calculating the sum of the first calculated value and the value of the salt parameter to obtain a second calculated value;
and the fingerprint parameter calculation unit is used for performing MD5 calculation on the second calculated value to obtain a fingerprint parameter.
In a third aspect, an embodiment of the present application further provides an apparatus identification information generating system, including a processor and a memory;
the memory is used for storing an executable program of the processor;
the processor is used for acquiring a seed parameter of equipment where the application software is located and a salt parameter of the equipment, wherein the seed parameter is a parameter acquired according to information of the equipment, and the salt parameter is a parameter acquired according to information of an equipment manufacturer; calculating a fingerprint parameter of the device using the seed parameter and the salt parameter; splicing the fingerprint parameters, the fingerprint parameter generation time and the version number of the SDK packet integrating the fingerprint parameters to obtain identification information of the equipment; carrying out AES encryption on the identification information by using the salt parameter to obtain an encrypted file; and storing the encrypted file in a storage space inside the application software.
According to the technical scheme, the embodiment of the application provides a method, a device and a system for generating equipment identification information. According to the technical scheme, seed parameters of equipment where application software is located and salt parameters of the equipment are obtained; calculating a fingerprint parameter of the device using the seed parameter and the salt parameter; splicing the fingerprint parameters, the fingerprint parameter generation time and the version number of the SDK packet integrating the fingerprint parameters to obtain identification information of the equipment; carrying out AES encryption on the identification information by using the salt parameter to obtain an encrypted file; and finally, storing the encrypted file in a storage space inside the application software. Therefore, the method and the device can firstly obtain the relevant parameters of the multiple devices, then continuously calculate and splice the relevant parameters to obtain the identification information, and in order to ensure the safety of the identification information, the identification information is encrypted, the encrypted file is stored in a specific space, the space only allows the application software to access, other applications cannot access, the safety of the identification information of the devices is further ensured, and the problem that personal information in the application software of a user is leaked due to the fact that the device identification is easy to be tampered is solved.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a device identification information generation method provided in an embodiment of the present application. As shown in fig. 1, a method for generating device identification information provided in an embodiment of the present application includes:
s101, acquiring a seed parameter of equipment where application software is located and a salt parameter of the equipment, wherein the seed parameter is acquired according to information of the equipment, and the salt parameter is acquired according to information of an equipment manufacturer.
The seed parameters and the salt parameters in the embodiment of the application are obtained according to the information of the equipment, wherein the seed parameters are sequentially selected according to the MAC address, the Android ID and the equipment serial number, when a first non-abnormal value occurs, the non-abnormal value is used as the seed parameter, and the non-abnormal condition in the embodiment of the application refers to the condition that the MAC address, the Android ID and the equipment serial number can be obtained.
Fig. 2 is a flowchart of acquiring a seed parameter of a device according to an embodiment of the present disclosure. As shown in fig. 2, the step of obtaining the seed parameter of the device includes:
s201, if the MAC address of the equipment is obtained, the MAC address is used as the seed parameter.
For example, if the MAC address of the acquired device is 02:00:00:00:00:00, the address may be used as the seed parameter.
S202, if the MAC address of the equipment is not acquired, the Android ID of the equipment is acquired.
S203, if the Android ID of the equipment is obtained, the Android ID is used as the seed parameter.
For example, if the Android ID of the acquired device is 6ae48d23d1887323, the ID may be used as a seed parameter.
And S204, if the Android ID of the equipment is not acquired, acquiring the equipment serial number of the equipment in the Android system.
The device Serial number in the embodiment of the present application may also be represented by Serial, and if Serial is 01b4549262d6a4a2, this Serial may be used as a seed parameter.
S205, using the device serial number as the seed parameter.
The process of obtaining the seed parameter of the device in the embodiment of the application is the most preferable process, and generally, all devices can obtain the MAC address, but in order to avoid the situation that the MAC address cannot be obtained very specially, the operations of obtaining the Android ID and obtaining the device serial number are added in the embodiment of the application, and it is ensured that each application software can obtain the seed parameter.
Fig. 3 is a flowchart for obtaining salt parameters of a device according to an embodiment of the present disclosure. As shown in fig. 3, the step of obtaining salt parameters of the device comprises:
s301, acquiring the name of the manufacturer of the equipment.
The manufacturer name acquired in the embodiment of the application is in a character string form, for example, the manufacturer name of a Google mobile phone is Google, the manufacturer name of a Samsung mobile phone is SAMAUNG, and the manufacturer name of a Hua mobile phone is HUAWEI.
S302, performing MD5 calculation on the manufacturer name to obtain the salt parameters of the equipment.
In the embodiment of the application, the parameters related to the identification information are obtained by using the information of the equipment, so that the identification information has a certain relevance with the equipment, and further, the calculated identification information of the equipment of different manufacturers has difference, and the identification of the equipment is facilitated.
And S102, calculating the fingerprint parameters of the equipment by using the seed parameters and the salt parameters.
The fingerprint parameters in the embodiment of the application are obtained by integrating and calculating the seed parameters and the manufacturer names for multiple times, so that the generated fingerprint parameters are irreversible, each parameter participating in calculation is related to equipment information, and the uniqueness of the fingerprint parameters generated aiming at each equipment is also ensured.
Fig. 4 is a flowchart of fingerprint parameters of a computing device according to an embodiment of the present application. As shown in fig. 4, the step of calculating the fingerprint parameters of the device includes:
s401, MD5 calculation is carried out on the seed parameters to obtain a first calculated value. In the embodiment of the present application, the seed parameter is denoted by S1, and the first calculated value is MD5 (S1).
S402, calculating the sum of the first calculated value and the salt parameter value to obtain a second calculated value. In the present example, the salt parameter is represented by H1, and the second calculated value is MD5(S1) + H1.
And S403, performing MD5 calculation on the second calculated value to obtain a fingerprint parameter. In the embodiment of the application, the fingerprint parameters are represented by FP, and the obtained FP is MD5(MD5(S1) + H1).
It can be seen that in the embodiment of the application, the parameters S1 and H1 are integrated and calculated for multiple times, so that irreversibility of the calculated FP can be ensured, and the FP is prevented from being tampered and forged at will.
S103, the fingerprint parameters, the fingerprint parameter generation time and the version number of the SDK packet integrating the fingerprint parameters are spliced to obtain identification information of the equipment.
In the system for implementing the method for generating the device identification information in the embodiment of the present application, the generation time TS of the fingerprint parameter FP is also counted, specifically, a timestamp of the system is taken and is expressed in a long integer form. And integrating the generated fingerprint parameters into the SDK file package, wherein each SDK is identified by a Version number SDK _ Version to distinguish difference among the SDKs. In the embodiment of the application, the fingerprint parameter generation time TS related to the fingerprint parameter FP is spliced with the version number of the SDK packet to obtain unique identification information so as to identify the application software of the current equipment.
The specific splicing form is as follows: FP | | TS | | SDK _ Version, for example, the FP obtained in the above embodiment is Ad23r45fdfRew122321354ewfde, the time for generating the FP is 567431234556, and the Version number SDK _ Version of the SDK is 1.0.0, then the identification information after splicing is Ad23r45fdfRew122321354 ewfre | |567431234556| |1.0.0, where the middle double vertical lines are only separators, and this piece of identification information represents the record generated by the current application, and there is a possibility that other applications integrated with the device fingerprint SDK are also installed on the mobile phone, and the same fingerprint information may also be generated therein, and this piece of information exists only as the identification information generated by the current application.
S104, performing AES encryption on the identification information by using the salt parameter to obtain an encrypted file. The identification information obtained in the embodiment of the application is encrypted again, so that the identification information is safer. The AES encryption belongs to an advanced encryption algorithm in cryptography, and in the embodiment of the present application, encryption is performed specifically in an AES256 manner.
And S105, storing the encrypted file in a storage space inside the application software. In the embodiment of the application, the storage space inside the application software is specifically a sandbox of the application software, which is a private space of the application software and cannot be accessed by other applications.
According to the embodiment of the application, the Android Keystore system is used for providing the storage mechanism of the encrypted file for the application software, the sandbox of the application software is realized based on the Android Keystore system, and the Android Keystore can prevent key materials from being integrally extracted from an application process and Android equipment, so that the key materials are prevented from being used outside the Android equipment in an unauthorized mode. Second, the Android Keystore may let applications specify authorized usage of keys and enforce these restrictions outside the application process, thereby avoiding unauthorized usage of key material on Android devices. In the embodiment of the application, after the device identification information is generated, in order to prevent the device identification information from being used by a malicious user and abused after being stolen, the generated identification information and the collected information to be reported need to be encrypted, stored and protected. The android keystore system provides a protection mechanism for saving a piece of content that is only securely accessible by current applications. According to the Android Keystore characteristics, a uniform API (application program interface) is provided for different Android versions, and data can be conveniently stored locally.
In addition, when communicating with a server, in order to prevent the identification information and the communication content from being stolen, a plurality of symmetric and asymmetric encryption methods are adopted for communication. When the dynamic library is used, the operation of verifying the application signature is carried out in the dynamic library, so that the illegal use of the device fingerprint SDK for malicious operation is prevented.
Therefore, the method for generating the device identification information provided by the embodiment of the application can firstly obtain the relevant parameters of a plurality of devices, then continuously calculate and splice the relevant parameters to obtain the identification information, and in order to ensure the safety of the identification information, the identification information needs to be encrypted, the encrypted file is stored in a specific space, the space only allows the application software to access, other applications cannot access, the safety of the device identification information is further ensured, and the problem that personal information in the user application software is leaked due to the fact that the device identification is easy to be tampered is solved.
Fig. 5 is a block diagram of a device identification information generating apparatus according to an embodiment of the present application. As shown in fig. 5, an apparatus for generating device identification information according to an embodiment of the present application includes: an obtainingmodule 51, configured to obtain a seed parameter of a device where the application software is located and a salt parameter of the device, where the seed parameter is obtained according to information of the device itself, and the salt parameter is obtained according to information of a device manufacturer; a calculatingmodule 52 for calculating a fingerprint parameter of the device using the seed parameter and the salt parameter; thesplicing module 53 is configured to splice the fingerprint parameter, the fingerprint parameter generation time, and the version number of the SDK packet that integrates the fingerprint parameter, to obtain identification information of the device; theencryption module 54 is configured to perform AES encryption on the identification information by using the salt parameter to obtain an encrypted file; astorage module 55, configured to store the encrypted file in a storage space inside the application software.
The acquisition module includes: an address obtaining unit, configured to, if an MAC address of a device is obtained, use the MAC address as the seed parameter; the ID obtaining unit is used for obtaining the Android ID of the equipment if the MAC address of the equipment is not obtained; if the Android ID of the equipment is obtained, the Android ID is used as the seed parameter; the serial number obtaining unit is used for obtaining the equipment serial number of the equipment in the Android system if the Android ID of the equipment is not obtained; and taking the equipment serial number as the seed parameter.
The acquisition module further comprises: the manufacturer name acquisition unit is used for acquiring the manufacturer name of the equipment; and the salt parameter calculation unit is used for performing MD5 calculation on the manufacturer name to obtain the salt parameter of the equipment.
The calculation module comprises: the first calculating unit is used for performing MD5 calculation on the seed parameters to obtain a first calculated value; a second calculation unit for calculating the sum of the first calculated value and the value of the salt parameter to obtain a second calculated value; and the fingerprint parameter calculation unit is used for performing MD5 calculation on the second calculated value to obtain a fingerprint parameter.
Fig. 6 is a schematic diagram of a device identification information generation system according to an embodiment of the present application. As shown in fig. 6, the device identification information generating system provided in the embodiment of the present application includes aprocessor 61 and amemory 62; the memory is used for storing an executable program of the processor; the processor is used for acquiring a seed parameter of equipment where the application software is located and a salt parameter of the equipment, wherein the seed parameter is a parameter acquired according to information of the equipment, and the salt parameter is a parameter acquired according to information of an equipment manufacturer; calculating a fingerprint parameter of the device using the seed parameter and the salt parameter; splicing the fingerprint parameters, the fingerprint parameter generation time and the version number of the SDK packet integrating the fingerprint parameters to obtain identification information of the equipment; carrying out AES encryption on the identification information by using the salt parameter to obtain an encrypted file; and storing the encrypted file in a storage space inside the application software.
According to the technical scheme, the embodiment of the application provides a method, a device and a system for generating equipment identification information. According to the technical scheme, seed parameters of equipment where application software is located and salt parameters of the equipment are obtained; calculating a fingerprint parameter of the device using the seed parameter and the salt parameter; splicing the fingerprint parameters, the fingerprint parameter generation time and the version number of the SDK packet integrating the fingerprint parameters to obtain identification information of the equipment; carrying out AES encryption on the identification information by using the salt parameter to obtain an encrypted file; and finally, storing the encrypted file in a storage space inside the application software. Therefore, the method and the device can firstly obtain the relevant parameters of the multiple devices, then continuously calculate and splice the relevant parameters to obtain the identification information, and in order to ensure the safety of the identification information, the identification information is encrypted, the encrypted file is stored in a specific space, the space only allows the application software to access, other applications cannot access, the safety of the identification information of the devices is further ensured, and the problem that personal information in the application software of a user is leaked due to the fact that the device identification is easy to be tampered is solved.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.