An offline password authentication method, generation method, device end and server end

By carrying anti-replay attack verification information in the offline password and using timestamp or counter verification, combined with MAC and symmetric encryption algorithms, the problem of replay attacks in offline password transmission and use in the existing technology is solved, and security and safety are improved. Use security.

CN115460598BActive Publication Date: 2024-08-27CHINA MOBILE M2M +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110632833.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-07
Publication Date
2024-08-27
Estimated Expiration
2041-06-07

AI Technical Summary

Technical Problem

The existing technology fails to effectively prevent malicious replay attacks in the transmission and use of offline passwords, and there are security risks.

Method used

Offline passwords carry anti-replay attack verification information and are verified through timestamps or counters. Double encryption is performed by combining MAC and non-aligned symmetric encryption algorithms to ensure the security, integrity and confidentiality of passwords.

Benefits of technology

It effectively avoids replay attacks by criminals, improves the security and use of offline passwords, and ensures device-side security and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115460598B
    Figure CN115460598B
Patent Text Reader

Abstract

The present application provides an offline password authentication method, generation method, device end and service end, wherein the offline password authentication method applied to the device end includes: after receiving the offline password input by the user, obtaining the authorization information and anti-replay attack verification information in the offline password, wherein the anti-replay attack verification information includes: the value of the timestamp or the first counter; performing replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result; when the first verification result is a non-replay attack, controlling the device end according to the authorization information. By carrying the anti-replay attack verification information in the offline password and performing replay attack verification through the timestamp or counter, it is helpful to avoid replay attacks carried out by lawbreakers for illegal use of the device end, and ensure the security of offline password use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information security, and in particular to an offline password authentication method, generation method, device end and server end. Background Art

[0002] Offline password is an offline authentication and authorization technology, which can be used in scenarios such as smart locks, rental equipment (shared equipment), unmanned ticket checking, and offline recharge. In actual applications, due to poor network or cost considerations of manufacturers, the device needs to complete the identity and authorization of the user without being able to connect to the Internet. The general usage mode is: the user applies for an offline password (a decimal string of several digits) from the cloud through a mobile phone, and then manually enters it through the numeric keypad on the device. After the device verifies, the corresponding usage rights are opened. However, the offline password carries authorization information. In order to ensure that these key information is not tampered with, or can be identified after being tampered with, the integrity of the offline password needs to be protected. The various encryption schemes used in the existing technology cannot guarantee the integrity of the offline password, and the offline password generally has a limit on the use time or number of times. It is necessary to ensure that expired, timed out, and passwords that exceed the number of times cannot pass the verification. Malicious replay attacks need to be considered, and the existing encryption methods have not yet achieved this. Summary of the invention

[0003] The technical purpose to be achieved by the embodiments of the present application is to provide an offline password authentication method, generation method, device end and server end, so as to solve the problem that malicious replay attacks are not considered in the current transmission and use of offline passwords, resulting in security risks.

[0004] In order to solve the above technical problems, the embodiment of the present application provides an offline password authentication method, which is applied to a device side, including:

[0005] After receiving the offline password input by the user, obtaining the authorization information and the anti-replay attack verification information in the offline password, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter;

[0006] Perform replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result;

[0007] When the first verification result is a non-replay attack, the device end is controlled according to the authorization information.

[0008] Preferably, in the offline password authentication method as described above, the step of performing replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result includes:

[0009] When the anti-replay attack verification information is a timestamp, obtain the valid duration in the authorization information and the local time on the device.

[0010] When the local time is greater than the timestamp, and the time difference with the timestamp is less than or equal to the valid duration, it is determined that the first verification result is a non-replay attack.

[0011] Specifically, the offline password authentication method described above performs replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result, including:

[0012] When the anti-replay attack verification information is the value of the first counter, obtaining the value of the second counter stored on the device end;

[0013] A first verification result is obtained according to the value of the first counter and the value of the second counter.

[0014] Preferably, in the offline password authentication method as described above, the step of obtaining the first verification result according to the value of the first counter and the value of the second counter comprises:

[0015] Obtaining a numerical difference between a value of the first counter and a value of the second counter;

[0016] When the numerical difference is within a preset value range, it is determined that the first verification result is a non-replay attack.

[0017] Specifically, in the offline password authentication method described above, the preset value range includes at least one of the following:

[0018] greater than zero and less than a first preset positive value;

[0019] Less than zero and greater than a first preset negative value;

[0020] is smaller than the second preset negative value and greater than or equal to the third preset negative value, wherein the absolute value of the third preset negative value is the counting upper limit value of the second counter.

[0021] Furthermore, the offline password authentication method as described above further includes:

[0022] After determining that the first verification result is not a replay attack, if the numerical difference is greater than zero, the value of the second counter is updated according to the value of the first counter.

[0023] Preferably, in the offline password authentication method as described above, the step of obtaining the authorization information and the anti-replay attack verification information in the offline password includes:

[0024] Convert the offline password entered by the user into a plaintext data frame;

[0025] Decrypt and verify the plaintext data frame according to the preset authentication encryption algorithm, and obtain the decryption verification result and the decrypted plaintext data frame;

[0026] When the decryption verification result is passed, the decrypted plaintext data frame is parsed into authorization information and anti-replay attack verification information.

[0027] Specifically, in the offline password authentication method described above, the step of converting the offline password input by the user into a plaintext data frame includes:

[0028] Convert offline password to unsigned integer;

[0029] Convert an unsigned integer to a plaintext data frame.

[0030] Preferably, the offline password authentication method described above decrypts and verifies the plaintext data frame according to a preset authentication encryption algorithm, and obtains the decryption verification result and the decrypted plaintext data frame, including the following steps:

[0031] Decrypting the plaintext data frame according to a preset non-aligned symmetric encryption algorithm to obtain a decrypted plaintext data frame;

[0032] The decrypted plaintext data frame is verified by the message authentication code (MAC) according to the unique identification code and subkey of the device end, and the decryption verification result is obtained.

[0033] Preferably, the offline password authentication method as described above further includes:

[0034] After receiving the offline password input by the user, obtaining a pre-stored used offline password usage table, wherein the used offline password usage table records a preset number of used passwords;

[0035] When the offline password is determined to be a used password based on the offline password and the used offline password usage table, an invalid password message is generated and a prompt is given

[0036] When it is determined that the offline password is an unused password according to the offline password and the used offline password usage table, the step of obtaining authorization information and anti-replay attack verification information in the offline password is performed.

[0037] Specifically, in the offline password authentication method as described above, when the first verification result is a non-replay attack, the step of controlling the device end according to the authorization information includes:

[0038] Determine the authorization result according to the authorization information;

[0039] When the authorization result is valid, the corresponding control authority is opened within the valid range according to the valid range information in the authorization information;

[0040] When the authorization result is invalid, an invalid authorization message is generated and prompted.

[0041] Another preferred embodiment of the present application further provides a device end, including:

[0042] The acquisition module is used to acquire the authorization information and the anti-replay attack verification information in the offline password after receiving the offline password input by the user, wherein the anti-replay attack verification information includes: a timestamp or a value of the first counter;

[0043] A first processing module, configured to perform a replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result;

[0044] The second processing module is used to control the device end according to the authorization information when the first verification result is a non-replay attack.

[0045] Preferably, in the device end as described above, the first processing module includes:

[0046] The first processing submodule is used to obtain the valid time in the authorization information and the local time of the device when the anti-replay attack verification information is a timestamp;

[0047] The second processing submodule is used to determine that the first verification result is a non-replay attack when the local time is greater than the timestamp and the time difference with the timestamp is less than or equal to the valid time length.

[0048] Specifically, in the device end as described above, the first processing module includes:

[0049] A third processing submodule, configured to obtain a value of a second counter stored on the device when the anti-replay attack verification information is the value of the first counter;

[0050] The fourth processing submodule is used to obtain a first verification result according to the value of the first counter and the value of the second counter.

[0051] Preferably, in the device end as described above, the fourth processing submodule includes:

[0052] A first processing unit, configured to obtain a numerical difference between a value of the first counter and a value of the second counter;

[0053] The second processing unit is used to determine that the first verification result is a non-replay attack when the numerical difference is within a preset value range.

[0054] Specifically, in the device as described above, the preset value range includes at least one of the following:

[0055] greater than zero and less than a first preset positive value;

[0056] Less than zero and greater than a first preset negative value;

[0057] is smaller than the second preset negative value and greater than or equal to the third preset negative value, wherein the absolute value of the third preset negative value is the counting upper limit value of the second counter.

[0058] Furthermore, the device side as described above further includes:

[0059] The third processing unit is used to update the value of the second counter according to the value of the first counter if the numerical difference is greater than zero after determining that the first verification result is a non-replay attack.

[0060] Preferably, in the device as described above, the acquisition module includes:

[0061] A fifth processing submodule, used for converting the offline password input by the user into a plain text data frame;

[0062] The sixth processing submodule is used to decrypt and verify the plaintext data frame according to a preset authentication encryption algorithm, and obtain a decryption verification result and a decrypted plaintext data frame;

[0063] The seventh processing submodule is used to parse the decrypted plaintext data frame into authorization information and anti-replay attack verification information when the decryption verification result is passed.

[0064] Specifically, as described above, the fifth processing submodule of the device includes:

[0065] A first conversion unit, used for converting the offline password into an unsigned integer;

[0066] The second conversion unit is used to convert the unsigned integer into a plain text data frame.

[0067] Preferably, in the device end as described above, the sixth processing module includes:

[0068] A fourth processing unit, configured to decrypt the plaintext data frame according to a preset non-aligned symmetric encryption algorithm to obtain a decrypted plaintext data frame;

[0069] The fifth processing unit is used to perform MAC verification on the decrypted plaintext data frame according to the unique identification code and subkey of the device end, and obtain a decryption verification result.

[0070] Preferably, the device as described above further includes:

[0071] A fifth processing module, configured to obtain a pre-stored used offline password usage table after receiving the offline password input by the user, wherein the used offline password usage table records a preset number of used passwords;

[0072] The sixth processing module is used to generate a password invalid message and prompt when the offline password is determined to be a used password according to the offline password and the used offline password usage table.

[0073] The seventh processing module is used to determine that the offline password is an unused password according to the offline password and the used offline password usage table.

[0074] Furthermore, the device side as described above further includes:

[0075] Specifically, in the device end as described above, the second processing module includes:

[0076] An eighth processing submodule, used to determine the authorization result according to the authorization information;

[0077] The ninth processing submodule is used to open the corresponding control authority within the valid range according to the valid range information in the authorization information when the authorization result is valid;

[0078] The tenth processing submodule is used to generate authorization invalid information and prompt when the authorization result is invalid.

[0079] Another preferred embodiment of the present application further provides a method for generating an offline password, which is applied to a server and includes:

[0080] After receiving the password request information about the device end sent by the user end, obtaining the anti-replay attack verification information of the corresponding device end according to the password request information, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter about the device end;

[0081] Based on the anti-replay attack verification information and the authorization information in the password request information, an offline password is generated and sent to the user end.

[0082] Preferably, in the above-mentioned offline password generation method, the step of obtaining the anti-replay attack verification information of the corresponding device end according to the password request information includes:

[0083] When the preset anti-replay attack verification information is a timestamp, the timestamp is determined according to the request time in the password request information;

[0084] When the preset anti-replay attack verification information is the value of the first counter, obtaining the historical value of the first counter when the offline password of the corresponding device was generated last time;

[0085] The value of the first counter in the current anti-replay attack verification information is obtained according to the historical value of the first counter.

[0086] Specifically, the method for generating an offline password as described above, according to the anti-replay attack verification information and the authorization information in the password request information, the steps of generating an offline password include:

[0087] Generate a plaintext data frame according to the anti-replay attack verification information and the authorization information in the password request information;

[0088] Encrypt the plaintext data frame according to a preset authentication encryption algorithm to obtain an encrypted plaintext data frame;

[0089] The encrypted plaintext data frame is converted into an offline password, where the offline password is a digital string with a preset length.

[0090] Furthermore, in the above-mentioned method for generating an offline password, the steps of encrypting the plaintext data frame according to a preset authentication encryption algorithm to obtain the encrypted plaintext data frame include:

[0091] Perform MAC authentication encryption on the plaintext data frame according to the unique identification code of the device and the root key corresponding to the device pre-stored on the server;

[0092] The authenticated encrypted plaintext data frame is encrypted again according to a non-aligned symmetric encryption algorithm to obtain an encrypted plaintext data frame.

[0093] Another preferred embodiment of the present application further provides a server, including:

[0094] A third processing module is used to obtain anti-replay attack verification information of the corresponding device end according to the password request information after receiving the password request information about the device end sent by the user end, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter about the device end;

[0095] The fourth processing module is used to generate an offline password according to the anti-replay attack verification information and the authorization information in the password request information, and send the password to the user end.

[0096] Preferably, in the above-mentioned method for generating an offline password, the third processing module comprises:

[0097] An eleventh processing submodule, for determining the timestamp according to the request time in the password request information when the preset anti-replay attack verification information is a timestamp;

[0098] A twelfth processing submodule is used to obtain the historical value of the first counter when the offline password of the corresponding device end was generated last time when the preset anti-replay attack verification information is the value of the first counter;

[0099] The thirteenth processing submodule is used to obtain the value of the first counter in the current anti-replay attack verification information according to the historical value of the first counter.

[0100] Specifically, in the above-mentioned offline password generation method, the fourth processing module includes:

[0101] A fourteenth processing submodule, used to generate a plaintext data frame according to the anti-replay attack verification information and the authorization information in the password request information;

[0102] A fifteenth processing submodule is used to encrypt the plaintext data frame according to a preset authentication encryption algorithm to obtain an encrypted plaintext data frame;

[0103] The sixteenth processing submodule is used to convert the encrypted plaintext data frame into an offline password, where the offline password is a digital string with a preset length.

[0104] Furthermore, in the above-mentioned offline password generation method, the steps of the fifteenth processing submodule include:

[0105] A sixth processing unit, configured to perform MAC authentication encryption on the plaintext data frame according to the unique identification code of the device end and the root key corresponding to the device end pre-stored in the server end;

[0106] The seventh processing unit is used to perform secondary encryption on the plaintext data frame after authentication encryption according to a non-aligned symmetric encryption algorithm to obtain an encrypted plaintext data frame.

[0107] Another preferred embodiment of the present application further provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the offline password authentication method described above is implemented, or the offline password generation method described above is implemented.

[0108] Compared with the prior art, the offline password authentication method, generation method, device end and server end provided in the embodiment of the present application have at least the following beneficial effects:

[0109] By carrying anti-replay attack verification information in the offline password and performing replay attack verification through timestamps or counters, it is helpful to avoid replay attacks carried out by criminals for illegal use of the device end and ensure the security of offline password use. Double encryption is also performed through MAC and non-aligned symmetric encryption algorithms to further improve the security, integrity and confidentiality of offline passwords. BRIEF DESCRIPTION OF THE DRAWINGS

[0110] Figure 1 This is one of the flowcharts of the offline password authentication method of this application;

[0111] Figure 2 This is the second flowchart of the offline password authentication method of this application;

[0112] Figure 3 This is the third flow chart of the offline password authentication method of this application;

[0113] Figure 4 This is the fourth flowchart of the offline password authentication method of this application;

[0114] Figure 5 This is the fifth flow chart of the offline password authentication method of this application;

[0115] Figure 6 This is the sixth flow chart of the offline password authentication method of this application;

[0116] Figure 7 This is the seventh flow chart of the offline password authentication method of this application;

[0117] Figure 8 This is the eighth flow chart of the offline password authentication method of this application;

[0118] Fig. 9 This is the ninth flowchart of the offline password authentication method of this application;

[0119] Fig.10 This is a schematic diagram of the device side structure of this application;

[0120] Fig.11 This is one of the flowcharts of the offline password generation method of this application;

[0121] Fig.12 This is the second flow chart of the method for generating an offline password of the present application;

[0122] Fig.13 This is the third flow chart of the method for generating an offline password of the present application;

[0123] Fig.14 This is a schematic diagram of the structure of the server side of this application. DETAILED DESCRIPTION

[0124] In order to make the technical problems, technical solutions and advantages to be solved by the application clearer, the following will be described in detail in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help fully understand the embodiments of the application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the application. In addition, for clarity and brevity, the description of known functions and structures has been omitted.

[0125] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0126] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0127] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0128] In the embodiments provided in this application, it should be understood that "B corresponding to A" means that B is associated with A and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, but B can also be determined according to A and / or other information.

[0129] See also Figure 1 A preferred embodiment of the present application provides an offline password authentication method, which is applied to a device, including:

[0130] Step S101, after receiving the offline password input by the user, obtaining the authorization information and anti-replay attack verification information in the offline password, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter;

[0131] Step S101, performing replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result;

[0132] Step S102: When the first verification result is a non-replay attack, the device end is controlled according to the authorization information.

[0133] In a specific embodiment of the present application, a method for authenticating an offline password applied to a device side is provided, wherein after receiving the offline password input by the user through keystrokes or touch, the device side will obtain the authorization information and anti-replay attack verification information carried in the offline password, wherein the authorization information is used to characterize the authorization of the owner of the device side to the user, and the anti-replay attack verification information is used to determine whether the password is a replay attack performed by criminals for illegal use of the device side, preferably based on different selectable timestamps of the authorization information or the value of a preset first counter as the anti-replay attack verification information; then, the offline password is replayed according to the obtained anti-replay attack verification information, and a first verification result is obtained; if the first verification result is not a replay attack, the device side will be controlled according to the authorization information.

[0134] To sum up, in this embodiment, by carrying anti-replay attack verification information in the offline password and performing replay attack verification through a timestamp or a counter, it is helpful to avoid replay attacks carried out by criminals for illegal use of the device end and ensure the security of the use of the offline password.

[0135] Since the offline password can be input unidirectionally by the user, it can be applied to various offline or semi-offline scenarios that require authorization and authentication, including but not limited to smart locks, equipment rental or sharing, unmanned ticket checking, offline recharge, etc., to ensure offline use of the device end, and help improve the security of offline passwords and device end use.

[0136] Optionally, the control of the device end is different according to the type of the device end, authorization information and other conditions. For example, when the device end is a smart lock, the device end is controlled to unlock; when the device end is an electric device, the device end is controlled to start, etc.

[0137] See also Figure 2 Preferably, the offline password authentication method as described above performs replay attack verification on the offline password according to the anti-replay attack verification information, and the step of obtaining the first verification result includes:

[0138] Step S201, when the anti-replay attack verification information is a timestamp, obtain the valid time in the authorization information and the local time of the device;

[0139] Step S202: When the local time is greater than the timestamp and the time difference with the timestamp is less than or equal to the valid time, it is determined that the first verification result is a non-replay attack.

[0140] In a specific embodiment of the present application, when replay attack verification is performed on an offline password according to anti-replay attack verification information, if the anti-replay attack verification information is a timestamp, the effective duration in the authorization information and the local time of the device are obtained, and the local time is compared with the timestamp. If the local time is greater than the timestamp, and the time difference with the timestamp is less than or equal to the effective duration, it is determined that the password is within the validity period, and at this time, the first verification result can be determined to be a non-replay attack; if the current time is less than the timestamp, it means that the time to use the password has not yet arrived, so the first verification result is determined to be verification failure; if the current time is greater than the timestamp, and the time difference with the timestamp is greater than the effective duration, it is determined that the time to use the password has exceeded the current time, so the first verification result is determined to be verification failure. That is, in this embodiment, anti-replay attack verification is performed by time, which can avoid the situation where the password is used again to control the device after the password is used for a period of time, thereby ensuring the security of the password and the device.

[0141] See also Figure 3Specifically, in the offline password authentication method as described above, the step of performing replay attack verification on the offline password according to the anti-replay attack verification information to obtain the first verification result includes:

[0142] Step S301, when the anti-replay attack verification information is the value of the first counter, obtaining the value of the second counter stored on the device end;

[0143] Step S302: Obtain a first verification result according to the value of the first counter and the value of the second counter.

[0144] In another preferred embodiment of the present application, when replay attack verification is performed on the offline password according to the anti-replay attack verification information, if the anti-replay attack verification information is the value of the first counter, it means that the authorization information does not include absolute time parameters at this time, but only includes relative parameters such as the number of valid times. At this time, the value of the second counter pre-stored in the device end is obtained, that is, the device end will record the number of times the password is used or the number of times the password has been used during use. Therefore, when performing replay attack verification, the value of the first counter is compared with the value of the second counter to determine whether the current offline password is a replay attack, and obtain the first verification result. By increasing the counter to determine whether the current password is a replay attack, the scope of use of the password can be reduced, and the security of the password and the device end can be further guaranteed.

[0145] See also Figure 4 Preferably, in the offline password authentication method as described above, the step of obtaining the first verification result according to the value of the first counter and the value of the second counter comprises:

[0146] Step S401, obtaining a numerical difference between a value of a first counter and a value of a second counter;

[0147] Step S402: When the numerical difference is within a preset value range, it is determined that the first verification result is a non-replay attack.

[0148] In a specific embodiment of the present application, when the first verification result is obtained according to the value of the first counter and the value of the second counter, the numerical difference between the two is first obtained. In this embodiment, the numerical difference is preferably the difference obtained by subtracting the value of the second counter from the value of the first counter, and then the numerical difference is compared with a preset value range that is predetermined and stored. When the numerical difference is within the preset value range, it can be determined that the first verification result is a non-replay attack; at this time, the device end can be controlled according to the offline password. If the numerical difference is outside the preset value range, it can be determined that the offline password has been used or has not yet been used. At this time, the device end is not controlled, which is conducive to ensuring the security of the device end.

[0149] Specifically, in the offline password authentication method described above, the preset value range includes at least one of the following:

[0150] greater than zero and less than a first preset positive value;

[0151] Less than zero and greater than a first preset negative value;

[0152] is smaller than the second preset negative value and greater than or equal to the third preset negative value, wherein the absolute value of the third preset negative value is the counting upper limit value of the second counter.

[0153] In a specific embodiment of the present application, the preset value range is set to be greater than zero and less than the first preset positive value, wherein the first preset positive value is preferably 2, that is, the numerical difference is 1, so that the offline password can only be normally controlled by inputting the device end in a sequentially increasing manner, which is conducive to preventing the device end from being replayed. Optionally, since it is difficult to synchronize the server and the device, and there is a situation in which the offline password is not used after being generated during actual use, the real-time numerical difference between the server and the device may be greater than 1. Therefore, in order to avoid the normal use of the offline password applied later and to prevent criminals from exploiting loopholes, the first preset positive value can be set to 3, 4 or other positive values ​​according to actual needs or experimental calibration.

[0154] In another specific embodiment of the present application, on the basis of setting the preset value range to be greater than zero and less than the first preset positive value, the preset value range is also set to be less than zero and greater than the first preset negative value, wherein the first preset negative value can be set to -2, -3 or other negative values ​​according to actual needs or experimental calibration, so as to avoid the situation where the value of the first counter is less than the value of the second counter due to the generation of multiple offline passwords at one time or in a short period of time, and due to the uncertain usage time of each offline password. At this time, the setting of the preset value range can ensure that the offline passwords generated in this batch can be used, thereby ensuring the user experience.

[0155] In another specific embodiment of the present application, since the amount of information that an offline password can carry is limited, when the password is frequently used, the counter (including the first counter and the second counter) needs to be used cyclically, that is, when the value of the counter reaches the upper limit of the count, it starts counting again from zero. At this time, there is a situation where the received offline password is a password generated later, but the value of the first counter is less than the value of the second counter. Therefore, on the basis of the above, the preset value range is also set to be less than the second preset negative value and greater than or equal to the third preset negative value, wherein the absolute value of the third preset negative value is the upper limit of the count of the second counter, and the second preset negative value and the third preset negative value are separated by a preset number of values, so as to ensure cyclic use while avoiding a large gap, resulting in the problem of being unable to distinguish the generation time of the password corresponding to the value of the offline password and the second counter.

[0156] Furthermore, the offline password authentication method as described above further includes:

[0157] After determining that the first verification result is not a replay attack, if the numerical difference is greater than zero, the value of the second counter is updated according to the value of the first counter.

[0158] In another embodiment of the present application, when it is determined that the first verification result is a non-replay attack, that is, the current offline password is determined to be a valid password, if the value difference is greater than zero, it indicates that the generation time of the current offline password is later than that of the last used offline password, and the value of the second counter is updated according to the value of the first counter, even if the value of the second counter is equal to the value of the first counter, which is conducive to ensuring the real-time performance of the device. When the value difference is less than zero, it is determined that the generation time of the current offline password is earlier than that of the last used offline password, and in order to ensure the real-time performance of the device, the value of the second counter is not updated.

[0159] See also Figure 5 Preferably, in the offline password authentication method as described above, the step of obtaining the authorization information and the anti-replay attack verification information in the offline password includes:

[0160] Step S501, converting the offline password input by the user into a plaintext data frame;

[0161] Step S502, decrypt and verify the plaintext data frame according to a preset authentication encryption algorithm, and obtain a decryption verification result and a decrypted plaintext data frame;

[0162] Step S503: When the decryption verification result is passed, the decrypted plaintext data frame is parsed into authorization information and anti-replay attack verification information.

[0163] In a preferred embodiment of the present application, when obtaining the authorization information and anti-replay attack verification information in the offline password, since the offline password entered by the user is generally a decimal digit string, the authorization information and anti-replay attack verification information carried therein cannot be directly obtained, so the offline password needs to be converted into a plaintext data frame, preferably a binary code stream. To ensure the security of the data, the plaintext data frame will be encrypted when it is produced. Therefore, after obtaining the plaintext data frame, the plaintext data frame needs to be decrypted to obtain the decrypted plaintext data frame. In this embodiment, to further ensure the security and confidentiality of the plaintext data frame, an authenticated encryption algorithm is used to encrypt the plaintext data frame. Therefore, when decrypting, the plaintext data frame needs to be decrypted and verified according to the authenticated encryption algorithm, and the decryption verification result and the decrypted plaintext data frame are obtained; if the decryption verification result obtained is passed, it is determined that the decrypted plaintext data frame is a complete data frame. At this time, the plaintext data frame can be parsed to obtain the above-mentioned authorization information and anti-replay attack verification information. If the decryption verification result is failed, it is determined that the decrypted plaintext data frame is an incomplete data frame. At this time, even if the plaintext data frame is parsed, the integrity and correctness of the obtained authorization information and anti-replay attack verification information cannot be determined. Therefore, it is necessary to inform the user of the verification failure through sound, light, electricity, text, etc., so that the user can regain the offline password to use the device.

[0164] Optionally, the encrypted plaintext data frame includes three parts: a frame header, a payload and a checksum. The frame header part may include frame control information such as frame type and version number; the payload part may include authorization information such as valid time and valid times and anti-replay attack verification information such as timestamp or counter; the checksum part is used to ensure the integrity and authenticity of the data frame.

[0165] The following is an example of the bit distribution of plaintext data frames for different offline ciphers:

[0166] First example: 26 bits correspond to an 8-digit string

[0167] Frame header: 2 bits; Payload: 15 bits; Message verification code: 10 bits.

[0168] The load may be an 11-bit counter and a 4-bit valid number of times (limited password);

[0169] Alternatively, a 12-bit timestamp and a 3-bit validity period (time-limited password).

[0170] Second example: 33 bits correspond to a 10-digit string

[0171] Frame header: 4 bits; Payload: 19 bits; Message verification code: 12 bits.

[0172] The payload may be a 12-bit counter and a 7-bit valid number of times (limited password);

[0173] Or, a 9-bit counter, a 5-bit start time, and a 5-bit validity time (cyclic password);

[0174] Or, 13-bit starting date and 6-bit valid days (time-limited password);

[0175] Alternatively, a 15-bit starting date and a 4-bit time period number (time-limited password).

[0176] Example 3: 39 bits correspond to a 12-digit string

[0177] Frame header: 2 bits; Payload: 23 bits; Message verification code: 14 bits.

[0178] The payload may be an 11-bit counter and a 7-bit valid number of times (limited password);

[0179] Or, an 11-bit counter, a 5-bit start time, and a 5-bit validity time (cyclic password);

[0180] Or, 14-bit starting date and 9-bit valid days (time-limited password);

[0181] Alternatively, 11 bits for the start date, 5 bits for the start time, and 5 bits for the validity period (time-limited password).

[0182] See also Figure 6 Specifically, in the offline password authentication method as described above, the step of converting the offline password input by the user into a plain text data frame includes:

[0183] Step S601, converting the offline password into an unsigned integer;

[0184] Step S602: convert the unsigned integer into a plaintext data frame.

[0185] In a specific embodiment of the present application, when converting an offline password into a plaintext data frame, since the offline password in this embodiment is preferably a decimal digit string and the plaintext data frame is a binary code stream, the offline password is first converted into an unsigned integer and then the unsigned integer is converted into a plaintext data frame, which is beneficial to ensure the smooth conversion of the offline password and the plaintext data frame, and is also beneficial to avoid the computing power consumed by the direct conversion of the offline password and the plaintext data frame.

[0186] See also Figure 7 Preferably, the offline password authentication method described above decrypts and verifies the plaintext data frame according to a preset authentication encryption algorithm, and obtains the decryption verification result and the decrypted plaintext data frame, including the following steps:

[0187] Step S701, decrypting the plaintext data frame according to a preset non-aligned symmetric encryption algorithm to obtain a decrypted plaintext data frame;

[0188] Step S702, perform MAC verification on the decrypted plaintext data frame according to the unique identification code and subkey of the device end, and obtain the decryption verification result.

[0189] In another preferred embodiment of the present application, when the plaintext data frame is decrypted and verified according to a preset authentication encryption algorithm, the plaintext data frame is first decrypted according to a preset non-aligned symmetric encryption algorithm to obtain a decrypted plaintext data frame, wherein the non-aligned symmetric encryption algorithm is used to decrypt or encrypt the plaintext data frame, which is beneficial to avoid the waste of bits when the number of bits of the binary code stream is aligned, and is beneficial to include more information in a limited data frame, or to carry limited information in a data frame with a smaller number of bits, thereby reducing the number of digits in the offline password and reducing the difficulty of user input.

[0190] After decryption, the decrypted plaintext data frame is verified by MAC according to the unique identification code and subkey of the device, that is, the MAC based on the key dispersion algorithm is used for verification. That is, a set of shared keys is pre-set on the server and the device, which can reduce the key storage pressure on the server. At the same time, the device can decrypt according to its own unique identification code and subkey, which is also conducive to ensuring the security of the device decryption.

[0191] Optionally, MAC includes but is not limited to: Hashed Message Authentication Code (HMAC) and Cipher-based Message Authentication Code (CMAC).

[0192] See also Figure 8 Preferably, the offline password authentication method as described above further includes:

[0193] Step S801, after receiving the offline password input by the user, obtaining a pre-stored used offline password usage table, wherein the used offline password usage table records a preset number of used passwords;

[0194] Step S802, when the offline password is determined to be a used password according to the offline password and the used offline password usage table, an invalid password message is generated and a prompt is given;

[0195] Step S803, when it is determined that the offline password is an unused password according to the offline password and the used offline password usage table, the step of obtaining authorization information and anti-replay attack verification information in the offline password is executed.

[0196] In a specific embodiment of the present application, the device has a password storage function, which can store a preset number of input or used passwords, so that after receiving the offline password input by the user, the pre-stored used offline password usage table is obtained, and the received offline password is compared with the used passwords in the used offline password usage table. When it is determined that the offline password is a used password, the password cannot be used again to control the device, and an invalid password message is generated and a prompt is given to facilitate the user to change the password;

[0197] When it is determined that the offline password is an unused password, it can be temporarily determined that the offline password is available, and the subsequent steps of obtaining the authorization information and the anti-replay attack verification information in the offline password can be performed. The used offline password usage table can be used to filter the used passwords, which is helpful to avoid the security problem caused by the repeated use of the same offline password when the value of the first counter in the password is used cyclically.

[0198] Optionally, after receiving the offline password input by the user, a pre-stored invalid password table can also be obtained, in which a preset number of expired passwords are recorded; when the offline password is determined to be an expired password based on the offline password and the invalid password table, invalid password information is generated and a prompt is given; when the offline password is determined to be a valid password based on the offline password and the invalid password table, the step of obtaining the authorization information and anti-replay attack verification information in the offline password is executed.

[0199] See also Fig. 9 Specifically, in the offline password authentication method as described above, when the first verification result is a non-replay attack, the step of controlling the device end according to the authorization information includes:

[0200] Step S901, determining the authorization result according to the authorization information;

[0201] Step S902: when the authorization result is valid, the corresponding control authority is opened within the valid range according to the valid range information in the authorization information;

[0202] Step S903: When the authorization result is invalid, generate authorization invalid information and prompt.

[0203] In another embodiment of the present application, when the device end is controlled according to the authorization information, the authorization result of the user is determined according to the authorization information, for example, the authorization result is determined in the case of the remaining valid times, the remaining valid time, etc.

[0204] The authorization result is valid. At this time, the corresponding control authority is opened within the valid range according to the valid range information in the authorization information. Taking the charging device as an example, the valid range information in the authorization information is the charging time. At this time, the charging is started and the time of maintaining the charging state is the charging time.

[0205] When the authorization result is invalid, it is determined that the number of authorizations or the validity period has been exceeded, and an authorization invalidity message is generated and prompted to facilitate the user to obtain authorization again.

[0206] See also Fig.10 Another preferred embodiment of the present application further provides a device end, including:

[0207] The acquisition module 1001 is used to acquire the authorization information and the anti-replay attack verification information in the offline password after receiving the offline password input by the user, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter;

[0208] The first processing module 1002 is used to perform replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result;

[0209] The second processing module 1003 is used to control the device end according to the authorization information when the first verification result is a non-replay attack.

[0210] Preferably, in the device end as described above, the first processing module includes:

[0211] The first processing submodule is used to obtain the valid time in the authorization information and the local time of the device when the anti-replay attack verification information is a timestamp;

[0212] The second processing submodule is used to determine that the first verification result is a non-replay attack when the local time is greater than the timestamp and the time difference with the timestamp is less than or equal to the valid time length.

[0213] Specifically, in the device end as described above, the first processing module includes:

[0214] A third processing submodule, configured to obtain a value of a second counter stored on the device when the anti-replay attack verification information is the value of the first counter;

[0215] The fourth processing submodule is used to obtain a first verification result according to the value of the first counter and the value of the second counter.

[0216] Preferably, in the device end as described above, the fourth processing submodule includes:

[0217] A first processing unit, configured to obtain a numerical difference between a value of the first counter and a value of the second counter;

[0218] The second processing unit is used to determine that the first verification result is a non-replay attack when the numerical difference is within a preset value range.

[0219] Specifically, in the device as described above, the preset value range includes at least one of the following:

[0220] greater than zero and less than a first preset positive value;

[0221] Less than zero and greater than a first preset negative value;

[0222] is smaller than the second preset negative value and greater than or equal to the third preset negative value, wherein the absolute value of the third preset negative value is the counting upper limit value of the second counter.

[0223] Furthermore, the device side as described above further includes:

[0224] The third processing unit is used to update the value of the second counter according to the value of the first counter if the numerical difference is greater than zero after determining that the first verification result is a non-replay attack.

[0225] Preferably, in the device as described above, the acquisition module includes:

[0226] A fifth processing submodule, used for converting the offline password input by the user into a plain text data frame;

[0227] The sixth processing submodule is used to decrypt and verify the plaintext data frame according to a preset authentication encryption algorithm, and obtain a decryption verification result and a decrypted plaintext data frame;

[0228] The seventh processing submodule is used to parse the decrypted plaintext data frame into authorization information and anti-replay attack verification information when the decryption verification result is passed.

[0229] Specifically, as described above, the fifth processing submodule of the device includes:

[0230] A first conversion unit, used for converting the offline password into an unsigned integer;

[0231] The second conversion unit is used to convert the unsigned integer into a plain text data frame.

[0232] Preferably, in the device end as described above, the sixth processing module includes:

[0233] A fourth processing unit, configured to decrypt the plaintext data frame according to a preset non-aligned symmetric encryption algorithm to obtain a decrypted plaintext data frame;

[0234] The fifth processing unit is used to perform MAC verification on the decrypted plaintext data frame according to the unique identification code and subkey of the device end, and obtain a decryption verification result.

[0235] Preferably, the device as described above further includes:

[0236] A fifth processing module, configured to obtain a pre-stored used offline password usage table after receiving the offline password input by the user, wherein the used offline password usage table records a preset number of used passwords;

[0237] The sixth processing module is used to generate a password invalid message and prompt when the offline password is determined to be a used password according to the offline password and the used offline password usage table.

[0238] The seventh processing module is used to determine that the offline password is an unused password according to the offline password and the used offline password usage table.

[0239] Furthermore, the device side as described above further includes:

[0240] Specifically, in the device end as described above, the second processing module includes:

[0241] An eighth processing submodule, used to determine the authorization result according to the authorization information;

[0242] The ninth processing submodule is used to open the corresponding control authority within the valid range according to the valid range information in the authorization information when the authorization result is valid;

[0243] The tenth processing submodule is used to generate authorization invalid information and prompt when the authorization result is invalid.

[0244] The device-side embodiment of the present application is a device-side corresponding to the embodiment of the above-mentioned offline password authentication method. All implementation means in the above-mentioned offline password authentication method embodiment are applicable to the embodiment of the device-side and can achieve the same technical effect.

[0245] See also Fig.11 In another preferred embodiment of the present application, a method for generating an offline password is provided, which is applied to a server and includes:

[0246] Step S1101, after receiving the password request information about the device end sent by the user end, obtaining the anti-replay attack verification information of the corresponding device end according to the password request information, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter about the device end;

[0247] Step S1102: Generate an offline password based on the anti-replay attack verification information and the authorization information in the password request information, and send it to the user end.

[0248] In a specific embodiment of the present application, a method for generating an offline password applied to a server is also provided, wherein the server is connected to a user end in communication, and upon receiving password request information about a device end sent by the user end, the server end obtains anti-replay attack verification information of the corresponding device end according to the password request information, including: a timestamp in absolute time or the number of times the password about the device end is generated, i.e., the value of a first counter; and then generates an offline password according to the anti-replay attack verification information and the authorization information in the password request information, and sends it to the user end, so that the user can input the offline password received by the user end into the corresponding device end, so that the device end performs verification, wherein the setting of the anti-replay attack verification information is beneficial to preventing the device end from being replayed, thereby facilitating improving the security of the offline password and the device end.

[0249] Preferably, in the above-mentioned offline password generation method, the step of obtaining the anti-replay attack verification information of the corresponding device end according to the password request information includes:

[0250] When the preset anti-replay attack verification information is a timestamp, the timestamp is determined according to the request time in the password request information;

[0251] When the preset anti-replay attack verification information is the value of the first counter, obtaining the historical value of the first counter when the offline password of the corresponding device was generated last time;

[0252] The value of the first counter is obtained according to the historical value of the first counter.

[0253] In a specific embodiment of the present application, when obtaining anti-replay attack verification information, the type of anti-replay attack verification information is first determined. If the anti-replay attack verification information is a timestamp, it is necessary to determine the timestamp based on the request time in the password request information, wherein the preferred request time is the timestamp. The request time includes but is not limited to the time when the request is sent and the time when the request is used. If the anti-replay attack verification information is the value of the first counter, it is necessary to obtain the historical value of the first counter when the offline password of the corresponding device side was generated last time, and then obtain the value of the first counter by increasing the preset increment based on the historical value. Thereby ensuring that the value of the counter increases. Optionally, when the value of the first counter needs to be used cyclically, if the historical value is the upper limit value of the count of the first counter, the value of the first counter is determined to be zero.

[0254] See also Fig.12 Specifically, the method for generating an offline password as described above, according to the anti-replay attack verification information and the authorization information in the password request information, the steps of generating an offline password include:

[0255] Step S1201, generating a plaintext data frame according to the anti-replay attack verification information and the authorization information in the password request information;

[0256] Step S1202, encrypting the plaintext data frame according to a preset authentication encryption algorithm to obtain an encrypted plaintext data frame;

[0257] Step S1203: convert the encrypted plaintext data frame into an offline password, where the offline password is a digital string with a preset length.

[0258] In a specific embodiment of the present application, when generating an offline password, a plaintext data frame is first generated based on the anti-replay attack verification information and the authorization information in the password request information to ensure the transmission of data, and then the plaintext data frame is encrypted according to a preset authentication encryption algorithm to obtain an encrypted plaintext data frame, which is conducive to ensuring the integrity and confidentiality of the encrypted plaintext data frame, and then the encrypted plaintext data frame is converted into an offline password, which is convenient for the user to input or transmit the password according to the offline password in the form of a digital string.

[0259] When converting the plaintext data frame into the offline password, since the offline password in this embodiment is preferably a decimal digit string and the plaintext data frame is a binary code stream, the plaintext data frame is first converted into an unsigned integer and then the unsigned integer is converted into the offline password, which is beneficial to ensure the smooth conversion of the offline password and the plaintext data frame, and is also beneficial to avoid the computing power consumed by the direct conversion of the offline password and the plaintext data frame.

[0260] See also Fig.13 Furthermore, the method for generating an offline password as described above encrypts the plaintext data frame according to a preset authentication encryption algorithm to obtain the encrypted plaintext data frame, including the following steps:

[0261] Step S1301, performing MAC authentication encryption on the plaintext data frame according to the unique identification code of the device and the root key corresponding to the device pre-stored in the server;

[0262] Step S1302, re-encrypt the plaintext data frame after authentication encryption according to a non-aligned symmetric encryption algorithm to obtain an encrypted plaintext data frame.

[0263] In a preferred embodiment of the present application, the step of encrypting the plaintext data frame includes: first, MAC authentication encryption is performed on the plaintext data frame according to the unique identification code of the device end and the root key corresponding to the device end pre-stored in the server end, which is conducive to protecting the integrity of the plaintext data frame, preventing malicious tampering, and ensuring the authenticity of the plaintext data frame to achieve the authentication function. Then, the plaintext data frame after authentication encryption is re-encrypted by a non-aligned symmetric encryption algorithm, and the integrity and confidentiality of the encrypted plaintext data frame are further guaranteed while reducing the number of idle bits.

[0264] See also Fig.14Another preferred embodiment of the present application further provides a server, including:

[0265] The third processing module 1401 is used to obtain anti-replay attack verification information of the corresponding device end according to the password request information after receiving the password request information about the device end sent by the user end, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter about the device end;

[0266] The fourth processing module 1402 is used to generate an offline password according to the anti-replay attack verification information and the authorization information in the password request information, and send the password to the user end.

[0267] Preferably, in the above-mentioned method for generating an offline password, the third processing module comprises:

[0268] An eleventh processing submodule, for determining the timestamp according to the request time in the password request information when the preset anti-replay attack verification information is a timestamp;

[0269] A twelfth processing submodule is used to obtain the historical value of the first counter when the offline password of the corresponding device end was generated last time when the preset anti-replay attack verification information is the value of the first counter;

[0270] The thirteenth processing submodule is used to obtain the value of the first counter in the current anti-replay attack verification information according to the historical value of the first counter.

[0271] Specifically, in the above-mentioned offline password generation method, the fourth processing module includes:

[0272] A fourteenth processing submodule, used to generate a plaintext data frame according to the anti-replay attack verification information and the authorization information in the password request information;

[0273] A fifteenth processing submodule is used to encrypt the plaintext data frame according to a preset authentication encryption algorithm to obtain an encrypted plaintext data frame;

[0274] The sixteenth processing submodule is used to convert the encrypted plaintext data frame into an offline password, where the offline password is a digital string with a preset length.

[0275] Furthermore, in the above-mentioned offline password generation method, the steps of the fifteenth processing submodule include:

[0276] A sixth processing unit, configured to perform MAC authentication encryption on the plaintext data frame according to the unique identification code of the device end and the root key corresponding to the device end pre-stored in the server end;

[0277] The seventh processing unit is used to perform secondary encryption on the plaintext data frame after authentication encryption according to a non-aligned symmetric encryption algorithm to obtain an encrypted plaintext data frame.

[0278] The server embodiment of the present application is a server corresponding to the embodiment of the offline password generation method described above. All implementation means in the embodiment of the offline password generation method described above are applicable to the server embodiment and can achieve the same technical effect.

[0279] Another preferred embodiment of the present application further provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the offline password authentication method described above is implemented, or the offline password generation method described above is implemented.

[0280] In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplicity and clarity, and does not in itself indicate the relationship between the various embodiments and / or settings discussed.

[0281] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusions.

[0282] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. An offline password authentication method, applied to the device side, It is characterized in that include: After receiving the offline password input by the user, obtaining the authorization information and anti-replay attack verification information in the offline password, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter; the authorization information is used to represent the authorization of the owner of the device end to the user; Perform a replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result; When the first verification result is a non-replay attack, controlling the device end according to the authorization information; The step of obtaining the authorization information and the anti-replay attack verification information in the offline password includes: Converting the offline password input by the user into a plaintext data frame; Decrypt and verify the plaintext data frame according to a preset authentication encryption algorithm, and obtain a decryption verification result and the decrypted plaintext data frame; When the decryption verification result is passed, the decrypted plaintext data frame is parsed to obtain authorization information and anti-replay attack verification information; The step of converting the offline password input by the user into a plaintext data frame comprises: Convert the offline password into an unsigned integer; Convert the unsigned integer into the plaintext data frame; The step of decrypting and verifying the plaintext data frame according to a preset authentication encryption algorithm and obtaining a decryption verification result and the decrypted plaintext data frame comprises: Decrypting the plaintext data frame according to a preset non-aligned symmetric encryption algorithm to obtain the decrypted plaintext data frame; The decrypted plaintext data frame is verified by a message authentication code MAC according to the unique identification code and subkey of the device end, and the decryption verification result is obtained.

