WO2020181797A1 - 动态码生成方法、装置、计算机设备和存储介质 - Google Patents

动态码生成方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2020181797A1
WO2020181797A1 PCT/CN2019/116335 CN2019116335W WO2020181797A1 WO 2020181797 A1 WO2020181797 A1 WO 2020181797A1 CN 2019116335 W CN2019116335 W CN 2019116335W WO 2020181797 A1 WO2020181797 A1 WO 2020181797A1
Authority
WO
WIPO (PCT)
Prior art keywords
dynamic code
preset
dynamic
target user
authentication
Prior art date
Application number
PCT/CN2019/116335
Other languages
English (en)
French (fr)
Inventor
宋杰
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020181797A1 publication Critical patent/WO2020181797A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/45Structures or tools for the administration of authentication
    • G06F21/46Structures or tools for the administration of authentication by designing passwords or checking the strength of passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements
    • H04W4/14Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]

Definitions

  • This application relates to the technical field of data processing, in particular to a dynamic code generation method, device, computer equipment and storage medium.
  • Dynamic password is a combination of unpredictable random numbers generated according to a special algorithm. It is also a safe and convenient account anti-theft technology that can effectively protect the authentication security of transactions and logins. It is currently widely used in online banking, online games, telecom operators, and electronics. Application fields such as government affairs and enterprises.
  • the traditional dynamic code digits and effective time are basically fixed, and the generation method is single. If the digits and effective time of the dynamic code need to be adjusted, manual intervention is required.
  • various industries usually adopt dynamic codes when generating dynamic codes. With a fixed code number and effective time, this kind of dynamic code is easy to decipher, has low security and is difficult to guarantee.
  • the main purpose of this application is to provide a dynamic code generation method, device, computer equipment and storage medium, aiming to solve the technical problem of low security of existing dynamic codes.
  • this application proposes a dynamic code generation method, including:
  • the target user token is generated by a preset strategy for generating dynamic codes
  • the first dynamic code is calculated according to the signature in the target user token and the number of bits of the second dynamic code according to a second preset rule, and the valid time of the first dynamic code is the second valid time.
  • This application also provides a dynamic code generation device, including:
  • the statistical probability unit is used to count the first proportion of successful dynamic code authentication for target users within a preset time, and calculate the second proportion of successful dynamic code authentication for all users within the preset time;
  • a difference calculation unit for calculating the difference between the first proportion and the second proportion
  • the judging range unit is used for judging whether the difference is within the value range of the dynamic code that needs to be changed;
  • the change rule unit is used to determine that the difference is within the numerical range of the dynamic code that needs to be changed, obtain the change rule corresponding to the data range, and combine the first dynamic code digits and the first valid number in the target user token
  • the time is changed according to the change rule to obtain the corresponding second dynamic code digits and second valid time, and the target user token is generated by a preset strategy for generating dynamic codes
  • the calculating dynamic code unit is configured to calculate the first dynamic code according to the signature in the target user token and the number of the second dynamic code according to a second preset rule, and the valid time of the first dynamic code is The second valid time.
  • the present application also provides a computer device, including a memory and a processor, the memory stores computer-readable instructions, and the processor implements the steps of the foregoing method when the computer-readable instructions are executed.
  • the present application also provides a computer non-volatile readable storage medium, on which computer readable instructions are stored, and when the computer readable instructions are executed by a processor, the steps of the foregoing method are implemented.
  • the beneficial effects of this application are: intelligently change the digits and effective time of the dynamic code according to preset rules, so that the digits and effective time of the dynamic code are no longer fixed, greatly improving the security of the dynamic code, and No manual intervention is required, manpower is saved, and it is automatically completed by the system, with higher efficiency and better timeliness.
  • FIG. 1 is a schematic diagram of the steps of a dynamic code generation method in an embodiment of this application
  • FIG. 2 is a schematic block diagram of the structure of a dynamic code generating device in an embodiment of the application
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the application.
  • the dynamic code generation method in this embodiment includes:
  • Step S1 Calculate the first proportion of target users who successfully pass the dynamic code authentication within a preset time, and calculate the second proportion of all users who pass the dynamic code authentication successfully within the preset time;
  • Step S2 Calculate the difference between the first proportion and the second proportion
  • Step S3 Determine whether the difference value is within the value range of the dynamic code that needs to be changed
  • Step S4 If yes, obtain the change rule corresponding to the data range, change the first dynamic code number and the first valid time in the target user token according to the change rule to obtain the corresponding second dynamic code point Data and the second valid time to obtain the change rule corresponding to the data range;
  • Step S5 According to the signature in the target user token and the number of second dynamic code bits, the first dynamic code is calculated according to the second preset rule, and the valid time of the first dynamic code is the second Effective time.
  • the target user can perform dynamic code authentication when using the above-mentioned service system, and the dynamic code needs to be obtained before authentication.
  • the specific dynamic code generation process can be completed by the dynamic code generation system.
  • the proportion of successful dynamic code authentication by the target user within the preset time is calculated, that is, the first proportion, for example, by calculating the preset time
  • the ratio of the number of successful authentication of the internal target user to the number of all authentication requests obtains the above-mentioned first proportion.
  • calculate the proportion of all users successfully authenticated by the dynamic code within the preset time that is, the second proportion.
  • comparing the first proportion with the second proportion is to compare the proportion of the target user’s successful dynamic code authentication with the proportion of all users’ successful dynamic code authentication. It is similar, indicating that the target user is relatively stable and its dynamic code does not need to be changed automatically, but the proportion of the first to the second is too high or too low, indicating that it is different from the general level of users, there may be risks, and all need to be improved safety.
  • the above numerical range is a preset range, including a range that does not need to change the dynamic code and a range that needs to be changed. Among the ranges that need to be changed, different numerical ranges correspond to different changing rules. First judge whether the above difference is within the value range of the dynamic code that needs to be changed.
  • the change rule Change the token attribute, that is, change the first dynamic code digits and the first valid time mentioned above.
  • the first proportion is p
  • the second proportion is p1
  • the first valid time is t
  • c is 4 and t is 10s.
  • the number of bits and effective time of the dynamic code will not change.
  • each user corresponds to a unique signature.
  • a string of characters can be randomly generated by a UUID (Universally Unique Identifier) generator, and then a new string can be generated by base64 conversion of the string.
  • the new character string is the aforementioned signature, and the signature is associated with user information (such as user mobile phone number, account number, etc.) and recorded in the user token.
  • the first dynamic code is calculated according to the second preset rule based on the second dynamic code digits and the second valid time in the target user token, and the first dynamic code can be further calculated according to the mobile phone number of the target user. The code is sent to the target user’s mobile phone.
  • the signature and the number of the first dynamic code are directly used to calculate the second dynamic code according to the second preset rule.
  • the valid time corresponding to the second dynamic code is the first valid time.
  • step S5 includes:
  • Step S51 Obtain the second dynamic code digits, the signature, and the first time stamp
  • Step S52 Convert the first time stamp into a binary first time stamp and then shift a specified number of bits in a preset direction to obtain a binary second time stamp;
  • Step S53 Calculate the signature and the second timestamp to obtain a first array through a Mac algorithm
  • Step S54 Perform a bitwise AND operation on the first array and the preset value to obtain a first offset
  • Step S55 Calculate according to the first array and the first offset to obtain a first integer
  • Step S56 Calculate according to the first integer to obtain an initial dynamic code
  • Step S57 Determine whether the number of bits of the initial dynamic code is the number of second dynamic codes
  • Step S58 If yes, set the initial dynamic code as the first dynamic code by default; if not, add a preset number at the preset position of the initial dynamic code until the initial dynamic code of the preset number is added The digits of is consistent with the digits of the second dynamic code, and the initial dynamic code added with the preset number is recorded as the first dynamic code.
  • the second dynamic code digits, signature, and the first time stamp of the dynamic code generation system are obtained from the target user token.
  • the above time stamp means that when digital signature technology is used, the original document Information, signature parameters, signature time, etc. constitute the data generated by the digital signature of the object to prove that the original document has existed before the signature time.
  • the timestamp is from 00: 00: 00 on January 1, 1970 to the current The total number of milliseconds of the time. When calculating the current timestamp, 19700101000000 can be subtracted from the current time.
  • the first time stamp obtained by subtracting 19700101 from the current time is then converted to binary to obtain the first binary time stamp, and then the binary first time stamp is shifted by the specified number of digits in the preset direction to obtain a new
  • the above signature and the second timestamp are calculated by the Mac algorithm to obtain the first array
  • the first array and the first offset are calculated according to the preset formula to obtain the first integer, where the preset formula is as follows:
  • n ((hash[offset]&0x6f) ⁇ 8a)
  • p n%10 ⁇ c, where p is the initial dynamic code, n is the first integer, and c is the second dynamic code digits.
  • the initial dynamic code 696756 is calculated by the second preset formula as the first integer 63696756. .
  • the initial dynamic code As described in the above steps S57 and S58, since the number of digits of the initial dynamic code calculated through the above steps may be inconsistent with the number of the second dynamic code, first determine whether the number of digits of the initial dynamic code is the second dynamic code. , If the digits of the initial dynamic code are exactly the digits of the second dynamic code, the initial dynamic code defaults to the above-mentioned first dynamic code, otherwise, the digits of the initial dynamic code are smaller than the digits of the second dynamic code. You can add a preset number to the preset position of the initial dynamic code until the number of the initial dynamic code with the added preset number is the same as the number of the second dynamic code. For example, add 0 to the starting position of the initial dynamic code 696756, and you can directly Sufficient second dynamic code digits (for example, 7 digits), you get the initial dynamic code 0696756 with the preset number added.
  • step S1 the method includes:
  • Step S01 Receive a dynamic code generation request sent by the target user
  • Step S02 Obtain a corresponding strategy for generating dynamic codes according to the dynamic code generation request
  • Step S03 Determine whether the authentication status of the target user is the authentication locked state according to the strategy
  • Step S04 If the authentication state is not the authentication locked state, then detect whether the automatic change function in the policy has been turned on, and the automatic function is a function of changing the number of bits and the effective time of the dynamic code;
  • Step S05 if the automatic change function in the strategy has been turned on, randomly select whether to enable the automatic change function;
  • Step S06 If the automatic change function is enabled, an instruction to count the first proportion is generated.
  • the above method is implemented by the dynamic code generation system.
  • the dynamic code generation request will be triggered in the above business system and then sent to the dynamic code generation System.
  • the business system used by the target user is recorded as the first business system.
  • the system ID of the first business system can be obtained according to the request.
  • a unique system ID can be set for each business system, and since each business system corresponds to a strategy, These strategies are used to generate dynamic codes.
  • the strategies include information such as the number of dynamic codes, valid time, number of authentication failures, and whether to support automatic changes.
  • the strategy ID can also be set for each strategy.
  • the corresponding strategy ID can be obtained through the system ID, and the strategy can be cached from the database (MongoDB) to the first business system according to the strategy ID, so that the later operation is successful Smoother.
  • the above authentication status includes the authentication locked status that the account is locked after the second authentication fails, and the authentication status that has not yet started or has not been authenticated but failed (at this time due to user misoperation). These statuses are all Recorded in the above strategy. After receiving the dynamic code generation request, judge whether the authentication status of the target has been locked according to the record in the strategy. If it is locked, end the dynamic code generation request. If it is pending authentication Status, continue to the next step.
  • the developer can set the automatic change function of the strategy for different business systems.
  • the automatic function is the function of changing the number of bits and the effective time of the dynamic code.
  • the automatic change function can be selected to be turned on or off. If you choose to enable this automatic change function, the developer can enter the dynamic code digits and the change range parameters of the effective time. For example, if you enter 4 ⁇ dynamic code digits ⁇ 8, 2 ⁇ effective time ⁇ 30, etc., the function is being generated Compared with the dynamic code generated last time, the digits and effective time of the dynamic code can be different. If the developer chooses to turn off the automatic change function, the digits and effective time of the dynamic code finally generated by the dynamic code generation system will not be the same. Changes. As described in the above step S04, after the authentication status is determined to be, the dynamic code generation system detects the above strategy to check whether the automatic change function in the above strategy has been activated.
  • the automatic change function in order to further improve the security of the dynamic code and further prevent the dynamic code from being deciphered, after the automatic change function is turned on, it can enter the random activation state, that is, whether to enable the automatic change function at random, for example, first Setting a probability of 50% will enable the automatic change function, that is, after the automatic change function is turned on, there will be a 50% possibility that the first dynamic code (digits and valid time and previous) will be generated according to the strategy of the automatic change function. There is a change compared to the first time), but there is also a 50% chance that a fixed dynamic code will be directly generated according to the second preset rule (the number of bits and the effective time are unchanged compared to the previous time).
  • the dynamic code generation system When the automatic change function is enabled according to random selection, the dynamic code generation system will generate an instruction to count the first proportion. According to the instruction, count the first proportion of successful dynamic code authentication by the target user within a preset time, and then follow the steps The steps S2-S5 are executed to obtain the first dynamic code.
  • step S04 after the above step S04, it includes:
  • Step S040 If the automatic change function in the policy is not enabled, the second dynamic code is calculated according to the second preset rule according to the signature and the first dynamic code number, and the first dynamic code The effective time of the second dynamic code is the first effective time.
  • the automatic change function in the strategy can be turned on or off, when it is detected that the automatic change function is not turned on, it means that the number of digits and valid time of the generated dynamic code are the same as the last time, and there is no need to change it.
  • the calculation is performed according to the above-mentioned second preset rule.
  • the calculation process according to the second preset rule refers to the above-mentioned steps S51-S58, and finally the second For dynamic codes, the effective time is the first effective time that has not been changed.
  • step S03 includes:
  • Step S031 query whether the target user token already exists according to the policy ID of the policy and the user information of the target user;
  • Step S032 If not, generate the target user token corresponding to the user information, and record the initial dynamic code digits, the initial valid time and the signature of the target user in the target user order in the policy And record the initial dynamic code digits as the first dynamic code digits, and the initial effective time as the first effective time;
  • Step S033 If yes, detect the authentication status of the target user in the target user token, where the authentication status includes pending authentication and authentication locked.
  • a user sends a dynamic code request through the first service system, for example, a dynamic code request sent when the user logs in to the first service system, and the user is not necessarily an existing user of the first service system. It may also be a newly registered user.
  • the strategy it is necessary to query whether the target user token corresponding to the target user exists. Since each business system can correspond to a strategy and a strategy can correspond to multiple users, the query is based on the strategy ID and the user information of the target user. Whether there is a target user token, where the user information can be the user's mobile phone number or account number, etc., used to indicate the identity of the target user.
  • step S032 when the target user token is found, there is no need to create the token, and it can be used directly.
  • the target user token is not found, it means that the target user is a new user.
  • the user creates a token and associates the token with the user information of the target user.
  • the UUID generator randomly generates a signature corresponding to the target user based on the user's information, and then records the initial dynamic code digits, initial valid time and signature to the In the token, the initial dynamic code digits and the initial valid time here are the first dynamic code digits and the first valid time.
  • step S033 when the target user token is queried, it indicates that the target user is an old user and has been registered or used in the first business system.
  • the authentication status in the target user token can be detected, and it is known
  • the authentication status includes the authentication locked status that the account is locked after the second authentication failure, and the authentication status that has not yet started or the authentication is not many but failed (at this time due to user misoperation). These statuses are recorded in the above command.
  • the authentication status is authentication locked, the system directly ends the request to prevent the user account from being stolen.
  • the authentication status is pending authentication, the above steps S04-S06 can be executed.
  • step S033 includes:
  • Step S0331 Obtain the number of authentication failures of the target user within a preset time
  • Step S0332 Determine whether the number of authentication failures is greater than a preset number
  • Step S0332 If yes, it is determined that the authentication status is that the authentication is locked; if not, it is determined that the authentication status is the pending authentication.
  • the authentication status can be determined by the number of authentication failures. For example, if the number of authentication failures exceeds 3 in 30 minutes, the first business system is Lock the target user’s account, that is, the preset number of times is 3 times. When the target user initiates a request again, the dynamic code generation system will obtain the number of authentication failures of the target user within 30 minutes, such as 4 times, and compare the number of authentication failures with the expected Set the number of times, it can be determined that the authentication is also locked, that is, the authentication status is authentication locked. If the number of times the target user is identified is 2, then the authentication status can be determined to be authentication pending, and then the above steps S04-S06 can be performed.
  • the dynamic code generating device in this embodiment includes:
  • the statistical probability unit 100 is configured to count the first proportion of the target users successfully passing the dynamic code authentication within a preset time, and to calculate the second proportion of all users successfully passing the dynamic code authentication within the preset time;
  • the difference calculating unit 200 is configured to calculate the difference between the first proportion and the second proportion
  • the judging range unit 300 is used to judge whether the difference is within the value range of the dynamic code that needs to be changed;
  • the modification rule unit 400 is used to determine that the difference is within the numerical range of the dynamic code that needs to be changed, obtain the modification rule corresponding to the data range, and combine the first dynamic code digits in the target user token and the first
  • the effective time is changed according to the change rule to obtain the corresponding second dynamic code digits and the second effective time, and the target user token is generated by a preset strategy for generating dynamic codes;
  • the dynamic code calculation unit 500 is configured to calculate the first dynamic code according to the signature in the target user token and the number of the second dynamic code according to a second preset rule, and the validity time of the first dynamic code Is the second valid time.
  • the above calculation dynamic code unit 500 includes:
  • the number of bits obtaining subunit is used to obtain the number of bits of the second dynamic code, the signature and the first time stamp;
  • the bit shift subunit is used to convert the first time stamp into a binary first time stamp and then shift a specified bit in a preset direction to obtain a binary second time stamp;
  • An arithmetic array subunit configured to perform a Mac algorithm on the signature and the second time stamp to obtain the first array
  • the bitwise calculation subunit is used to perform a bitwise AND operation between the first array and the preset value to obtain the first offset;
  • a first calculation subunit configured to calculate a first integer according to the first array and the first offset
  • the second calculation subunit is used to calculate the initial dynamic code according to the first integer
  • the number of bits determining subunit is used to determine whether the number of bits of the initial dynamic code is the number of second dynamic codes
  • the initial dynamic code is Add a digital subunit to determine that the number of bits of the initial dynamic code is the number of second dynamic codes, then the initial dynamic code is defaulted to the first dynamic code, if not, then the initial dynamic code is Add a preset number to the preset position of the preset number until the number of digits of the initial dynamic code of the added preset number is consistent with the number of digits of the second dynamic code, and the initial dynamic code after adding the preset number is recorded as the first dynamic code code.
  • the first array and the first offset are calculated according to a preset formula to obtain a first integer, where the preset formula is as follows:
  • n ((hash[offset]&0x6f) ⁇ 8a)
  • p n%10 ⁇ c, where p is the initial dynamic code, n is the first integer, and c is the number of bits of the second dynamic code.
  • the above-mentioned dynamic code generation device includes:
  • the receiving request unit is used to receive the dynamic code generation request sent by the target user
  • An acquiring strategy unit configured to acquire a corresponding strategy for generating dynamic codes according to the dynamic code generation request
  • the judging state unit is used to judge whether the authentication state of the target user is the authentication locked state according to the strategy
  • the detection function unit is used to detect whether the automatic change function in the strategy has been turned on when the authentication state is not the authentication locked state, and the automatic function is a function of changing the number of bits and the effective time of the dynamic code ;
  • the enabling function subunit is used to randomly select whether to enable the automatic change function when the automatic change function in the strategy has been enabled;
  • the generating instruction unit is configured to generate an instruction to count the first proportion when the automatic change function is enabled.
  • the above-mentioned dynamic code generation device includes:
  • the dynamic code calculation unit is used to calculate the second dynamic code according to the second preset rule according to the signature and the first dynamic code number if the automatic change function in the strategy is not enabled ,
  • the effective time of the second dynamic code is the first effective time.
  • the above judgment status unit includes:
  • the query token subunit is used to query whether the target user token already exists according to the policy ID of the policy and the user information of the target user;
  • the recording token subunit is used to generate the target user token corresponding to the user information when the target user token cannot be found, and to set the initial dynamic code number and the initial effective time in the strategy And the signature of the target user is recorded in the target user token, and the initial dynamic code digits are recorded as the first dynamic code digits, and the initial valid time is recorded as the first valid time;
  • the detection status subunit is used for querying the existing target user token and detecting the authentication status of the target user in the target user token, where the authentication status includes pending authentication and authentication locked.
  • the above detection status subunit includes:
  • the obtaining times module is used to obtain the authentication failure times of the target user within a preset time
  • the judging frequency module is used to judge whether the number of authentication failures is greater than the preset number
  • the determination status module is used to determine that the number of authentication failures is greater than the preset number of times, and then determine that the authentication status is the authentication locked, and if not, determine that the authentication status is the pending authentication.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in FIG. 3.
  • the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
  • the memory provides an environment for the operation of the operating system and computer readable instructions in the non-volatile storage medium.
  • the database of the computer equipment is used to store all the data needed to generate dynamic codes.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer-readable instructions are executed by the processor to realize a dynamic code generation method.
  • the above-mentioned processor executes the steps of the above-mentioned dynamic code generation method: counting the first proportion of target users who successfully pass the dynamic code authentication within a preset time, and calculating the second proportion of all users who have successfully passed the dynamic code authentication within the preset time Accounted for; calculate the difference between the first accounted for and the second accounted for; determine whether the difference is within the value range of the dynamic code that needs to be changed; if so, obtain the change rule corresponding to the data range, and The first dynamic code digits and the first valid time in the target user token are changed according to the change rule to obtain the corresponding second dynamic code digits and the second valid time.
  • the target user token is used by the preset For generating the dynamic code strategy; according to the signature in the target user token and the second dynamic code digits, the first dynamic code is calculated according to the second preset rule, and the validity time of the first dynamic code Is the second valid time.
  • the step of calculating the first dynamic code according to the second preset rule based on the signature and the second dynamic code number includes: obtaining the second dynamic code number, the signature, and A first time stamp; after converting the first time stamp into a binary first time stamp, shifting a specified number of bits in a preset direction to obtain a binary second time stamp; pass the Mac to the signature and the second time stamp
  • the algorithm performs an operation to obtain a first array; performs a bitwise AND operation on the first array and a preset value to obtain a first offset; calculates according to the first array and the first offset to obtain a first integer Calculate according to the first integer to obtain the initial dynamic code; determine whether the number of bits of the initial dynamic code is the number of second dynamic code bits; if so, the initial dynamic code is defaulted to the first dynamic code, If not, add a preset number to the preset position of the initial dynamic code until the number of digits of the initial dynamic code to which the preset number is added is consistent with the number of digits
  • the method before the step of counting the first proportion of successful dynamic code authentication of the target user within a preset time, includes: receiving a dynamic code generation request sent by the target user; obtaining the corresponding dynamic code according to the dynamic code generation request.
  • the strategy for generating dynamic codes judging whether the authentication status of the target user is the authentication locked state according to the strategy; if the authentication status is not the authentication locked state, then detecting the automatic in the strategy Whether the change function has been turned on, the automatic function is the function of changing the number of bits and the effective time of the dynamic code; if the automatic change function in the strategy has been turned on, whether to enable the automatic change function is randomly selected; if When the automatic change function is enabled, an instruction to count the first proportion is generated.
  • the step of detecting whether the automatic change function in the policy has been turned on it includes: if the automatic change function in the policy is not turned on, then according to the signature and the first dynamic code The number of bits is calculated according to the second preset rule to obtain the second dynamic code, and the valid time of the second dynamic code is the first valid time.
  • the step of judging whether the authentication status of the target user is locked according to the policy includes: querying whether the target user already exists according to the policy ID of the policy and the user information of the target user Token; if not, generate the target user token corresponding to the user information, and record the initial dynamic code digits, the initial valid time, and the signature of the target user in the policy to the target user order And record the initial dynamic code digits as the first dynamic code digits, and the initial valid time as the first valid time; if so, detect the authentication status of the target user in the target user token, Wherein, the authentication status includes pending authentication and authentication locked.
  • FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • An embodiment of the present application also provides a computer non-volatile readable storage medium, on which computer readable instructions are stored, and when the computer readable instructions are executed by a processor, a dynamic code generation method is implemented, specifically: a statistical target The first percentage of users who successfully passed the dynamic code authentication within the preset time, and the second percentage of all users who successfully passed the dynamic code authentication within the preset time; calculate the first percentage and the second percentage Determine whether the difference is within the value range of the dynamic code that needs to be changed; if so, obtain the change rule corresponding to the data range, and combine the first dynamic code digits and the first dynamic code digits in the target user token A valid time is changed according to the change rule to obtain the corresponding second dynamic code digits and second valid time, the target user token is generated by a preset strategy for generating dynamic codes; according to the target user order The signature in the card and the number of bits of the second dynamic code are calculated according to a second preset rule to obtain the first dynamic code, and the valid time of the first dynamic code is the
  • the step of calculating the first dynamic code according to the second preset rule based on the signature and the number of second dynamic code includes: obtaining the second dynamic code The number of bits, the signature, and the first time stamp; the first time stamp is converted into a binary first time stamp and then the specified number of bits is shifted in the preset direction to obtain a binary second time stamp; the signature and the first time stamp are The second timestamp is operated by the Mac algorithm to obtain the first array; the bitwise AND operation is performed on the first array and the preset value to obtain the first offset; according to the first array and the first offset Calculate the quantity to obtain a first integer; calculate according to the first integer to obtain the initial dynamic code; determine whether the number of bits of the initial dynamic code is the second number of dynamic codes; if so, set the initial dynamic code to The first dynamic code, if not, add a preset number to the preset position of the initial dynamic code until the number of digits of the initial dynamic code to which the
  • the method before the step of counting the first proportion of successful dynamic code authentication of the target user within a preset time, includes: receiving a dynamic code generation request sent by the target user; obtaining the corresponding dynamic code according to the dynamic code generation request.
  • the strategy for generating dynamic codes judging whether the authentication status of the target user is the authentication locked state according to the strategy; if the authentication status is not the authentication locked state, then detecting the automatic in the strategy Whether the change function has been turned on, the automatic function is the function of changing the number of bits and the effective time of the dynamic code; if the automatic change function in the strategy has been turned on, whether to enable the automatic change function is randomly selected; if When the automatic change function is enabled, an instruction to count the first proportion is generated.
  • the step of detecting whether the automatic change function in the policy has been turned on it includes: if the automatic change function in the policy is not turned on, then according to the signature and the first dynamic code The number of bits is calculated according to the second preset rule to obtain the second dynamic code, and the valid time of the second dynamic code is the first valid time.
  • the step of judging whether the authentication status of the target user is locked according to the policy includes: querying whether the target user already exists according to the policy ID of the policy and the user information of the target user Token; if not, generate the target user token corresponding to the user information, and record the initial dynamic code digits, the initial valid time, and the signature of the target user in the policy to the target user order And record the initial dynamic code digits as the first dynamic code digits, and the initial valid time as the first valid time; if so, detect the authentication status of the target user in the target user token, Wherein, the authentication status includes pending authentication and authentication locked.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

本申请提出的基于数据处理的动态码生成方法、装置、计算机设备和存储介质,其中方法包括:统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在预设时间内通过动态码认证成功的第二占比;计算第一占比与第二占比的差值;判断差值是否处于需要变更动态码的数值范围内;若是,将目标用户令牌中的第一动态码位数和第一有效时间按对应数据范围的更改规则进行更改,得到对应的第二动态码位数和第二有效时间;依据目标用户令牌中的签名以及第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为第二有效时间,这样使得动态码的位数以及有效时间都不再固定,大大地提高了动态码的安全性。

Description

动态码生成方法、装置、计算机设备和存储介质
本申请要求于2019年3月8日提交中国专利局、申请号为201910175741.6,申请名称为“动态码生成方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及到数据处理的技术领域,特别是涉及到一种动态码生成方法、装置、计算机设备和存储介质。
背景技术
动态密码是根据专门的算法生成一个不可预测的随机数字组合,也是一种安全便捷的帐号防盗技术,可以有效保护交易和登录的认证安全,目前被广泛运用在网银、网游、电信运营商、电子政务、企业等应用领域。
传统的动态码位数、有效时间基本固定,产生方式单一,若需要调整动态码的位数和有效时间,则需要人工进行干预,而各行业通常会为了节省资源,在生成动态码时采用动态码位数与有效时间固定的生产方式,该种动态码容易被破译,安全性较低,难以得到保障。
发明内容
本申请的主要目的为提供一种动态码生成方法、装置、计算机设备和存储介质,旨在解决现有动态码安全性较低的技术问题。
基于上述发明目的,本申请提出一种动态码生成方法,包括:
统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
计算所述第一占比与第二占比的差值;
判断所述差值是否处于需要变更动态码的数值范围内;
若是,则获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;
依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
本申请还提供一种动态码生成装置,包括:
统计概率单元,用于统计目标用户在预设时间内通过动态码认证成功的第一占比,以 及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
计算差值单元,用于计算所述第一占比与第二占比的差值;
判断范围单元,用途于判断所述差值是否处于需要变更动态码的数值范围内;
更改规则单元,用于判定所述差值处于需要变更动态码的数值范围内时,获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;
计算动码单元,用于依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
本申请还提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现上述方法的步骤。
本申请还提供了一种计算机非易失性可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述方法的步骤。
本申请的有益效果为:根据预设规则智能地对动态码的位数和有效时间进行更改,使得动态码的位数以及有效时间都不再固定,大大地提高了动态码的安全性,且无需人工干预,节省人力,由系统自动完成,效率更高,时效性也更好。
附图说明
图1为本申请一实施例中动态码生成方法的步骤示意图;
图2为本申请一实施例中动态码生成装置的结构示意框图;
图3为本申请一实施例的计算机设备的结构示意框图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
参照图1,本实施例中的动态码生成方法,包括:
步骤S1:统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
步骤S2:计算所述第一占比与所述第二占比的差值;
步骤S3:判断所述差值是否处于需要变更动态码的数值范围内;
步骤S4:若是,则获取对应所述数据范围的更改规则,将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,获取对应所述数据范围的更改规则;
步骤S5:依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
可以理解的是,在一个公司的互联网构架中,可能会存在多个不同业务系统,例如一家银行,其客户会使用保险系统完成查询、投保等一系列操作,会使用交易系统进行投资、取款等等一系列操作。而为了用户的账户安全,一般情况下用户想要在业务系统中进行操作之前需要进行身份验证,用户通过发送动态码生成请求,以获取动态码进行认证,本申请并不限制生成动态码的应用场景。现有技术中,动态码为固定的位数以及固定有效时间,安全性不高,本申请提供的方法可以实现可变的位数以及可变的有效时间,即用户每一次的请求得到的动态码的位数和有效时间都可能不一样,大大地提高了安全性。
本实施例中,目标用户可在使用上述业务系统时进行动态码认证,在认证之前需获取到动态码。具体生成动态码过程可通过动态码生成系统来完成,如上述步骤S1所述,统计目标用户在预设时间内通过动态码认证成功的占比,即第一占比,例如通过计算预设时间内目标用户认证成功的次数与所有请求认证的次数的比值得到上述第一占比。同时计算所有用户在该预设时间内通过动态码认证成功的占比,即第二占比,例如计算在预设时间内所有用户认证成功的次数与所有请求认证的次数的比值,然后计算第一占比和第二占比的差值,这样就可以通过比较目标用户和所有用户的差别来确定目标用户是不是稳定的用户,是不是安全性在普遍水平的用户,上述所有用户是指采用上述动态码生成系统来完成动态码认证的全部用户。
如上述步骤S3和步骤S4所述,将第一占比与第二占比进行比较,即是将目标用户的动态码认证成功占比与所有用户的动态码认证成功占比进行比较,若两者差不多,表明该目标用户较为稳定,其动态码不需要自动变化,但是第一占比比第二占比过高或过低,都说明与普遍水平的用户有差别,可能存在风险,都需要提高安全性。上述数值范围为预设的范围,包括不需要变更动态码的范围以及需要变更动态码的范围,其中对于需要变更动态码的范围中,不同的数值范围对应不同的更改规则。首先判断上述差值是否处在需要变更动态码的数值范围内,若上述差值落在需要变更动态码的数值范围内,则可获取对应该数值范围的更改规则,然后按照该更改规则来进行更改令牌属性,即更改上述第一动态码位数和第一有效时间。例如,第一占比为p,第二占比为p1,第一有效时间为t,第一动态码位数为c,若差值处于大于0.2的数值范围时,更改规则为c=c-1,t=t-0.5;当差值处于小于-0.2的数值范围时,对应的更改规则为c=c+1,t=t+0.5,而差值处于-0.2至0.2之间时,则可判断不需要对动态码进行变更。在一具体例子中c为4,t为10s,当p-p1>0.2时,则通过更改规则计算得到c=3,t=9.5s;当p-p1<-0.2,则通过更改规则计算得到c=5, t=10.5s。其中,当p-p1处于-0.2到0.2之间,则动态码的位数和有效时间不发生变化。另外,由于预先设定了变化范围,例如4<c<8、2<t<30,则当c或t达到了变化范围的临界值之后,只能取其临界值,这样动态码的位数和有效时间不会出现无限变大或变小。
如上述步骤S5所述,每个用户对应唯一的签名,首先可通过UUID(Universally Unique Identifier,通用唯一识别码)生成器随机生成一串字符串,然后通过对该字符串进行base64转换,生成新的字符串,该新的字符串即为上述签名,并该签名与用户信息(如用户手机号码、账号等)关联,记录到用户令牌中。本实施例中,通过目标用户令牌中的第二动态码位数和第二有效时间按第二预设规则计算得到上述第一动态码,进一步可依据目标用户的手机号码将该第一动态码发送到目标用户的手机。
在另一个实施例中,当依据上述差值所处的数值范围对应为不需要变更动态码,则直接使用签名以及第一动态码位数按照第二预设规则进行计算得到第二动态码,该第二动态码对应的有效时间为第一有效时间。
其中,按照第二预设规则生成动态码的步骤如下,即上述步骤S5,包括:
步骤S51:获取所述第二动态码位数、所述签名以及第一时间戳;
步骤S52:将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;
步骤S53:对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;
步骤S54:将所述第一数组与预设数值进行按位与运算得到第一偏移量;
步骤S55:依据所述第一数组和所述第一偏移量进行计算得到第一整数;
步骤S56:依据所述第一整数进行计算得到初始动态码;
步骤S57:判断所述初始动态码的位数是否为第二动态码位数;
步骤S58:若是,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
如上述步骤S51及S52所述,从目标用户令牌中获取第二动态码位数、签名,以及动态码生成系统的第一时间戳,上述时间戳是指使用数字签名技术时,对原始文件信息、签名参数、签名时间等构成的对象进行数字签名而产生的数据,用以证明原始文件在签名时间之前已经存在,时间戳是自1970年01月01日00时00分00秒起至当前时间的总毫秒数,计算当前时间戳时可将当前时间减去19700101000000。本实施例中,将当前时间减去19700101得到的上述第一时间戳,然后转换成二进制,得到上述二进制第一时间戳,然后将二进制第一时间戳向预设方向位移指定的位数得到新的二进制时间戳,即上述二进 制第二时间戳,例如,将第一时间戳向左移12位得到上述第二时间戳(new_time=time<<12)。
如上述步骤S53以及S54所述,对上述签名和第二时间戳通过Mac算法进行运算,得到第一数组,表达式如下:bytes[]hash=mac(seed,new_time),其中bytes[]hash为上述第一数组,seed为上述签名,new_time为上述第二时间戳,而Mac算法为现有技术,这里计算过程不再赘述。得到上述第一数组之后,将第一数组和预设数值进行按位与运算得到上述第一偏移量,例如将第一数组和18进行按位与运算,表达式如下:offset=hash&18,其中,offset为第一偏移量,hash为上述第一数组。
如上述步骤S55及S56所述,将第一数组和第一偏移量按预设公式进行计算得到第一整数,其中,预设公式如下:
n=((hash[offset]&0x6f)<<8a)|((hash[offset+2]&0x7f)<<4a)|((hash[offset+4]&0x8f)<<2a),其中n为上述第一整数,a为自然整数数值(如1或2),0x6f、0x7f、0x8f为16进制数。
如上述a为2,第一偏移量为6时,先在上述第一数组中取第6个数据:hash[offset],然后与十六进制数0x6f进行按位与计算,再向左移16位数得到一个数值;在上述第一数组中取第8(offset+2)个数据:hash[offset+2],然后与十六进制数0x7f进行按位与计算,再向左移8位得到一个数值;在上述第一数组中取第10(offset+4)个数据,然后与十六进制数0x8f进行按位与计算,再向左移4位得到一个数值,然后将这三个数值进行按位或运算,即将这三个数值按二进制进行“或”运算,最后得到上述第一整数,如计算得到一个整数63696756,然后将第一整数进行计算得到初始动态码,例如将第一整数求余得到初始动态码,则可利用如下公式:
p=n%10^c,其中p为初始动态码,n为第一整数,c为所述第二动态码位数,如上述第一整数63696756通过第二预设公式计算得到初始动态码696756。
如上述步骤S57及S58所述,由于通过上述步骤计算得到的初始动态码的位数可能与上述第二动态码位数不一致,故而先判断初始动态码的位数是否为第二动态码位数,若初始动态码的位数恰好为第二动态码位数,则该初始动态码默认为上述第一动态码,否则,即初始动态码的位数比第二动态码位数小,这时可在初始动态码的预设位置添加预设数字,直至添加预设数字的初始动态码的位数与第二动态码位数一致,例如在初始动态码696756的起始位置加0,直接补够第二动态码位数(如7位),即得到添加预设数字的初始动态码0696756。
在一个实施例中,上述步骤S1之前,包括:
步骤S01:接收目标用户发送的动态码生成请求;
步骤S02:依据所述动态码生成请求获取对应的用于生成动态码的策略;
步骤S03:依据所述策略判断所述目标用户的认证状态是否为认证已被锁定状态;
步骤S04:若所述认证状态不为认证已被锁定状态,则检测所述策略中的自动变化功能是否已被开启,所述自动化功能为变更动态码的位数以及有效时间的功能;
步骤S05:若所述策略中的自动变化功能已被开启,则通过随机选择是否启用所述自动变化功能;
步骤S06:若启用所述自动变化功能,则生成统计所述第一占比的指令。
如上述步骤S01及S02所述,上述方法通过动态码生成系统实现,当目标用户在上述业务系统进行对应的操作,会在上述业务系统中触发动态码生成请求,然后发送至所述动态码生成系统,为了便于描述,本实施例中将目标用户使用的业务系统记作第一业务系统,动态码生成系统接收到该请求之后,由于该请求中包含有第一业务系统以及目标用户的信息,则可依据该请求得到第一业务系统的系统ID,本实施例中,为了区别每一个业务系统,可对每一业务系统进行设定唯一的系统ID,且由于每个业务系统对应一个策略,这些策略用于生成动态码,策略中包括有动态码位数、有效时间、认证失败次数、是否支持自动变化等信息。当然,也可以对每一个策略进行设定策略ID,这时可通过系统ID获得对应的策略ID,根据策略ID从数据库(MongoDB)中将该策略缓存至第一业务系统,这样使得后期运行得更畅顺。
如上述步骤S03所述,由于当前目标用户发送来的动态码认证请求,有可能是在多次认证失败的基础上发送过来的,而多次认证失败说明目标用户可能不是本人操作,存在极大风险,故上述认证状态包括对次认证失败之后账号被锁定的认证已锁定状态,以及还没有开始认证或者认证次数不多但失败(这时由于用户误操作造成)的待认证状态,这些状态均记录在上述策略当中,当接收到动态码生成请求之后,依据策略中的记录,判断目标用的认证状态是否已被锁定,若已被锁定,则结束该次动态码生成请求,若为待认证状态,则继续下一步。
本实施例中,开发人员可以针对不同的业务系统设置策略的自动变化功能,该自动化功能为变更动态码的位数以及有效时间的功能,如可以选择开启或者关闭该自动变化功能,若开发人员选择开启这个自动变化功能,则开发人员可输入动态码位数和有效时间的变化范围参数,如输入4<动态码位数<8、2<有效时间<30等,该功能即为在生成的动态码与上次生成动态码相比,其位数和有效时间均可不相同的,若开发人员选择关闭该自动变化功能,则动态码生成系统最终生成的动态码的位数和有效时间不会发生变化。如上述步骤 S04所述,当判定认证状态为之后,动态码生成系统对上述策略进行检测,查看上述策略中的自动变化功能是否已被开启。
如上述步骤S05-S06所述,为了进一步提高动态码的安全性,进一步防止破译动态码,在开启上述自动变化功能之后,可进入随机启用状态,即随机选择是否启用自动变化功能,例如,先设定50%的概率会进行启用自动变化功能,即开启了自动变化功能之后,会有50%的可能性会依据自动变化功能的策略来生成上述第一动态码(位数和有效时间与前一次相比有变化),但是也有50%的可能会直接按第二预设规则生成固定的动态码(位数和有效时间与前一次相比没有变化)。当按随机选择启用了自动变化功能,那么动态码生成系统会生成统计第一占比的指令,依据该指令统计目标用户在预设时间内通过动态码认证成功的第一占比,再按照步骤S2-S5的步骤执行,从而得到第一动态码。
在一个实施例中,上述步骤S04之后,包括:
步骤S040:若所述策略中的自动变化功能未开启,则依据所述签名和所述第一动态码位数按照所述第二预设规则进行计算得到所述第二动态码,所述第二动态码的有效时间为所述第一有效时间。
本实施例中,由于策略中的自动变化功能可以开启或者关闭,当检测到自动变化功能未开启时,即表明生成的动态码的位数和有效时间与上一次一样,无需作改变,即可直接依据上述签名和没有更改的第一动态码位数作为计算参数,按照上述第二预设规则进行计算,其中,按第二预设规则计算的过程参照上述步骤S51-S58,最终得到第二动态码,其有效时间为没有更改过的第一有效时间。
在一个实施例中,上述步骤S03,包括:
步骤S031:依据所述策略的策略ID以及目标用户的用户信息查询是否已存在所述目标用户令牌;
步骤S032:若否,则对应所述用户信息生成所述目标用户令牌,并将所述策略中的初始动态码位数、初始有效时间以及所述目标用户的签名记录到所述目标用户令牌,并将所述初始动态码位数记为所述第一动态码位数,初始有效时间记为所述第一有效时间;
步骤S033:若是,检测所述目标用户令牌中目标用户的认证状态,其中,所述认证状态包括待认证以及认证已锁定。
本实施例中,已知的是,用户通过第一业务系统发送动态码请求,例如用户登录第一业务系统时发送的动态码请求,该用户并不一定是第一业务系统已有的用户,也有可能是新注册的用户,这时动态码生成系统中并没有用户的信息,对应的策略中也没有对应该用户的签名等。故而在获取了策略之后,要查询对应目标用户的目标用户令牌是否存在,由 于每个业务系统可对应一个策略,一个策略可对应多个用户,故而依据策略ID和目标用户的用户信息来查询是否存在目标用户令牌,其中用户信息可以为用户的手机号码或者账号等,用于表明目标用户的身份。
如上述步骤S032所述,当查询到已存在目标用户令牌,则无需建立令牌,直接使用即可,当没有查询到目标用户令牌,说明目标用户是新的用户,这时需要针对目标用户建立令牌,且将该令牌关联目标用户的用户信息,同时依据用户的信息通过UUID生成器随机生成对应目标用户的签名,然后将初始动态码位数、初始有效时间以及签名记录到该令牌中,而此处的初始动态码位数和初始有效时间即为上述第一动态码位数和第一有效时间。
如上述步骤S033所述,当查询到目标用户令牌,即表明目标用户是老用户,已经在该第一业务系统注册或者使用过,这时可检测目标用户令牌中的认证状态,已知认证状态包括对次认证失败之后账号被锁定的认证已锁定状态,以及还没有开始认证或者认证次数不多但失败(这时由于用户误操作造成)的待认证状态,这些状态均记录在上述令牌当中。当认证状态为认证已锁定,那么系统直接结束该次请求,避免用户账号被盗用。当认证状态为待认证,那么可执行上述步骤S04-S06。
在一个实施例中,上述步骤S033,包括:
步骤S0331:获取所述目标用户在预设时间内的认证失败次数;
步骤S0332:判断所述认证失败次数是否大于预设次数;
步骤S0332:若是,则判定所述认证状态为所述认证已锁定,若否,在判定所述认证状态为所述待认证。
本实施例中,由于认证状态包括认证已锁定以及待认证,本实施例中,可通过认证失败次数来判定认证的状态,例如在30分钟内认证失败的次数超过3次,第一业务系统即锁定目标用户的账号,即预设次数为3次,当目标用户再次发起请求时,动态码生成系统会获取目标用户在30分钟内认证失败的次数,如4次,然后对比认证失败次数和预设次数,则可判定认证同样被锁定,即认证状态为认证已锁定,若目标用户识别的次数为2次,那么可判定认证状态为待认证,这时可执行上述步骤S04-S06。
参照图2,本实施例中动态码生成装置,包括:
统计概率单元100,用于统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
计算差值单元200,用于计算所述第一占比与第二占比的差值;
判断范围单元300,用途于判断所述差值是否处于需要变更动态码的数值范围内;
更改规则单元400,用于判定所述差值处于需要变更动态码的数值范围内时,获取对 应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;
计算动码单元500,用于依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
其中,上述计算动码单元500,包括:
获取位数子单元,用于获取所述第二动态码位数、所述签名以及第一时间戳;
位移位数子单元,用于将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;
运算数组子单元,用于对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;
按位计算子单元,用于将所述第一数组与预设数值进行按位与运算得到第一偏移量;
第一计算子单元,用于依据所述第一数组和所述第一偏移量进行计算得到第一整数;
第二计算子单元,用于依据所述第一整数进行计算得到初始动态码;
判断位数子单元,用于判断所述初始动态码的位数是否为第二动态码位数;
添加数字子单元,用于判定所述初始动态码的位数为第二动态码位数,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
如上述第一计算子单元及第二计算子单元所述,将第一数组和第一偏移量按预设公式进行计算得到第一整数,其中,预设公式如下:
n=((hash[offset]&0x6f)<<8a)|((hash[offset+2]&0x7f)<<4a)|((hash[offset+4]&0x8f)<<2a),其中n为上述第一整数,a为自然整数数值(如1),0x6f、0x7f、0x8f为16进制数。
将第一整数进行计算得到初始动态码,例如将第一整数求余得到初始动态码,则可利用如下公式:
p=n%10^c,其中p为初始动态码,n为第一整数,c为所述第二动态码位数。
在一个实施例中,上述动态码生成装置,包括:
接收请求单元,用于接收目标用户发送的动态码生成请求;
获取策略单元,用于依据所述动态码生成请求获取对应的用于生成动态码的策略;
判断状态单元,用于依据所述策略判断所述目标用户的认证状态是否为认证已被锁定状态;
检测功能单元,用于所述认证状态不为认证已被锁定状态时,则检测所述策略中的自动变化功能是否已被开启,所述自动化功能为变更动态码的位数以及有效时间的功能;
启用功能子单元,用于所述策略中的自动变化功能已被开启时,则通过随机选择是否启用所述自动变化功能;
生成指令单元,用于启用所述自动变化功能时,生成统计所述第一占比的指令。
在一个实施例中,上述动态码生成装置,包括:
计算动码单元,用于若所述策略中的自动变化功能未开启,则依据所述签名和所述第一动态码位数按照所述第二预设规则进行计算得到所述第二动态码,所述第二动态码的有效时间为所述第一有效时间。
在一个实施例中,上述判断状态单元,包括:
查询令牌子单元,用于依据所述策略的策略ID以及目标用户的用户信息查询是否已存在所述目标用户令牌;
记录令牌子单元,用于在查询不到已存在所述目标用户令牌,则对应所述用户信息生成所述目标用户令牌,并将所述策略中的初始动态码位数、初始有效时间以及所述目标用户的签名记录到所述目标用户令牌,并将所述初始动态码位数记为所述第一动态码位数,初始有效时间记为所述第一有效时间;
检测状态子单元,用于用于在查询已存在所述目标用户令牌,检测所述目标用户令牌中目标用户的认证状态,其中,所述认证状态包括待认证以及认证已锁定。
在一个实施例中,上述检测状态子单元,包括:
获取次数模块,用于获取所述目标用户在预设时间内的认证失败次数;
判断次数模块,用于判断所述认证失败次数是否大于预设次数;
判定状态模块,用于判断所述认证失败次数大于预设次数,则判定所述认证状态为所述认证已锁定,若否,在判定所述认证状态为所述待认证。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储生成动态码所需的所有数据。该计算机设备的 网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种动态码生成方法。
上述处理器执行上述动态码生成方法的步骤:统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;计算所述第一占比与第二占比的差值;判断所述差值是否处于需要变更动态码的数值范围内;若是,则获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
上述计算机设备,上述依据所述签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码的步骤,包括:获取所述第二动态码位数、所述签名以及第一时间戳;将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;将所述第一数组与预设数值进行按位与运算得到第一偏移量;依据所述第一数组和所述第一偏移量进行计算得到第一整数;依据所述第一整数进行计算得到初始动态码;判断所述初始动态码的位数是否为第二动态码位数;若是,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
在一个实施例中,上述依据所述第一数组和所述第一偏移量进行计算得到第一整数的步骤,包括:利用以下公式计算得到所述第一整数:n=((hash[offset]&0x6f)<<8a)|((hash[offset+2]&0x7f)<<4a)|((hash[offset+4]&0x8f)<<2a);其中,n为所述第一整数,a为自然整数数值,hash为所述第一数组,offset为所述第一偏移量,0x6f、0x7f、0x8f为16进制数。
在一个实施例中,上述依据所述第一整数进行计算得到初始动态码的步骤,包括:利用以下公式计算得到所述初始动态码:p=n%10^c;其中p为初始动态码,n为所述第一整数,c为所述第二动态码位数。
在一个实施例中,上述统计目标用户在预设时间内通过动态码认证成功的第一占比的步骤之前,包括:接收目标用户发送的动态码生成请求;依据所述动态码生成请求获取对应的用于生成动态码的策略;依据所述策略判断所述目标用户的认证状态是否为认证已被 锁定状态;若所述认证状态不为认证已被锁定状态,则检测所述策略中的自动变化功能是否已被开启,所述自动化功能为变更动态码的位数以及有效时间的功能;若所述策略中的自动变化功能已被开启,则通过随机选择是否启用所述自动变化功能;若启用所述自动变化功能,则生成统计所述第一占比的指令。
在一个实施例中,上述检测所述策略中的自动变化功能是否已被开启的步骤之后,包括:若所述策略中的自动变化功能未开启,则依据所述签名和所述第一动态码位数按照所述第二预设规则进行计算得到所述第二动态码,所述第二动态码的有效时间为所述第一有效时间。
在一个实施例中,上述依据所述策略判断所述目标用户的认证状态是否已被锁定状态的步骤,包括:依据所述策略的策略ID以及目标用户的用户信息查询是否已存在所述目标用户令牌;若否,则对应所述用户信息生成所述目标用户令牌,并将所述策略中的初始动态码位数、初始有效时间以及所述目标用户的签名记录到所述目标用户令牌,并将所述初始动态码位数记为所述第一动态码位数,初始有效时间记为所述第一有效时间;若是,检测所述目标用户令牌中目标用户的认证状态,其中,所述认证状态包括待认证以及认证已锁定。
本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定。
本申请一实施例还提供一种计算机非易失性可读存储介质,其上存储有计算机可读指令,计算机可读指令被处理器执行时实现一种动态码生成方法,具体为:统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;计算所述第一占比与第二占比的差值;判断所述差值是否处于需要变更动态码的数值范围内;若是,则获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
上述计算机非易失性可读存储介质,上述依据所述签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码的步骤,包括:获取所述第二动态码位数、所述签名以及第一时间戳;将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;将所述第一数组与预设数值进行按位与运算得到第一偏移量;依据所述 第一数组和所述第一偏移量进行计算得到第一整数;依据所述第一整数进行计算得到初始动态码;判断所述初始动态码的位数是否为第二动态码位数;若是,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
在一个实施例中,上述依据所述第一数组和所述第一偏移量进行计算得到第一整数的步骤,包括:利用以下公式计算得到所述第一整数:n=((hash[offset]&0x6f)<<8a)|((hash[offset+2]&0x7f)<<4a)|((hash[offset+4]&0x8f)<<2a);其中,n为所述第一整数,a为自然整数数值,hash为所述第一数组,offset为所述第一偏移量,0x6f、0x7f、0x8f为16进制数。
在一个实施例中,上述依据所述第一整数进行计算得到初始动态码的步骤,包括:利用以下公式计算得到所述初始动态码:p=n%10^c;其中p为初始动态码,n为所述第一整数,c为所述第二动态码位数。
在一个实施例中,上述统计目标用户在预设时间内通过动态码认证成功的第一占比的步骤之前,包括:接收目标用户发送的动态码生成请求;依据所述动态码生成请求获取对应的用于生成动态码的策略;依据所述策略判断所述目标用户的认证状态是否为认证已被锁定状态;若所述认证状态不为认证已被锁定状态,则检测所述策略中的自动变化功能是否已被开启,所述自动化功能为变更动态码的位数以及有效时间的功能;若所述策略中的自动变化功能已被开启,则通过随机选择是否启用所述自动变化功能;若启用所述自动变化功能,则生成统计所述第一占比的指令。
在一个实施例中,上述检测所述策略中的自动变化功能是否已被开启的步骤之后,包括:若所述策略中的自动变化功能未开启,则依据所述签名和所述第一动态码位数按照所述第二预设规则进行计算得到所述第二动态码,所述第二动态码的有效时间为所述第一有效时间。
在一个实施例中,上述依据所述策略判断所述目标用户的认证状态是否已被锁定状态的步骤,包括:依据所述策略的策略ID以及目标用户的用户信息查询是否已存在所述目标用户令牌;若否,则对应所述用户信息生成所述目标用户令牌,并将所述策略中的初始动态码位数、初始有效时间以及所述目标用户的签名记录到所述目标用户令牌,并将所述初始动态码位数记为所述第一动态码位数,初始有效时间记为所述第一有效时间;若是,检测所述目标用户令牌中目标用户的认证状态,其中,所述认证状态包括待认证以及认证已锁定。
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种动态码生成方法,其特征在于,包括:
    统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
    计算所述第一占比与所述第二占比的差值;
    判断所述差值是否处于需要变更动态码的数值范围内;
    若是,则获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;
    依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
  2. 根据权利要求1所述的动态码生成方法,其特征在于,所述依据所述签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码的步骤,包括:
    获取所述第二动态码位数、所述签名以及第一时间戳;
    将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;
    对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;
    将所述第一数组与预设数值进行按位与运算得到第一偏移量;
    依据所述第一数组和所述第一偏移量进行计算得到第一整数;
    依据所述第一整数进行计算得到初始动态码;
    判断所述初始动态码的位数是否为第二动态码位数;
    若是,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
  3. 根据权利要求2所述的动态码生成方法,其特征在于,所述依据所述第一数组和所述第一偏移量进行计算得到第一整数的步骤,包括:
    利用以下公式计算得到所述第一整数:
    n=((hash[offset]&0x6f)<<8a)|((hash[offset+2]&0x7f)<<4a)|((hash[offset+4]&0x8f)<<2a);
    其中,n为所述第一整数,a为自然整数数值,hash为所述第一数组,offset为所述 第一偏移量,0x6f、0x7f、0x8f为16进制数。
  4. 根据权利要求2所述的动态码生成方法,其特征在于,所述依据所述第一整数进行计算得到初始动态码的步骤,包括:
    利用以下公式计算得到所述初始动态码:
    p=n%10^c;
    其中,p为初始动态码,n为所述第一整数,c为所述第二动态码位数。
  5. 根据权利要求1所述的动态码生成方法,其特征在于,所述统计目标用户在预设时间内通过动态码认证成功的第一占比的步骤之前,包括:
    接收目标用户发送的动态码生成请求;
    依据所述动态码生成请求获取对应的用于生成动态码的策略;
    依据所述策略判断所述目标用户的认证状态是否为认证已被锁定状态;
    若所述认证状态不为认证已被锁定状态,则检测所述策略中的自动变化功能是否已被开启,所述自动化功能为变更动态码的位数以及有效时间的功能;
    若所述策略中的自动变化功能已被开启,则通过随机选择是否启用所述自动变化功能;
    若启用所述自动变化功能,则生成统计所述第一占比的指令。
  6. 根据权利要求5所述的动态码生成方法,其特征在于,所述检测所述策略中的自动变化功能是否已被开启的步骤之后,包括:
    若所述策略中的自动变化功能未开启,则依据所述签名和所述第一动态码位数按照所述第二预设规则进行计算得到所述第二动态码,所述第二动态码的有效时间为所述第一有效时间。
  7. 根据权利要求5所述的动态码生成方法,其特征在于,所述依据所述策略判断所述目标用户的认证状态是否已被锁定状态的步骤,包括:
    依据所述策略的策略ID以及目标用户的用户信息查询是否已存在所述目标用户令牌;
    若否,则对应所述用户信息生成所述目标用户令牌,并将所述策略中的初始动态码位数、初始有效时间以及所述目标用户的签名记录到所述目标用户令牌,并将所述初始动态码位数记为所述第一动态码位数,初始有效时间记为所述第一有效时间;
    若是,检测所述目标用户令牌中目标用户的认证状态,其中,所述认证状态包括待认证以及认证已锁定。
  8. 一种动态码生成装置,其特征在于,包括:
    统计概率单元,用于统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
    计算差值单元,用于计算所述第一占比与第二占比的差值;
    判断范围单元,用途于判断所述差值是否处于需要变更动态码的数值范围内;
    更改规则单元,用于判定所述差值处于需要变更动态码的数值范围内时,获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;
    计算动码单元,用于依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
  9. 根据权利要求8所述的动态码生成装置,其特征在于,所述计算动码单元,包括:
    获取位数子单元,用于获取所述第二动态码位数、所述签名以及第一时间戳;
    位移位数子单元,用于将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;
    运算数组子单元,用于对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;
    按位计算子单元,用于将所述第一数组与预设数值进行按位与运算得到第一偏移量;
    第一计算子单元,用于依据所述第一数组和所述第一偏移量进行计算得到第一整数;
    第二计算子单元,用于依据所述第一整数进行计算得到初始动态码;
    判断位数子单元,用于判断所述初始动态码的位数是否为第二动态码位数;
    添加数字子单元,用于判定所述初始动态码的位数为第二动态码位数,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
  10. 根据权利要求9所述的动态码生成装置,其特征在于,所述第一计算子单元,包括:
    利用以下公式计算得到所述第一整数:
    n=((hash[offset]&0x6f)<<8a)|((hash[offset+2]&0x7f)<<4a)|((hash[offset+4]&0x8f)<<2a);
    其中,n为所述第一整数,a为自然整数数值,hash为所述第一数组,offset为所述第一偏移量,0x6f、0x7f、0x8f为16进制数。
  11. 根据权利要求9所述的动态码生成装置,其特征在于,所述第二计算子单元,包括:
    利用以下公式计算得到所述初始动态码:
    p=n%10^c;
    其中,p为初始动态码,n为所述第一整数,c为所述第二动态码位数。
  12. 根据权利要求8所述的动态码生成装置,其特征在于,还包括:
    接收请求单元,用于接收目标用户发送的动态码生成请求;
    获取策略单元,用于依据所述动态码生成请求获取对应的用于生成动态码的策略;
    判断状态单元,用于依据所述策略判断所述目标用户的认证状态是否为认证已被锁定状态;
    检测功能单元,用于所述认证状态不为认证已被锁定状态时,则检测所述策略中的自动变化功能是否已被开启,所述自动化功能为变更动态码的位数以及有效时间的功能;
    启用功能子单元,用于所述策略中的自动变化功能已被开启时,则通过随机选择是否启用所述自动变化功能;
    生成指令单元,用于启用所述自动变化功能时,生成统计所述第一占比的指令。
  13. 根据权利要求8所述的动态码生成装置,其特征在于,还包括:
    计算动码单元,用于若所述策略中的自动变化功能未开启,则依据所述签名和所述第一动态码位数按照所述第二预设规则进行计算得到所述第二动态码,所述第二动态码的有效时间为所述第一有效时间。
  14. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现动态码生成方法,该动态码生成方法包括:
    统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
    计算所述第一占比与所述第二占比的差值;
    判断所述差值是否处于需要变更动态码的数值范围内;
    若是,则获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;
    依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
  15. 根据权利要求14所述的计算机设备,其特征在于,所述依据所述签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码的步骤,包括:
    获取所述第二动态码位数、所述签名以及第一时间戳;
    将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;
    对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;
    将所述第一数组与预设数值进行按位与运算得到第一偏移量;
    依据所述第一数组和所述第一偏移量进行计算得到第一整数;
    依据所述第一整数进行计算得到初始动态码;
    判断所述初始动态码的位数是否为第二动态码位数;
    若是,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
  16. 根据权利要求15所述的计算机设备,其特征在于,所述依据所述第一数组和所述第一偏移量进行计算得到第一整数的步骤,包括:
    利用以下公式计算得到所述第一整数:
    n=((hash[offset]&0x6f)<<8a)|((hash[offset+2]&0x7f)<<4a)|((hash[offset+4]&0x8f)<<2a);
    其中,n为所述第一整数,a为自然整数数值,hash为所述第一数组,offset为所述第一偏移量,0x6f、0x7f、0x8f为16进制数。
  17. 根据权利要求15所述的计算机设备,其特征在于,所述依据所述第一整数进行计算得到初始动态码的步骤,包括:
    利用以下公式计算得到所述初始动态码:
    p=n%10^c;
    其中,p为初始动态码,n为所述第一整数,c为所述第二动态码位数。
  18. 根据权利要求14所述的计算机设备,其特征在于,所述统计目标用户在预设时间内通过动态码认证成功的第一占比的步骤之前,包括:
    接收目标用户发送的动态码生成请求;
    依据所述动态码生成请求获取对应的用于生成动态码的策略;
    依据所述策略判断所述目标用户的认证状态是否为认证已被锁定状态;
    若所述认证状态不为认证已被锁定状态,则检测所述策略中的自动变化功能是否已被开启,所述自动化功能为变更动态码的位数以及有效时间的功能;
    若所述策略中的自动变化功能已被开启,则通过随机选择是否启用所述自动变化功能;
    若启用所述自动变化功能,则生成统计所述第一占比的指令。
  19. 一种计算机非易失性可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现动态码生成方法,该动态码生成方法包括:
    统计目标用户在预设时间内通过动态码认证成功的第一占比,以及计算所有用户在所述预设时间内通过动态码认证成功的第二占比;
    计算所述第一占比与所述第二占比的差值;
    判断所述差值是否处于需要变更动态码的数值范围内;
    若是,则获取对应所述数据范围的更改规则,并将目标用户令牌中的第一动态码位数和第一有效时间按所述更改规则进行更改,得到对应的第二动态码位数和第二有效时间,所目标用户令牌由预设的用于生成动态码的策略生成;
    依据所述目标用户令牌中的签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码,所述第一动态码的有效时间为所述第二有效时间。
  20. 根据权利要求19所述的计算机非易失性可读存储介质,其特征在于,所述依据所述签名以及所述第二动态码位数按照第二预设规则进行计算得到第一动态码的步骤,包括:
    获取所述第二动态码位数、所述签名以及第一时间戳;
    将所述第一时间戳转换成二进制的第一时间戳之后向预设方向位移指定位数得到二进制的第二时间戳;
    对所述签名以及所述第二时间戳通过Mac算法进行运算得到第一数组;
    将所述第一数组与预设数值进行按位与运算得到第一偏移量;
    依据所述第一数组和所述第一偏移量进行计算得到第一整数;
    依据所述第一整数进行计算得到初始动态码;
    判断所述初始动态码的位数是否为第二动态码位数;
    若是,则将所述初始动态码默认为所述第一动态码,若否,则在所述初始动态码的预设位置添加预设数字,直至被添加预设数字的初始动态码的位数与第二动态码位数一致,并将添加预设数字后的初始动态码记为所述第一动态码。
PCT/CN2019/116335 2019-03-08 2019-11-07 动态码生成方法、装置、计算机设备和存储介质 WO2020181797A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910175741.6A CN110032864B (zh) 2019-03-08 2019-03-08 动态码生成方法、装置、计算机设备和存储介质
CN201910175741.6 2019-03-08

Publications (1)

Publication Number Publication Date
WO2020181797A1 true WO2020181797A1 (zh) 2020-09-17

Family

ID=67235188

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/116335 WO2020181797A1 (zh) 2019-03-08 2019-11-07 动态码生成方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN110032864B (zh)
WO (1) WO2020181797A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110032864B (zh) * 2019-03-08 2023-10-17 平安科技(深圳)有限公司 动态码生成方法、装置、计算机设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104935555A (zh) * 2014-03-20 2015-09-23 华为技术有限公司 客户端证书认证方法、服务器、客户端及系统
CN105046141A (zh) * 2015-06-12 2015-11-11 北京京东尚科信息技术有限公司 一种自适应的验证码设计方法及系统
US20170270728A1 (en) * 2014-12-02 2017-09-21 Inventio Ag Improved access control using portable electronic devices
CN110032864A (zh) * 2019-03-08 2019-07-19 平安科技(深圳)有限公司 动态码生成方法、装置、计算机设备和存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5048105B2 (ja) * 2010-06-29 2012-10-17 レノボ・シンガポール・プライベート・リミテッド コンピュータへのアクセス方法およびコンピュータ
CN102377569B (zh) * 2011-10-18 2014-03-26 上海众人网络安全技术有限公司 一种动态令牌解锁方法及系统
CN103220148B (zh) * 2013-04-03 2015-12-09 天地融科技股份有限公司 电子签名令牌响应操作请求的方法、系统和电子签名令牌
KR101434447B1 (ko) * 2013-09-13 2014-08-27 제이슨 준 이 동적 조합 비밀번호를 이용한 사용자 인증 장치 및 사용자 인증 방법
CN104038502B (zh) * 2014-06-24 2018-11-13 五八同城信息技术有限公司 一种验证方法及系统
CN106656913A (zh) * 2015-10-28 2017-05-10 珠海金山办公软件有限公司 一种数字验证码的生成方法及装置
KR101967874B1 (ko) * 2017-02-22 2019-04-10 한국스마트인증 주식회사 주기적으로 변경되는 동적 코드 생성 방법과 그러한 동적 코드의 인증 방법
CN108810831B (zh) * 2018-04-17 2020-03-10 平安科技(深圳)有限公司 短信验证码的推送方法、电子装置及可读存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104935555A (zh) * 2014-03-20 2015-09-23 华为技术有限公司 客户端证书认证方法、服务器、客户端及系统
US20170270728A1 (en) * 2014-12-02 2017-09-21 Inventio Ag Improved access control using portable electronic devices
CN105046141A (zh) * 2015-06-12 2015-11-11 北京京东尚科信息技术有限公司 一种自适应的验证码设计方法及系统
CN110032864A (zh) * 2019-03-08 2019-07-19 平安科技(深圳)有限公司 动态码生成方法、装置、计算机设备和存储介质

Also Published As

Publication number Publication date
CN110032864B (zh) 2023-10-17
CN110032864A (zh) 2019-07-19

Similar Documents

Publication Publication Date Title
WO2020019341A1 (zh) 区块链账户的处理方法、装置和存储介质
US9930040B2 (en) System and method for provisioning a security token
US20190280863A1 (en) Recovery of secret data in a distributed system
US6950523B1 (en) Secure storage of private keys
US11316681B2 (en) User identity authentication method and device, readable storage medium and computer equipment
US7822689B2 (en) Maintaining privacy for transactions performable by a user device having a security module
US20200076592A1 (en) Method for generating seed and device thereof
CN110912689A (zh) 一种唯一值的生成、验证方法及系统
US20210234709A1 (en) Integrated circuit performing authentication using challenge-response protocol and method of using the integrated circuit
EP3298531A1 (en) Brute force attack prevention system
CN113676452B (zh) 基于一次性密钥的重放攻击抵御方法及系统
CN103607281A (zh) 一种安全设备的解锁方法和系统
CN111800262A (zh) 数字资产的处理方法、装置和电子设备
WO2020181797A1 (zh) 动态码生成方法、装置、计算机设备和存储介质
EP2477137A1 (en) Method for verifying the integrity of a set of data
US10284371B2 (en) Brute force attack prevention system
CN112217632B (zh) 一种基于智能合约和哈希链的身份认证方法及装置
CN108449753B (zh) 一种手机设备读取可信计算环境中的数据的方法
CN111865573A (zh) 一种动态密码生成系统、生成方法、设备及存储介质
CN111259347A (zh) 一种判断机器唯一性的授权方法及装置
AU2019274926A1 (en) Authenticating an entity
GB2574024A (en) Authenticating an entity
CN114844645B (zh) 一种数据验证方法、装置、电子设备和存储介质
US9805205B2 (en) Adaptive system profile
CN117195275B (zh) 数据访问方法、装置、电子设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19918695

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19918695

Country of ref document: EP

Kind code of ref document: A1