One-time password generation method and device

CN113254920BActive Publication Date: 2025-02-21BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010088921.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-12
Publication Date
2025-02-21
Estimated Expiration
2040-02-12

AI Technical Summary

Technical Problem

The existing one-time password generation method has low security due to the risk of leaking stored keys.

Method used

By responding to the trigger operation command sent by the application, the spatial attitude of the device is obtained and a one-time password is generated in combination with a digital sequence of set lengths. This spatial attitude does not exist in any storage space and cannot be known in advance, ensuring that the generated one-time password is unforeseen and predictable.

Benefits of technology

It effectively reduces the possibility of a one-time password being cracked and improves its security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113254920B_ABST
    Figure CN113254920B_ABST
Patent Text Reader

Abstract

The present invention discloses a one-time password generation method and device, and relates to the field of computer technology. A specific implementation of the method includes: in response to receiving a trigger operation instruction sent by an application, according to the trigger operation instruction, obtaining the spatial posture of the device where the application is located, and determining a digital sequence of a set length; generating a one-time password according to the spatial posture and the digital sequence. This implementation can effectively improve the security of the one-time password.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a one-time password generation method and device. Background Art

[0002] One Time Password (OTP), also known as dynamic password or single-time valid password, refers to a password that can only be used once for a login or transaction within its validity period. Currently, one-time passwords are calculated based on stored keys and timestamps.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] One-time passwords are less secure because the stored keys are at risk of being leaked. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a one-time password generation method and device, which can effectively improve the security of the one-time password.

[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a one-time password generation method is provided, comprising:

[0007] In response to receiving a trigger operation instruction sent by an application, obtaining a spatial posture of a device where the application is located according to the trigger operation instruction, and determining a digital sequence of a set length;

[0008] A one-time password is generated according to the spatial posture and the digital sequence.

[0009] Preferably,

[0010] Obtaining the spatial posture of the device where the application is located, including:

[0011] determining a reference position of a reference portion, the reference portion being a designated area of ​​the device;

[0012] In response to the reference portion reaching a current position, a three-dimensional rotation angle of the current position is determined based on the reference position and a preset rotation direction.

[0013] Preferably, generating a one-time password according to the spatial posture and the digital sequence comprises:

[0014] Convert the three-dimensional rotation angle into a corresponding first matrix, and convert the digital sequence into a second matrix, wherein the number of columns of the first matrix is ​​equal to the number of rows of the second matrix;

[0015] A one-time password is generated using the first matrix and the second matrix.

[0016] Preferably, using the first matrix and the second matrix to generate a one-time password includes:

[0017] performing a preset operation on the first matrix and the second matrix;

[0018] The result of the operation is converted into the one-time password.

[0019] Preferably, converting the three-dimensional rotation angle into a corresponding first matrix includes:

[0020] Calculate the conversion value corresponding to each rotation angle of the three-dimensional rotation angle;

[0021] A diagonal matrix is ​​constructed using the conversion value corresponding to each dimensional rotation angle, and the diagonal matrix is ​​used as the first matrix.

[0022] Preferably,

[0023] Generating a one-time password using the first matrix and the second matrix includes:

[0024] Performing a preset operation on the first matrix and the second matrix to obtain a result matrix;

[0025] For each non-zero matrix element in each row of the result matrix, executing: obtaining a valid value of a preset number of bits from the non-zero matrix element;

[0026] The one-time password is arranged using all the obtained valid numerical values.

[0027] Preferably, the step of determining a digital sequence of a set length comprises:

[0028] Encrypt the determined timestamp using a preset key;

[0029] Calculate the hash value corresponding to the encrypted timestamp.

[0030] Preferably, the one-time password generation method further comprises:

[0031] The one-time password is sent to the application and the server, so that the application receives the verification password input by the user, and the server verifies whether the verification password is consistent with the one-time password.

[0032] According to a second aspect of an embodiment of the present invention, a one-time password verification method is provided, which is applied to a server and includes:

[0033] receiving a task execution request sent by an application, the task execution request including user verification information, and verifying the verification information;

[0034] After verification, obtain the one-time password generated by any of the above one-time password generation methods;

[0035] receiving a verification password input by a user and sent by the application, wherein the verification password indicates information input by the user according to the one-time password received by the application;

[0036] It is determined whether the one-time password is consistent with the verification password, and if so, it is determined that the verification is successful.

[0037] Preferably,

[0038] When a one-time password generated by any of the one-time password generation methods described above is obtained, starting a timer;

[0039] When the verification password input by the user sent by the application is received and the timing duration does not reach the preset duration threshold,

[0040] Execute the step of determining whether the one-time password is consistent with the verification password.

[0041] According to a third aspect of an embodiment of the present invention, a one-time password generating device is provided, comprising: a trigger unit, a sensor and a password generating unit, wherein:

[0042] The trigger unit is configured to trigger the sensor in response to receiving a trigger operation instruction sent by the application;

[0043] The sensor is used to obtain the spatial posture of the device where the application is located after receiving a trigger from the trigger unit;

[0044] The password generating unit is used to determine a digital sequence of a set length; and to generate a one-time password according to the spatial posture and the digital sequence acquired by the sensor.

[0045] According to a fourth aspect of an embodiment of the present invention, a one-time password verification device is provided, comprising: a first interface, a second interface and a verification unit, wherein:

[0046] The first interface is used to receive a task execution request sent by an application, wherein the task execution request includes user verification information;

[0047] The verification unit is used to verify the verification information received by the first interface, and trigger the second interface after the verification is passed;

[0048] The second interface is used to obtain the one-time password generated by the one-time password generating device when receiving a trigger from the verification unit;

[0049] The first interface is further used to receive a verification password input by a user sent by the application, wherein the verification password indicates information input by the user according to the one-time password received by the application;

[0050] The verification unit is further used to determine whether the one-time password obtained by the second interface is consistent with the verification password received by the first interface, and if so, determine that the verification is successful.

[0051] According to a fifth aspect of an embodiment of the present invention, a one-time password verification system is provided, characterized in that it includes: the one-time password generating device mentioned above and the one-time password verification device mentioned above.

[0052] An embodiment of the above invention has the following advantages or beneficial effects: Since the embodiment of the present invention generates a one-time password based on a spatial posture and a digital sequence, wherein the spatial posture is obtained based on a trigger operation instruction sent by a received application, the spatial posture does not exist in any storage space and cannot be known in advance, so that the generated one-time password is also unforeseeable or predictable, effectively reducing the possibility of the one-time password being cracked, thereby effectively improving the security of the one-time password.

[0053] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0055] Figure 1 is a schematic diagram of the main process of a one-time password generation method according to an embodiment of the present invention;

[0056] Figure 2 is a schematic diagram of a rotation direction of one dimension according to an embodiment of the present invention;

[0057] Figure 3 is a schematic diagram of a rotation direction of another dimension according to an embodiment of the present invention;

[0058] Figure 4 is a schematic diagram of a rotation direction of another dimension according to an embodiment of the present invention;

[0059] Figure 5 is a schematic diagram of a spatial coordinate system according to an embodiment of the present invention;

[0060] Figure 6 is a schematic diagram of the main process of the one-time password verification method according to an embodiment of the present invention;

[0061] Figure 7is a schematic diagram of the interaction between an application, a server, and a one-time password generating device according to an embodiment of the present invention;

[0062] Figure 8 is a schematic diagram of main units of a one-time password generating device according to an embodiment of the present invention;

[0063] Fig. 9 is a schematic diagram of main units of a one-time password verification server according to an embodiment of the present invention;

[0064] Fig.10 is a schematic diagram of main devices of a one-time password verification system according to an embodiment of the present invention;

[0065] Fig.11 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0066] Fig.12 It is a schematic diagram of the structure of a computer system of a terminal device suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0067] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0068] Application generally refers to applications for mobile phones and tablets. The application can exist in the form of a client or a web page. It contains interfaces such as login or payment, so that users can log in or pay through the interface provided by the application.

[0069] Spatial posture refers to the posture / tilt angle / rotation angle of the current position of the device where the application is located relative to the reference position in space. For example, the tilt angle or rotation angle of a mobile terminal such as a mobile phone or tablet relative to the reference position.

[0070] Figure 1 A one-time password generation method according to an embodiment of the present invention is provided. Figure 1 As shown, the steps of the one-time password generation method include:

[0071] 101: in response to receiving a trigger operation instruction sent by an application, obtaining a spatial posture of a device where the application is located according to the trigger operation instruction, and determining a digital sequence of a set length;

[0072] 102: Generate a one-time password based on the spatial posture and the digital sequence.

[0073] Among them, the trigger operation instruction refers to the user triggering the login item or payment item on the application interface, so that the application sends the corresponding trigger operation instruction such as login instruction, payment instruction, etc. According to the trigger operation instruction, the spatial posture of the device where the application is located can be obtained when the login instruction is received; according to the trigger operation instruction, the spatial posture of the device where the application is located can also be obtained when the payment instruction is received. The spatial posture of the device where the application is located can be obtained through a sensor.

[0074] The above-mentioned device can be a device capable of IoT connection, or it can be a mobile terminal such as a mobile phone, tablet, PC, etc.

[0075] The set length can be any length set by the user, such as 4 digits, 6 digits, 8 digits, etc.

[0076] The digital sequence may be input by the user or calculated using the timestamp and the key, that is, using the preset key to encrypt the determined timestamp and calculate the hash value corresponding to the encrypted timestamp. The key may be an existing key.

[0077] It can be understood that after the one-time password is generated, the above method may further include: sending the one-time password to the application respectively, so that the application receives the verification password input by the user according to the one-time password.

[0078] exist Figure 1 In the illustrated embodiment, a one-time password is generated based on a spatial posture and a digital sequence, wherein the spatial posture is acquired upon receiving a trigger operation instruction sent by an application. Therefore, the spatial posture does not exist in any storage space and cannot be known in advance, so that the generated one-time password is also unforeseeable or predictable, effectively reducing the possibility of the one-time password being cracked, thereby effectively improving the security of the one-time password.

[0079] In one embodiment of the present invention, the one-time password generation method further includes: providing a reference part and a rotation direction on the device; accordingly, the specific implementation of obtaining the spatial posture of the device where the application is located may include: determining the reference position of the reference part; in response to the reference part reaching the current position, determining the three-dimensional rotation angle corresponding to the current position based on the reference position and the rotation direction. Three-dimensional rotation angle (pitch angle, roll angle, azimuth angle).

[0080] Among them, the reference part is a designated area of ​​the device, such as a designated area of ​​the device can be a reference position or reference line or reference area on the device, for example, the position of the front camera of a mobile phone, a side of the mobile phone, the head of the mobile phone, the edge of the head of the mobile phone, the tail edge of the tablet, the position of the PC camera, the upper edge of the PC, etc.

[0081] The rotation direction is configured by the user, for example, if the device is rotated counterclockwise to reach the target position such as the current position, the device's rotation angle; for example, if the device is rotated right-handed to reach the target position such as the current position, the device's rotation angle. Figure 2 , Figure 3 as well as Figure 4 The rotation direction of the mobile phone is given as counterclockwise rotation / right-hand rotation. Among them, a spatial coordinate system is constructed. Accordingly, the reference part is based on Figure 2 , Figure 3 as well as Figure 4 The reference part is rotated in the given rotation direction to reach the current position, and the rotation angle corresponding to the rotation constitutes the three-dimensional rotation angle. Figure 5 The spatial coordinate system shown, the rotation performed to make the reference part reach the current position from the reference position may include: Figure 2 The rotation around the z-axis (i.e., horizontal rotation) is shown. Figure 3 The rotation around the x-axis is shown as Figure 4The rotation around the y-axis is shown. Among them, the three-dimensional rotation angle (0, 0, 0) corresponding to the reference position, starting from the reference position, the counterclockwise rotation around the z-axis increases according to the rotation angle of 0° to 360°; starting from the reference position, the counterclockwise rotation around the x-axis increases according to the rotation angle of 0° to 180°, and the clockwise rotation around the x-axis decreases according to the rotation angle of 0° to -180°; based on the reference position, the counterclockwise rotation around the y-axis increases according to the rotation angle of 0° to 90°, and the clockwise rotation around the y-axis decreases according to the rotation angle of -90° to 0°. That is, the rotation angle relative to the z-axis ranges from 0° to 360°, the rotation angle relative to the x-axis ranges from -180° to 180°, and the rotation angle relative to the y-axis ranges from -90° to 90°. The three-dimensional rotation angle is composed of the rotation angle relative to the z-axis, the rotation angle relative to the x-axis, and the rotation angle relative to the y-axis. For example, based on the spatial coordinate system (x-axis, y-axis and z-axis) set for the mobile phone, the determined spatial posture, i.e., the three-dimensional rotation angle, is (β, γ, α), where β represents the rotation angle of the mobile phone from the reference position to the current position, which needs to be rotated around the x-axis; γ represents the rotation angle of the mobile phone from the reference position to the current position, which needs to be rotated around the y-axis; α represents the rotation angle of the mobile phone from the reference position to the current position, which needs to be rotated around the z-axis. For example, in one embodiment, the reference part of the determined device (such as a mobile phone or a tablet) is the upper edge of the device, the reference position is the upper edge of the device (such as a mobile phone or a tablet) facing the magnetic north, and the screen of the device is parallel to the ground and facing upward. Correspondingly, the value of α (the rotation angle of rotation around the z-axis) is the azimuth, i.e., the angle between the current compass direction and the magnetic north. If the upper edge of the mobile phone faces the magnetic north, the azimuth is 0°; if the upper edge faces south, the azimuth is 180°. Similarly, if the top edge is facing east, the azimuth is 90°; if the top edge is facing west, the azimuth is 270°. As another example, the value of β (the angle of rotation about the x-axis) is the pitch angle, which is the angle between a plane parallel to the device screen and a plane parallel to the ground. If the device is placed parallel to the ground with its bottom edge away from the ground and its top edge tilted toward the ground, the pitch angle becomes positive. Tilting in the opposite direction (moving the top edge of the device away from the ground) makes the pitch angle negative. Values ​​range from -180° to 180°. The value of γ (the angle of rotation about the y-axis) is the roll angle. This is the angle between a plane perpendicular to the device screen and a plane perpendicular to the ground. If the device is placed parallel to the ground with the left edge of the device tilted toward the ground and the right edge of the device tilted away from the ground, the roll angle becomes positive. Tilting in the opposite direction (tilting the right edge of the device toward the ground and the left edge of the device tilted away from the ground) makes the roll angle negative. Values ​​range from -90° to 90°.

[0082] The above-mentioned spatial posture can be directly acquired through a sensor, and a gyroscope sensor is preferably selected.

[0083] By using the reference part and the reference position, the three-dimensional rotation angle corresponding to the current position of the reference part is determined as the spatial posture, which can make the spatial posture acquisition more convenient and accurate. Under the premise of ensuring the security of the one-time password, the efficiency of generating the one-time password can be effectively improved.

[0084] In one embodiment of the present invention, the specific implementation method of generating a one-time password based on the spatial posture and the digital sequence includes: converting the three-dimensional rotation angle into a corresponding first matrix, and converting the digital sequence into a second matrix, wherein the number of columns of the first matrix is ​​equal to the number of rows of the second matrix; using the first matrix and the second matrix to generate a one-time password. Since the three-dimensional rotation angle involves three rotation angles, and the digital sequence generally involves 4, 6 or 8 digits, by converting the three-dimensional rotation angle and the digital sequence into a matrix to generate a one-time password based on the matrix, on the one hand, the three-dimensional rotation angle can be better utilized, and the number of digits of the digital sequence can be maintained as much as possible. On the other hand, the one-time password generated based on the matrix can effectively improve the security of the one-time password. By making the number of columns of the first matrix equal to the number of rows of the second matrix, the first matrix can be operated with the second matrix.

[0085] In one embodiment of the present invention, the specific implementation method of generating a one-time password using the first matrix and the second matrix includes: performing a preset operation on the first matrix and the second matrix; and converting the result of the operation into a one-time password. The operation can merge the three-dimensional rotation angle with the digital sequence. The operation can be any one of multiplication, addition, and subtraction of the first matrix and the second matrix.

[0086] In one embodiment of the present invention, the specific implementation of converting the three-dimensional rotation angle into the corresponding first matrix may include: calculating the conversion value corresponding to each rotation angle in the three-dimensional rotation angle; using the conversion value corresponding to each rotation angle to construct a diagonal matrix. The diagonal matrix is ​​the first matrix. Through this process, on the one hand, a larger rotation angle can be reasonably converted into a smaller value, making the one-time password generation simple. On the other hand, the rotation angle can be reasonably used so that the one-time password is closely related to the rotation angle, while ensuring that the number of digits of the result of the subsequent operation is close to the number of digits required for the one-time password, thereby ensuring that the one-time password acquisition process is simple and does not burden the resources of the device.

[0087] The conversion value corresponding to each rotation angle in the above three-dimensional rotation angle calculation can be implemented through three specific implementations.

[0088] The first specific implementation method:

[0089] The conversion value corresponding to each rotation angle in the three-dimensional rotation angle is calculated using the following calculation formula (1);

[0090] Calculation formula (1):

[0091]

[0092] Among them, Z i represents the first conversion value corresponding to the i-th dimension rotation angle; ω represents an integer multiple of 0.0175; A represents the first constant that is not 0; W i Represents the degree of the rotation angle of the i-th dimension. When i is the dimension corresponding to the x-axis, W i ∈[-π,π], when i is the dimension corresponding to the y-axis, When i is the dimension corresponding to the z-axis, W i ∈[0,2π]; Represents a second constant that is not 0; the value of i belongs to the set {the dimension corresponding to the x-axis, the dimension corresponding to the y-axis, and the dimension corresponding to the z-axis in the three-dimensional coordinate system}.

[0093] Accordingly, using the conversion value corresponding to each rotation angle, the diagonal matrix constructed can be:

[0094]

[0095] Among them, Z x The first conversion value corresponding to the rotation angle of one dimension corresponding to the x-axis calculated by the calculation formula (1); Z y The first conversion value corresponding to the rotation angle of one dimension corresponding to the y-axis calculated by the calculation formula (1); Z z The first conversion value corresponding to the rotation angle of one dimension corresponding to the z-axis calculated by the calculation formula (1) is represented.

[0096] The second specific implementation method:

[0097] The conversion value corresponding to each rotation angle in the three-dimensional rotation angle is calculated using the following calculation formula (2);

[0098] Calculation formula (2):

[0099] T i =B×cos(k×W i +τ)

[0100] Among them, T i represents the second conversion value corresponding to the i-th dimension rotation angle; k represents an integer multiple of 0.0175; B represents a third constant that is not 0; W iRepresents the degree of the rotation angle of the i-th dimension; τ represents the fourth constant that is not 0; the value of i belongs to the set {the dimension corresponding to the x-axis, the dimension corresponding to the y-axis, and the dimension corresponding to the z-axis in the three-dimensional coordinate system}.

[0101] Accordingly, using the conversion value corresponding to each rotation angle, the diagonal matrix constructed can be:

[0102]

[0103] Among them, T x The second conversion value corresponding to the rotation angle of one dimension corresponding to the x-axis calculated by formula (2); T y The second conversion value corresponding to the rotation angle of one dimension corresponding to the y-axis calculated by the calculation formula (2); T z The second conversion value corresponding to the rotation angle of one dimension corresponding to the z-axis calculated by the calculation formula (2) is represented.

[0104] The third specific implementation method:

[0105] The conversion value corresponding to each rotation angle in the three-dimensional rotation angle is calculated using the following calculation formula (3);

[0106] Calculation formula (3):

[0107] P i =V×tan(r×W i )

[0108] Among them, P i represents the third conversion value corresponding to the i-th dimension rotation angle; r represents an integer multiple of 0.0175, and |r|<0.25; V represents a fifth constant that is not 0; W i Represents the degree of the rotation angle of the i-th dimension; the value of i belongs to the set {the dimension corresponding to the x-axis, the dimension corresponding to the y-axis, and the dimension corresponding to the z-axis in the three-dimensional coordinate system}.

[0109] Accordingly, using the conversion value corresponding to each rotation angle, the diagonal matrix constructed can be:

[0110]

[0111] Among them, P x The third conversion value corresponding to the rotation angle of one dimension corresponding to the x-axis calculated by the calculation formula (3); P y The third conversion value corresponding to the rotation angle of one dimension corresponding to the y-axis calculated by the calculation formula (3); P z The third conversion value corresponding to the rotation angle of one dimension corresponding to the z-axis calculated by the calculation formula (3) is represented.

[0112] It is worth noting that the positions of the conversion values ​​corresponding to the rotation angle of each dimension in the diagonal matrix can be mutually converted. Taking the conversion values ​​calculated in the third implementation as an example, the diagonal matrix that can be constructed can also be:

[0113]

[0114] In one embodiment of the present invention, a specific implementation method of converting a digital sequence into a second matrix is ​​as follows:

[0115] Convert the number sequence into a 3×1 matrix, that is, the number of columns in the first matrix is ​​equal to the number of rows in the second matrix.

[0116] The specific implementation method of converting a digital sequence into a 3×1 matrix is ​​as follows: the digital sequence is divided into three segments, and the corresponding matrix positions are assigned to the three segments in the 3×1 matrix. For example, the digital sequence is 123456, which is divided into three segments of 12, 34, and 56. The 3×1 matrix obtained by the three segments of 12, 34, and 56 is:

[0117]

[0118] That is, the digital sequence is abcdefgh, and the three segments are ab, cde, and fgh, and the resulting 3×1 matrix is:

[0119]

[0120] The digital sequence is abcdef, which is divided into three segments ab, cde, and fgh. The resulting 3×1 matrix is:

[0121]

[0122] The digital sequence is abcd, and the three segments are a, b, cd. The resulting 3×1 matrix is:

[0123]

[0124] Among them, the values ​​of a, b, c, d, e, f, g, and h can be any integer not less than 0.

[0125] In one embodiment of the present invention, a specific implementation method of generating a one-time password using a first matrix and a second matrix includes: performing a preset operation on the first matrix and the second matrix; and converting the result of the operation into a one-time password.

[0126] For example, if the operation is multiplication, the diagonal matrix constructed by the third specific implementation method and the second matrix converted from the digital sequence are:

[0127]

[0128] Taking the preset operation as a product operation as an example, the preset operation performed on the first matrix and the second matrix is ​​described in detail:

[0129]

[0130] It is worth noting that in order to effectively improve the calculation efficiency in the process of generating a one-time password, in the process of calculating the conversion value corresponding to each dimensional rotation angle, the number of valid digits is taken for the calculation result, for example, two valid digits, one valid digit, etc. For example, a calculated conversion value is 12.345, and two valid digits are taken, then the conversion value is 12, and one valid digit is taken, then the conversion value is 1.

[0131] In one embodiment of the present invention, a result matrix is ​​obtained through the above operation; for each non-zero matrix element in each row of the result matrix, the following is performed: obtaining a preset number of valid values ​​from the non-zero matrix elements; and arranging a one-time password using all the obtained valid values ​​so that the length of the one-time password is equal to the product of the preset number of bits and the number of non-zero matrix elements in the result matrix.

[0132] Among them, the result matrix can be:

[0133]

[0134] Matrix elements that are not zero: P x ×ab,P y ×cd,P z ×ef, the preset number of digits can be set by the user, such as 1, 2, etc., and insufficient digits can be supplemented with 0. For example, if a matrix element is 6 and the preset number of digits is 2, then the effective value of the preset number of digits is 60.

[0135] In one embodiment of the present invention, the specific implementation of determining the digital sequence of the set length may include: using a preset key to encrypt the determined timestamp; calculating the hash value corresponding to the encrypted timestamp. The specific implementation of calculating the digital sequence of the set length can be calculated by an existing TOTP algorithm (Time-based One-time Password algorithm). That is, the key may be an existing shared key. The hash value can be obtained by inputting the encrypted timestamp into the hash function.

[0136] In order to clearly explain the one-time password generation process, the following takes the three-dimensional rotation angle (alpha, beta, gamma) of a mobile phone as an example. The calculation formula for converting the three-dimensional rotation angle to the first matrix is:

[0137]

[0138] in, (The effective number is the preset number of effective digits).

[0139] For example, the data sequence 123456 is converted into the second matrix:

[0140]

[0141] alpha=beta=gamma=60°, based on this, the resulting matrix is:

[0142]

[0143] The preset number of bits for each non-zero matrix element is 2, and for matrix elements with only one digit, the two digits are padded with 0. For example, the two digits for the matrix element 6 are padded with 0, and the number is 60. Use:

[0144]

[0145] The one-time password is 601728.

[0146] It is worth noting that the above-mentioned one-time password generation process, such as obtaining the first matrix corresponding to the three-dimensional rotation angle, obtaining the second matrix corresponding to the data sequence, and obtaining the final one-time password through the first matrix and the second matrix, are all obtained through multiple test comparisons, which can make the one-time password difficult to crack or leak. At the same time, without increasing the operating burden of the equipment, through simple calculations, it can ensure that the rotation angle, data sequence, etc. can be reasonably planned or used.

[0147] Any of the above one-time password generation methods can be implemented in a terminal or in a server, preferably, in a terminal.

[0148] In one embodiment of the present invention, the method may further include: sending the one-time password to the application and the server, so that the application receives the verification password input by the user, and the server verifies whether the verification password is consistent with the one-time password.

[0149] The server verifies whether the verification password is consistent with the one-time password. Figure 6 As shown. Figure 6 It can be seen that the embodiment of the present invention provides a one-time password verification method which specifically may include the following steps:

[0150] 601: receiving a task execution request sent by an application, the task execution request including user verification information, and verifying the verification information;

[0151] The task execution request may be a login request such as a shopping account login request, a payment request, a registration request, an after-sales request, etc.

[0152] 602: After verification, obtain a one-time password;

[0153] The one-time password is generated by the one-time password generation method described above.

[0154] 603: receiving a verification password input by a user and sent by the application, where the verification password indicates information input by the user according to the one-time password received by the application;

[0155] 604: Determine whether the one-time password is consistent with the verification password. If yes, execute 605; otherwise, execute 606;

[0156] 605: Confirm that the verification is successful and end the current process;

[0157] 606: Verification failed.

[0158] In one embodiment of the present invention, when the one-time password is obtained, the timer is started; when the verification password input by the user sent by the application is received and the timing duration does not reach the preset duration threshold, the step of determining whether the one-time password is consistent with the verification password is executed.

[0159] In order to clearly explain the one-time password generation and verification process, Figure 7 The interaction between the application in the terminal, the server providing services for the application, and the one-time password generating device in the terminal is taken as an example to illustrate. Figure 7 As shown, the one-time password verification process may include the following steps:

[0160] 701: The application in the terminal receives a trigger event;

[0161] The trigger event can be that the user enters the login account and login password, triggering the login button, indicating that the application has received a trigger event; it can also be that the user enters the payment password set by the user, indicating that the application has received a trigger event.

[0162] 702: The application sends a task execution request, which includes user verification information;

[0163] 703: The server receives the task execution request sent by the application and verifies the verification information;

[0164] 704: The server sends verification success information to the application;

[0165] 705: The application sends a trigger operation instruction to the one-time password generating device;

[0166] 706: After receiving the trigger operation instruction, the one-time password generating device determines a digital sequence of a set length;

[0167] 707: The one-time password generating device obtains the spatial posture of the device where the application is located;

[0168] 708: The one-time password generating device determines a reference position of a reference part set in the terminal;

[0169] 709: In response to the reference portion reaching the current position, the one-time password generating device determines a three-dimensional rotation angle corresponding to the current position based on the reference position and a preset rotation direction;

[0170] 710: The one-time password generating device calculates a conversion value corresponding to each rotation angle of the three-dimensional rotation angle;

[0171] 711: The one-time password generating device constructs a 3×3 diagonal matrix using the conversion value corresponding to each rotation angle of each dimension;

[0172] 712: The one-time password generating device converts the digital sequence into a 3×1 matrix;

[0173] 713: The one-time password generating device performs a multiplication operation on the 3×3 diagonal matrix and the 3×1 matrix;

[0174] 714: The one-time password generating device converts the result of the operation into a one-time password;

[0175] 715: The one-time password generating device sends the one-time password to the application and the server respectively;

[0176] 716: The server starts timing;

[0177] 717: the application receives a verification password input by the user, where the verification password indicates information input by the user according to the one-time password received by the application;

[0178] 718: The application outputs the verification password to the server;

[0179] 719: The server determines whether the timing duration reaches a preset duration threshold. If yes, execute 720; otherwise, execute 721;

[0180] 720: The server sends a verification failure message to the application and ends the current process;

[0181] 721: The server determines whether the one-time password is consistent with the verification password. If yes, execute 722; otherwise, execute 723;

[0182] 722: The server confirms that the verification is successful and ends the current process;

[0183] After verification, the app can complete login / payment.

[0184] 723: The server determined that authentication failed.

[0185] If the verification fails, the app cannot complete the login / payment.

[0186] It is worth noting that the above diagonal matrix is ​​the first matrix.

[0187] like Figure 8 As shown, an embodiment of the present invention provides a one-time password generating device 800, which includes: a trigger unit 801, a sensor 802 and a password generating unit 803, wherein:

[0188] The trigger unit 801 is used to trigger the sensor 802 in response to receiving a trigger operation instruction sent by the application;

[0189] The sensor 802 is used to obtain the spatial posture of the device where the application is located after receiving the trigger from the trigger unit 801;

[0190] The password generation unit 803 is used to determine a digital sequence of a set length; and generate a one-time password according to the spatial posture and digital sequence acquired by the sensor 802.

[0191] In one embodiment of the present invention, sensor 802 is used to determine a reference position of a reference part, where the reference part is a designated area of ​​the device; in response to the reference part reaching a current position, a three-dimensional rotation angle corresponding to the current position of the reference part is determined based on the reference position and a preset rotation direction.

[0192] In one embodiment of the present invention, the password generation unit 803 is used to convert the three-dimensional rotation angle into a corresponding first matrix, and convert the digital sequence into a second matrix, wherein the number of columns of the first matrix is ​​equal to the number of rows of the second matrix; and generate a one-time password using the first matrix and the second matrix.

[0193] In one embodiment of the present invention, the password generating unit 803 is used to perform a preset operation on the first matrix and the second matrix; and convert the result of the operation into a one-time password according to a preset password conversion event.

[0194] In one embodiment of the present invention, the password generation unit 803 is used to perform a preset operation on the first matrix and the second matrix to obtain a result matrix; for each non-zero matrix element in each row of the result matrix, execute: obtain a preset number of valid values ​​from the non-zero matrix elements; and use all the obtained valid values ​​to arrange a one-time password.

[0195] In one embodiment of the present invention, the password generation unit 803 is used to encrypt the determined timestamp using a preset key; and calculate a hash value corresponding to the encrypted timestamp.

[0196] The one-time password generating device 800 can be applied to a terminal or a server, preferably, to a terminal.

[0197] The sensor 802 may be a gyroscope sensor.

[0198] like Fig. 9 As shown, an embodiment of the present invention provides a one-time password verification device 900, which is applied to a server. The one-time password verification device 900 includes: a first interface 901, a second interface 902 and a verification unit 903, wherein:

[0199] The first interface 901 is used to receive a task execution request sent by an application, where the task execution request includes user verification information;

[0200] The verification unit 903 is used to verify the verification information received by the first interface 901, and trigger the second interface 902 after the verification is passed;

[0201] The second interface 902 is used to respond to the acquisition of the one-time password generated by the one-time password generating device 800 upon receiving the trigger of the verification unit 903;

[0202] The first interface 901 is further used to receive a verification password input by a user sent by an application, where the verification password indicates information input by the user according to the one-time password received by the application;

[0203] The verification unit 903 is further used to determine whether the one-time password obtained by the second interface 902 is consistent with the verification password received by the first interface 901. If yes, it is determined that the verification is successful.

[0204] like Fig.10 As shown, an embodiment of the present invention provides a one-time password verification system 1000 , which includes: a one-time password generating device 800 and a one-time password verification device 900 .

[0205] The one-time password generating device 800 can be applied to a terminal or a server; the one-time password verifying device 900 is applied to a server.

[0206] Fig.11 An exemplary system architecture 1100 is shown to which a one-time password generation method or a one-time password generation device or a one-time password verification method or a one-time password verification device according to an embodiment of the present invention can be applied.

[0207] like Fig.11 As shown, system architecture 1100 may include terminal devices 1101, 1102, 1103, a network 1104, and a server 1105. Network 1104 is used to provide a medium for communication links between terminal devices 1101, 1102, 1103 and server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0208] Users can use terminal devices 1101, 1102, 1103 to interact with server 1105 through network 1104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1101, 1102, 1103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0209] The terminal devices 1101 , 1102 , and 1103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0210] The server 1105 may be a server that provides various services, such as a background management server that provides support for shopping websites browsed by users using the terminal devices 1101, 1102, and 1103 or provides verification for the one-time passwords input by the terminal devices 1101, 1102, and 1103 (for example only). The background management server may verify the received one-time password and other data, and feedback the verification result (for example, verification passed / verification failed - for example only) to the terminal device.

[0211] It should be noted that the one-time password generation method provided in the embodiment of the present invention is generally executed by the terminal devices 1101 , 1102 , and 1103 , and accordingly, the one-time password generation device is generally arranged in the terminal devices 1101 , 1102 , and 1103 .

[0212] It should be understood that Fig.11 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0213] Reference below Fig.12 , which shows a schematic diagram of the structure of a computer system 1200 of a terminal device suitable for implementing an embodiment of the present invention. Fig.12 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0214] like Fig.12As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage part 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the system 1200 are also stored. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.

[0215] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed, so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0216] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1209, and / or installed from the removable medium 1211. When the computer program is executed by the central processing unit (CPU) 1201, the above-mentioned functions defined in the system of the present invention are executed.

[0217] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0218] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0219] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a trigger unit, a sensor, and a password generation unit. The names of these units do not constitute a limitation on the units themselves in some cases. For example, the trigger unit may also be described as "a unit for triggering a sensor in response to receiving a trigger operation instruction sent by an application."

[0220] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: responding to receiving a trigger operation instruction sent by an application; obtaining the spatial posture of the device where the application is located, and determining a digital sequence of a set length; generating a one-time password according to the spatial posture and the digital sequence.

[0221] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the device includes: determining a base position of a reference part, where the reference part is a designated area of ​​the device; in response to the reference part reaching a current position, determining a three-dimensional rotation angle of the current position based on the base position and a preset rotation direction.

[0222] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the device includes: converting the three-dimensional rotation angle into a corresponding first matrix, and converting the digital sequence into a second matrix, wherein the number of columns of the first matrix is ​​equal to the number of rows of the second matrix; and generating a one-time password using the first matrix and the second matrix.

[0223] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the device includes: calculating the conversion value corresponding to each rotation angle in the three-dimensional rotation angle; and constructing a diagonal matrix using the conversion value corresponding to each rotation angle.

[0224] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the device includes: using a first matrix and a second matrix to generate a one-time password, including: performing a preset operation on the first matrix and the second matrix to obtain a result matrix; for each non-zero matrix element in each row of the result matrix, executing: obtaining a preset number of valid values ​​from the non-zero matrix elements; and arranging the one-time password using all the obtained valid values.

[0225] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: receiving a task execution request sent by an application, the task execution request includes the user's verification information, and verifying the verification information; after the verification is passed, obtaining a one-time password; receiving a verification password input by the user sent by the application, the verification password indicates the information input by the user according to the one-time password received by the application; judging whether the one-time password is consistent with the verification password, and if so, determining that the verification is passed.

[0226] According to the technical solution of the embodiment of the present invention, a one-time password is generated according to a spatial posture and a digital sequence, wherein the spatial posture is obtained in response to receiving a trigger operation instruction sent by an application. Therefore, the spatial posture does not exist in any storage space and cannot be known in advance, so that the generated one-time password is also unforeseeable or predictable, which effectively reduces the possibility of the one-time password being cracked, thereby effectively improving the security of the one-time password.

[0227] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A one-time password generation method, characterized in that: include: In response to receiving a trigger operation instruction sent by an application, obtaining a spatial posture of a device where the application is located according to the trigger operation instruction, and determining a digital sequence of a set length; generating a one-time password according to the spatial posture and the digital sequence; Obtaining the spatial posture of the device where the application is located, including: determining a reference position of a reference portion, the reference portion being a designated area of ​​the device; In response to the reference portion reaching the current position, determining a three-dimensional rotation angle of the current position based on the reference position and a preset rotation direction; Generating a one-time password according to the spatial posture and the digital sequence, including: Convert the three-dimensional rotation angle into a corresponding first matrix, and convert the digital sequence into a second matrix, wherein the number of columns of the first matrix is ​​equal to the number of rows of the second matrix; A one-time password is generated using the first matrix and the second matrix.

2. The one-time password generation method according to claim 1, characterized in that: Converting the three-dimensional rotation angle into a corresponding first matrix includes: Calculate the conversion value corresponding to each rotation angle of the three-dimensional rotation angle; A diagonal matrix is ​​constructed using the conversion values ​​corresponding to the rotation angles of each dimension, and the diagonal matrix is ​​used as the first matrix.

3. The one-time password generation method according to claim 1, characterized in that: Generating a one-time password using the first matrix and the second matrix includes: Performing a preset operation on the first matrix and the second matrix to obtain a result matrix; For each non-zero matrix element in each row of the result matrix, executing: obtaining a valid value of a preset number of bits from the non-zero matrix element; The one-time password is arranged using all the obtained valid numerical values.

4. The one-time password generation method according to any one of claims 1 to 3, characterized in that: The step of determining a digital sequence of a set length comprises: Encrypting the determined timestamp using a preset key; Calculate the hash value corresponding to the encrypted timestamp.

5. The one-time password generation method according to any one of claims 1 to 3, characterized in that: Further including: The one-time password is sent to the application and the server, so that the application receives the verification password input by the user, and the server verifies whether the verification password is consistent with the one-time password.

6. A one-time password generating device, characterized in that: include: A trigger unit, a sensor and a password generating unit, wherein: The trigger unit is configured to trigger the sensor in response to receiving a trigger operation instruction sent by the application; The sensor is used to obtain the spatial posture of the device where the application is located after receiving a trigger from the trigger unit; The password generating unit is used to determine a digital sequence of a set length; and generate a one-time password according to the spatial posture and the digital sequence acquired by the sensor; The sensor is also used to: determining a reference position of a reference portion, the reference portion being a designated area of ​​the device; In response to the reference portion reaching the current position, determining a three-dimensional rotation angle of the current position based on the reference position and a preset rotation direction; The password generating unit is also used for: Convert the three-dimensional rotation angle into a corresponding first matrix, and convert the digital sequence into a second matrix, wherein the number of columns of the first matrix is ​​equal to the number of rows of the second matrix; A one-time password is generated using the first matrix and the second matrix.

7. An electronic device for generating a one-time password, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • User authentication method and device and terminal equipment

    CN105095701A

  • Password generation method and device, password authentication method and device as well as terminal

    CN105608356A