CN116055172A - A device authentication method, system, electronic device and storage medium - Google Patents
A device authentication method, system, electronic device and storage medium Download PDFInfo
- Publication number
- CN116055172A CN116055172A CN202310036933.5A CN202310036933A CN116055172A CN 116055172 A CN116055172 A CN 116055172A CN 202310036933 A CN202310036933 A CN 202310036933A CN 116055172 A CN116055172 A CN 116055172A
- Authority
- CN
- China
- Prior art keywords
- target
- server
- dynamic token
- client
- timestamp
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
- H04L63/0807—Network architectures or network communication protocols for network security for authentication of entities using tickets, e.g. Kerberos
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0863—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0866—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving user or device identifiers, e.g. serial number, physical or biometrical information, DNA, hand-signature or measurable physical characteristics
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/321—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
- H04L9/3213—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority using tickets or tokens, e.g. Kerberos
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2463/00—Additional details relating to network architectures or network communication protocols for network security covered by H04L63/00
- H04L2463/121—Timestamp
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Computer And Data Communications (AREA)
Abstract
Description
技术领域technical field
本发明涉及密码技术领域,更具体地说,涉及一种设备认证方法、系统、电子设备及存储介质。The present invention relates to the technical field of encryption, and more specifically, relates to a device authentication method, system, electronic device and storage medium.
背景技术Background technique
电商行业所提供的应用程序(Application,APP)经常会举办活动,例如,拉新和投票;客户端可以通过安装该APP,以便向访问对应的服务端来参与该活动,为了保证参与的设备均是合法的,服务端可以对访问的客户端的合法性进行校验。The application (Application, APP) provided by the e-commerce industry often holds activities, such as new pull and voting; the client can participate in the activity by installing the APP in order to access the corresponding server, in order to ensure that the participating equipment All are legal, and the server can verify the legitimacy of the accessed client.
现有的设备合法性的验证方法,通常是客户端对相应设备信息进行加密和加签,得到相应的加密信息后,服务端再对加密信息进行解密和验签来校验该客户端是否合法,在确定合法的情况下,接收该客户端发送的访问请求。这种方式虽然保证了单个设备(客户端)的合法性,但是无法保证第三方业务行为是发生在该设备(客户端)上的,也就是说,无法保证该设备(客户端)在真实环境中运行,例如,非法用户通过虚拟软件模拟该设备(客户端)向服务端发送相应的访问请求,这样就容易出现用户使用单个合法设备创建大量账号进行薅羊毛的现象。Existing verification methods for device legitimacy usually involve the client encrypting and signing the corresponding device information. After obtaining the corresponding encrypted information, the server decrypts the encrypted information and verifies the signature to verify whether the client is legal. , if it is determined to be legal, receive the access request sent by the client. Although this method guarantees the legitimacy of a single device (client), it cannot guarantee that the third-party business behavior occurs on the device (client), that is, it cannot guarantee that the device (client) is in the real environment. For example, illegal users simulate the device (client) through virtual software to send corresponding access requests to the server, so it is easy for users to use a single legitimate device to create a large number of accounts to collect wool.
发明内容Contents of the invention
有鉴于此,本发明提供一种设备认证方法、系统、电子设备及存储介质,以实现在保证设备的合法性的前提下,保证设备在真实环境中运行,避免用户使用单个合法设备创建大量账号进行薅羊毛。In view of this, the present invention provides a device authentication method, system, electronic device and storage medium, so as to ensure that the device operates in a real environment under the premise of ensuring the legitimacy of the device, and prevent users from using a single legal device to create a large number of accounts. Carry out fleece.
本发明第一方面公开一种设备认证方法,所述方法包括:The first aspect of the present invention discloses a device authentication method, the method comprising:
客户端当检测到目标APP初始化客户端sdk时,向服务端发送参数信息,其中,所述参数信息至少包括设备标识;When the client detects that the target APP initializes the client sdk, it sends parameter information to the server, wherein the parameter information includes at least a device identifier;
所述服务端接收到所述参数信息时,根据所述设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给所述客户端;其中,所述第一时间戳为所述服务端的本地时间戳;When the server receives the parameter information, it generates a key according to the device identifier and encrypted salt value, and sends the target parameter information generated according to the first timestamp and time slice to the client; wherein , the first timestamp is the local timestamp of the server;
所述客户端接收到所述目标参数信息时,根据所述第一时间戳和第二时间戳,计算时钟偏差,并根据所述第二时间戳、所述时钟偏差、所述时间片和与所述服务端预先约定的密钥,生成动态令牌,并将所述动态令牌发送给所述服务端;其中,所述与所述服务端预先预定的密钥和所述密钥相同;所述第二时间戳为所述客户端的本地时间戳;When the client receives the target parameter information, it calculates a clock offset according to the first timestamp and the second timestamp, and calculates the clock offset according to the second timestamp, the clock offset, the time slice and the The key pre-agreed by the server generates a dynamic token, and sends the dynamic token to the server; wherein, the key predetermined by the server is the same as the key; The second timestamp is a local timestamp of the client;
所述服务端接收到所述动态令牌时,根据所述第一时间戳、所述时间片和所述密钥,生成至少一个目标动态令牌;When the server receives the dynamic token, it generates at least one target dynamic token according to the first timestamp, the time slice and the key;
所述服务端若存在与所述动态令牌一致的目标动态令牌,确定所述客户端认证通过,向所述目标APP对应的服务方发送相应的认证通过信息。If there is a target dynamic token consistent with the dynamic token, the server determines that the client has passed the authentication, and sends corresponding authentication passing information to the service party corresponding to the target APP.
可选的,所述服务端接收到所述参数信息时,根据所述设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给所述客户端,包括:Optionally, when the server receives the parameter information, it generates a key according to the device identifier and encrypted salt value, and sends the target parameter information generated according to the first timestamp and time slice to the Clients, including:
所述服务端接收到所述参数信息时,从时间同步钟获取第一时间戳和时间片,并从所述设备标识中截取目标设备标识;When the server receives the parameter information, it obtains the first time stamp and time slice from the time synchronization clock, and intercepts the target device identifier from the device identifier;
所述服务端根据所述目标设备标识和加密盐值,生成密钥;The server generates a key according to the target device identifier and the encrypted salt value;
所述服务端根据所述第一时间戳和所述时间片,生成目标参数信息,并将所述目标参数信息发送给所述客户端。The server generates target parameter information according to the first timestamp and the time slice, and sends the target parameter information to the client.
可选的,所述客户端接收到所述目标参数信息时,根据所述第一时间戳和所述第二时间戳,计算时钟偏差,并根据所述第二时间戳、所述时钟偏差、所述时间片和与所述服务端预先预定的密钥,生成动态令牌,并将所述动态令牌发送给所述服务端,包括:Optionally, when the client receives the target parameter information, it calculates a clock offset according to the first timestamp and the second timestamp, and calculates a clock offset according to the second timestamp, the clock offset, The time slice and the pre-booked key with the server generate a dynamic token, and send the dynamic token to the server, including:
所述客户端接收到所述目标参数信息时,从所述时间同步钟获取第二时间戳,并根据所述第一时间戳和所述第二时间戳,计算时钟偏差;其中,所述目标参数信息包括所述第一时间戳和所述第一时间片;When the client receives the target parameter information, it obtains a second time stamp from the time synchronization clock, and calculates a clock offset according to the first time stamp and the second time stamp; wherein, the target The parameter information includes the first time stamp and the first time slice;
所述客户端根据所述第二时间戳、所述第一时钟偏差和所述时间片,生成校准时间;其中,所述校准时间和所述目标校准时间相同;The client generates a calibration time according to the second timestamp, the first clock offset, and the time slice; wherein, the calibration time is the same as the target calibration time;
所述客户端利用哈希算法对所述校准时间和与所述服务端预先预定的密钥进行处理,得到相应的第一哈希值,并利用HMAC-sha1算法对所述第一哈希值进行处理,生成相应的动态令牌,并将所述动态令牌发送给所述服务端。The client uses a hash algorithm to process the calibration time and the key pre-determined with the server to obtain a corresponding first hash value, and uses the HMAC-sha1 algorithm to process the first hash value process, generate a corresponding dynamic token, and send the dynamic token to the server.
可选的,所述服务端接收到所述动态令牌时,根据第一时间戳、所述时间片和所述密钥,生成至少一个目标动态令牌,包括:Optionally, when the server receives the dynamic token, it generates at least one target dynamic token according to the first timestamp, the time slice and the key, including:
所述服务端接收到所述动态令牌时,根据所述第一时间戳确定目标校准时间,并将所述目标校准时间加上预设数值,得到第一校准时间,将所述目标校准时间减去所述预设数据,得到第二校准时间;When the server receives the dynamic token, it determines the target calibration time according to the first time stamp, and adds a preset value to the target calibration time to obtain the first calibration time, and calculates the target calibration time Subtracting the preset data to obtain a second calibration time;
所述服务端利用哈希算法对所述目标校准时间和所述密钥进行处理,得到第二哈希值,并利用HMAC-sha1算法对所述第二哈希值进行处理,生成第一目标动态令牌;利用哈希算法对所述第一校准时间和所述密钥进行处理,得到第三哈希值,并利用HMAC-sha1算法对所述第三哈希值进行处理,生成第二目标动态令牌;利用哈希算法对所述第二校准时间和所述密钥进行处理,得到第四哈希值,并利用HMAC-sha1算法对所述第四哈希值进行处理,生成第三目标动态令牌。The server uses a hash algorithm to process the target calibration time and the key to obtain a second hash value, and uses the HMAC-sha1 algorithm to process the second hash value to generate a first target Dynamic token; use a hash algorithm to process the first calibration time and the key to obtain a third hash value, and use the HMAC-sha1 algorithm to process the third hash value to generate a second The target dynamic token; use a hash algorithm to process the second calibration time and the key to obtain a fourth hash value, and use the HMAC-sha1 algorithm to process the fourth hash value to generate a fourth hash value Three-goal dynamic token.
可选的,所述服务端判断所述至少一个目标动态令牌中,是否存在与所述动态令牌一致的目标动态令牌;若存在与所述动态令牌一致的目标动态令牌,确定所述客户端认证通过,向所述目标APP对应的服务方发送相应的认证通过信息,包括:Optionally, the server judges whether there is a target dynamic token consistent with the dynamic token in the at least one target dynamic token; if there is a target dynamic token consistent with the dynamic token, determine The client passes the authentication, and sends corresponding authentication passing information to the service party corresponding to the target APP, including:
所述服务端判断所述动态令牌是否与所述第一目标动态令牌一致,或者是否与所述第二目标动态令牌一致,或者是否与所述第三目标动态令牌一致;The server determines whether the dynamic token is consistent with the first target dynamic token, or whether it is consistent with the second target dynamic token, or whether it is consistent with the third target dynamic token;
若所述动态令牌与所述第一目标动态令牌一致,或者与所述第二目标动态令牌一致,或者与所述第三目标动态令牌一致,所述服务端确定所述客户端认证通过,向所述目标APP对应的服务方发送相应的认证通过信息。If the dynamic token is consistent with the first target dynamic token, or is consistent with the second target dynamic token, or is consistent with the third target dynamic token, the server determines that the client If the authentication is passed, corresponding authentication passing information is sent to the service party corresponding to the target APP.
本发明第二方面公开一种设备认证系统,所述设备认证系统包括客户端和服务端;The second aspect of the present invention discloses a device authentication system, the device authentication system includes a client and a server;
所述客户端,用于当检测到目标APP初始化客户端sdk时,向服务端发送参数信息,其中,所述参数信息至少包括设备标识;接收到所述目标参数信息时,根据所述第一时间戳和第二时间戳,计算时钟偏差,并根据所述第二时间戳、所述时钟偏差、所述时间片和与所述服务端预先约定的密钥,生成动态令牌,并将所述动态令牌发送给所述服务端;其中,所述与所述服务端预先预定的密钥和所述密钥相同;所述第二时间戳为所述客户端的本地时间戳;The client is configured to send parameter information to the server when detecting that the target APP initializes the client sdk, wherein the parameter information includes at least a device identifier; when receiving the target parameter information, according to the first Timestamp and second timestamp, calculate the clock offset, and generate a dynamic token according to the second timestamp, the clock offset, the time slice and the key pre-agreed with the server, and send the The dynamic token is sent to the server; wherein, the key predetermined by the server is the same as the key; the second timestamp is the local timestamp of the client;
所述服务端,用于接收到所述参数信息时,根据所述设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给所述客户端;其中,所述第一时间戳为所述服务端的本地时间戳;接收到所述动态令牌时,根据所述第一时间戳、所述时间片和所述密钥,生成至少一个目标动态令牌;若存在与所述动态令牌一致的目标动态令牌,确定所述客户端认证通过,向所述目标APP对应的服务方发送相应的认证通过信息,并允许所述客户端访问所述服务端。The server is configured to generate a key according to the device identifier and encrypted salt value when receiving the parameter information, and send the target parameter information generated according to the first timestamp and time slice to the client terminal; wherein, the first timestamp is the local timestamp of the server; when the dynamic token is received, at least one target is generated according to the first timestamp, the time slice and the key Dynamic token; if there is a target dynamic token consistent with the dynamic token, determine that the client has passed the authentication, send corresponding authentication passing information to the service party corresponding to the target APP, and allow the client to access the server.
可选的,接收到所述参数信息时,根据所述设备标识和加密盐值,生成密钥,并将根据所述密钥、第一时间戳和时间片,生成的目标参数信息发送给所述客户端的所述服务端,具体用于:Optionally, when the parameter information is received, a key is generated according to the device identifier and encrypted salt value, and the target parameter information generated according to the key, the first timestamp and the time slice is sent to the The server of the client, specifically for:
接收到所述参数信息时,从时间同步钟获取第一时间戳和时间片,并从所述设备标识中截取目标设备标识;根据所述目标设备标识和加密盐值,生成密钥;根据所述第一时间戳和所述时间片,生成目标参数信息,并将所述目标参数信息发送给所述客户端。When receiving the parameter information, obtain the first time stamp and time slice from the time synchronization clock, and intercept the target device ID from the device ID; generate a key according to the target device ID and encrypted salt value; The first timestamp and the time slice are used to generate target parameter information, and the target parameter information is sent to the client.
可选的,接收到所述目标参数信息时,根据所述第一时间戳和所述第二时间戳,计算时钟偏差,并根据所述第二时间戳、所述时钟偏差、所述时间片和与所述服务端预先预定的密钥,生成动态令牌,并将所述动态令牌发送给所述服务端的所述客户端,具体用于:Optionally, when the target parameter information is received, a clock offset is calculated according to the first timestamp and the second timestamp, and a clock offset is calculated according to the second timestamp, the clock offset, and the time slice Generate a dynamic token with the pre-booked key with the server, and send the dynamic token to the client of the server, specifically for:
接收到所述目标参数信息时,从所述时间同步钟获取第二时间戳,并根据所述第一时间戳和所述第二时间戳,计算时钟偏差;其中,所述目标参数信息包括所述第一时间戳和所述第一时间片;根据所述第二时间戳、所述时钟偏差和所述时间片,生成校准时间;利用哈希算法对所述校准时间和与所述服务端预先预定的密钥进行处理,得到相应的第一哈希值,并利用HMAC-sha1算法对所述第一哈希值进行处理,生成相应的动态令牌,并将所述动态令牌发送给所述服务端。When receiving the target parameter information, obtain a second time stamp from the time synchronization clock, and calculate a clock offset according to the first time stamp and the second time stamp; wherein the target parameter information includes the The first time stamp and the first time slice; according to the second time stamp, the clock offset and the time slice, generate a calibration time; use a hash algorithm to compare the calibration time and the server Pre-determined keys are processed to obtain the corresponding first hash value, and the HMAC-sha1 algorithm is used to process the first hash value to generate a corresponding dynamic token, and the dynamic token is sent to the server.
本发明第三方面公开的一种电子设备,包括:处理器以及存储器,所述处理器以及存储器通过通信总线相连;其中,所述处理器,用于调用并执行所述存储器中存储的程序;所述存储器,用于存储程序,所述程序用于实现如上述本发明第一方面公开的设备认证方法。An electronic device disclosed in the third aspect of the present invention includes: a processor and a memory, the processor and the memory are connected through a communication bus; wherein the processor is used to call and execute a program stored in the memory; The memory is used to store a program, and the program is used to implement the device authentication method disclosed in the first aspect of the present invention.
本发明第四方面公开,一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行如上述本发明第一方面公开的设备认证方法。The fourth aspect of the present invention discloses a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used to perform device authentication as disclosed in the above-mentioned first aspect of the present invention method.
本发明提供一种设备认证方法、系统、电子设备及存储介质,客户端当检测到目标APP初始化客户端sdk时,向服务端发送参数信息,其中,参数信息至少包括设备标识;服务端接收到参数信息时,根据设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给客户端;客户端接收到目标参数信息时,根据第一时间戳和第二时间戳,计算时钟偏差,并根据第一时间戳、时钟偏差、时间片和与服务器预先预定的密钥,生成动态令牌,并将动态令牌发送给服务端;服务端接收到动态令牌时,根据第一时间戳、时间片和密钥,生成至少一个目标动态令牌;服务端若存在与动态令牌一致的目标动态令牌,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息。本发明提供的技术方案,分别通过客户端和服务端生成具有唯一性和时效性的的动态令牌,并将客户端和服务端生成的动态令牌进行比对,从而防止非法用户通过虚拟软件模拟该设备(客户端)访问服务端,能够有效保证设备(客户端)在真实环境中运行,从而避免用户使用单个合法设备创建大量账号进行薅羊毛。The present invention provides a device authentication method, system, electronic device and storage medium. When the client detects that the target APP initializes the client sdk, the client sends parameter information to the server, wherein the parameter information includes at least the device identifier; the server receives For parameter information, generate a key according to the device ID and encrypted salt value, and send the target parameter information generated according to the first time stamp and time slice to the client; when the client receives the target parameter information, it will stamp and the second timestamp, calculate the clock offset, and generate a dynamic token based on the first timestamp, clock offset, time slice and pre-booked key with the server, and send the dynamic token to the server; the server receives When the dynamic token is received, at least one target dynamic token is generated according to the first timestamp, time slice and key; if there is a target dynamic token consistent with the dynamic token on the server side, it is determined that the client authentication is passed, and the target APP The corresponding server sends corresponding authentication passing information. The technical solution provided by the present invention generates unique and time-sensitive dynamic tokens through the client and the server respectively, and compares the dynamic tokens generated by the client and the server, thereby preventing illegal users from passing virtual software Simulating the device (client) to access the server can effectively ensure that the device (client) runs in a real environment, thereby preventing users from using a single legitimate device to create a large number of accounts for scamming.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1为本发明实施例提供一种设备认证方法的流程示意图;FIG. 1 is a schematic flowchart of a device authentication method provided by an embodiment of the present invention;
图2为本发明实施例提供的一种设备认证系统的结构示意图;FIG. 2 is a schematic structural diagram of a device authentication system provided by an embodiment of the present invention;
图3为本发明实施例提供的一种电子设备的结构示意图。FIG. 3 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。As used herein, the term "comprise" and its variations are open-ended, ie "including but not limited to". The term "based on" is "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one further embodiment"; the term "some embodiments" means "at least some embodiments." Relevant definitions of other terms will be given in the description below.
需要注意,本发明公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。It should be noted that concepts such as "first" and "second" mentioned in the disclosure of the present invention are only used to distinguish different devices, modules or units, and are not used to limit the functions performed by these devices, modules or units. sequence or interdependence.
需要注意,本发明公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "one" and "multiple" mentioned in the disclosure of the present invention are illustrative and not restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "a or more".
参见图1,示出了本发明实施例提供的一种设备认证方法的流程示意图,该设备认证方法应用于设备认证系统,该设备认证系统包括客户端和服务端,该设备认证方法具体包括以下步骤:Referring to FIG. 1 , it shows a schematic flowchart of a device authentication method provided by an embodiment of the present invention. The device authentication method is applied to a device authentication system. The device authentication system includes a client and a server. The device authentication method specifically includes the following step:
S101:客户端当检测到目标APP初始化客户端sdk时,向服务端发送参数信息。S101: When the client detects that the target APP initializes the client sdk, it sends parameter information to the server.
在本申请实施例中,可以预先在客户端中安装目标APP,当用户想要参加服务方在目标APP中举办的营销活动时,可以通过该客户端中安装的目标APP参与。其中,目标APP包括sdk。In the embodiment of the present application, the target APP can be pre-installed on the client, and when the user wants to participate in a marketing activity organized by the service party in the target APP, he can participate through the target APP installed on the client. Wherein, the target APP includes sdk.
在具体执行步骤S101的过程,客户端可以实时检测目标APP是否初始化客户端sdk;当客户端检测到目标APP初始化客户端sdk时,可以调用sdk和该目标APP对应的服务端建立连接;客户端在与该服务端建立连接后,获取自身的设备did和目标APP的appid,并将根据设备did和appid生成的参数信息传递给该服务端。其中,设备did为客户端的设备标识。In the process of specifically executing step S101, the client can detect in real time whether the target APP initializes the client sdk; when the client detects that the target APP initializes the client sdk, it can call the sdk to establish a connection with the server corresponding to the target APP; After establishing a connection with the server, obtain the device did and the appid of the target APP, and pass the parameter information generated according to the device did and appid to the server. Wherein, the device did is the device identifier of the client.
需要说明的是,客户端可以和服务端预定约定对应的密钥,预先约定的密钥的生成过程为:客户端从设备标识中截取出一部分设备标识作为目标设备标识,并目标设备标识和加密盐值进行拼接,并对拼接后的目标设备标识和加密盐值进行加密处理,得到相应的密钥。It should be noted that the client can pre-determine the corresponding key with the server. The pre-agreed key generation process is as follows: the client intercepts a part of the device ID from the device ID as the target device ID, and the target device ID and encryption The salt value is spliced, and the spliced target device ID and encrypted salt value are encrypted to obtain the corresponding key.
S102:服务端接收到参数信息时,根据设备标识和加密盐值,生成密钥。S102: When the server receives the parameter information, it generates a key according to the device identifier and the encrypted salt value.
在具体执行步骤S102的过程中,服务端在接收到客户端发送的参数信息时,可以从时间同步钟获取第一时间戳和时间片,并从接收到参数信息中的设备标识中截取出一部分设备标识作为目标设备标识;根据目标设备标识和加密盐值生成相应的密钥。During the specific execution of step S102, when the server receives the parameter information sent by the client, it can obtain the first time stamp and time slice from the time synchronization clock, and intercept a part of the device identifier from the received parameter information The device ID is used as the target device ID; the corresponding key is generated according to the target device ID and the encrypted salt value.
其中,第一时间戳为服务器的当前时间戳。Wherein, the first timestamp is the current timestamp of the server.
需要说明的是,服务器从设备标识截取的一部分设备标识与客户端从设备标识中截取出一部分设备标识相同,也就是说,服务器根据目标设备标识和加密盐值生成相应的密钥与客户端和服务端预先约定的密钥相同。It should be noted that the part of the device ID intercepted by the server from the device ID is the same as that intercepted by the client from the device ID. The pre-agreed key on the server side is the same.
在本申请实施例中,可以将目标设备标识和加密盐值进行拼接,并对拼接后的目标设备标识和加密盐值进行加密处理,得到相应的密钥。In the embodiment of the present application, the target device ID and the encrypted salt value may be concatenated, and the spliced target device ID and encrypted salt value may be encrypted to obtain a corresponding key.
S103:服务端将根据第一时间戳和时间片,生成的目标参数信息发送给客户端。S103: The server sends the target parameter information generated according to the first timestamp and the time slice to the client.
在具体执行步骤S103的过程中,服务端可以根据第一时间戳、时间片和密钥,生成相应的目标参数信息,并将生成的目标参数信息发送给客户端。During the specific execution of step S103, the server may generate corresponding target parameter information according to the first timestamp, time slice and key, and send the generated target parameter information to the client.
S104:客户端接收到目标参数信息时,根据第一时间戳和第二时间戳,计算时钟偏差。S104: When the client receives the target parameter information, calculate a clock offset according to the first timestamp and the second timestamp.
在具体执行步骤S104的过程中,客户端在接收到服务端发送的目标参数信息时,从时间同步钟获取第二时间戳,并根据目标参数信息中的第一时间戳和第二时间戳,计算相应的时间偏差。During the specific execution of step S104, when the client receives the target parameter information sent by the server, it obtains the second timestamp from the time synchronization clock, and according to the first timestamp and the second timestamp in the target parameter information, Calculate the corresponding time offset.
需要说明的是,第二时间戳为客户端当前的本地时间戳。It should be noted that the second timestamp is the current local timestamp of the client.
S105:客户端根据第二时间戳、时钟偏差、时间片和与服务端预先约定的密钥,生成动态令牌,并将动态令牌发送给服务端。S105: The client generates a dynamic token according to the second timestamp, the clock offset, the time slice and the key pre-agreed with the server, and sends the dynamic token to the server.
在本申请实施例中,客户端在计算出时间偏差后,可以根据计算的时间偏差、第二时间戳和目标参数信息中的时间片,生成校准时间;最后利用哈希算法对校准时间和与服务端预先约定的密钥进行处理,得到相应的第一哈希值,并利用HMAC-sha1算法对第一哈希值进行处理,生成相应的动态令牌,并将动态令牌发送给服务端。In this embodiment of the application, after calculating the time offset, the client can generate the calibration time according to the calculated time offset, the second timestamp, and the time slice in the target parameter information; The pre-agreed key on the server is processed to obtain the corresponding first hash value, and the first hash value is processed by the HMAC-sha1 algorithm to generate a corresponding dynamic token, and the dynamic token is sent to the server .
需要说明的是,利用哈希算法对校准时间和与服务端预先预定的密钥进行处理,得到相应的第一哈希值,并利用HMAC-sha1算法对第一哈希值进行处理,生成相应的动态令牌的方式可以为:code=HOTP(K,T)=Truncate(hash算法(K,T));其中,code为动态令牌,K为客户端与服务端预先预定的密钥,T为校准时间。It should be noted that the calibration time and the key pre-determined with the server are processed by the hash algorithm to obtain the corresponding first hash value, and the first hash value is processed by the HMAC-sha1 algorithm to generate the corresponding The way of the dynamic token can be: code=HOTP(K, T)=Truncate(hash algorithm (K, T)); wherein, code is the dynamic token, K is the key predetermined by the client and the server, T is the calibration time.
还需要说明的是,动态令牌可以为6bit的动态令牌数字。It should also be noted that the dynamic token may be a 6-bit dynamic token number.
在一些实施例中,客户端可以将第一时间戳减去第二时间戳,得到时间偏差;并将第二时间戳减去时间偏差得到相应的差值后,并将差值除以时间片,得到校准时间。In some embodiments, the client can subtract the second timestamp from the first timestamp to obtain the time offset; and subtract the time offset from the second timestamp to obtain the corresponding difference, and divide the difference by the time slice , to get the calibration time.
S106:服务端接收到动态令牌时,根据第一时间戳、时间片和密钥,生成至少一个目标动态令牌。S106: When the server receives the dynamic token, generate at least one target dynamic token according to the first timestamp, the time slice and the key.
在具体执行步骤S106的过程中,服务端在接收到客户端发送的动态令牌时,可以通过时钟同步钟基于第一时间戳确定目标校准时间。其中,目标校准时间与客户端侧的校准时间相同。During the specific execution of step S106, when the server receives the dynamic token sent by the client, it can determine the target calibration time based on the first time stamp through the clock synchronization clock. Wherein, the target calibration time is the same as the calibration time at the client side.
服务端在获取到目标校准时间后,可以将目标校准时间加上预设数值,得到第一校准时间,将目标校验时间减去预设数据,得到第二校准时间;最后利用哈希算法对目标校准时间和密钥进行处理,得到第二哈希值,并利用HMAC-sha1算法对第二哈希值进行处理,生成第一目标动态令牌;利用哈希算法对第一校准时间和密钥进行处理,得到第三哈希值,并利用HMAC-sha1算法对第三哈希值进行处理,生成第二目标动态令牌;利用哈希算法对第二校准时间和密钥进行处理,得到第四哈希值,并利用HMAC-sha1算法对第四哈希值进行处理,生成第三目标动态令牌。After obtaining the target calibration time, the server can add the target calibration time to the preset value to obtain the first calibration time, and subtract the preset data from the target calibration time to obtain the second calibration time; finally, use the hash algorithm to Process the target calibration time and key to obtain the second hash value, and use the HMAC-sha1 algorithm to process the second hash value to generate the first target dynamic token; use the hash algorithm to process the first calibration time and password key to obtain the third hash value, and use the HMAC-sha1 algorithm to process the third hash value to generate the second target dynamic token; use the hash algorithm to process the second calibration time and key to obtain the fourth hash value, and use the HMAC-sha1 algorithm to process the fourth hash value to generate the third target dynamic token.
需要说明的是,预设数值可以为1,可以根据实际应用进行设置,本申请实施例不加以限制。根据目标校准时间和目标参数信息中的密钥,生成相应的至少一个目标动态令牌的方式可以为:code1=HOTP(K,T)=Truncate(hash算法(K,T1)),其中,code1为第二目标动态令牌,K为密钥,T1为目标校准时间;code2=HOTP(K,T1-1)=Truncate(hash算法(K,T1-1)),其中,code2为第三目标动态令牌,K为密钥,T1-1为第一校准时间;code3=HOTP(K,T1+1)=Truncate(hash算法(K,T1+1)),其中,code3为第四目标动态令牌,K为密钥,T1+1为第二校准时间。It should be noted that the preset value may be 1, which may be set according to actual applications, which is not limited in this embodiment of the present application. According to the key in the target calibration time and the target parameter information, the way to generate at least one corresponding target dynamic token can be: code1=HOTP(K, T)=Truncate(hash algorithm (K, T1)), where code1 is the second target dynamic token, K is the key, and T1 is the target calibration time; code2=HOTP(K, T1-1)=Truncate(hash algorithm (K, T1-1)), wherein, code2 is the third target Dynamic token, K is the key, T1-1 is the first calibration time; code3=HOTP(K, T1+1)=Truncate(hash algorithm (K, T1+1)), wherein, code3 is the fourth target dynamic Token, K is the key, and T1+1 is the second calibration time.
S107:服务端若存在与动态令牌一致的目标动态令牌,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息。S107: If there is a target dynamic token consistent with the dynamic token at the server end, determine that the client terminal has passed the authentication, and send corresponding authentication pass information to the service party corresponding to the target APP.
在具体执行步骤S107的过程中,服务端在根据第一时间戳、时间片和密钥,生成至少一个目标动态令牌后,可以判断至少一个目标动态令牌中,是否存在与动态令牌一致的目标动态令牌;若存在与动态令牌一致的目标动态令牌,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息,并允许客户端访问服务端。During the specific execution of step S107, after the server generates at least one target dynamic token according to the first timestamp, time slice and key, it can determine whether there is a The target dynamic token; if there is a target dynamic token consistent with the dynamic token, determine that the client has passed the authentication, send the corresponding authentication pass information to the server corresponding to the target APP, and allow the client to access the server.
如果至少一个目标动态令牌中不存在与动态令牌一致的目标动态令牌,可以认为该客户端认证失败,即可以认为该客户端不合法,则向该目标APP对应的服务方发送相应的认证未通过信息,并禁止该客户端访问服务端,以防非法用户通过虚拟软件模拟该设备(客户端)访问服务端,从而避免用户使用单个合法设备创建大量账号进行薅羊毛。If there is no target dynamic token consistent with the dynamic token in at least one target dynamic token, it can be considered that the client authentication fails, that is, it can be considered that the client is not legal, and the corresponding service party corresponding to the target APP is sent. Authentication failed information, and the client is prohibited from accessing the server to prevent illegal users from simulating the device (client) to access the server through virtual software, thereby preventing users from using a single legitimate device to create a large number of accounts for profit.
作为本申请实施例的优选方式,至少一个目标动态令牌包括第一目标动态令牌、第二目标动态令牌和第三目标动态令牌;服务端判断动态令牌是否与第一目标动态令牌一致,或者是否与第二目标动态令牌一致,或者是否与第三目标动态令牌一致。As a preferred mode of the embodiment of this application, at least one target dynamic token includes a first target dynamic token, a second target dynamic token and a third target dynamic token; the server determines whether the dynamic token is consistent with the first target dynamic token card, or whether it is consistent with the second target dynamic token, or whether it is consistent with the third target dynamic token.
若动态令牌与第一目标动态令牌一致,或者与第二目标动态令牌一致,或者与第三目标动态令牌一致,服务端确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息。If the dynamic token is consistent with the first target dynamic token, or the second target dynamic token, or the third target dynamic token, the server determines that the client authentication is passed, and sends a corresponding response to the server corresponding to the target APP. The authentication pass information.
若动态令牌与第一目标动态令牌不一致,且与第二目标动态令牌不一致,且与第三目标动态令牌不一致,服务端确定客户端认证不通过,则向该目标APP对应的服务方发送相应的认证未通过信息,以防非法用户通过虚拟软件模拟该设备(客户端)访问服务端,从而避免用户使用单个合法设备创建大量账号进行薅羊毛。If the dynamic token is inconsistent with the first target dynamic token, and inconsistent with the second target dynamic token, and inconsistent with the third target dynamic token, the server determines that the client authentication fails, and then the corresponding service of the target APP The corresponding authentication failure information is sent to prevent illegal users from simulating the device (client) through virtual software to access the server, so as to prevent users from using a single legitimate device to create a large number of accounts for profit.
本发明提供一种设备认证方法,客户端当检测到目标APP初始化客户端sdk时,向服务端发送参数信息,其中,参数信息至少包括设备标识;服务端接收到参数信息时,根据设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给客户端;客户端接收到目标参数信息时,根据第一时间戳和第二时间戳,计算时钟偏差,并根据第一时间戳、时钟偏差、时间片和与服务器预先预定的密钥,生成动态令牌,并将动态令牌发送给服务端;服务端接收到动态令牌时,根据第一时间戳、时间片和密钥,生成至少一个目标动态令牌;服务端若存在与动态令牌一致的目标动态令牌,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息。本发明提供的技术方案,分别通过客户端和服务端生成具有唯一性和时效性的的动态令牌,并将客户端和服务端生成的动态令牌进行比对,从而防止非法用户通过虚拟软件模拟该设备(客户端)访问服务端,能够有效保证设备(客户端)在真实环境中运行,从而避免用户使用单个合法设备创建大量账号进行薅羊毛。The present invention provides a device authentication method. When the client detects that the target APP initializes the client sdk, the client sends parameter information to the server, wherein the parameter information includes at least the device identifier; when the server receives the parameter information, it Encrypt the salt value, generate a key, and send the target parameter information generated according to the first timestamp and time slice to the client; when the client receives the target parameter information, it calculates according to the first timestamp and the second timestamp Clock deviation, and generate a dynamic token according to the first timestamp, clock deviation, time slice and pre-booked key with the server, and send the dynamic token to the server; when the server receives the dynamic token, according to the first A timestamp, time slice and key to generate at least one target dynamic token; if there is a target dynamic token consistent with the dynamic token on the server side, determine that the client authentication is passed, and send the corresponding authentication to the service party corresponding to the target APP pass information. The technical solution provided by the present invention generates unique and time-sensitive dynamic tokens through the client and the server respectively, and compares the dynamic tokens generated by the client and the server, thereby preventing illegal users from passing virtual software Simulating the device (client) to access the server can effectively ensure that the device (client) runs in a real environment, thereby preventing users from using a single legitimate device to create a large number of accounts for scamming.
基于本发明实施例公开的设备认证方法,本发明实施例还对应公开一种设备认证系统,如图2所示,该设备认证系统包括客户端和服务端,该设备认证系统包括:Based on the device authentication method disclosed in the embodiment of the present invention, the embodiment of the present invention also discloses a corresponding device authentication system, as shown in Figure 2, the device authentication system includes a client and a server, and the device authentication system includes:
客户端,用于当检测到目标APP初始化客户端sdk时,向服务端发送参数信息,其中,参数信息至少包括设备标识;接收到目标参数信息时,根据第一时间戳和第二时间戳,计算时钟偏差,并根据第二时间戳、时钟偏差、时间片和与服务端预先约定的密钥,生成动态令牌,并将动态令牌发送给服务端;其中,与服务端预先预定的密钥和密钥相同;第二时间戳为客户端的本地时间戳;The client is configured to send parameter information to the server when detecting that the target APP initializes the client sdk, wherein the parameter information includes at least a device identifier; when receiving the target parameter information, according to the first timestamp and the second timestamp, Calculate the clock deviation, and generate a dynamic token according to the second timestamp, clock deviation, time slice and the key pre-agreed with the server, and send the dynamic token to the server; The key is the same as the key; the second timestamp is the local timestamp of the client;
服务端,用于接收到参数信息时,根据设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给客户端;其中,第一时间戳为服务端的本地时间戳;接收到动态令牌时,根据第一时间戳、时间片和密钥,生成至少一个目标动态令牌;若存在与动态令牌一致的目标动态令牌,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息。The server is configured to generate a key according to the device identifier and encrypted salt value when receiving the parameter information, and send the target parameter information generated according to the first timestamp and time slice to the client; wherein, the first timestamp is the local timestamp of the server; when receiving the dynamic token, generate at least one target dynamic token according to the first timestamp, time slice and key; if there is a target dynamic token consistent with the dynamic token, determine the client If the authentication is passed, corresponding authentication passing information is sent to the service party corresponding to the target APP.
本发明提供一种设备认证系统,客户端当检测到目标APP初始化客户端sdk时,向服务端发送参数信息,其中,参数信息至少包括设备标识;服务端接收到参数信息时,根据设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给客户端;客户端接收到目标参数信息时,根据第一时间戳和第二时间戳,计算时钟偏差,并根据第一时间戳、时钟偏差、时间片和与服务器预先预定的密钥,生成动态令牌,并将动态令牌发送给服务端;服务端接收到动态令牌时,根据第一时间戳、时间片和密钥,生成至少一个目标动态令牌;服务端若存在与动态令牌一致的目标动态令牌,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息。本发明提供的技术方案,分别通过客户端和服务端生成具有唯一性和时效性的的动态令牌,并将客户端和服务端生成的动态令牌进行比对,从而防止非法用户通过虚拟软件模拟该设备(客户端)访问服务端,能够有效保证设备(客户端)在真实环境中运行,从而避免用户使用单个合法设备创建大量账号进行薅羊毛。The present invention provides a device authentication system. When the client detects that the target APP initializes the client sdk, it sends parameter information to the server, wherein the parameter information includes at least the device identifier; when the server receives the parameter information, it Encrypt the salt value, generate a key, and send the target parameter information generated according to the first timestamp and time slice to the client; when the client receives the target parameter information, it calculates according to the first timestamp and the second timestamp Clock deviation, and generate a dynamic token according to the first timestamp, clock deviation, time slice and pre-booked key with the server, and send the dynamic token to the server; when the server receives the dynamic token, according to the first A timestamp, time slice and key to generate at least one target dynamic token; if there is a target dynamic token consistent with the dynamic token on the server side, determine that the client authentication is passed, and send the corresponding authentication to the service party corresponding to the target APP pass information. The technical solution provided by the present invention generates unique and time-sensitive dynamic tokens through the client and the server respectively, and compares the dynamic tokens generated by the client and the server, thereby preventing illegal users from passing virtual software Simulating the device (client) to access the server can effectively ensure that the device (client) runs in a real environment, thereby preventing users from using a single legitimate device to create a large number of accounts for scamming.
可选的,接收到参数信息时,根据设备标识和加密盐值,生成密钥,并将根据第一时间戳和时间片,生成的目标参数信息发送给客户端的服务端,具体用于:Optionally, when the parameter information is received, a key is generated according to the device identifier and the encrypted salt value, and the target parameter information generated according to the first timestamp and time slice is sent to the server of the client, specifically for:
接收到参数信息时,从时间同步钟获取第一时间戳和时间片,并从设备标识中截取目标设备标识;根据目标设备标识和加密盐值,生成密钥;根据第一时间戳和时间片,生成目标参数信息,并将目标参数信息发送给客户端。When the parameter information is received, obtain the first timestamp and time slice from the time synchronization clock, and intercept the target device ID from the device ID; generate a key according to the target device ID and encrypted salt value; according to the first timestamp and time slice , generate target parameter information, and send the target parameter information to the client.
可选的,接收到目标参数信息时,根据第一时间戳和第二时间戳,计算时钟偏差,并根据第二时间戳、时钟偏差、时间片和与服务端预先预定的密钥,生成动态令牌,并将动态令牌发送给服务端的客户端,具体用于:Optionally, when the target parameter information is received, calculate the clock offset according to the first timestamp and the second timestamp, and generate a dynamic Token, and send the dynamic token to the server client, specifically for:
接收到目标参数信息时,从时间同步钟获取第二时间戳,并根据第一时间戳和第二时间戳,计算时钟偏差;其中,目标参数信息包括第一时间戳和第一时间片;根据第二时间戳、时钟偏差和时间片,生成校准时间;利用哈希算法对校准时间和与服务端预先预定的密钥进行处理,得到相应的第一哈希值,并利用HMAC-sha1算法对第一哈希值进行处理,生成相应的动态令牌,并将动态令牌发送给服务端。When the target parameter information is received, the second time stamp is obtained from the time synchronization clock, and the clock deviation is calculated according to the first time stamp and the second time stamp; wherein, the target parameter information includes the first time stamp and the first time slice; according to The second timestamp, clock offset and time slice generate the calibration time; use the hash algorithm to process the calibration time and the pre-scheduled key with the server to obtain the corresponding first hash value, and use the HMAC-sha1 algorithm to process the calibration time The first hash value is processed, a corresponding dynamic token is generated, and the dynamic token is sent to the server.
可选的,接收到动态令牌时,根据第一时间戳、时间片和密钥,生成至少一个目标动态令牌的服务端,具体用于:Optionally, when receiving the dynamic token, generate at least one target dynamic token server according to the first timestamp, time slice and key, specifically for:
接收到动态令牌时,根据所述第一时间戳确定目标校准时间;并将目标校准时间加上预设数值,得到第一校准时间,将目标校准时间减去预设数据,得到第二校准时间;利用哈希算法对目标校准时间和密钥进行处理,得到第二哈希值,并利用HMAC-sha1算法对第二哈希值进行处理,生成第一目标动态令牌;利用哈希算法对第一校准时间和密钥进行处理,得到第三哈希值,并利用HMAC-sha1算法对第三哈希值进行处理,生成第二目标动态令牌;利用哈希算法对第二校准时间和密钥进行处理,得到第四哈希值,并利用HMAC-sha1算法对第四哈希值进行处理,生成第三目标动态令牌。When the dynamic token is received, the target calibration time is determined according to the first time stamp; the target calibration time is added to a preset value to obtain the first calibration time, and the target calibration time is subtracted from the preset data to obtain the second calibration time Time; use the hash algorithm to process the target calibration time and key to obtain the second hash value, and use the HMAC-sha1 algorithm to process the second hash value to generate the first target dynamic token; use the hash algorithm Process the first calibration time and key to obtain a third hash value, and use the HMAC-sha1 algorithm to process the third hash value to generate a second target dynamic token; use the hash algorithm to process the second calibration time and the key to obtain the fourth hash value, and use the HMAC-sha1 algorithm to process the fourth hash value to generate the third target dynamic token.
可选的,若存在与动态令牌一致的目标动态令牌,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息,并允许客户端访问的服务端,具体用于:Optionally, if there is a target dynamic token that is consistent with the dynamic token, determine that the client has passed the authentication, send corresponding authentication passing information to the server corresponding to the target APP, and allow the client to access the server, specifically for:
判断动态令牌是否与第一目标动态令牌一致,或者是否与第二目标动态令牌一致,或者是否与第三目标动态令牌一致;若动态令牌与第一目标动态令牌一致,或者与第二目标动态令牌一致,或者与第三目标动态令牌一致,确定客户端认证通过,向目标APP对应的服务方发送相应的认证通过信息,并允许客户端访问服务端。Judging whether the dynamic token is consistent with the first target dynamic token, or whether it is consistent with the second target dynamic token, or whether it is consistent with the third target dynamic token; if the dynamic token is consistent with the first target dynamic token, or Consistent with the second target dynamic token, or consistent with the third target dynamic token, determine that the client is authenticated, send corresponding authentication pass information to the server corresponding to the target APP, and allow the client to access the server.
本申请实施例提供了一种电子设备,如图3所示,电子设备包括处理器301和存储器302,存储器302用于设备认证的程序代码和数据,处理器301用于调用存储器中的程序指令执行实现如上述实施例中设备认证方法所示的步骤。An embodiment of the present application provides an electronic device. As shown in FIG. 3 , the electronic device includes a
本申请实施例提供了一种存储介质,存储介质包括存储程序,其中,在程序运行时控制存储介质所在设备执行上述实施例示出的设备认证方法。An embodiment of the present application provides a storage medium, and the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the device authentication method shown in the foregoing embodiments.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统或系统实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的系统及系统实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。Each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment. The above-described systems and system embodiments are only illustrative, where the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
以上仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only preferred embodiments of the present invention, and it should be pointed out that for those of ordinary skill in the art, some improvements and modifications can also be made without departing from the principle of the present invention, and these improvements and modifications should also be considered Be the protection scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310036933.5A CN116055172A (en) | 2023-01-10 | 2023-01-10 | A device authentication method, system, electronic device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310036933.5A CN116055172A (en) | 2023-01-10 | 2023-01-10 | A device authentication method, system, electronic device and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116055172A true CN116055172A (en) | 2023-05-02 |
Family
ID=86123398
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310036933.5A Pending CN116055172A (en) | 2023-01-10 | 2023-01-10 | A device authentication method, system, electronic device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116055172A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117527238A (en) * | 2024-01-03 | 2024-02-06 | 成都新希望金融信息有限公司 | Key generation method, device, electronic equipment and storage medium |
| CN119892355A (en) * | 2025-01-09 | 2025-04-25 | 北京世冠金洋科技发展有限公司 | Password verification method and related device |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110830471A (en) * | 2019-11-06 | 2020-02-21 | 北京一砂信息技术有限公司 | OTP (one time password) verification method, server, client and computer-readable storage medium |
| US20200195658A1 (en) * | 2018-12-14 | 2020-06-18 | Daniel Chien | Timestamp-based authentication |
-
2023
- 2023-01-10 CN CN202310036933.5A patent/CN116055172A/en active Pending
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20200195658A1 (en) * | 2018-12-14 | 2020-06-18 | Daniel Chien | Timestamp-based authentication |
| CN110830471A (en) * | 2019-11-06 | 2020-02-21 | 北京一砂信息技术有限公司 | OTP (one time password) verification method, server, client and computer-readable storage medium |
Non-Patent Citations (2)
| Title |
|---|
| 章思宇等: "基于动态口令的增强身份认证", 华东师范大学学报, 23 April 2015 (2015-04-23), pages 247 - 248 * |
| 缪蕊等: "基于Java语言实现一次性动态口令算法", 昆明冶金高等专科学校学报, 7 May 2021 (2021-05-07), pages 74 * |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117527238A (en) * | 2024-01-03 | 2024-02-06 | 成都新希望金融信息有限公司 | Key generation method, device, electronic equipment and storage medium |
| CN117527238B (en) * | 2024-01-03 | 2024-03-19 | 成都新希望金融信息有限公司 | Key generation method, device, electronic equipment and storage medium |
| CN119892355A (en) * | 2025-01-09 | 2025-04-25 | 北京世冠金洋科技发展有限公司 | Password verification method and related device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111212095B (en) | Authentication method, server, client and system for identity information | |
| US12250209B2 (en) | Network identity protection method and device, and electronic equipment and storage medium | |
| US10437985B2 (en) | Using a second device to enroll a secure application enclave | |
| US8196186B2 (en) | Security architecture for peer-to-peer storage system | |
| EP1680884B1 (en) | Methods and apparatus for providing application credentials | |
| CN107493291B (en) | Identity authentication method and device based on Secure Element (SE) | |
| CN100383694C (en) | Maintain privacy for transactions that can be performed by user equipment with a security module | |
| CN104753674B (en) | A kind of verification method and equipment of application identity | |
| US20140006781A1 (en) | Encapsulating the complexity of cryptographic authentication in black-boxes | |
| CN107135073A (en) | Interface call method and device | |
| US11223489B1 (en) | Advanced security control implementation of proxied cryptographic keys | |
| EP3061027A1 (en) | Verifying the security of a remote server | |
| CN111355726A (en) | Identity authorization login method and device, electronic equipment and storage medium | |
| CN113824570B (en) | Block chain-based security terminal authentication method and system | |
| CN102223420A (en) | Digital content distribution method for multimedia social network | |
| US20250016145A1 (en) | End-to-end verifiable multi-factor authentication service | |
| CN111683090A (en) | Block chain digital signature method and device based on distributed storage | |
| CN101777983A (en) | Trading signature method, authentication server and system | |
| CN116055172A (en) | A device authentication method, system, electronic device and storage medium | |
| CN118632248A (en) | Device authentication method, device, electronic device, storage medium and program product | |
| JP2022533874A (en) | Prevent data manipulation and protect user privacy in telecom network measurements | |
| CN107104804A (en) | A kind of platform integrity verification method and device | |
| CN112422534B (en) | Credit evaluation method and equipment for electronic certificate | |
| CN120639456A (en) | A secure access method for the Internet of Things based on cloud-edge collaboration | |
| CN110034922B (en) | Request processing method, processing device, request verification method and verification device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |