[go: up one dir, main page]

CN116012982A - Authentication method and device for digital key, computer equipment and storage medium - Google Patents

Authentication method and device for digital key, computer equipment and storage medium Download PDF

Info

Publication number
CN116012982A
CN116012982A CN202211724761.2A CN202211724761A CN116012982A CN 116012982 A CN116012982 A CN 116012982A CN 202211724761 A CN202211724761 A CN 202211724761A CN 116012982 A CN116012982 A CN 116012982A
Authority
CN
China
Prior art keywords
matching
algorithm
password
digital key
result
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.)
Granted
Application number
CN202211724761.2A
Other languages
Chinese (zh)
Other versions
CN116012982B (en
Inventor
赵洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guoqi Zhiduan Chengdu Technology Co ltd
Original Assignee
Guoqi Zhiduan Chengdu Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guoqi Zhiduan Chengdu Technology Co ltd filed Critical Guoqi Zhiduan Chengdu Technology Co ltd
Priority to CN202211724761.2A priority Critical patent/CN116012982B/en
Publication of CN116012982A publication Critical patent/CN116012982A/en
Application granted granted Critical
Publication of CN116012982B publication Critical patent/CN116012982B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Lock And Its Accessories (AREA)

Abstract

本申请涉及一种数字钥匙的认证方法、装置、计算机设备、存储介质和计算机程序产品。方法包括:响应于解锁终端发送的匹配指令,确定本地支持的密码算法;在本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;向解锁终端返回匹配响应数据,匹配响应数据用于指示解锁终端根据密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果;根据匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于待使用的密码算法进行认证处理。本方案保证了数字钥匙端和解锁终端的待使用的密码算法是同一种密码算法,进而采用本方案来进行认证,是可以认证成功的。

Figure 202211724761

The present application relates to a digital key authentication method, device, computer equipment, storage medium and computer program product. The method includes: responding to the matching instruction sent by the unlocking terminal, determining the locally supported cryptographic algorithm; when the locally supported cryptographic algorithm satisfies a preset condition, generating matching response data containing cryptographic algorithm information; and returning the matching response data to the unlocking terminal , the matching response data is used to instruct the unlocking terminal to determine the password matching response result according to the analysis result of the password algorithm information and the password selection policy; to determine the password matching response result corresponding to the matching response data, and to determine the password algorithm to be used based on the password matching response result to be used Cryptographic algorithm for authentication processing. This scheme ensures that the cryptographic algorithms to be used on the digital key terminal and the unlocking terminal are the same cryptographic algorithm, and then adopting this scheme for authentication can be successfully authenticated.

Figure 202211724761

Description

数字钥匙的认证方法、装置、计算机设备和存储介质Digital key authentication method, device, computer equipment and storage medium

技术领域technical field

本申请涉及数字钥匙通信技术领域,特别是涉及一种数字钥匙的认证方法、装置、计算机设备和存储介质。The present application relates to the technical field of digital key communication, in particular to a digital key authentication method, device, computer equipment and storage medium.

背景技术Background technique

随着数字钥匙通信技术的发展,出现了数字钥匙的认证技术,通过该认证技术可以使数字钥匙终端与解锁端成功认证,进而对解锁端成功解锁。数字钥匙终端是包含数字钥匙的终端,例如智能手机、可穿戴智能设备等。解锁端是待解锁的终端,例如汽车。With the development of digital key communication technology, digital key authentication technology has emerged, through which the digital key terminal and the unlocking terminal can be successfully authenticated, and then the unlocking terminal can be successfully unlocked. Digital key terminals are terminals that contain digital keys, such as smartphones, wearable smart devices, etc. The unlocking terminal is a terminal to be unlocked, such as a car.

在传统技术中,数字钥匙终端基于数字钥匙终端预设的密码算法与解锁终端进行认证,而在认证过程中,解锁终端基于解锁终端预设的密码算法与数字钥匙终端进行认证。In the traditional technology, the digital key terminal authenticates with the unlocking terminal based on the cryptographic algorithm preset by the digital key terminal, and during the authentication process, the unlocking terminal authenticates with the digital key terminal based on the cryptographic algorithm preset by the unlocking terminal.

然而,目前的数字钥匙的认证方法,数字钥匙终端与解锁终端都只预先设置一种本地支持的密码算法,并且在数字钥匙终端预设的密码算法与解锁终端预设的密码算法是相同的密码算法的情况下,数字钥匙终端与解锁终端才可以认证成功。如果终端(即数字钥匙终端和/或解锁端)预设的密码算法有多个,并且数字钥匙终端预设的密码算法与解锁端预设的密码算法有相同的密码算法,那么采用目前的数字钥匙的认证方法来进行认证,是不能认证成功的。However, in the current digital key authentication method, both the digital key terminal and the unlocking terminal only preset a locally supported password algorithm, and the preset password algorithm on the digital key terminal and the preset password algorithm on the unlocking terminal are the same password In the case of the algorithm, the digital key terminal and the unlocking terminal can be authenticated successfully. If there are multiple preset password algorithms for the terminal (that is, the digital key terminal and/or the unlocking terminal), and the preset password algorithm for the digital key terminal and the preset password algorithm for the unlocking terminal have the same password algorithm, then the current digital algorithm is used. The key authentication method is used for authentication, but the authentication cannot be successful.

发明内容Contents of the invention

基于此,有必要针对上述技术问题,提供一种能够使数字钥匙端与解锁终端成功认证的数字钥匙的认证方法、装置、计算机设备、计算机可读存储介质和计算机程序产品。Based on this, it is necessary to address the above technical problems and provide a digital key authentication method, device, computer equipment, computer-readable storage medium and computer program product that can successfully authenticate the digital key terminal and the unlocking terminal.

第一方面,本申请提供了一种数字钥匙的认证方法。所述方法应用于数字钥匙端,所述方法包括:In a first aspect, the present application provides a digital key authentication method. The method is applied to the digital key terminal, and the method includes:

响应于解锁终端发送的匹配指令,确定本地支持的密码算法;Responding to the matching instruction sent by the unlocking terminal, determine locally supported cryptographic algorithms;

在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含各所述密码算法对应的优先级信息;When the cryptographic algorithms supported locally meet the preset conditions, generate matching response data including cryptographic algorithm information; the cryptographic algorithm information includes priority information corresponding to each of the cryptographic algorithms;

向所述解锁终端返回所述匹配响应数据,所述匹配响应数据用于指示所述解锁终端根据所述密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果;returning the matching response data to the unlocking terminal, where the matching response data is used to instruct the unlocking terminal to determine a password matching response result according to the analysis result of the password algorithm information and the password selection policy;

根据所述匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。According to the password matching response result corresponding to the matching response data, a password algorithm to be used is determined, and authentication processing is performed based on the password algorithm to be used.

在其中一个实施例中,所述根据所述匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法包括:In one of the embodiments, the determining the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data includes:

在所述匹配响应数据对应的密码匹配响应结果为接收到所述解锁终端发送的密码算法指示数据的情况下,获取所述密码算法指示数据中的密码算法标识,将所述密码算法标识对应的密码算法作为待使用的密码算法;When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal is received, obtain the password algorithm identification in the encryption algorithm indication data, and use the password algorithm identification corresponding to the cryptographic algorithm as the cryptographic algorithm to be used;

在所述匹配响应数据对应的密码匹配响应结果为未接收到所述解锁终端发送的密码算法指示数据的情况下,将本地支持的第一类密码算法作为所述待使用的密码算法。When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal has not been received, the locally supported first type of password algorithm is used as the password algorithm to be used.

在其中一个实施例中,在所述匹配指令包含匹配应用标识的情况下,所述在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据包括:In one of the embodiments, in the case where the matching instruction includes a matching application identifier, in the case where the locally supported cryptographic algorithm satisfies a preset condition, generating matching response data containing cryptographic algorithm information includes:

在所述本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,生成包含密码算法信息的匹配响应数据;When the cryptographic algorithms supported locally include a first type of cryptographic algorithm and a second type of cryptographic algorithm, generate matching response data containing cryptographic algorithm information;

所述方法还包括:The method also includes:

在所述本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,比较所述匹配应用标识与预设的应用标识,确定比较结果;When the cryptographic algorithm supported locally is a first-type cryptographic algorithm or a second-type cryptographic algorithm, comparing the matching application identifier with a preset application identifier to determine a comparison result;

在所述比较结果表示标识一致的情况下,生成表示匹配成功的第二匹配结果,并基于所述第二匹配结果,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据;When the comparison result indicates that the identifiers are consistent, generate a second matching result indicating that the matching is successful, and based on the second matching result, generate matching response data that includes the matching result identifier corresponding to the second matching result;

在所述比较结果表示标识不一致的情况下,生成表示匹配失败的第一匹配结果,并基于所述第一匹配结果,生成包含所述第一匹配结果对应的匹配结果标识的匹配响应数据。If the comparison result indicates that the identifications are inconsistent, generate a first matching result indicating that the matching fails, and based on the first matching result, generate matching response data including the matching result identification corresponding to the first matching result.

在其中一个实施例中,在所述匹配指令不包含匹配应用标识的情况下,所述在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据包括:In one of the embodiments, in the case where the matching instruction does not include a matching application identifier, the generating matching response data containing cryptographic algorithm information includes:

响应于所述匹配指令,生成表示匹配成功的第二匹配结果;In response to the matching instruction, generating a second matching result indicating that the matching is successful;

基于所述第二匹配结果、以及本地支持的各所述密码算法对应的优先级信息,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据。Based on the second matching result and the priority information corresponding to each of the cryptographic algorithms supported locally, matching response data including a matching result identifier corresponding to the second matching result is generated.

第二方面,本申请提供了一种数字钥匙的认证方法。所述方法应用于解锁终端,所述方法包括:In a second aspect, the present application provides a digital key authentication method. The method is applied to unlocking a terminal, and the method includes:

向数字钥匙端发送匹配指令,所述匹配指令用于指示所述数字钥匙端基于所述匹配指令返回匹配响应数据;sending a matching instruction to the digital key, where the matching instruction is used to instruct the digital key to return matching response data based on the matching instruction;

在所述匹配响应数据包含所述数字钥匙端对应的密码算法信息的情况下,根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;所述密码匹配响应结果用于供数字钥匙端确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。If the matching response data includes cryptographic algorithm information corresponding to the digital key terminal, determine the cryptographic matching response result corresponding to the matching response data according to the analysis result of the cryptographic algorithm information and the cryptographic selection strategy; The password matching response result is used for the digital key terminal to determine the password algorithm to be used, and perform authentication processing based on the password algorithm to be used.

在其中一个实施例中,所述根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果包括:In one of the embodiments, the determining the password matching response result corresponding to the matching response data according to the analysis result of the password algorithm information and the password selection strategy includes:

在所述密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,基于所述密码算法信息中的各密码算法对应的优先级信息和密码选择策略,确定密码匹配响应结果;In the case where the analysis result of the encryption algorithm information includes priority information corresponding to each encryption algorithm, based on the priority information corresponding to each encryption algorithm in the encryption algorithm information and the password selection strategy, determine the password matching response result;

在所述密码算法信息的解析结果为无法解析密码算法信息的情况下,确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。If the analysis result of the password algorithm information is that the password algorithm information cannot be parsed, it is determined that the password matching response result is not to send the password algorithm indication data to the digital key.

在其中一个实施例中,所述方法还包括:In one embodiment, the method also includes:

在所述匹配指令包含匹配应用标识、且所述匹配响应数据不包含所述数字钥匙端对应的密码算法信息的情况下,基于所述匹配响应数据包含的匹配结果标识,确定所述匹配结果;When the matching instruction includes a matching application identifier and the matching response data does not include cryptographic algorithm information corresponding to the digital key terminal, determine the matching result based on the matching result identifier included in the matching response data;

在所述匹配结果为表示匹配失败的第一匹配结果的情况下,将第一类密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据;When the matching result is the first matching result indicating that the matching fails, the first type of cryptographic algorithm is used as the cryptographic algorithm to be used, and the cryptographic matching response result is determined not to send the cryptographic algorithm to the digital key terminal indicating data;

在所述匹配结果为表示匹配成功的第二匹配结果的情况下,将所述匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。When the matching result is the second matching result indicating that the matching is successful, the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier is used as the cryptographic algorithm to be used, and the cryptographic matching response result is determined as The cryptographic algorithm indication data is not sent to the digital key end.

第三方面,本申请还提供了一种数字钥匙的认证系统。所述系统包括数字钥匙端和解锁终端,其中:In a third aspect, the present application also provides a digital key authentication system. The system includes a digital key terminal and an unlocking terminal, wherein:

所述解锁终端,用于向所述数字钥匙端发送匹配指令;The unlocking terminal is configured to send a matching instruction to the digital key terminal;

所述数字钥匙端,用于响应于解锁终端发送的匹配指令,确定本地支持的密码算法;在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含本地支持的各密码算法对应的优先级信息;所述解锁终端,还用于根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;The digital key terminal is used to determine a locally supported cryptographic algorithm in response to a matching instruction sent by an unlocking terminal; and generate matching response data containing cryptographic algorithm information when the locally supported cryptographic algorithm meets a preset condition; The cryptographic algorithm information includes priority information corresponding to each cryptographic algorithm supported locally; the unlocking terminal is also used to determine the cryptographic matching code corresponding to the matching response data according to the analysis result of the cryptographic algorithm information and the password selection policy. response result;

所述数字钥匙端,还用于根据所述匹配响应数据对应的密码匹配响应结果确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The digital key terminal is further configured to determine the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data, and perform authentication processing based on the cryptographic algorithm to be used.

在其中一个实施例中,所述数字钥匙端具体用于:In one of the embodiments, the digital key terminal is specifically used for:

在所述匹配响应数据对应的密码匹配响应结果为接收到所述解锁终端发送的密码算法指示数据的情况下,获取所述密码算法指示数据中的密码算法标识,将所述密码算法标识对应的密码算法作为待使用的密码算法;When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal is received, obtain the password algorithm identification in the encryption algorithm indication data, and use the password algorithm identification corresponding to the cryptographic algorithm as the cryptographic algorithm to be used;

在所述匹配响应数据对应的密码匹配响应结果为未接收到所述解锁终端发5送的密码算法指示数据的情况下,将本地支持的第一类密码算法作为所述待使用的密码算法。When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal has not been received, the locally supported first type of password algorithm is used as the password algorithm to be used.

在其中一个实施例中,在所述匹配指令包含匹配应用标识的情况下,所述数字钥匙端具体用于:In one of the embodiments, when the matching instruction includes a matching application identifier, the digital key terminal is specifically used for:

在所述本地支持的密码算法包括第一类密码算法和第二类密码算法的情况0下,生成包含密码算法信息的匹配响应数据;In the case where the locally supported cryptographic algorithms include a first type of cryptographic algorithm and a second type of cryptographic algorithm, generating matching response data containing cryptographic algorithm information;

所述数字钥匙端还用于:The Digital Key is also used for:

在所述本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,比较所述匹配应用标识与预设的应用标识,确定比较结果;When the cryptographic algorithm supported locally is a first-type cryptographic algorithm or a second-type cryptographic algorithm, comparing the matching application identifier with a preset application identifier to determine a comparison result;

在所述比较结果表示标识一致的情况下,生成表示匹配成功的第二匹配结5果,并基于所述第二匹配结果,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据;When the comparison result indicates that the identification is consistent, generate a second matching result indicating that the matching is successful, and based on the second matching result, generate matching response data that includes the matching result identification corresponding to the second matching result ;

在所述比较结果表示标识不一致的情况下,生成表示匹配失败的第一匹配结果,并基于所述第一匹配结果,生成包含所述第一匹配结果对应的匹配结果标识的匹配响应数据。If the comparison result indicates that the identifications are inconsistent, generate a first matching result indicating that the matching fails, and based on the first matching result, generate matching response data including the matching result identification corresponding to the first matching result.

0在其中一个实施例中,在所述匹配指令不包含匹配应用标识的情况下,所述数字钥匙端具体用于:0 In one of the embodiments, when the matching instruction does not include a matching application identifier, the digital key terminal is specifically used to:

响应于所述匹配指令,生成表示匹配成功的第二匹配结果;In response to the matching instruction, generating a second matching result indicating that the matching is successful;

基于所述第二匹配结果、以及本地支持的各所述密码算法对应的优先级信息,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据。Based on the second matching result and the priority information corresponding to each of the cryptographic algorithms supported locally, matching response data including a matching result identifier corresponding to the second matching result is generated.

5在其中一个实施例中,所述解锁终端具体用于:5 In one of the embodiments, the unlocking terminal is specifically used for:

在所述密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,基于所述密码算法信息中的各密码算法对应的优先级信息和密码选择策略,确定密码匹配响应结果;In the case where the analysis result of the encryption algorithm information includes priority information corresponding to each encryption algorithm, based on the priority information corresponding to each encryption algorithm in the encryption algorithm information and the password selection strategy, determine the password matching response result;

在所述密码算法信息的解析结果为无法解析密码算法信息的情况下,确定0所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。If the analysis result of the cryptographic algorithm information is that the cryptographic algorithm information cannot be parsed, it is determined that the cryptographic matching response result is 0 and that the cryptographic algorithm indication data is not sent to the digital key.

在其中一个实施例中,所述解锁终端还用于:In one of the embodiments, the unlocking terminal is also used for:

在所述匹配指令包含匹配应用标识、且所述匹配响应数据不包含所述数字钥匙端对应的密码算法信息的情况下,基于所述匹配响应数据包含的匹配结果标识,确定所述匹配结果;When the matching instruction includes a matching application identifier and the matching response data does not include cryptographic algorithm information corresponding to the digital key terminal, determine the matching result based on the matching result identifier included in the matching response data;

在所述匹配结果为表示匹配失败的第一匹配结果的情况下,将第一类密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据;When the matching result is the first matching result indicating that the matching fails, the first type of cryptographic algorithm is used as the cryptographic algorithm to be used, and the cryptographic matching response result is determined not to send the cryptographic algorithm to the digital key terminal indicating data;

在所述匹配结果为表示匹配成功的第二匹配结果的情况下,将所述匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。When the matching result is the second matching result indicating that the matching is successful, the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier is used as the cryptographic algorithm to be used, and the cryptographic matching response result is determined as The cryptographic algorithm indication data is not sent to the digital key end.

第四方面,本申请还提供了一种数字钥匙的认证装置。所述装置应用于数字钥匙端,所述装置包括:In a fourth aspect, the present application also provides a digital key authentication device. The device is applied to the digital key terminal, and the device includes:

响应模块,用于响应于解锁终端发送的匹配指令,确定本地支持的密码算法;A response module, configured to determine locally supported cryptographic algorithms in response to the matching instruction sent by the unlocking terminal;

第一确定模块,用于在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含各所述密码算法对应的优先级信息;A first determination module, configured to generate matching response data including cryptographic algorithm information when the locally supported cryptographic algorithms meet preset conditions; the cryptographic algorithm information includes priority information corresponding to each of the cryptographic algorithms;

发送模块,用于向所述解锁终端返回所述匹配响应数据,所述匹配响应数据用于指示所述解锁终端根据所述密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果;A sending module, configured to return the matching response data to the unlocking terminal, where the matching response data is used to instruct the unlocking terminal to determine a password matching response result according to the analysis result of the password algorithm information and the password selection strategy;

第二确定模块,用于根据所述匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The second determining module is configured to determine the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data, and perform authentication processing based on the cryptographic algorithm to be used.

在其中一个实施例中,所述第二确定模块具体用于:In one of the embodiments, the second determination module is specifically used for:

在所述匹配响应数据对应的密码匹配响应结果为接收到所述解锁终端发送的密码算法指示数据的情况下,获取所述密码算法指示数据中的密码算法标识,将所述密码算法标识对应的密码算法作为待使用的密码算法;When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal is received, obtain the password algorithm identification in the encryption algorithm indication data, and use the password algorithm identification corresponding to the cryptographic algorithm as the cryptographic algorithm to be used;

在所述匹配响应数据对应的密码匹配响应结果为未接收到所述解锁终端发送的密码算法指示数据的情况下,将本地支持的第一类密码算法作为所述待使用的密码算法。When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal has not been received, the locally supported first type of password algorithm is used as the password algorithm to be used.

在其中一个实施例中,在所述匹配指令包含匹配应用标识的情况下,第一确定模块具体用于:In one of the embodiments, when the matching instruction includes a matching application identifier, the first determination module is specifically configured to:

在所述本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,生成包含密码算法信息的匹配响应数据;When the cryptographic algorithms supported locally include a first type of cryptographic algorithm and a second type of cryptographic algorithm, generate matching response data containing cryptographic algorithm information;

所述数字钥匙的认证装置还包括:The authentication device of the digital key also includes:

第三确定模块,用于在所述本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,比较所述匹配应用标识与预设的应用标识,确定比较结果;A third determining module, configured to compare the matching application identifier with a preset application identifier when the locally supported cryptographic algorithm is a first-type cryptographic algorithm or a second-type cryptographic algorithm, and determine a comparison result;

第一匹配模块,用于在所述比较结果表示标识一致的情况下,生成表示匹配成功的第二匹配结果,并基于所述第二匹配结果,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据;The first matching module is configured to generate a second matching result indicating successful matching when the comparison result indicates that the identifiers are consistent, and generate a matching result corresponding to the second matching result based on the second matching result identified matching response data;

第二匹配模块,用于在所述比较结果表示标识不一致的情况下,生成表示匹配失败的第一匹配结果,并基于所述第一匹配结果,生成包含所述第一匹配结果对应的匹配结果标识的匹配响应数据。The second matching module is configured to generate a first matching result indicating a matching failure when the comparison result indicates that the identification is inconsistent, and generate a matching result corresponding to the first matching result based on the first matching result Identified matching response data.

在其中一个实施例中,在所述匹配指令不包含匹配应用标识的情况下,所述第一确定模块具体用于:In one of the embodiments, when the matching instruction does not include a matching application identifier, the first determining module is specifically configured to:

响应于所述匹配指令,生成表示匹配成功的第二匹配结果;In response to the matching instruction, generating a second matching result indicating that the matching is successful;

基于所述第二匹配结果、以及本地支持的各所述密码算法对应的优先级信息,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据。Based on the second matching result and the priority information corresponding to each of the cryptographic algorithms supported locally, matching response data including a matching result identifier corresponding to the second matching result is generated.

第五方面,本申请还提供了一种数字钥匙的认证装置。所述装置应用于解锁终端,所述装置包括:In a fifth aspect, the present application also provides a digital key authentication device. The device is applied to unlocking a terminal, and the device includes:

发送模块,用于向数字钥匙端发送匹配指令,所述匹配指令用于指示所述数字钥匙端基于所述匹配指令返回匹配响应数据;A sending module, configured to send a matching instruction to the digital key, where the matching instruction is used to instruct the digital key to return matching response data based on the matching instruction;

第一确定模块,用于在所述匹配响应数据包含所述数字钥匙端对应的密码算法信息的情况下,根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;所述密码匹配响应结果用于供数字钥匙端确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The first determination module is configured to determine the matching response data corresponding to the cryptographic algorithm information according to the analysis result of the cryptographic algorithm information and the password selection policy in the case that the matching response data includes the cryptographic algorithm information corresponding to the digital key terminal. A password matching response result; the password matching response result is used for the digital key terminal to determine the password algorithm to be used, and perform authentication processing based on the password algorithm to be used.

在其中一个实施例中,所述第一确定模块具体用于:In one of the embodiments, the first determining module is specifically configured to:

在所述密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,基于所述密码算法信息中的各密码算法对应的优先级信息和密码选择策略,确定密码匹配响应结果;In the case where the analysis result of the encryption algorithm information includes priority information corresponding to each encryption algorithm, based on the priority information corresponding to each encryption algorithm in the encryption algorithm information and the password selection strategy, determine the password matching response result;

在所述密码算法信息的解析结果为无法解析密码算法信息的情况下,确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。If the analysis result of the password algorithm information is that the password algorithm information cannot be parsed, it is determined that the password matching response result is not to send the password algorithm indication data to the digital key.

在其中一个实施例中,所述数字钥匙的认证装置还包括:In one of the embodiments, the digital key authentication device further includes:

第二确定模块,用于在所述匹配指令包含匹配应用标识、且所述匹配响应数据不包含所述数字钥匙端对应的密码算法信息的情况下,基于所述匹配响应数据包含的匹配结果标识,确定所述匹配结果;The second determination module is configured to, when the matching instruction includes a matching application identifier and the matching response data does not include the cryptographic algorithm information corresponding to the digital key terminal, based on the matching result identifier included in the matching response data , to determine the matching result;

第一匹配模块,用于在所述匹配结果为表示匹配失败的第一匹配结果的情况下,将第一类密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据;The first matching module is configured to use the first type of cryptographic algorithm as the cryptographic algorithm to be used when the matching result is the first matching result indicating that the matching fails, and determine that the cryptographic matching response result is not applicable to all The digital key terminal sends the cryptographic algorithm instruction data;

第二匹配模块,用于在所述匹配结果为表示匹配成功的第二匹配结果的情况下,将所述匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。The second matching module is configured to use the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier as the cryptographic algorithm to be used when the matching result is the second matching result indicating that the matching is successful, and determine The result of the password matching response is that no password algorithm indication data is sent to the digital key.

第六方面,本申请还提供了一种计算机设备。所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以第一方面或者第二方面所述的步骤。In a sixth aspect, the present application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps described in the first aspect or the second aspect when executing the computer program.

第七方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以第一方面或者第二方面所述的步骤。In a seventh aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the steps described in the first aspect or the second aspect are realized.

第八方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时以第一方面或者第二方面所述的步骤。In an eighth aspect, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps described in the first aspect or the second aspect are performed.

上述数字钥匙的认证方法、装置、计算机设备、存储介质和计算机程序产品,通过响应于解锁终端发送的匹配指令,确定本地支持的密码算法;在本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;密码算法信息包含各密码算法对应的优先级信息;向解锁终端返回匹配响应数据,匹配响应数据用于指示解锁终端根据密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果;根据匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于待使用的密码算法进行认证处理。上述方案中,解锁终端接收数字钥匙端基于本地支持的密码算法确定的匹配响应数据,因此,解锁终端基于匹配响应数据是可以得知数字钥匙端本地支持的密码算法,进而确定解锁终端的待使用的密码算法。然后,数字钥匙端的待使用的密码算法是基于解锁终端的密码匹配响应结果确定的,也就是说,数字钥匙端可以基于密码匹配响应结果确定解锁终端的待使用的密码算法,进而确定自身(即数字钥匙端)的待使用的密码算法。这样,保证了数字钥匙端和解锁终端的待使用的密码算法是同一种密码算法,进而采用本方案来进行认证,是可以认证成功的。The above digital key authentication method, device, computer equipment, storage medium and computer program product determine the locally supported cryptographic algorithm by responding to the matching instruction sent by the unlocking terminal; when the locally supported cryptographic algorithm satisfies the preset conditions, Generate matching response data containing cryptographic algorithm information; cryptographic algorithm information includes priority information corresponding to each cryptographic algorithm; return matching response data to the unlocking terminal, and the matching response data is used to instruct the unlocking terminal to analyze the result and password selection strategy according to the cryptographic algorithm information , determine the password matching response result; determine the password algorithm to be used according to the password matching response result corresponding to the matching response data, and perform authentication processing based on the password matching algorithm to be used. In the above solution, the unlocking terminal receives the matching response data determined based on the cryptographic algorithm locally supported by the digital key terminal. Therefore, based on the matching response data, the unlocking terminal can know the cryptographic algorithm locally supported by the digital key terminal, and then determine the to-be-used cryptographic algorithm of the unlocking terminal. cryptographic algorithm. Then, the password algorithm to be used on the digital key terminal is determined based on the password matching response result of the unlocked terminal, that is, the digital key terminal can determine the password algorithm to be used on the unlocked terminal based on the password matching response result, and then determine itself (i.e. The cryptographic algorithm to be used on the digital key terminal). In this way, it is ensured that the cryptographic algorithms to be used on the digital key terminal and the unlocking terminal are the same cryptographic algorithm, and then using this scheme for authentication can be successfully authenticated.

附图说明Description of drawings

图1为一个实施例中数字钥匙的认证方法的应用环境图;Fig. 1 is the application environment diagram of the authentication method of digital key in an embodiment;

图2为一个实施例中数字钥匙的认证方法的流程示意图;Fig. 2 is a schematic flow chart of an authentication method of a digital key in an embodiment;

图3为一个实施例中待使用的密码算法的确定方法的流程示意图;Fig. 3 is a schematic flowchart of a method for determining a cryptographic algorithm to be used in an embodiment;

图4为另一个实施例中数字钥匙的认证方法的流程示意图;FIG. 4 is a schematic flow diagram of a digital key authentication method in another embodiment;

图5为另一个实施例中待使用的密码算法的确定方法的流程示意图;FIG. 5 is a schematic flowchart of a method for determining a cryptographic algorithm to be used in another embodiment;

图6为一个实施例中数字钥匙的认证装置的结构框图;Fig. 6 is a structural block diagram of a digital key authentication device in an embodiment;

图7为另一个实施例中数字钥匙的认证装置的结构框图;Fig. 7 is a structural block diagram of a digital key authentication device in another embodiment;

图8为一个实施例中计算机设备的内部结构图。Figure 8 is a diagram of the internal structure of a computer device in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.

本申请实施例提供的数字钥匙的认证方法,可以应用于如图1所示的应用环境中。其中,数字钥匙端102通过网络与解锁终端104进行通信。数字钥匙端102可以但不限于是各种智能手机和便携式可穿戴设备,便携式可穿戴设备可为智能手表、智能手环等。数字钥匙端102或者解锁终端104至少其中一个终端中预先设置两种密码算法。其中,密码算法的种类包括国际算法、以及国密算法。国际算法包括但不限于椭圆曲线密码(Elliptic CurveCryptography,ECC)算法;国密算法包括但不限于SM1算法、SM2算法、以及SM3算法。The digital key authentication method provided in the embodiment of the present application can be applied to the application environment shown in FIG. 1 . Wherein, the digital key terminal 102 communicates with the unlocking terminal 104 through the network. The digital key terminal 102 can be, but not limited to, various smart phones and portable wearable devices, and the portable wearable devices can be smart watches, smart bracelets, and the like. At least one of the digital key terminal 102 or the unlocking terminal 104 is preset with two password algorithms. Among them, the types of cryptographic algorithms include international algorithms and national secret algorithms. International algorithms include but not limited to Elliptic Curve Cryptography (Elliptic CurveCryptography, ECC) algorithm; national secret algorithms include but not limited to SM1 algorithm, SM2 algorithm, and SM3 algorithm.

在解锁终端104检测到数字钥匙端102的情况下,解锁终端104向数字钥匙端102发送匹配指令。其中,匹配指令是用于匹配数字钥匙端中的数字钥匙应用。数字钥匙端102响应于解锁终端104发送的匹配指令,确定数字钥匙端102本地支持的密码算法。具体的,数字钥匙端102响应于解锁终端104发送的匹配指令,并基于该匹配指令,匹配与该匹配指令对应的数字钥匙应用。数字钥匙端102将该匹配指令对应的数字钥匙应用所支持的密码算法作为本地支持的密码算法。可选的,匹配指令对应的数字钥匙应用可以是一个,也可以是多个。若匹配指令对应的数字钥匙应用是多个,则匹配指令对应的不同的数字钥匙应用可以支持不同的密码算法。可以理解,在匹配指令对应的数字钥匙应用是多个的情况下,数字钥匙端102将匹配指令对应的各数字钥匙应用所支持的密码算法作为本地支持的密码算法。可以理解,数字钥匙端102中的数字钥匙应用支持的密码算法必须是数字钥匙端预设的密码算法。在本地支持的密码算法满足预设条件的情况下,数字钥匙端102生成包含密码算法信息的匹配响应数据。其中,预设条件是本地支持的密码算法包括国际算法和国密算法。密码算法信息是基于本地支持的各密码算法的优先级确定的,密码算法信息包含各密码算法对应的优先级信息。匹配响应数据还包含匹配结果。匹配结果包括第一匹配结果和第二匹配结果,第一匹配结果表示匹配成功,第二匹配结果表示匹配失败。具体的,在本地支持的密码算法包括国际算法和国密算法的情况下,数字钥匙端102生成包含密码算法信息和匹配结果的匹配响应数据,并向解锁终端104返回该匹配响应数据。解锁终端104对匹配响应数据进行解析,并得到匹配响应数据中的密码算法信息的解析结果。其中,解析结果为包含各密码算法对应的优先级信息,或者,无法解析密码算法信息。解锁终端104根据解析结果和密码选择策略,生成匹配响应数据对应的密码匹配响应结果。其中,密码选择策略与匹配响应数据的解析结果具有对应关系。匹配响应数据的解析结果包括密码算法信息的解析结果和匹配结果。其中,密码匹配响应结果为解锁终端104向数字钥匙端102发送密码算法指示数据,或者,解锁终端104不向数字钥匙端102发送密码算法指示数据。可以理解,匹配响应数据的解析结果与密码匹配响应结果具有对应关系。数字钥匙端102根据匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法。具体的,在匹配响应数据对应的密码匹配响应结果为解锁终端104向数字钥匙端102发送密码算法指示数据的情况下,解锁终端104向数字钥匙端102发送密码算法指示数据,数字钥匙端102基于密码算法指示数据中的密码算法标识,将密码算法标识对应的密码算法作为待使用的密码算法。在匹配响应数据对应的密码匹配响应结果为解锁终端104不向数字钥匙端102发送密码算法指示数据的情况下,数字钥匙端102将本地支持的第一类密码算法作为待使用的密码算法。第一类密码算法包括国际算法。在一个实施例中,在预设接收时间内,若数字钥匙端102未接收到解锁终端104发送的密码算法指示数据,则数字钥匙端102将本地支持的第一类密码算法作为待使用的密码算法。数字钥匙端102基于待使用的密码算法进行认证处理。具体的,解锁终端104基于解锁终端104中待使用的密码算法进行加密处理,数字钥匙端102基于数字钥匙端102中待使用的密码算法进行解密处理。可以理解,解锁终端104中待使用的密码算法与数字钥匙端102中的待使用的密码算法是同一个密码算法。When the unlocking terminal 104 detects the digital key terminal 102 , the unlocking terminal 104 sends a matching instruction to the digital key terminal 102 . Wherein, the matching instruction is used to match the digital key application in the digital key terminal. The digital key terminal 102 determines the cryptographic algorithm locally supported by the digital key terminal 102 in response to the matching instruction sent by the unlocking terminal 104 . Specifically, the digital key terminal 102 responds to the matching instruction sent by the unlocking terminal 104, and based on the matching instruction, matches the digital key application corresponding to the matching instruction. The digital key terminal 102 takes the cryptographic algorithm supported by the digital key application corresponding to the matching command as the locally supported cryptographic algorithm. Optionally, there may be one or more digital key applications corresponding to the matching instruction. If there are multiple digital key applications corresponding to the matching command, different digital key applications corresponding to the matching command may support different cryptographic algorithms. It can be understood that when there are multiple digital key applications corresponding to the matching command, the digital key terminal 102 uses the cryptographic algorithm supported by each digital key application corresponding to the matching command as the locally supported cryptographic algorithm. It can be understood that the cryptographic algorithm supported by the digital key application in the digital key terminal 102 must be the preset cryptographic algorithm of the digital key terminal. When the cryptographic algorithm supported locally meets the preset condition, the digital key terminal 102 generates matching response data including cryptographic algorithm information. Wherein, the preset condition is that the cryptographic algorithms supported locally include international algorithms and national secret algorithms. The cryptographic algorithm information is determined based on the priority of each cryptographic algorithm supported locally, and the cryptographic algorithm information includes priority information corresponding to each cryptographic algorithm. The match response data also contains match results. The matching result includes a first matching result and a second matching result, the first matching result indicates that the matching is successful, and the second matching result indicates that the matching fails. Specifically, when locally supported cryptographic algorithms include international algorithms and national secret algorithms, digital key terminal 102 generates matching response data including cryptographic algorithm information and matching results, and returns the matching response data to unlocking terminal 104 . The unlocking terminal 104 analyzes the matching response data, and obtains an analysis result of the cryptographic algorithm information in the matching response data. Wherein, the parsing result includes priority information corresponding to each cryptographic algorithm, or the cryptographic algorithm information cannot be parsed. The unlocking terminal 104 generates a password matching response result corresponding to the matching response data according to the analysis result and the password selection policy. Wherein, the password selection policy has a corresponding relationship with the parsing result of the matching response data. The parsing result of the matching response data includes the parsing result and the matching result of the cryptographic algorithm information. Wherein, the password matching response result is that the unlocking terminal 104 sends the password algorithm indication data to the digital key terminal 102 , or the unlocking terminal 104 does not send the password algorithm indication data to the digital key terminal 102 . It can be understood that the parsing result of the matching response data has a corresponding relationship with the password matching response result. The digital key terminal 102 determines the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data. Specifically, when the password matching response result corresponding to the matching response data is that the unlocking terminal 104 sends the password algorithm indication data to the digital key terminal 102, the unlocking terminal 104 sends the password algorithm indicating data to the digital key terminal 102, and the digital key terminal 102 sends the password algorithm indication data to the digital key terminal 102, and the digital key terminal 102 based on The cryptographic algorithm indicates the cryptographic algorithm identifier in the data, and the cryptographic algorithm corresponding to the cryptographic algorithm identifier is used as the cryptographic algorithm to be used. When the password matching response result corresponding to the matching response data is that the unlocking terminal 104 does not send the password algorithm indication data to the digital key terminal 102, the digital key terminal 102 uses the locally supported first type of password algorithm as the password algorithm to be used. The first category of cryptographic algorithms includes international algorithms. In one embodiment, if the digital key terminal 102 does not receive the cryptographic algorithm indication data sent by the unlocking terminal 104 within the preset receiving time, the digital key terminal 102 uses the locally supported first type of cryptographic algorithm as the password to be used algorithm. The digital key terminal 102 performs authentication processing based on the cryptographic algorithm to be used. Specifically, the unlocking terminal 104 performs encryption processing based on the encryption algorithm to be used in the unlocking terminal 104 , and the digital key terminal 102 performs decryption processing based on the encryption algorithm to be used in the digital key terminal 102 . It can be understood that the encryption algorithm to be used in the unlocking terminal 104 and the encryption algorithm to be used in the digital key terminal 102 are the same encryption algorithm.

在一个实施例中,如图2所示,提供了一种数字钥匙的认证方法,以该方法应用于图1中的数字钥匙的认证系统为例进行说明,包括以下步骤:In one embodiment, as shown in Figure 2, a digital key authentication method is provided, and the method is applied to the digital key authentication system in Figure 1 as an example for illustration, including the following steps:

步骤202,响应于解锁终端发送的匹配指令,确定本地支持的密码算法。Step 202, in response to the matching instruction sent by the unlocking terminal, determine the cryptographic algorithms supported locally.

本申请实施例中,数字钥匙端102响应于解锁终端104发送的匹配指令,确定数字钥匙端102本地支持的密码算法。具体的,数字钥匙端102接收解锁终端发送的匹配指令,并基于该匹配指令,匹配与该匹配指令对应的数字钥匙应用。其中,匹配指令用于判断在数字钥匙端102中是否存在与匹配指令对应的数字钥匙应用。不包含匹配应用标识的匹配指令用于判断数字钥匙端102中是否存有数字钥匙应用,数字钥匙端102中的数字钥匙应用都是不包含匹配应用标识的匹配指令对应的数字钥匙应用。包含匹配应用标识的匹配指令用于判断数字钥匙端102中是否存在该匹配应用标识对应的数字钥匙应用,在数字钥匙端102中只有预设的应用标识与匹配应用标识一致的数字钥匙应用是包含匹配应用标识的匹配指令对应的数字钥匙应用。数字钥匙端102将数字钥匙端102中与该匹配指令对应的数字钥匙应用所支持的密码算法作为本地支持的密码算法。可选的,匹配指令对应的数字钥匙应用可以是一个,也可以是多个。若匹配指令对应的数字钥匙应用是多个,则匹配指令对应的不同的数字钥匙应用可以支持不同的密码算法。可以理解,在匹配指令对应的数字钥匙应用是多个的情况下,数字钥匙端102将匹配指令对应的各数字钥匙应用所支持的密码算法作为本地支持的密码算法。例如,假设数字钥匙端102中预设的密码算法是ECC算法和SM2算法,数字钥匙端102中有数字钥匙应用1、数字钥匙应用2、以及数字钥匙应用3。其中,数字钥匙应用1支持ECC算法,数字钥匙应用2支持SM2算法,数字钥匙应用3同时支持ECC算法和SM2算法。假设匹配指令对应的数字钥匙应用包括数字钥匙应用1、数字钥匙应用2和数字钥匙应用3,那么本地支持的密码算法包括ECC算法和SM2算法。可以理解,数字钥匙端102中的数字钥匙应用支持的密码算法必须是数字钥匙端预设的密码算法。In the embodiment of the present application, the digital key terminal 102 determines the cryptographic algorithm locally supported by the digital key terminal 102 in response to the matching instruction sent by the unlocking terminal 104 . Specifically, the digital key terminal 102 receives the matching instruction sent by the unlocking terminal, and based on the matching instruction, matches the digital key application corresponding to the matching instruction. Wherein, the matching instruction is used to determine whether there is a digital key application corresponding to the matching instruction in the digital key terminal 102 . The matching instruction that does not include the matching application identifier is used to determine whether there is a digital key application in the digital key terminal 102, and the digital key applications in the digital key terminal 102 are all digital key applications corresponding to the matching instruction that does not include the matching application identifier. The matching command containing the matching application identifier is used to determine whether there is a digital key application corresponding to the matching application identifier in the digital key terminal 102. In the digital key terminal 102, only the digital key application whose preset application identifier is consistent with the matching application identifier is included. The digital key application corresponding to the matching command matching the application identifier. The digital key terminal 102 uses the cryptographic algorithm supported by the digital key application corresponding to the matching instruction in the digital key terminal 102 as the locally supported cryptographic algorithm. Optionally, there may be one or more digital key applications corresponding to the matching instruction. If there are multiple digital key applications corresponding to the matching command, different digital key applications corresponding to the matching command may support different cryptographic algorithms. It can be understood that when there are multiple digital key applications corresponding to the matching command, the digital key terminal 102 uses the cryptographic algorithm supported by each digital key application corresponding to the matching command as the locally supported cryptographic algorithm. For example, assuming that the preset encryption algorithms in the digital key terminal 102 are the ECC algorithm and the SM2 algorithm, the digital key terminal 102 has a digital key application 1 , a digital key application 2 and a digital key application 3 . Among them, the digital key application 1 supports the ECC algorithm, the digital key application 2 supports the SM2 algorithm, and the digital key application 3 supports both the ECC algorithm and the SM2 algorithm. Assuming that the digital key applications corresponding to the matching instruction include digital key application 1, digital key application 2 and digital key application 3, then the cryptographic algorithms supported locally include ECC algorithm and SM2 algorithm. It can be understood that the cryptographic algorithm supported by the digital key application in the digital key terminal 102 must be the preset cryptographic algorithm of the digital key terminal.

步骤204,在本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据。Step 204, in the case that the locally supported cryptographic algorithm satisfies the preset condition, generate matching response data including cryptographic algorithm information.

其中,密码算法信息包含各密码算法对应的优先级信息。Wherein, the cryptographic algorithm information includes priority information corresponding to each cryptographic algorithm.

本申请实施例中,数字钥匙端102识别并统计本地支持的密码算法的算法类别,在算法类别满足预设条件的情况下,数字钥匙端102生成包含密码算法信息的匹配响应数据。其中,预设条件是本地支持的密码算法包括第一类密码算法和第二类密码算法。第一类密码算法包括国际算法,第二类密码算法包括国密算法。具体的,在本地支持的密码算法的算法类别包括第一类密码算法和第二类密码算法的情况下,数字钥匙端102基于本地支持的各密码算法的优先级,生成包含各密码算法对应的优先级信息的密码算法信息,并基于该密码算法信息生成匹配响应数据。在一个实施例中,数字钥匙端102将密码算法信息写入一个TLV(T表示tag标签,L表示length长度,V表示value值)字段,其中,value值用于表征各密码算法对应的优先级信息。可选的,value值还用于表征数字钥匙端102本地支持的密码算法。其中,匹配响应数据包括匹配结果。匹配结果包括第一匹配结果和第二匹配结果,第一匹配结果表示匹配成功,第二匹配结果表示匹配失败。匹配成功表示数字钥匙端102中存在与匹配指令对应的数字钥匙应用;匹配失败表示数字钥匙端102中不存在与匹配指令对应的数字钥匙应用。具体的,数字钥匙端102基于密码算法信息、以及匹配结果,生成匹配响应数据。In the embodiment of this application, the digital key terminal 102 identifies and counts the algorithm types of locally supported cryptographic algorithms, and if the algorithm category meets the preset conditions, the digital key terminal 102 generates matching response data containing cryptographic algorithm information. Wherein, the preset condition is that the locally supported cryptographic algorithms include the first type of cryptographic algorithms and the second type of cryptographic algorithms. The first category of cryptographic algorithms includes international algorithms, and the second category of cryptographic algorithms includes national secret algorithms. Specifically, when the algorithm types of locally supported cryptographic algorithms include the first type of cryptographic algorithm and the second type of cryptographic algorithm, the digital key terminal 102 generates a corresponding algorithm containing each cryptographic algorithm based on the priorities of the locally supported cryptographic algorithms. The cryptographic algorithm information of the priority information, and generate matching response data based on the cryptographic algorithm information. In one embodiment, the digital key terminal 102 writes the cryptographic algorithm information into a TLV (T represents a tag, L represents a length, and V represents a value) field, where the value is used to represent the corresponding priority of each cryptographic algorithm information. Optionally, the value value is also used to represent the cryptographic algorithm locally supported by the digital key terminal 102 . Wherein, the matching response data includes matching results. The matching result includes a first matching result and a second matching result, the first matching result indicates that the matching is successful, and the second matching result indicates that the matching fails. Matching success indicates that there is a digital key application corresponding to the matching instruction in the digital key terminal 102 ; matching failure indicates that there is no digital key application corresponding to the matching instruction in the digital key terminal 102 . Specifically, the digital key terminal 102 generates matching response data based on the cryptographic algorithm information and the matching result.

步骤206,向解锁终端返回匹配响应数据。Step 206, returning matching response data to the unlocking terminal.

其中,匹配响应数据用于指示解锁终端根据密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果。Wherein, the matching response data is used to instruct the unlocking terminal to determine the password matching response result according to the analysis result of the password algorithm information and the password selection strategy.

本申请实施例中,数字钥匙端102向解锁终端返回匹配响应数据。其中,匹配响应数据包含匹配结果和密码算法信息。解析结果为包含各密码算法对应的优先级信息,或者,无法解析密码算法信息。密码选择策略用于解锁终端确定解锁终端的待使用的密码算法。密码匹配响应结果为解锁终端104向数字钥匙端102发送密码算法指示数据,或者,解锁终端104不向数字钥匙端102发送密码算法指示数据。匹配响应数据的解析结果、密码选择策略与密码匹配响应结果三者具有预设的第一对应关系。密码算法指示数据用于指示数字钥匙端102确定数字钥匙端102的待使用的密码算法。In the embodiment of the present application, the digital key terminal 102 returns matching response data to the unlocking terminal. Wherein, the matching response data includes matching results and cryptographic algorithm information. The parsing result contains priority information corresponding to each cryptographic algorithm, or the cryptographic algorithm information cannot be parsed. The password selection policy is used to unlock the terminal to determine the password algorithm to be used to unlock the terminal. The password matching response result is that the unlocking terminal 104 sends the password algorithm indication data to the digital key terminal 102 , or the unlocking terminal 104 does not send the password algorithm indication data to the digital key terminal 102 . The parsing result of the matching response data, the password selection strategy and the password matching response result have a preset first corresponding relationship. The cryptographic algorithm indication data is used to instruct the digital key terminal 102 to determine the cryptographic algorithm to be used by the digital key terminal 102 .

步骤208,根据匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于待使用的密码算法进行认证处理。Step 208: Determine the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data, and perform authentication processing based on the cryptographic algorithm to be used.

本申请实施例中,数字钥匙端102根据匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于待使用的密码算法进行认证处理。其中,密码匹配响应结果与待使用的密码算法具有预设的第二对应关系。第二对应关系包括若密码匹配响应结果为解锁终端104向数字钥匙端102发送密码算法指示数据,则与密码匹配响应结果对应的待使用的密码算法为密码算法指示数据对应的密码算法;若密码匹配响应结果为解锁终端104不向数字钥匙端102发送密码算法指示数据,则与密码匹配响应结果对应的待使用的密码算法为第一类密码算法。在一个实施例中,第一类密码算法包括国际算法。In the embodiment of the present application, the digital key terminal 102 determines the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data, and performs authentication processing based on the cryptographic algorithm to be used. Wherein, the password matching response result and the password algorithm to be used have a preset second corresponding relationship. The second correspondence includes that if the password matching response result is that the unlocking terminal 104 sends the password algorithm indication data to the digital key terminal 102, then the password algorithm to be used corresponding to the password matching response result is the password algorithm corresponding to the password algorithm indication data; If the matching response result is that the unlocking terminal 104 does not send cryptographic algorithm indication data to the digital key terminal 102, then the cryptographic algorithm to be used corresponding to the cryptographic matching response result is the first type of cryptographic algorithm. In one embodiment, the first class of cryptographic algorithms includes international algorithms.

上述数字钥匙的认证方法中,解锁终端接收数字钥匙端基于本地支持的密码算法确定的匹配响应数据,因此,解锁终端基于匹配响应数据是可以得知数字钥匙端本地支持的密码算法,进而确定解锁终端的待使用的密码算法。然后,数字钥匙端的待使用的密码算法是基于解锁终端的密码匹配响应结果确定的,也就是说,数字钥匙端可以基于密码匹配响应结果确定解锁终端的待使用的密码算法,进而确定自身(即数字钥匙端)的待使用的密码算法。这样,保证了数字钥匙端和解锁终端的待使用的密码算法是同一种密码算法,进而采用本方案来进行认证,是可以认证成功的。In the above digital key authentication method, the unlocking terminal receives the matching response data determined based on the cryptographic algorithm locally supported by the digital key terminal. Therefore, based on the matching response data, the unlocking terminal can know the cryptographic algorithm locally supported by the digital key terminal, and then determine the unlocking method. The terminal's cryptographic algorithm to use. Then, the password algorithm to be used on the digital key terminal is determined based on the password matching response result of the unlocked terminal, that is, the digital key terminal can determine the password algorithm to be used on the unlocked terminal based on the password matching response result, and then determine itself (i.e. The cryptographic algorithm to be used on the digital key terminal). In this way, it is ensured that the cryptographic algorithms to be used on the digital key terminal and the unlocking terminal are the same cryptographic algorithm, and then using this scheme for authentication can be successfully authenticated.

在一个实施例中,如图3所示,根据匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法包括:In one embodiment, as shown in FIG. 3, according to the password matching response result corresponding to the matching response data, determining the password algorithm to be used includes:

步骤302,在匹配响应数据对应的密码匹配响应结果为接收到解锁终端发送的密码算法指示数据的情况下,获取密码算法指示数据中的密码算法标识,将密码算法标识对应的密码算法作为待使用的密码算法。Step 302, when the result of the password matching response corresponding to the matching response data is that the cryptographic algorithm indication data sent by the unlocking terminal is received, obtain the cryptographic algorithm identification in the cryptographic algorithm indication data, and use the cryptographic algorithm corresponding to the cryptographic algorithm identification as the to-be-used cryptographic algorithm.

本申请实施例中,在匹配响应数据对应的密码匹配响应结果为接收到解锁终端104发送的密码算法指示数据的情况下,数字钥匙端102接收解锁终端104发送的密码算法指示数据。其中,密码算法指示数据包括密码算法标识,密码算法标识是解锁终端104的待使用的密码算法对应的密码算法标识。数字钥匙端102解析并获取密码算法指示数据中的密码标识,识别该密码标识对应的密码算法,并将该密码标识对应的密码算法作为数字钥匙端102的待使用的密码算法。In the embodiment of the present application, when the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal 104 is received, the digital key terminal 102 receives the password algorithm indication data sent by the unlocking terminal 104 . Wherein, the cryptographic algorithm indication data includes a cryptographic algorithm identifier, and the cryptographic algorithm identifier is a cryptographic algorithm identifier corresponding to a cryptographic algorithm to be used to unlock the terminal 104 . The digital key terminal 102 parses and obtains the cryptographic identifier in the cryptographic algorithm indication data, identifies the cryptographic algorithm corresponding to the cryptographic identifier, and uses the cryptographic algorithm corresponding to the cryptographic identifier as the cryptographic algorithm to be used by the digital key terminal 102 .

步骤304,在匹配响应数据对应的密码匹配响应结果为未接收到解锁终端发送的密码算法指示数据的情况下,将本地支持的第一类密码算法作为待使用的密码算法。Step 304: When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal has not been received, the locally supported first type of password algorithm is used as the password algorithm to be used.

本申请实施例中,在匹配响应数据对应的密码匹配响应结果为未接收到解锁终端104发送的密码算法指示数据的情况下,数字钥匙端102将本地支持的第一类密码算法作为数字钥匙端102的待使用的密码算法。可以理解,在数字钥匙端102本地支持的密码算法满足预设条件的情况下,若解锁终端104的待使用的密码算法为第一类密码算法,则解锁终端104不向数字钥匙端102发送密码算法指示数据,那么匹配响应数据对应的密码匹配响应结果为未接收到解锁终端104发送的密码算法指示数据。其中,第一类密码算法包括国际算法。在一个实施例中,未接收到解锁终端104发送的密码算法指示数据的情况可以是,在预设接收时间内,数字钥匙端102未接收到解锁终端104发送的密码算法指示数据。具体的,在预设接收时间内,若数字钥匙端102未接收到解锁终端104发送的密码算法指示数据,则数字钥匙端102将本地支持的第一类密码算法作为待使用的密码算法。In the embodiment of this application, when the result of the password matching response corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal 104 has not been received, the digital key terminal 102 uses the locally supported first type of password algorithm as the digital key terminal 102 cryptographic algorithms to be used. It can be understood that if the cryptographic algorithm locally supported by the digital key terminal 102 meets the preset conditions, if the cryptographic algorithm to be used by the unlocking terminal 104 is the first type of cryptographic algorithm, the unlocking terminal 104 will not send the password to the digital key terminal 102 Algorithm indication data, then the password matching response result corresponding to the matching response data is that the encryption algorithm indication data sent by the unlocking terminal 104 has not been received. Wherein, the first category of cryptographic algorithms includes international algorithms. In one embodiment, the situation that the password algorithm indication data sent by the unlocking terminal 104 is not received may be that the digital key terminal 102 does not receive the password algorithm indication data sent by the unlocking terminal 104 within the preset receiving time. Specifically, if the digital key terminal 102 does not receive the cryptographic algorithm indication data sent by the unlocking terminal 104 within the preset receiving time, the digital key terminal 102 will use the locally supported first type of cryptographic algorithm as the cryptographic algorithm to be used.

本实施例中,数字钥匙端将解锁终端发送到的密码算法标识对应的密码算法作为待使用的密码算法,或者,在数字钥匙端本地支持的密码算法满足预设条件的情况下,若解锁终端的待使用的密码算法为第一类密码算法,则数字钥匙端未接收到密码算法指示数据,并把第一类密码算法组作为待使用的密码算法。保证了数字钥匙端和解锁终端的待使用的密码算法一致,从而能认证成功。In this embodiment, the digital key side uses the cryptographic algorithm corresponding to the cryptographic algorithm identifier sent by the unlocking terminal as the cryptographic algorithm to be used, or, when the cryptographic algorithm locally supported by the digital key side meets the preset conditions, if the unlocking terminal If the cryptographic algorithm to be used is the first type of cryptographic algorithm, the digital key terminal does not receive the cryptographic algorithm indication data, and uses the first type of cryptographic algorithm group as the cryptographic algorithm to be used. It is ensured that the cryptographic algorithms to be used on the digital key terminal and the unlocking terminal are consistent, so that the authentication can be successful.

在一个实施例中,在匹配指令包含匹配应用标识的情况下,在本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据包括:In one embodiment, in the case where the matching instruction includes the matching application identifier, and in the case that the locally supported cryptographic algorithm satisfies a preset condition, generating the matching response data containing cryptographic algorithm information includes:

在本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,生成包含密码算法信息的匹配响应数据;In the case that the cryptographic algorithms supported locally include the first type of cryptographic algorithm and the second type of cryptographic algorithm, generate matching response data containing cryptographic algorithm information;

其中,匹配指令包含匹配应用标识。匹配应用标识用于数字钥匙端匹配该匹配应用标识对应的数字钥匙应用。Wherein, the matching instruction includes the matching application identifier. The matching application identifier is used by the digital key end to match the digital key application corresponding to the matching application identifier.

本申请实施例中,在匹配指令包含匹配应用标识、且数字钥匙端102本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,数字钥匙端102基于本地支持的各密码算法的优先级,生成包含各密码算法对应的优先级信息的密码算法信息,并基于该密码算法信息生成匹配响应数据。具体的,在匹配指令包含匹配应用标识、且数字钥匙端102本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,数字钥匙端102比较匹配指令中的匹配应用标识与数字钥匙端102中数字钥匙应用的预设的应用标识,得到表示标识不一致的比较结果。其中,匹配指令包含匹配应用标识对应的数字钥匙应用所支持的密码算法为第二类密码算法。第二类密码算法包括国密算法。数字钥匙端102本地支持的密码算法满足预设条件是指数字钥匙端102中的数字钥匙应用所支持的密码算法包括第一类密码算法和第二类密码算法。第一类密码算法包括国际算法。可以理解,在匹配指令包含匹配应用标识、且数字钥匙端102本地支持的密码算法满足预设条件的情况下,匹配应用标识对应的数字钥匙应用仅支持第二类密码算法,数字钥匙端102中数字钥匙应用支持双算法(包括第一类密码算法和第二类密码算法),所以匹配应用标识与数字钥匙端102中数字钥匙应用预设的应用标识不一致。数字钥匙端102基于表示标识不一致的比较结果,生成表示匹配失败的第一匹配结果。其中,匹配结果包括第一匹配结果和第二匹配结果,第一匹配结果表示匹配失败,第二匹配结果表示匹配成功。数字钥匙端102基于第一匹配结果、以及本地支持的各密码算法对应的优先级信息,生成包含第一匹配结果对应的匹配结果标识和密码算法信息的匹配响应数据。具体的,数字钥匙端102基于第一匹配结果,生成第一匹配结果对应的匹配结果标识。数字钥匙端102基于预设的本地支持的各密码算法对应的优先级信息,生成密码算法信息。数字钥匙端102基于第一匹配结果对应的匹配结果标识、以及密码算法信息,生成匹配响应数据。In this embodiment of the application, when the matching instruction includes a matching application identifier, and the cryptographic algorithms locally supported by the digital key terminal 102 include the first-type cryptographic algorithm and the second-type cryptographic algorithm, the digital key terminal 102 The priority of the algorithm, generating cryptographic algorithm information including priority information corresponding to each cryptographic algorithm, and generating matching response data based on the cryptographic algorithm information. Specifically, when the matching instruction includes a matching application identifier, and the cryptographic algorithm locally supported by the digital key terminal 102 includes the first type of cryptographic algorithm and the second type of cryptographic algorithm, the digital key terminal 102 compares the matching application identification in the matching instruction with The preset application identification of the digital key application in the digital key terminal 102 obtains a comparison result indicating that the identifications are inconsistent. Wherein, the matching instruction includes that the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier is the second type of cryptographic algorithm. The second category of cryptographic algorithms includes national secret algorithms. The encryption algorithms locally supported by the digital key terminal 102 satisfying the preset condition means that the encryption algorithms supported by the digital key application in the digital key terminal 102 include the first type of encryption algorithm and the second type of encryption algorithm. The first category of cryptographic algorithms includes international algorithms. It can be understood that when the matching instruction includes the matching application identification and the cryptographic algorithm locally supported by the digital key terminal 102 meets the preset conditions, the digital key application corresponding to the matching application identification only supports the second type of cryptographic algorithm, and the digital key terminal 102 The digital key application supports dual algorithms (including the first type of encryption algorithm and the second type of encryption algorithm), so the matching application identification is inconsistent with the preset application identification of the digital key application in the digital key terminal 102 . The digital key terminal 102 generates a first matching result indicating that the matching fails based on the comparison result indicating that the identifiers are inconsistent. Wherein, the matching result includes a first matching result and a second matching result, the first matching result indicates a matching failure, and the second matching result indicates a matching success. Based on the first matching result and the priority information corresponding to each locally supported cryptographic algorithm, the digital key terminal 102 generates matching response data including the matching result identifier and cryptographic algorithm information corresponding to the first matching result. Specifically, the digital key terminal 102 generates a matching result identifier corresponding to the first matching result based on the first matching result. The digital key terminal 102 generates cryptographic algorithm information based on the preset priority information corresponding to each cryptographic algorithm supported locally. The digital key terminal 102 generates matching response data based on the matching result identifier corresponding to the first matching result and the cryptographic algorithm information.

本实施例中,在匹配指令包含匹配应用标识、且数字钥匙端本地支持的密码算法第一类密码算法和第二类密码算法的情况下,数字钥匙端基于本地支持的各密码算法对应的优先级信息,生成匹配响应数据。这样,匹配响应数据包含数字钥匙端中各密码算法的优先级信息,解锁终端就可以基于匹配响应数据中的信息判断数字钥匙端中的数字钥匙应用所支持的密码算法,进而确定解锁终端的待使用的密码算法,从而保证解锁终端与数字钥匙端的待使用的密码算法为同一个密码算法,实现认证成功。In this embodiment, when the matching instruction includes matching application identifiers, and the first type of encryption algorithm and the second type of encryption algorithm locally supported by the digital key end, the digital key end is based on the corresponding priority of each encryption algorithm locally supported. level information to generate matching response data. In this way, the matching response data contains the priority information of each cryptographic algorithm in the digital key terminal, and the unlocking terminal can judge the cryptographic algorithms supported by the digital key application in the digital key terminal based on the information in the matching response data, and then determine the waiting time of the unlocking terminal. The cryptographic algorithm used, so as to ensure that the cryptographic algorithms to be used on the unlocking terminal and the digital key end are the same cryptographic algorithm, and the authentication is successful.

在一个实施例中,在匹配指令包含匹配应用标识的情况下,数字钥匙的认证方法还包括:In one embodiment, when the matching instruction includes a matching application identifier, the digital key authentication method further includes:

在本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,比较匹配应用标识与预设的应用标识,确定比较结果;在比较结果表示标识一致的情况下,生成表示匹配成功的第二匹配结果,并基于第二匹配结果,生成包含第二匹配结果对应的匹配结果标识的匹配响应数据;在比较结果表示标识不一致的情况下,生成表示匹配失败的第一匹配结果,并基于第一匹配结果,生成包含第一匹配结果对应的匹配结果标识的匹配响应数据。When the cryptographic algorithm supported locally is the first type of cryptographic algorithm or the second type of cryptographic algorithm, compare and match the application ID with the preset application ID to determine the comparison result; when the comparison result shows that the IDs are consistent, generate a match A successful second matching result, and based on the second matching result, generating matching response data containing a matching result identifier corresponding to the second matching result; when the comparison result indicates that the identifier is inconsistent, generating a first matching result indicating that the matching failed, And based on the first matching result, generating matching response data including the matching result identifier corresponding to the first matching result.

本申请实施例中,在匹配指令包含匹配应用标识、且数字钥匙端本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,数字钥匙端102比较匹配指令中的匹配应用标识与数字钥匙端102中数字钥匙应用的预设的应用标识,得到比较结果。其中,数字钥匙端本地支持的密码算法为第一类密码算法或者第二类密码算法是指数字钥匙端102中的数字钥匙应用所支持的密码算法是第一类密码算法,或者,第二类密码算法,也就是说,数字钥匙端102中的数字钥匙应用仅支持单算法而不支持双算法。匹配指令包含匹配应用标识对应的数字钥匙应用所支持的密码算法为第二类密码算法。第二类密码算法包括国密算法。具体的,在匹配指令包含匹配应用标识、且数字钥匙端本地支持的密码算法为第二类密码算法的情况下,数字钥匙端102比较匹配指令中的匹配应用标识与数字钥匙端102中数字钥匙应用的预设的应用标识,数字钥匙端102得到表示标识一致的比较结果。在比较结果表示标识一致的情况下,数字钥匙端102生成表示匹配成功的第二匹配结果,并基于第二匹配结果,生成包含第二匹配结果对应的匹配结果标识的匹配响应数据。在匹配指令包含匹配应用标识、且数字钥匙端本地支持的密码算法为第一类密码算法的情况下,数字钥匙端102比较匹配指令中的匹配应用标识与数字钥匙端102中数字钥匙应用的预设的应用标识,数字钥匙端102得到表示标识不一致的比较结果。在比较结果表示标识不一致的情况下,数字钥匙端102生成表示匹配失败的第一匹配结果,并基于第一匹配结果,生成包含第一匹配结果对应的匹配结果标识的匹配响应数据。In this embodiment of the application, when the matching instruction includes the matching application identifier, and the encryption algorithm locally supported by the digital key terminal is the first type of encryption algorithm or the second type of encryption algorithm, the digital key terminal 102 compares the matching application in the matching instruction The identification is compared with the preset application identification of the digital key application in the digital key terminal 102 to obtain a comparison result. Wherein, the cryptographic algorithm locally supported by the digital key terminal is the first type of cryptographic algorithm or the second type of cryptographic algorithm means that the cryptographic algorithm supported by the digital key application in the digital key terminal 102 is the first type of cryptographic algorithm, or the second type of cryptographic algorithm The cryptographic algorithm, that is to say, the digital key application in the digital key terminal 102 only supports single algorithm but not double algorithm. The matching instruction includes that the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier is the second type of cryptographic algorithm. The second category of cryptographic algorithms includes national secret algorithms. Specifically, when the matching instruction includes a matching application identifier, and the encryption algorithm locally supported by the digital key terminal is the second type of encryption algorithm, the digital key terminal 102 compares the matching application identification in the matching instruction with the digital key in the digital key terminal 102. The digital key terminal 102 obtains a comparison result indicating that the identifier is consistent with the preset application identifier of the application. If the comparison result indicates that the identifications are consistent, the digital key terminal 102 generates a second matching result indicating that the matching is successful, and based on the second matching result, generates matching response data including the matching result identification corresponding to the second matching result. In the case that the matching instruction contains the matching application identification, and the cryptographic algorithm locally supported by the digital key terminal is the first type of cryptographic algorithm, the digital key terminal 102 compares the matching application identification in the matching instruction with the predetermined value of the digital key application in the digital key terminal 102. If the application identifier is set, the digital key terminal 102 obtains a comparison result indicating that the identifiers are inconsistent. If the comparison result indicates that the identifications are inconsistent, the digital key terminal 102 generates a first matching result indicating that the matching fails, and based on the first matching result, generates matching response data including the matching result identification corresponding to the first matching result.

本实施例中,若数字钥匙端中的数字钥匙应用预设的应用标识与匹配应用标识一致,则生成包含表示匹配成功信息的匹配响应数据;若数字钥匙端中的数字钥匙应用预设的应用标识与匹配应用标识不一致,则生成包含表示匹配失败信息的匹配响应数据。因此,解锁终端可以根据匹配响应数据包含的信息来确定数字钥匙端本地支持的密码算法,进而保证解锁终端与数字钥匙端待使用的密码算法为同一个密码算法,从而能认证成功。In this embodiment, if the preset application identification of the digital key application in the digital key terminal is consistent with the matching application identification, then generate matching response data containing information indicating that the matching is successful; If the ID is not consistent with the matching application ID, a matching response data including matching failure information is generated. Therefore, the unlocking terminal can determine the cryptographic algorithm locally supported by the digital key terminal according to the information contained in the matching response data, thereby ensuring that the cryptographic algorithm to be used by the unlocking terminal and the digital key terminal is the same cryptographic algorithm, so that the authentication can be successful.

在一个实施例中,在匹配指令不包含匹配应用标识的情况下,在本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据包括:In one embodiment, when the matching instruction does not include the matching application identifier, and if the locally supported cryptographic algorithm satisfies a preset condition, generating matching response data containing cryptographic algorithm information includes:

响应于匹配指令,生成表示匹配成功的第二匹配结果;基于第二匹配结果、以及本地支持的各密码算法对应的优先级信息,生成包含第二匹配结果对应的匹配结果标识的匹配响应数据。In response to the matching instruction, generate a second matching result indicating that the matching is successful; based on the second matching result and the priority information corresponding to each cryptographic algorithm supported locally, generate matching response data including a matching result identifier corresponding to the second matching result.

其中,不包含匹配应用标识的匹配指令用于指示数字钥匙端判断数字钥匙端中是否存有数字钥匙应用。Wherein, the matching instruction that does not include the matching application identifier is used to instruct the digital key terminal to determine whether there is a digital key application in the digital key terminal.

本申请实施例中,在匹配指令不包含匹配应用标识、且数字钥匙端102本地支持的密码算法满足预设条件的情况下,数字钥匙端102响应于不包含匹配应用标识的匹配指令,生成表示匹配成功的第二匹配结果。数字钥匙端102本地支持的密码算法满足预设条件表明数字钥匙端中存有支持双算法(包括第一类密码算法和第二类密码算法)的数字钥匙应用。可以理解,数字钥匙端102中只要存有数字钥匙应用,都会响应于不包含匹配应用标识的匹配指令,生成第二匹配结果。数字钥匙端102基于第二匹配结果、以及数字钥匙端本地支持的各密码算法对应的优先级信息,生成包含第二匹配结果对应的匹配结果表示的匹配响应数据。具体的,数字钥匙端102基于第二匹配结果,生成第二匹配结果对应的匹配结果标识。数字钥匙端102基于预设的本地支持的各密码算法对应的优先级信息,生成密码算法信息。数字钥匙端102基于第二匹配结果对应的匹配结果标识、以及密码算法信息,生成匹配响应数据。In the embodiment of the present application, when the matching instruction does not include the matching application identifier and the cryptographic algorithm locally supported by the digital key terminal 102 satisfies the preset conditions, the digital key terminal 102 generates a representation The second matching result with a successful match. The cryptographic algorithm locally supported by the digital key terminal 102 meets the preset conditions, indicating that there is a digital key application supporting dual algorithms (including the first type of encryption algorithm and the second type of encryption algorithm) in the digital key terminal. It can be understood that as long as there is a digital key application stored in the digital key terminal 102, a second matching result will be generated in response to a matching instruction that does not include a matching application identifier. Based on the second matching result and the priority information corresponding to each cryptographic algorithm locally supported by the digital key, the digital key terminal 102 generates matching response data including a matching result representation corresponding to the second matching result. Specifically, the digital key terminal 102 generates a matching result identifier corresponding to the second matching result based on the second matching result. The digital key terminal 102 generates cryptographic algorithm information based on the preset priority information corresponding to each cryptographic algorithm supported locally. The digital key terminal 102 generates matching response data based on the matching result identifier corresponding to the second matching result and the cryptographic algorithm information.

本实施例中,在匹配指令不包含匹配应用标识、且数字钥匙端102本地支持的密码算法满足预设条件的情况下,数字钥匙端基于表示匹配成功的第二匹配结果、以及本地支持的各密码算法对应的优先级信息,生成匹配响应数据。这样,匹配响应数据包含匹配成功的信息以及数字钥匙端中各密码算法的优先级信息,解锁终端就可以基于匹配响应数据中的信息判断数字钥匙端中的数字钥匙应用所支持的密码算法,进而确定解锁终端的待使用的密码算法,从而保证解锁终端与数字钥匙端的待使用的密码算法为同一个密码算法,实现认证成功。In this embodiment, when the matching instruction does not include the matching application identifier, and the cryptographic algorithm locally supported by the digital key terminal 102 satisfies the preset conditions, the digital key terminal 102 based on the second matching result indicating that the matching is successful, and the locally supported encryption algorithm The priority information corresponding to the cryptographic algorithm generates matching response data. In this way, the matching response data includes the information of successful matching and the priority information of each cryptographic algorithm in the digital key terminal, and the unlocking terminal can judge the cryptographic algorithm supported by the digital key application in the digital key terminal based on the information in the matching response data, and then The password algorithm to be used for unlocking the terminal is determined, so as to ensure that the password algorithm to be used for the unlocking terminal and the digital key terminal are the same password algorithm, and the authentication is successful.

在一个实施例中,如图4所示,方法应用于解锁终端,方法包括:In one embodiment, as shown in FIG. 4, the method is applied to unlocking a terminal, and the method includes:

步骤402,向数字钥匙端发送匹配指令。Step 402, sending a matching instruction to the digital key.

其中,匹配指令用于指示数字钥匙端基于匹配指令返回匹配响应数据。Wherein, the matching instruction is used to instruct the digital key terminal to return matching response data based on the matching instruction.

本申请实施例中,在解锁终端104检测到数字钥匙端102的情况下,解锁终端104向数字钥匙端102发送匹配指令。可选的,匹配指令可以是包含匹配应用标识的匹配指令,也可以是不包含匹配应用标识的匹配指令。在一个实施例中,在解锁终端104检测到数字钥匙端102的情况下,解锁终端104根据预设的匹配应用标识,生成包含匹配应用标识的匹配指令。其中,匹配应用标识对应的数字钥匙应用所支持的密码算法为第二类密码算法。In the embodiment of the present application, when the unlocking terminal 104 detects the digital key terminal 102 , the unlocking terminal 104 sends a matching instruction to the digital key terminal 102 . Optionally, the matching instruction may be a matching instruction including a matching application identifier, or a matching instruction not including a matching application identifier. In one embodiment, when the unlocking terminal 104 detects the digital key terminal 102, the unlocking terminal 104 generates a matching instruction including a matching application identifier according to a preset matching application identifier. Wherein, the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier is the second type of cryptographic algorithm.

步骤404,在匹配响应数据包含数字钥匙端对应的密码算法信息的情况下,根据密码算法信息的解析结果和密码选择策略,确定匹配响应数据对应的密码匹配响应结果。Step 404, if the matching response data includes cryptographic algorithm information corresponding to the digital key terminal, determine the cryptographic matching response result corresponding to the matching response data according to the analysis result of the cryptographic algorithm information and the cryptographic selection strategy.

其中,密码匹配响应结果用于供数字钥匙端确定待使用的密码算法,并基于待使用的密码算法进行认证处理。Wherein, the password matching response result is used for the digital key terminal to determine the password algorithm to be used, and perform authentication processing based on the password algorithm to be used.

本申请实施例中,解锁终端104接收并解析数字钥匙端102返回的匹配响应数据。在匹配响应数据包含数字钥匙端102对应的密码算法信息的情况下,解锁终端104对匹配响应数据中的密码算法信息进行解析,得到解析结果。其中,解析结果为包含各密码算法对应的优先级信息,或者,无法解析密码算法信息。解锁终端104基于解析结果和密码选择策略,设置解锁终端104的待使用的密码算法,并基于解锁终端104的待使用的密码算法,得到解锁终端104的待使用的密码算法对应的密码匹配响应结果。其中,密码选择策略用于确定解锁终端104的待使用的密码算法。密码匹配响应结果为解锁终端104向数字钥匙端102发送密码算法指示数据,或者,解锁终端104不向数字钥匙端102发送密码算法指示数据。匹配响应数据的解析结果、密码选择策略与密码匹配响应结果三者具有预设的第一对应关系。具体的,在匹配响应数据的解析结果包含各密码算法对应的优先级信息的情况下,密码选择策略为基于密码算法信息确定解锁终端104的待使用的密码算法;在匹配响应数据的解析结果为无法解析密码算法信息的情况下,密码选择策略为将预设的第一类密码算法作为解锁终端104的待使用的密码算法。在解锁终端104的待使用的密码算法是第一类密码算法的情况下,密码匹配响应结果为解锁终端104不向数字钥匙端102发送密码算法指示数据;在解锁终端104的待使用的密码算法是第二类密码算法的情况下,密码匹配响应结果为解锁终端104向数字钥匙端102发送密码算法指示数据。其中,密码算法指示数据包含第二类密码算法对应的密码算法标识,第二类密码算法对应的密码算法标识用于数字钥匙端102将数字钥匙端102的待使用的密码算法设置为第二类密码算法。In the embodiment of the present application, the unlocking terminal 104 receives and analyzes the matching response data returned by the digital key terminal 102 . In the case that the matching response data includes the cryptographic algorithm information corresponding to the digital key terminal 102, the unlocking terminal 104 analyzes the cryptographic algorithm information in the matching response data to obtain the parsing result. Wherein, the parsing result includes priority information corresponding to each cryptographic algorithm, or the cryptographic algorithm information cannot be parsed. The unlocking terminal 104 sets the password algorithm to be used for the unlocking terminal 104 based on the analysis result and the password selection strategy, and obtains a password matching response result corresponding to the password algorithm to be used for the unlocking terminal 104 based on the password algorithm to be used for the unlocking terminal 104 . Wherein, the password selection policy is used to determine the password algorithm to be used for unlocking the terminal 104 . The password matching response result is that the unlocking terminal 104 sends the password algorithm indication data to the digital key terminal 102 , or the unlocking terminal 104 does not send the password algorithm indication data to the digital key terminal 102 . The parsing result of the matching response data, the password selection strategy and the password matching response result have a preset first corresponding relationship. Specifically, when the parsing result of the matching response data includes priority information corresponding to each cryptographic algorithm, the password selection strategy is to determine the cryptographic algorithm to be used for unlocking the terminal 104 based on the cryptographic algorithm information; when the parsing result of the matching response data is If the password algorithm information cannot be parsed, the password selection strategy is to use the preset first type of password algorithm as the password algorithm to be used to unlock the terminal 104 . In the case that the password algorithm to be used by the unlocking terminal 104 is the first type of password algorithm, the password matching response result is that the unlocking terminal 104 does not send the password algorithm indication data to the digital key terminal 102; In the case of the second type of encryption algorithm, the password matching response result is that the unlocking terminal 104 sends encryption algorithm indication data to the digital key terminal 102 . Wherein, the cryptographic algorithm indication data includes the cryptographic algorithm identification corresponding to the second type of cryptographic algorithm, and the cryptographic algorithm identification corresponding to the second type of cryptographic algorithm is used for the digital key terminal 102 to set the cryptographic algorithm to be used on the digital key terminal 102 as the second type cryptographic algorithm.

本实施例中,基于数字钥匙端发送的匹配响应数据、以及预设的密码选择策略,确定解锁终端的待使用的密码算法,并基于解锁终端的待使用的密码算法,确定密码匹配响应结果。其中,匹配响应数据包含数字钥匙端本地支持的密码算法的信息,因此,解锁终端的待使用的密码算法是基于数字钥匙端本地支持的密码算法确定的。而解锁终端的密码匹配响应结果用于指示数字钥匙端的待使用的密码算法,也就是说,数字钥匙端的待使用的密码算法是基于解锁终端的待使用的密码算法确定的,进而保证了数字钥匙端和解锁终端的待使用的密码算法是同一种密码算法。因此,采用本方案来进行认证,是可以认证成功的。In this embodiment, based on the matching response data sent by the digital key terminal and the preset password selection strategy, the password algorithm to be used to unlock the terminal is determined, and the password matching response result is determined based on the password algorithm to be used to unlock the terminal. Wherein, the matching response data includes the information of the cryptographic algorithm locally supported by the digital key terminal, therefore, the cryptographic algorithm to be used for unlocking the terminal is determined based on the cryptographic algorithm locally supported by the digital key terminal. The password matching response result of the unlocked terminal is used to indicate the cryptographic algorithm to be used on the digital key side, that is, the cryptographic algorithm to be used on the digital key side is determined based on the cryptographic algorithm to be used on the unlocked terminal, thereby ensuring that the digital key The cryptographic algorithm to be used on the terminal and the unlocked terminal is the same cryptographic algorithm. Therefore, using this scheme for authentication can succeed in authentication.

在一个实施例中,根据密码算法信息的解析结果和密码选择策略,确定匹配响应数据对应的密码匹配响应结果包括:In one embodiment, according to the analysis result of the password algorithm information and the password selection strategy, determining the password matching response result corresponding to the matching response data includes:

在密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,基于密码算法信息中的各密码算法对应的优先级信息和密码选择策略,确定密码匹配响应结果;在密码算法信息的解析结果为无法解析密码算法信息的情况下,确定密码匹配响应结果为不向数字钥匙端发送密码算法指示数据。In the case that the analysis result of the cryptographic algorithm information includes the priority information corresponding to each cryptographic algorithm, based on the priority information corresponding to each cryptographic algorithm in the cryptographic algorithm information and the password selection strategy, determine the password matching response result; in the cryptographic algorithm information If the analysis result is that the password algorithm information cannot be parsed, it is determined that the password matching response result is not to send the password algorithm indication data to the digital key.

本申请实施例中,在密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,解锁终端104解析得到密码算法信息,并基于密码算法信息中的数字钥匙端102的各密码算法对应的优先级信息和预设的密码选择策略,设置解锁终端104的待使用的密码算法。具体的,在数字钥匙端102的各密码算法对应的优先级信息包括第一类密码算法的优先级高于第二类密码算法的优先级的情况下,解锁终端104将预设的第一类密码算法作为解锁终端104的密码算法。在数字钥匙端102的各密码算法对应的优先级信息包括第二类密码算法的优先级高于第一类密码算法的优先级的情况下,解锁终端104将预设的第二类密码算法作为解锁终端104的密码算法。解锁终端104基于解锁终端104的待使用的密码算法,生成密码匹配响应结果。具体的,在解锁终端104的待使用的密码算法为第一类密码算法的情况下,解锁终端不生产密码算法指示数据,进而也不向数字钥匙端102发送密码算法指示数据。在解锁终端104的待使用的密码算法为第二类密码算法的情况下,解锁终端基于第二类密码算法对应的密码算法标识,生成包含密码算法标识的密码算法指示数据,并向数字钥匙端102发送包含密码算法标识的密码算法指示数据。在密码算法信息的解析结果为无法解析密码算法信息的情况下,解锁终端104未解析得到密码算法信息,解锁终端104将预设的第一类密码算法作为解锁终端104的待使用的密码算法。在解锁终端104的待使用的密码算法为第一类密码算法的情况下,解锁终端不生产密码算法指示数据,进而也不向数字钥匙端102发送密码算法指示数据。In the embodiment of the present application, when the analysis result of the encryption algorithm information includes the priority information corresponding to each encryption algorithm, the unlocking terminal 104 analyzes the encryption algorithm information, and based on the encryption algorithm information in the encryption algorithm information, the encryption algorithm of the digital key terminal 102 Corresponding to the priority information and the preset password selection strategy, the password algorithm to be used for unlocking the terminal 104 is set. Specifically, when the priority information corresponding to each cryptographic algorithm on the digital key terminal 102 includes that the priority of the first type of cryptographic algorithm is higher than that of the second type of cryptographic algorithm, the unlocking terminal 104 will use the preset first type The cryptographic algorithm serves as a cryptographic algorithm for unlocking the terminal 104 . When the priority information corresponding to each encryption algorithm on the digital key terminal 102 includes that the priority of the second type of encryption algorithm is higher than that of the first type of encryption algorithm, the unlocking terminal 104 uses the preset second type of encryption algorithm as A cryptographic algorithm for unlocking the terminal 104 . The unlocking terminal 104 generates a password matching response result based on the password algorithm to be used by the unlocking terminal 104 . Specifically, when the encryption algorithm to be used by the unlocking terminal 104 is the first type of encryption algorithm, the unlocking terminal does not generate encryption algorithm indication data, and does not send encryption algorithm indication data to the digital key terminal 102 . In the case that the cryptographic algorithm to be used by the unlocking terminal 104 is the second type of cryptographic algorithm, the unlocking terminal generates cryptographic algorithm indication data containing the cryptographic algorithm logo based on the cryptographic algorithm identification corresponding to the second type of cryptographic algorithm, and sends the data to the digital key terminal 102 Send cryptographic algorithm indication data including the cryptographic algorithm identifier. If the analysis result of the encryption algorithm information is that the encryption algorithm information cannot be analyzed, the unlocking terminal 104 has not analyzed the encryption algorithm information, and the unlocking terminal 104 uses the preset first type of encryption algorithm as the encryption algorithm to be used by the unlocking terminal 104 . When the encryption algorithm to be used by the unlocking terminal 104 is the first type of encryption algorithm, the unlocking terminal does not generate encryption algorithm indication data, and does not send encryption algorithm indication data to the digital key terminal 102 .

本实施例中,解锁终端根据密码算法信息的解析结果和密码选择策略,确定解锁终端的待使用的密码算法,并基于解锁终端的待使用的密码算法,确定密码匹配响应结果。其中,密码匹配响应结果用于指示数字钥匙端的待使用的密码算法,也就是说,数字钥匙端的待使用的密码算法是基于解锁终端的待使用的密码算法确定的,进而保证了数字钥匙端和解锁终端的待使用的密码算法是同一种密码算法。因此,采用本方案来进行认证,是可以认证成功的。In this embodiment, the unlocking terminal determines the password algorithm to be used by the unlocking terminal according to the analysis result of the password algorithm information and the password selection strategy, and determines the password matching response result based on the password algorithm to be used by the unlocking terminal. Wherein, the password matching response result is used to indicate the password algorithm to be used on the digital key terminal, that is to say, the password algorithm to be used on the digital key terminal is determined based on the password algorithm to be used on the unlocked terminal, thereby ensuring that the digital key terminal and the The cryptographic algorithm to be used for unlocking the terminal is the same cryptographic algorithm. Therefore, using this scheme for authentication can succeed in authentication.

在一个实施例中,如图5所示,数字钥匙的认证方法还包括:In one embodiment, as shown in Figure 5, the digital key authentication method also includes:

步骤502,在匹配指令包含匹配应用标识、且匹配响应数据不包含数字钥匙端对应的密码算法信息的情况下,基于匹配响应数据包含的匹配结果标识,确定匹配结果。Step 502: In the case that the matching instruction includes the matching application identifier and the matching response data does not include the cryptographic algorithm information corresponding to the digital key, determine the matching result based on the matching result identifier included in the matching response data.

本申请实施例中,在匹配指令包含匹配应用标识、且匹配响应数据不包含数字钥匙端102对应的密码算法信息的情况下,解锁终端104基于匹配响应数据包含的匹配结果标识,得到匹配结果。其中,匹配结果是表示匹配失败的第一匹配结果,或者,是表示匹配成功的第二匹配结果。可以理解,匹配响应数据不包含数字钥匙端102对应的密码算法信息,说明数字钥匙端102本地支持的密码算法是单算法(第一类密码算法或者第二类密码算法),因此,数字钥匙端102的待使用的密码算法只能是本地支持的唯一的密码算法。那么,只需要根据数字钥匙端102的匹配结果来确定解锁终端的待使用的密码算法,而不用基于解锁终端104的待使用的密码算法来确定数字钥匙端102的待使用的密码算法。也就是说,在匹配指令包含匹配应用标识、且匹配响应数据不包含数字钥匙端102对应的密码算法信息的情况下,数字钥匙端102将本地支持的密码算法作为数字钥匙端102的待使用的密码算法。In this embodiment of the application, when the matching instruction includes the matching application identifier and the matching response data does not include the cryptographic algorithm information corresponding to the digital key terminal 102, the unlocking terminal 104 obtains the matching result based on the matching result identifier included in the matching response data. Wherein, the matching result is the first matching result indicating that the matching fails, or is the second matching result indicating that the matching is successful. It can be understood that the matching response data does not contain the cryptographic algorithm information corresponding to the digital key terminal 102, indicating that the cryptographic algorithm locally supported by the digital key terminal 102 is a single algorithm (the first type of cryptographic algorithm or the second type of cryptographic algorithm). Therefore, the digital key terminal The cryptographic algorithm to be used in 102 can only be the unique cryptographic algorithm supported locally. Then, it only needs to determine the password algorithm to be used for unlocking the terminal 102 according to the matching result of the digital key terminal 102 , instead of determining the password algorithm to be used for the digital key terminal 102 based on the password algorithm to be used for unlocking the terminal 104 . That is to say, when the matching instruction includes the matching application identifier and the matching response data does not include the cryptographic algorithm information corresponding to the digital key terminal 102, the digital key terminal 102 uses the locally supported cryptographic algorithm as the to-be-used cryptographic algorithm of the digital key terminal 102. cryptographic algorithm.

步骤504,在匹配结果为表示匹配失败的第一匹配结果的情况下,将第一类密码算法作为待使用的密码算法,并确定密码匹配响应结果为不向数字钥匙端发送密码算法指示数据。Step 504, if the matching result is the first matching result indicating that the matching fails, use the first type of cryptographic algorithm as the cryptographic algorithm to be used, and determine that the cryptographic matching response result is not to send cryptographic algorithm indication data to the digital key.

本申请实施例中,在匹配结果为表示匹配失败的第一匹配结果的情况下,解锁终端104将第一类密码算法作为待使用的密码算法,并生成不向数字钥匙端102发送密码算法指示数据的密码匹配响应结果。可以理解,在匹配指令包含匹配应用标识的情况下,解锁终端104向数字钥匙端102发送的匹配指令包含支持第二类密码算法的数字钥匙应用对应的应用标识,若数字钥匙端102基于该匹配指令生成的匹配结果表示匹配失败,那么说明数字钥匙端102本地支持的密码算法为第一类密码算法。因此,在匹配结果为表示匹配失败的第一匹配结果的情况下,解锁终端104将第一类密码算法作为待使用的密码算法,可以保证解锁终端104和数字钥匙端102两者的待使用的密码算法都是第一类密码算法。In the embodiment of the present application, when the matching result is the first matching result indicating that the matching fails, the unlocking terminal 104 uses the first type of cryptographic algorithm as the cryptographic algorithm to be used, and generates an instruction not to send the cryptographic algorithm to the digital key terminal 102 The data's password matches the response result. It can be understood that when the matching instruction includes the matching application identification, the matching instruction sent by the unlocking terminal 104 to the digital key terminal 102 contains the application identification corresponding to the digital key application supporting the second type of cryptographic algorithm, if the digital key terminal 102 is based on the matching If the matching result generated by the instruction indicates that the matching fails, it means that the cryptographic algorithm locally supported by the digital key terminal 102 is the first type of cryptographic algorithm. Therefore, when the matching result is the first matching result indicating that the matching fails, the unlocking terminal 104 uses the first type of cryptographic algorithm as the cryptographic algorithm to be used, which can ensure that both the unlocking terminal 104 and the digital key terminal 102 are to be used. All cryptographic algorithms are Class I cryptographic algorithms.

步骤506,在匹配结果为表示匹配成功的第二匹配结果的情况下,将匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并确定密码匹配响应结果为不向数字钥匙端发送密码算法指示数据。Step 506, if the matching result is the second matching result indicating that the matching is successful, use the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier as the cryptographic algorithm to be used, and determine that the cryptographic matching response result is a non-directional digital key The key end sends the cryptographic algorithm indication data.

本申请实施例中,在匹配结果为表示匹配成功的第二匹配结果的情况下,解锁终端104将匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并生成不向数字钥匙端102发送密码算法指示数据的密码匹配响应结果。可以理解,在匹配指令包含匹配应用标识的情况下,解锁终端104向数字钥匙端102发送的匹配指令包含支持第二类密码算法的数字钥匙应用对应的应用标识,若数字钥匙端102基于该匹配指令生成的匹配结果表示匹配成功,那么说明数字钥匙端102本地支持的密码算法为第二类密码算法。因此,在匹配结果为表示匹配成功的第二匹配结果的情况下,解锁终端104将第二类密码算法作为待使用的密码算法,可以保证解锁终端104和数字钥匙端102两者的待使用的密码算法都是第二类密码算法。In the embodiment of the present application, when the matching result is the second matching result indicating that the matching is successful, the unlocking terminal 104 uses the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier as the cryptographic algorithm to be used, and generates an The digital key terminal 102 sends a cryptographic matching response result of the cryptographic algorithm indication data. It can be understood that when the matching instruction includes the matching application identification, the matching instruction sent by the unlocking terminal 104 to the digital key terminal 102 contains the application identification corresponding to the digital key application supporting the second type of cryptographic algorithm, if the digital key terminal 102 is based on the matching The matching result generated by the instruction indicates that the matching is successful, which means that the cryptographic algorithm locally supported by the digital key terminal 102 is the second type of cryptographic algorithm. Therefore, when the matching result is the second matching result indicating that the matching is successful, the unlocking terminal 104 uses the second type of cryptographic algorithm as the cryptographic algorithm to be used, which can ensure that both the unlocking terminal 104 and the digital key terminal 102 are to be used. Cryptographic algorithms are all Class II cryptographic algorithms.

本实施例中,在匹配指令包含匹配应用标识、且匹配响应数据不包含数字钥匙端对应的密码算法信息的情况下,解锁终端基于匹配响应数据中的匹配结果确定解锁终端的待使用的密码算法。由于匹配响应数据不包含密码算法信息的数字钥匙端本地支持的密码算法是单算法(第一类密码算法或者第二类密码算法),而解锁终端又是基于数字钥匙端发送的匹配响应数据确定的,因此,保证了数字钥匙端和解锁终端的待使用的密码算法是同一种密码算法。所以采用本方案来进行认证,是可以认证成功的。In this embodiment, when the matching instruction includes the matching application identifier and the matching response data does not include the cryptographic algorithm information corresponding to the digital key terminal, the unlocking terminal determines the cryptographic algorithm to be used for the unlocking terminal based on the matching result in the matching response data . Since the matching response data does not contain cryptographic algorithm information, the cryptographic algorithm locally supported by the digital key terminal is a single algorithm (the first type of cryptographic algorithm or the second type of cryptographic algorithm), and the unlocking terminal is determined based on the matching response data sent by the digital key end. Therefore, it is guaranteed that the cryptographic algorithm to be used on the digital key terminal and the unlocking terminal is the same cryptographic algorithm. Therefore, using this scheme for authentication can be successful.

应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flow charts involved in the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flow charts involved in the above-mentioned embodiments may include multiple steps or stages, and these steps or stages are not necessarily executed at the same time, but may be performed at different times For execution, the execution order of these steps or stages is not necessarily performed sequentially, but may be executed in turn or alternately with other steps or at least a part of steps or stages in other steps.

基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的数字钥匙的认证方法的数字钥匙的认证系统。该系统所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个数字钥匙的认证系统实施例中的具体限定可以参见上文中对于数字钥匙的认证方法的限定,在此不再赘述。Based on the same inventive concept, an embodiment of the present application further provides a digital key authentication system for implementing the digital key authentication method involved above. The solution to the problem provided by the system is similar to the implementation described in the above method, so the specific limitations in the embodiment of the authentication system for one or more digital keys provided below can be referred to above for the authentication of the digital key The limitation of the method will not be repeated here.

在一个实施例中,如图1所示,提供了一种数字钥匙的认证系统,所述系统包括数字钥匙端102和解锁终端104,其中:In one embodiment, as shown in FIG. 1 , a digital key authentication system is provided, the system includes a digital key terminal 102 and an unlocking terminal 104, wherein:

所述解锁终端104,用于向所述数字钥匙端102发送匹配指令;The unlocking terminal 104 is configured to send a matching instruction to the digital key terminal 102;

数字钥匙端102,用于响应于解锁终端104发送的匹配指令,确定本地支持的密码算法;在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含本地支持的各密码算法对应的优先级信息;所述解锁终端104,还用于根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;The digital key terminal 102 is configured to determine a locally supported cryptographic algorithm in response to the matching instruction sent by the unlocking terminal 104; when the locally supported cryptographic algorithm satisfies a preset condition, generate matching response data containing cryptographic algorithm information; The cryptographic algorithm information includes priority information corresponding to each cryptographic algorithm supported locally; the unlocking terminal 104 is also used to determine the password corresponding to the matching response data according to the analysis result of the cryptographic algorithm information and the password selection policy matching response result;

所述数字钥匙端102,还用于根据所述匹配响应数据对应的密码匹配响应结果确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The digital key terminal 102 is further configured to determine the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data, and perform authentication processing based on the cryptographic algorithm to be used.

在一个实施例中,所述数字钥匙端102具体用于:In one embodiment, the digital key terminal 102 is specifically used for:

在所述匹配响应数据对应的密码匹配响应结果为接收到所述解锁终端104发送的密码算法指示数据的情况下,获取所述密码算法指示数据中的密码算法标识,将所述密码算法标识对应的密码算法作为待使用的密码算法;When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal 104 is received, the password algorithm identification in the encryption algorithm indication data is obtained, and the encryption algorithm identification is corresponding to The cryptographic algorithm of is used as the cryptographic algorithm to be used;

在所述匹配响应数据对应的密码匹配响应结果为未接收到所述解锁终端104发送的密码算法指示数据的情况下,将本地支持的第一类密码算法作为所述待使用的密码算法。When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal 104 has not been received, the locally supported first type of password algorithm is used as the password algorithm to be used.

在一个实施例中,在所述匹配指令包含匹配应用标识的情况下,所述数字钥匙端102具体用于:In one embodiment, when the matching instruction includes a matching application identifier, the digital key terminal 102 is specifically configured to:

在所述本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,生成包含密码算法信息的匹配响应数据;When the cryptographic algorithms supported locally include a first type of cryptographic algorithm and a second type of cryptographic algorithm, generate matching response data containing cryptographic algorithm information;

所述数字钥匙端102还用于:The digital key terminal 102 is also used for:

在所述本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,比较所述匹配应用标识与预设的应用标识,确定比较结果;When the cryptographic algorithm supported locally is a first-type cryptographic algorithm or a second-type cryptographic algorithm, comparing the matching application identifier with a preset application identifier to determine a comparison result;

在所述比较结果表示标识一致的情况下,生成表示匹配成功的第二匹配结果,并基于所述第二匹配结果,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据;When the comparison result indicates that the identifiers are consistent, generate a second matching result indicating that the matching is successful, and based on the second matching result, generate matching response data that includes the matching result identifier corresponding to the second matching result;

在所述比较结果表示标识不一致的情况下,生成表示匹配失败的第一匹配结果,并基于所述第一匹配结果,生成包含所述第一匹配结果对应的匹配结果标识的匹配响应数据。If the comparison result indicates that the identifications are inconsistent, generate a first matching result indicating that the matching fails, and based on the first matching result, generate matching response data including the matching result identification corresponding to the first matching result.

在一个实施例中,在所述匹配指令不包含匹配应用标识的情况下,所述数字钥匙端102具体用于:In one embodiment, when the matching instruction does not include a matching application identifier, the digital key terminal 102 is specifically used for:

响应于所述匹配指令,生成表示匹配成功的第二匹配结果;In response to the matching instruction, generating a second matching result indicating that the matching is successful;

基于所述第二匹配结果、以及本地支持的各所述密码算法对应的优先级信息,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据。Based on the second matching result and the priority information corresponding to each of the cryptographic algorithms supported locally, matching response data including a matching result identifier corresponding to the second matching result is generated.

在一个实施例中,所述解锁终端104具体用于:In one embodiment, the unlocking terminal 104 is specifically used for:

在所述密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,基于所述密码算法信息中的各密码算法对应的优先级信息和密码选择策略,确定密码匹配响应结果;In the case where the analysis result of the encryption algorithm information includes priority information corresponding to each encryption algorithm, based on the priority information corresponding to each encryption algorithm in the encryption algorithm information and the password selection strategy, determine the password matching response result;

在所述密码算法信息的解析结果为无法解析密码算法信息的情况下,确定所述密码匹配响应结果为不向所述数字钥匙端102发送密码算法指示数据。If the analysis result of the password algorithm information is that the password algorithm information cannot be parsed, it is determined that the password matching response result is not to send the password algorithm indication data to the digital key terminal 102 .

在一个实施例中,所述解锁终端104还用于:In one embodiment, the unlocking terminal 104 is also used for:

在所述匹配指令包含匹配应用标识、且所述匹配响应数据不包含所述数字钥匙端102对应的密码算法信息的情况下,基于所述匹配响应数据包含的匹配结果标识,确定所述匹配结果;When the matching instruction includes a matching application identifier and the matching response data does not include the cryptographic algorithm information corresponding to the digital key terminal 102, determine the matching result based on the matching result identifier included in the matching response data ;

在所述匹配结果为表示匹配失败的第一匹配结果的情况下,将第一类密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端102发送密码算法指示数据;In the case that the matching result is the first matching result indicating that the matching fails, the first type of cryptographic algorithm is used as the cryptographic algorithm to be used, and it is determined that the cryptographic matching response result is not to send the cryptogram to the digital key terminal 102 Algorithms indicate data;

在所述匹配结果为表示匹配成功的第二匹配结果的情况下,将所述匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端102发送密码算法指示数据。When the matching result is the second matching result indicating that the matching is successful, the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier is used as the cryptographic algorithm to be used, and the cryptographic matching response result is determined as The cryptographic algorithm indication data is not sent to the digital key terminal 102 .

基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的数字钥匙的认证方法的数字钥匙的认证装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个数字钥匙的认证装置实施例中的具体限定可以参见上文中对于数字钥匙的认证方法的限定,在此不再赘述。Based on the same inventive concept, an embodiment of the present application further provides a digital key authentication device for implementing the above-mentioned digital key authentication method. The solution to the problem provided by the device is similar to the implementation described in the above method, so the specific limitations in the embodiment of the authentication device for one or more digital keys provided below can be referred to above for the authentication of the digital key The limitation of the method will not be repeated here.

在一个实施例中,如图6所示,提供了一种数字钥匙的认证装置。所述装置应用于数字钥匙端,所述装置包括:In one embodiment, as shown in FIG. 6 , a digital key authentication device is provided. The device is applied to the digital key terminal, and the device includes:

响应模块602,用于响应于解锁终端发送的匹配指令,确定本地支持的密码算法;A response module 602, configured to determine locally supported cryptographic algorithms in response to the matching instruction sent by the unlocking terminal;

第一确定模块604,用于在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含各所述密码算法对应的优先级信息;The first determination module 604 is configured to generate matching response data including cryptographic algorithm information when the locally supported cryptographic algorithms meet preset conditions; the cryptographic algorithm information includes priority information corresponding to each of the cryptographic algorithms ;

发送模块606,用于向所述解锁终端返回所述匹配响应数据,所述匹配响应数据用于指示所述解锁终端根据所述密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果;A sending module 606, configured to return the matching response data to the unlocking terminal, where the matching response data is used to instruct the unlocking terminal to determine a password matching response result according to the analysis result of the password algorithm information and the password selection strategy;

第二确定模块608,用于根据所述匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The second determining module 608 is configured to determine a password algorithm to be used according to a password matching response result corresponding to the matching response data, and perform authentication processing based on the password algorithm to be used.

在一个实施例中,所述第二确定模块608具体用于:In one embodiment, the second determining module 608 is specifically configured to:

在所述匹配响应数据对应的密码匹配响应结果为接收到所述解锁终端发送的密码算法指示数据的情况下,获取所述密码算法指示数据中的密码算法标识,将所述密码算法标识对应的密码算法作为待使用的密码算法;When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal is received, obtain the password algorithm identification in the encryption algorithm indication data, and use the password algorithm identification corresponding to the cryptographic algorithm as the cryptographic algorithm to be used;

在所述匹配响应数据对应的密码匹配响应结果为未接收到所述解锁终端发送的密码算法指示数据的情况下,将本地支持的第一类密码算法作为所述待使用的密码算法。When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal has not been received, the locally supported first type of password algorithm is used as the password algorithm to be used.

在一个实施例中,在所述匹配指令包含匹配应用标识的情况下,第一确定模块604具体用于:In one embodiment, when the matching instruction includes a matching application identifier, the first determining module 604 is specifically configured to:

在所述本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,生成包含密码算法信息的匹配响应数据;When the cryptographic algorithms supported locally include a first type of cryptographic algorithm and a second type of cryptographic algorithm, generate matching response data containing cryptographic algorithm information;

所述数字钥匙的认证装置还包括:The authentication device of the digital key also includes:

第三确定模块,用于在所述本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,比较所述匹配应用标识与预设的应用标识,确定比较结果;A third determining module, configured to compare the matching application identifier with a preset application identifier when the locally supported cryptographic algorithm is a first-type cryptographic algorithm or a second-type cryptographic algorithm, and determine a comparison result;

第一匹配模块,用于在所述比较结果表示标识一致的情况下,生成表示匹配成功的第二匹配结果,并基于所述第二匹配结果,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据;The first matching module is configured to generate a second matching result indicating successful matching when the comparison result indicates that the identifiers are consistent, and generate a matching result corresponding to the second matching result based on the second matching result identified matching response data;

第二匹配模块,用于在所述比较结果表示标识不一致的情况下,生成表示匹配失败的第一匹配结果,并基于所述第一匹配结果,生成包含所述第一匹配结果对应的匹配结果标识的匹配响应数据。The second matching module is configured to generate a first matching result indicating a matching failure when the comparison result indicates that the identification is inconsistent, and generate a matching result corresponding to the first matching result based on the first matching result Identified matching response data.

在一个实施例中,在所述匹配指令不包含匹配应用标识的情况下,所述第一确定模块604具体用于:In one embodiment, when the matching instruction does not include a matching application identifier, the first determining module 604 is specifically configured to:

响应于所述匹配指令,生成表示匹配成功的第二匹配结果;In response to the matching instruction, generating a second matching result indicating that the matching is successful;

基于所述第二匹配结果、以及本地支持的各所述密码算法对应的优先级信息,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据。Based on the second matching result and the priority information corresponding to each of the cryptographic algorithms supported locally, matching response data including a matching result identifier corresponding to the second matching result is generated.

在一个实施例中,如图7所示,提供了一种数字钥匙的认证装置。所述装置应用于解锁终端,所述装置包括:In one embodiment, as shown in FIG. 7 , a digital key authentication device is provided. The device is applied to unlocking a terminal, and the device includes:

发送模块702,用于向数字钥匙端发送匹配指令,所述匹配指令用于指示所述数字钥匙端基于所述匹配指令返回匹配响应数据;A sending module 702, configured to send a matching instruction to the digital key, where the matching instruction is used to instruct the digital key to return matching response data based on the matching instruction;

第一确定模块704,用于在所述匹配响应数据包含所述数字钥匙端对应的密码算法信息的情况下,根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;所述密码匹配响应结果用于供数字钥匙端确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The first determination module 704 is configured to determine the matching response data corresponding to the cryptographic algorithm information according to the analysis result of the cryptographic algorithm information and the password selection strategy in the case that the matching response data includes the cryptographic algorithm information corresponding to the digital key terminal. The password matching response result; the password matching response result is used for the digital key terminal to determine the password algorithm to be used, and perform authentication processing based on the password algorithm to be used.

在一个实施例中,所述第一确定模块704具体用于:In one embodiment, the first determining module 704 is specifically configured to:

在所述密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,基于所述密码算法信息中的各密码算法对应的优先级信息和密码选择策略,确定密码匹配响应结果;In the case where the analysis result of the encryption algorithm information includes priority information corresponding to each encryption algorithm, based on the priority information corresponding to each encryption algorithm in the encryption algorithm information and the password selection strategy, determine the password matching response result;

在所述密码算法信息的解析结果为无法解析密码算法信息的情况下,确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。If the analysis result of the password algorithm information is that the password algorithm information cannot be parsed, it is determined that the password matching response result is not to send the password algorithm indication data to the digital key.

在一个实施例中,所述数字钥匙的认证装置还包括:In one embodiment, the digital key authentication device further includes:

第二确定模块,用于在所述匹配指令包含匹配应用标识、且所述匹配响应数据不包含所述数字钥匙端对应的密码算法信息的情况下,基于所述匹配响应数据包含的匹配结果标识,确定所述匹配结果;The second determination module is configured to, when the matching instruction includes a matching application identifier and the matching response data does not include the cryptographic algorithm information corresponding to the digital key terminal, based on the matching result identifier included in the matching response data , to determine the matching result;

第一匹配模块,用于在所述匹配结果为表示匹配失败的第一匹配结果的情况下,将第一类密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据;The first matching module is configured to use the first type of cryptographic algorithm as the cryptographic algorithm to be used when the matching result is the first matching result indicating that the matching fails, and determine that the cryptographic matching response result is not applicable to all The digital key terminal sends the cryptographic algorithm indication data;

第二匹配模块,用于在所述匹配结果为表示匹配成功的第二匹配结果的情况下,将所述匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。上述数字钥匙的认证装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。The second matching module is configured to use the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier as the cryptographic algorithm to be used when the matching result is the second matching result indicating that the matching is successful, and determine The result of the password matching response is that no password algorithm indication data is sent to the digital key. Each module in the above-mentioned digital key authentication device can be fully or partially realized by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图7所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种数字钥匙的认证方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure may be as shown in FIG. 7 . The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. , the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. When the computer program is executed by the processor, a digital key authentication method is realized. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the casing of the computer device , and can also be an external keyboard, touchpad, or mouse.

本领域技术人员可以理解,图7中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 7 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation to the computer equipment on which the solution of this application is applied. The specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.

在一个实施例中,还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。In one embodiment, there is also provided a computer device, including a memory and a processor, where a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the foregoing method embodiments are implemented.

在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the foregoing method embodiments are implemented.

需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据。It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all Information and data authorized by the user or fully authorized by all parties.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the computer programs can be stored in a non-volatile computer-readable memory In the medium, when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, any reference to storage, database or other media used in the various embodiments provided in the present application may include at least one of non-volatile and volatile storage. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive variable memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory, MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (Phase Change Memory, PCM), graphene memory, etc. The volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a blockchain-based distributed database, etc., but is not limited thereto. The processors involved in the various embodiments provided by this application can be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., and are not limited to this.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present application, and the description thereof is relatively specific and detailed, but should not be construed as limiting the patent scope of the present application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be determined by the appended claims.

Claims (11)

1.一种数字钥匙的认证方法,其特征在于,所述方法应用于数字钥匙端,所述方法包括:1. An authentication method of a digital key, characterized in that the method is applied to a digital key end, and the method comprises: 响应于解锁终端发送的匹配指令,确定本地支持的密码算法;Responding to the matching instruction sent by the unlocking terminal, determine locally supported cryptographic algorithms; 在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含各所述密码算法对应的优先级信息;When the cryptographic algorithms supported locally meet the preset conditions, generate matching response data including cryptographic algorithm information; the cryptographic algorithm information includes priority information corresponding to each of the cryptographic algorithms; 向所述解锁终端返回所述匹配响应数据,所述匹配响应数据用于指示所述解锁终端根据所述密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果;returning the matching response data to the unlocking terminal, where the matching response data is used to instruct the unlocking terminal to determine a password matching response result according to the analysis result of the password algorithm information and the password selection strategy; 根据所述匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。According to the password matching response result corresponding to the matching response data, a password algorithm to be used is determined, and authentication processing is performed based on the password algorithm to be used. 2.根据权利要求1所述的方法,其特征在于,所述根据所述匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法包括:2. The method according to claim 1, wherein the determining the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data comprises: 在所述匹配响应数据对应的密码匹配响应结果为接收到所述解锁终端发送的密码算法指示数据的情况下,获取所述密码算法指示数据中的密码算法标识,将所述密码算法标识对应的密码算法作为待使用的密码算法;When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal is received, obtain the password algorithm identification in the encryption algorithm indication data, and use the password algorithm identification corresponding to the cryptographic algorithm as the cryptographic algorithm to be used; 在所述匹配响应数据对应的密码匹配响应结果为未接收到所述解锁终端发送的密码算法指示数据的情况下,将本地支持的第一类密码算法作为所述待使用的密码算法。When the password matching response result corresponding to the matching response data is that the password algorithm indication data sent by the unlocking terminal has not been received, the locally supported first type of password algorithm is used as the password algorithm to be used. 3.根据权利要求1所述的方法,其特征在于,在所述匹配指令包含匹配应用标识的情况下,所述在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据包括:3. The method according to claim 1, wherein, in the case where the matching instruction includes a matching application identifier, when the locally supported cryptographic algorithm satisfies a preset condition, generating The matching response data for the message includes: 在所述本地支持的密码算法包括第一类密码算法和第二类密码算法的情况下,生成包含密码算法信息的匹配响应数据;When the cryptographic algorithms supported locally include a first type of cryptographic algorithm and a second type of cryptographic algorithm, generate matching response data containing cryptographic algorithm information; 所述方法还包括:The method also includes: 在所述本地支持的密码算法为第一类密码算法或者第二类密码算法的情况下,比较所述匹配应用标识与预设的应用标识,确定比较结果;When the cryptographic algorithm supported locally is a first-type cryptographic algorithm or a second-type cryptographic algorithm, comparing the matching application identifier with a preset application identifier to determine a comparison result; 在所述比较结果表示标识一致的情况下,生成表示匹配成功的第二匹配结果,并基于所述第二匹配结果,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据;When the comparison result indicates that the identifiers are consistent, generate a second matching result indicating that the matching is successful, and based on the second matching result, generate matching response data that includes the matching result identifier corresponding to the second matching result; 在所述比较结果表示标识不一致的情况下,生成表示匹配失败的第一匹配结果,并基于所述第一匹配结果,生成包含所述第一匹配结果对应的匹配结果标识的匹配响应数据。If the comparison result indicates that the identifications are inconsistent, generate a first matching result indicating that the matching fails, and based on the first matching result, generate matching response data including the matching result identification corresponding to the first matching result. 4.根据权利要求1所述的方法,其特征在于,在所述匹配指令不包含匹配应用标识的情况下,所述在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据包括:4. The method according to claim 1, wherein when the matching instruction does not include a matching application identifier, when the locally supported encryption algorithm satisfies a preset condition, generating an instruction containing a password The matching response data for algorithm information includes: 响应于所述匹配指令,生成表示匹配成功的第二匹配结果;In response to the matching instruction, generating a second matching result indicating that the matching is successful; 基于所述第二匹配结果、以及本地支持的各所述密码算法对应的优先级信息,生成包含所述第二匹配结果对应的匹配结果标识的匹配响应数据。Based on the second matching result and the priority information corresponding to each of the cryptographic algorithms supported locally, matching response data including a matching result identifier corresponding to the second matching result is generated. 5.一种数字钥匙的认证方法,其特征在于,所述方法应用于解锁终端,所述方法包括:5. An authentication method of a digital key, characterized in that the method is applied to unlocking a terminal, and the method comprises: 向数字钥匙端发送匹配指令,所述匹配指令用于指示所述数字钥匙端基于所述匹配指令返回匹配响应数据;sending a matching instruction to the digital key, where the matching instruction is used to instruct the digital key to return matching response data based on the matching instruction; 在所述匹配响应数据包含所述数字钥匙端对应的密码算法信息的情况下,根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;所述密码匹配响应结果用于供数字钥匙端确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。If the matching response data includes cryptographic algorithm information corresponding to the digital key terminal, determine the cryptographic matching response result corresponding to the matching response data according to the analysis result of the cryptographic algorithm information and the cryptographic selection strategy; The password matching response result is used for the digital key terminal to determine the password algorithm to be used, and perform authentication processing based on the password algorithm to be used. 6.根据权利要求5所述的方法,其特征在于,所述根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果包括:6. The method according to claim 5, wherein the determining the password matching response result corresponding to the matching response data according to the analysis result of the password algorithm information and the password selection strategy comprises: 在所述密码算法信息的解析结果包含各密码算法对应的优先级信息的情况下,基于所述密码算法信息中的各密码算法对应的优先级信息和密码选择策略,确定密码匹配响应结果;In the case where the analysis result of the encryption algorithm information includes priority information corresponding to each encryption algorithm, based on the priority information corresponding to each encryption algorithm in the encryption algorithm information and the password selection strategy, determine the password matching response result; 在所述密码算法信息的解析结果为无法解析密码算法信息的情况下,确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。If the analysis result of the password algorithm information is that the password algorithm information cannot be parsed, it is determined that the password matching response result is not to send the password algorithm indication data to the digital key. 7.根据权利要求5所述的方法,其特征在于,所述方法还包括:7. The method according to claim 5, wherein the method further comprises: 在所述匹配指令包含匹配应用标识、且所述匹配响应数据不包含所述数字钥匙端对应的密码算法信息的情况下,基于所述匹配响应数据包含的匹配结果标识,确定所述匹配结果;When the matching instruction includes a matching application identifier and the matching response data does not include cryptographic algorithm information corresponding to the digital key terminal, determine the matching result based on the matching result identifier included in the matching response data; 在所述匹配结果为表示匹配失败的第一匹配结果的情况下,将第一类密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据;When the matching result is the first matching result indicating that the matching fails, the first type of cryptographic algorithm is used as the cryptographic algorithm to be used, and the cryptographic matching response result is determined not to send the cryptographic algorithm to the digital key terminal indicating data; 在所述匹配结果为表示匹配成功的第二匹配结果的情况下,将所述匹配应用标识对应的数字钥匙应用所支持的密码算法作为待使用的密码算法,并确定所述密码匹配响应结果为不向所述数字钥匙端发送密码算法指示数据。When the matching result is the second matching result indicating that the matching is successful, the cryptographic algorithm supported by the digital key application corresponding to the matching application identifier is used as the cryptographic algorithm to be used, and the cryptographic matching response result is determined as The cryptographic algorithm indication data is not sent to the digital key end. 8.一种数字钥匙的认证系统,其特征在于,所述系统包括数字钥匙端和解锁终端,其中:8. An authentication system for a digital key, characterized in that the system includes a digital key terminal and an unlocking terminal, wherein: 所述解锁终端,用于向所述数字钥匙端发送匹配指令;The unlocking terminal is configured to send a matching instruction to the digital key terminal; 所述数字钥匙端,用于响应于解锁终端发送的匹配指令,确定本地支持的密码算法;在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含本地支持的各密码算法对应的优先级信息;所述解锁终端,还用于根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;The digital key terminal is used to determine a locally supported cryptographic algorithm in response to a matching instruction sent by an unlocking terminal; and generate matching response data containing cryptographic algorithm information when the locally supported cryptographic algorithm meets a preset condition; The cryptographic algorithm information includes priority information corresponding to each cryptographic algorithm supported locally; the unlocking terminal is also used to determine the cryptographic matching code corresponding to the matching response data according to the analysis result of the cryptographic algorithm information and the password selection policy. response result; 所述数字钥匙端,还用于根据所述匹配响应数据对应的密码匹配响应结果确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The digital key terminal is further configured to determine the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data, and perform authentication processing based on the cryptographic algorithm to be used. 9.一种数字钥匙的认证装置,其特征在于,所述装置应用于数字钥匙端,所述装置包括:9. An authentication device for a digital key, characterized in that the device is applied to a digital key terminal, and the device includes: 响应模块,用于响应于解锁终端发送的匹配指令,确定本地支持的密码算法;A response module, configured to determine locally supported cryptographic algorithms in response to the matching instruction sent by the unlocking terminal; 第一确定模块,用于在所述本地支持的密码算法满足预设条件的情况下,生成包含密码算法信息的匹配响应数据;所述密码算法信息包含各所述密码算法对应的优先级信息;A first determination module, configured to generate matching response data including cryptographic algorithm information when the locally supported cryptographic algorithms meet preset conditions; the cryptographic algorithm information includes priority information corresponding to each of the cryptographic algorithms; 发送模块,用于向所述解锁终端返回所述匹配响应数据,所述匹配响应数据用于指示所述解锁终端根据所述密码算法信息的解析结果和密码选择策略,确定密码匹配响应结果;A sending module, configured to return the matching response data to the unlocking terminal, where the matching response data is used to instruct the unlocking terminal to determine a password matching response result according to the analysis result of the password algorithm information and the password selection strategy; 第二确定模块,用于根据所述匹配响应数据对应的密码匹配响应结果,确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The second determining module is configured to determine the cryptographic algorithm to be used according to the cryptographic matching response result corresponding to the matching response data, and perform authentication processing based on the cryptographic algorithm to be used. 10.一种数字钥匙的认证装置,其特征在于,所述装置应用于解锁终端,所述装置包括:10. An authentication device for a digital key, characterized in that the device is used to unlock a terminal, and the device includes: 发送模块,用于向数字钥匙端发送匹配指令,所述匹配指令用于指示所述数字钥匙端基于所述匹配指令返回匹配响应数据;A sending module, configured to send a matching instruction to the digital key, where the matching instruction is used to instruct the digital key to return matching response data based on the matching instruction; 第一确定模块,用于在所述匹配响应数据包含所述数字钥匙端对应的密码算法信息的情况下,根据所述密码算法信息的解析结果和密码选择策略,确定所述匹配响应数据对应的密码匹配响应结果;所述密码匹配响应结果用于供数字钥匙端确定待使用的密码算法,并基于所述待使用的密码算法进行认证处理。The first determination module is configured to determine the matching response data corresponding to the cryptographic algorithm information according to the analysis result of the cryptographic algorithm information and the password selection policy in the case that the matching response data includes the cryptographic algorithm information corresponding to the digital key terminal. A password matching response result; the password matching response result is used for the digital key terminal to determine the password algorithm to be used, and perform authentication processing based on the password algorithm to be used. 11.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至6中任一项所述的方法的步骤。11. A computer device, comprising a memory and a processor, the memory stores a computer program, wherein the processor implements the method according to any one of claims 1 to 6 when executing the computer program step.
CN202211724761.2A 2022-12-30 2022-12-30 Digital key authentication method, device, computer equipment and storage medium Active CN116012982B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211724761.2A CN116012982B (en) 2022-12-30 2022-12-30 Digital key authentication method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211724761.2A CN116012982B (en) 2022-12-30 2022-12-30 Digital key authentication method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116012982A true CN116012982A (en) 2023-04-25
CN116012982B CN116012982B (en) 2025-03-28

Family

ID=86029529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211724761.2A Active CN116012982B (en) 2022-12-30 2022-12-30 Digital key authentication method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116012982B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195810A1 (en) * 2012-10-11 2014-07-10 Openways Sas Secured method for controlling the opening of lock devices from messages implementing a symmetrical encryption
JP2018085625A (en) * 2016-11-24 2018-05-31 トヨタ自動車株式会社 Vehicle authentication system
CN114684070A (en) * 2022-03-23 2022-07-01 中汽创智科技有限公司 Safe vehicle control method and device, vehicle system and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195810A1 (en) * 2012-10-11 2014-07-10 Openways Sas Secured method for controlling the opening of lock devices from messages implementing a symmetrical encryption
JP2018085625A (en) * 2016-11-24 2018-05-31 トヨタ自動車株式会社 Vehicle authentication system
CN114684070A (en) * 2022-03-23 2022-07-01 中汽创智科技有限公司 Safe vehicle control method and device, vehicle system and storage medium

Also Published As

Publication number Publication date
CN116012982B (en) 2025-03-28

Similar Documents

Publication Publication Date Title
US20060232826A1 (en) Method, device, and system of selectively accessing data
WO2019184740A1 (en) Data encryption, decryption method and device
CN114785556B (en) Encryption communication method, device, computer equipment and storage medium
CN114244565B (en) Key distribution method, device, equipment and storage medium
CN114519360B (en) Data read-write method, login method and device of service system and computer equipment
US12126718B2 (en) Electronic device for selecting key to be used for encryption on basis of amount of information of data to be encrypted, and operation method of electronic device
CN114553556B (en) Data encryption method, device, computer equipment and storage medium
CN116012982B (en) Digital key authentication method, device, computer equipment and storage medium
CN115189929B (en) Authorization authentication method, device, computer equipment and storage medium
CN112052432A (en) Terminal device authorization method and device
CN114785677B (en) Log management method, device, computer equipment, storage medium and program product
CN114614992B (en) Signature value output and verification method, device, computer equipment and storage medium
CN117041956A (en) Communication authentication method, device, computer equipment and storage medium
CN116366289A (en) Safety supervision method and device for remote sensing data of unmanned aerial vehicle
CN115174260A (en) Data verification method, data verification device, computer, storage medium and program product
CN114448722A (en) Cross-browser login method and device, computer equipment and storage medium
CN114170014A (en) Method, apparatus, computer equipment and storage medium for processing blockchain transactions
CN114666154B (en) Device communication method, device, gateway, device, system, medium and product
CN113179161B (en) Method and device for replacing secret key, computer equipment and storage medium
CN111478770A (en) Security verification method and device, computer equipment and storage medium
WO2018017019A1 (en) Personal security device and method
CN115880816A (en) Unlocking method and device of intelligent lock, computer equipment and storage medium
CN114782040A (en) Method and device for generating offline payment code, computer equipment and storage medium
CN116938535A (en) Identification method and device of common equipment and computer equipment
CN117149739A (en) Data transfer verification method, device, apparatus, storage medium and program product

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
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Zhao Yang

Inventor after: Wang Bo

Inventor before: Zhao Yang

GR01 Patent grant
GR01 Patent grant