2. The offline password authentication method according to claim 1, It is characterized in that The step of performing replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result comprises: When the anti-replay attack verification information is the timestamp, obtaining the valid duration in the authorization information and the local time of the device end; When the local time is greater than the timestamp, and the time difference with the timestamp is less than or equal to the valid duration, it is determined that the first verification result is a non-replay attack.

3. The offline password authentication method according to claim 1, It is characterized in that The step of performing replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result comprises: When the anti-replay attack verification information is the value of the first counter, obtaining the value of the second counter stored on the device end; The first verification result is obtained according to the value of the first counter and the value of the second counter.

4. The offline password authentication method according to claim 3, It is characterized in that The step of obtaining the first verification result according to the value of the first counter and the value of the second counter comprises: Obtaining a numerical difference between a value of the first counter and a value of the second counter; When the numerical difference is within a preset value range, it is determined that the first verification result is a non-replay attack.

5. The offline password authentication method according to claim 4, It is characterized in that The preset value range includes at least one of the following: greater than zero and less than a first preset positive value; Less than zero and greater than a first preset negative value; is smaller than the second preset negative value and greater than or equal to the third preset negative value, wherein the absolute value of the third preset negative value is the counting upper limit value of the second counter.

6. The offline password authentication method according to claim 4, It is characterized in that Also includes: After determining that the first verification result is a non-replay attack, if the numerical difference is greater than zero, the value of the second counter is updated according to the value of the first counter.

7. The offline password authentication method according to claim 1, It is characterized in that Also includes: After receiving the offline password input by the user, obtaining a pre-stored used offline password usage table, wherein the used offline password usage table records a preset number of used passwords; When it is determined that the offline password is a used password according to the offline password and the used offline password usage table, generating password invalid information and prompting; When it is determined that the offline password is an unused password according to the offline password and the used offline password usage table, the step of obtaining authorization information and anti-replay attack verification information in the offline password is performed.

8. The offline password authentication method according to claim 1, It is characterized in that When the first verification result is a non-replay attack, the step of controlling the device end according to the authorization information includes: Determine an authorization result according to the authorization information; When the authorization result is valid, the corresponding control authority is opened within the valid range according to the valid range information in the authorization information; When the authorization result is invalid, an authorization invalidity message is generated and prompted.

9. A device end, It is characterized in that include: An acquisition module, configured to acquire authorization information and anti-replay attack verification information in the offline password after receiving the offline password input by the user, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter; the authorization information is used to represent the authorization of the owner of the device end to the user; A first processing module, configured to perform a replay attack verification on the offline password according to the anti-replay attack verification information to obtain a first verification result; A second processing module, configured to control the device end according to the authorization information when the first verification result is a non-replay attack; Wherein, the acquisition module includes: A fifth processing submodule, used for converting the offline password input by the user into a plain text data frame; The sixth processing submodule is used to decrypt and verify the plaintext data frame according to a preset authentication encryption algorithm, and obtain a decryption verification result and a decrypted plaintext data frame; The seventh processing submodule is used to parse the decrypted plaintext data frame to obtain authorization information and anti-replay attack verification information when the decryption verification result is passed; The fifth processing submodule comprises: A first conversion unit, used for converting the offline password into an unsigned integer; A second conversion unit, used for converting an unsigned integer into a plaintext data frame; The sixth processing submodule comprises: A fourth processing unit, configured to decrypt the plaintext data frame according to a preset non-aligned symmetric encryption algorithm to obtain a decrypted plaintext data frame; The fifth processing unit is used to perform MAC verification on the decrypted plaintext data frame according to the unique identification code and subkey of the device end, and obtain a decryption verification result.

10. A method for generating an offline password, applied to a server, It is characterized in that include: After receiving the password request information about the device end sent by the user end, obtaining the anti-replay attack verification information corresponding to the device end according to the password request information, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter about the device end; Generate the offline password according to the anti-replay attack verification information and the authorization information in the password request information, and send it to the user terminal; The step of generating the offline password according to the anti-replay attack verification information and the authorization information in the password request information includes: Generate a plaintext data frame according to the anti-replay attack verification information and the authorization information in the password request information; Encrypting the plaintext data frame according to a preset authentication encryption algorithm to obtain the encrypted plaintext data frame; Converting the encrypted plaintext data frame into the offline password, where the offline password is a digital string with a preset length; The step of encrypting the plaintext data frame according to a preset authentication encryption algorithm to obtain the encrypted plaintext data frame comprises: Performing MAC authentication encryption on the plaintext data frame according to the unique identification code of the device end and the root key corresponding to the device end pre-stored in the server end; Performing secondary encryption on the plaintext data frame after authentication encryption according to a non-aligned symmetric encryption algorithm to obtain the encrypted plaintext data frame; The step of converting the encrypted plaintext data frame into the offline password comprises: Convert the encrypted plaintext data frame into an unsigned integer; Convert the unsigned integer to the offline password.

11. The method for generating an offline password according to claim 10, It is characterized in that The step of obtaining the anti-replay attack verification information corresponding to the device end according to the password request information includes: When the preset anti-replay attack verification information is a timestamp, determining the timestamp according to the request time in the password request information; When the preset anti-replay attack verification information is the value of the first counter, obtaining the historical value of the first counter when the offline password corresponding to the device was generated last time; The value of the first counter in the current anti-replay attack verification information is obtained according to the historical value of the first counter.

12. A server, It is characterized in that include: A third processing module is used to obtain anti-replay attack verification information corresponding to the device end according to the password request information after receiving the password request information about the device end sent by the user end, wherein the anti-replay attack verification information includes: a timestamp or a value of a first counter about the device end; A fourth processing module, used to generate an offline password according to the anti-replay attack verification information and the authorization information in the password request information, and send the password to the user terminal; Wherein, the fourth processing module includes: A fourteenth processing submodule, used to generate a plaintext data frame according to the anti-replay attack verification information and the authorization information in the password request information; A fifteenth processing submodule is used to encrypt the plaintext data frame according to a preset authentication encryption algorithm to obtain an encrypted plaintext data frame; A sixteenth processing submodule, configured to convert the encrypted plaintext data frame into an offline password, wherein the offline password is a digital string having a preset length; The fifteenth processing submodule comprises: A sixth processing unit, configured to perform MAC authentication encryption on the plaintext data frame according to the unique identification code of the device end and the root key corresponding to the device end pre-stored in the server end; A seventh processing unit, configured to perform secondary encryption on the authenticated encrypted plaintext data frame according to a non-aligned symmetric encryption algorithm to obtain an encrypted plaintext data frame; The sixteenth processing submodule is specifically used for: Convert the encrypted plaintext data frame into an unsigned integer; Convert the unsigned integer to the offline password.

13. A readable storage medium, It is characterized in that The readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the offline password authentication method according to any one of claims 1 to 8, or implements the offline password generation method according to any one of claims 10 to 11.