WO2016146007A1 - 验证码的校验方法及装置 - Google Patents

验证码的校验方法及装置 Download PDF

Info

Publication number
WO2016146007A1
WO2016146007A1 PCT/CN2016/075940 CN2016075940W WO2016146007A1 WO 2016146007 A1 WO2016146007 A1 WO 2016146007A1 CN 2016075940 W CN2016075940 W CN 2016075940W WO 2016146007 A1 WO2016146007 A1 WO 2016146007A1
Authority
WO
WIPO (PCT)
Prior art keywords
verification
verification code
code
codes
container
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2016/075940
Other languages
English (en)
French (fr)
Inventor
伍晋升
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of WO2016146007A1 publication Critical patent/WO2016146007A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a verification method and apparatus for a verification code.
  • the server provides the user with a time-valid verification code during the user login or transaction, and the user needs to send the corresponding verification code to the server within the effective time, so that The server verifies the corresponding verification code, thereby verifying the legitimacy of the user.
  • the existing verification code verification method has a problem that if the user sends a corresponding verification code when the verification code is about to expire, for example, the verification code is valid for 10 seconds, and the user sends the ninth second of the valid time period.
  • Verification code because the network transmission has a certain time delay, the server does not receive the verification code sent by the client within the valid time of the verification code, the verification code saved in the server is deleted, and the server receives the correct verification sent by the client.
  • the current check code cannot be verified.
  • the current check code fails to pass the check.
  • the corresponding server needs to be re-generated and sent a verification code to re-verify the network traffic and resources. It also affects the user's verification experience.
  • the present application aims to solve at least one of the technical problems in the related art to some extent.
  • the first object of the present application is to provide a verification method for a verification code, which avoids the fact that the user inputs the verification code within the valid time of the client and cannot pass the verification, and the re-verification needs to be performed, reducing The network traffic and resource consumption improve the user's verification experience.
  • a second object of the present application is to propose a verification device for a verification code.
  • the first aspect of the present application provides a method for verifying information, including: receiving a first verification code sent by a client; and pairing the first according to at least two second verification codes stored in advance. Verification code for school And determining whether the first verification code is consistent with at least one of the at least two second verification codes, and if they are consistent, passing the verification.
  • the method for verifying information in the embodiment of the present application receives the first verification code sent by the client, and performs verification on the first verification code according to at least two second verification codes stored in advance; and determines the first verification code and at least Whether at least one of the two second verification codes is consistent. If the two are consistent, the verification is performed. Therefore, the embodiment can verify the received verification code by using at least two verification codes stored in advance, thereby avoiding the user.
  • the verification code is input within the valid time of the client and cannot pass the verification. The re-verification needs to occur, which reduces network traffic and resource consumption, and improves the user's verification experience.
  • the second aspect of the present application provides a device for verifying information, including: a receiving module, configured to receive a first verification code sent by a client, and a verification module, configured to The second verification code is used to check the first verification code, and the processing module is configured to determine whether the first verification code is consistent with at least one of the at least two second verification codes. Then pass the verification.
  • the information verification apparatus of the embodiment of the present application receives the first verification code sent by the client by the receiving module, and then the verification module checks the first verification code according to the at least two second verification codes stored in advance, and processes the The module determines whether the first verification code is consistent with at least one of the at least two second verification codes. If they are consistent, the module passes the verification. Therefore, the embodiment can detect that the received verification is performed by using at least two verification codes stored in advance. The code is verified to prevent the user from entering the verification code within the valid time of the client and cannot pass the verification, and the need for re-verification occurs, which reduces network traffic and resource consumption, and improves the user's verification experience.
  • FIG. 1a is a flowchart of a verification method of a verification code according to an embodiment of the present application.
  • FIG. 1b is a flowchart of a verification method of a verification code according to another embodiment of the present application.
  • FIG. 2 is a flow chart of a verification method of a verification code according to another embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a verification apparatus for a verification code according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a verification apparatus of a verification code according to another embodiment of the present application.
  • FIG. 1a is a flowchart of a verification method of a verification code according to an embodiment of the present application.
  • the verification method of the verification code includes:
  • At least two second verification codes may also be sent to the client before performing step S101a.
  • the first verification code is generated according to at least one of the second verification codes.
  • the client is located in the terminal, and the terminal may be a hardware device with various operating systems, such as a smart phone, a tablet computer, or a personal computer (PC).
  • S102a The first verification code is verified according to at least two second verification codes stored in advance.
  • the server may perform verification on the first verification code by using at least two channels established in advance.
  • the pre-established channel correspondingly saves the pre-generated second verification code, and the number of pre-established channels is equal to the number of pre-generated second verification codes.
  • S103a Determine whether the first verification code is consistent with at least one of the at least two second verification codes, and if they are consistent, pass the verification.
  • the verification code saved in the current channel may be compared with the received first verification code. If the content and the time limit of both are the same, the first verification code is verified by the current channel. If the content or time difference of the two is inconsistent, confirm that the first verification code has not passed the verification of the current channel.
  • the expired second verification code may be buffered into the container. Since the capacity of the container is limited, that is, the container can only save a predetermined number of verification codes, In the process of saving the expired second verification code, it may first determine whether the number of verification codes in the container reaches a preset threshold, and if so, delete at least one verification code in the container.
  • the preset threshold is 3, when the expired verification code d is saved in the container, the number of the verification codes stored in the container may be determined first, and it is assumed that three verification codes have been saved in the container, and are saved in the container.
  • the chronological order of the three verification codes are a, b, and c.
  • the received first verification code does not pass the verification of all channels, that is, the received verification code and the used pass If the verification codes of the channels are different, the first verification code received in the container containing the predetermined number of verification codes may be queried, and the verification is confirmed according to the query result.
  • the container determining, according to the time information carried in the first verification code, whether the time difference from the receipt of the verification code by the client is within the time limit of the corresponding verification code, if yes, Confirm that the verification is passed. If not, confirm that the verification failed.
  • the server can compare with the verification code in the two channels, if the received verification code is If the content and the aging of any of the two channels are the same, the verification is passed. If the received verification code does not pass the verification of all the channels, the corresponding verification is saved in the container for the expired verification code in the cache channel. If the code includes the corresponding verification code, it is determined according to the time information carried in the verification code whether the time difference between the receiving and sending of the verification code is within the time limit of the corresponding verification code, that is, whether the user inputs the verification within the valid time of the client. If it is determined that the user inputs the verification code within the valid time of the verification code, it is determined that the verification is passed. If the user does not input the verification code within the valid time of the verification code, it is determined that the verification fails.
  • the embodiment may compare the received verification code with the verification code in at least two channels established in advance in a parallel manner, when the received verification code After the verification of all channels is not passed, the container containing the predetermined number of verification codes can be queried whether the received verification code is included. If it is included, the verification is confirmed. If not, the verification fails. Therefore, a verification mode of the verification code is provided, which prevents the user from inputting the verification code within the valid time of the client and cannot pass the verification, and needs to be re-verified, thereby reducing network traffic and resource consumption, and improving the network. User's verification experience.
  • the verification method of the verification code in the embodiment of the present application receives the first verification code sent by the client, and performs verification on the first verification code according to the at least two second verification codes stored in advance; and determines the first verification code and At least one of the at least two second verification codes is consistent. If the two are consistent, the verification is performed. Therefore, the embodiment can verify the received verification code by using at least two verification codes stored in advance, thereby avoiding The user enters the verification code within the valid time of the client and cannot pass the verification. The re-verification needs to occur, which reduces network traffic and resource consumption, and improves the user's verification experience.
  • FIG. 1b is a flowchart of a verification method of a verification code according to another embodiment of the present application.
  • the verification method of the verification code includes:
  • step S101b S100b may also be included.
  • S100b Receive an information acquisition request sent by the client, select one information from at least one piece of information generated in advance according to the information acquisition request, and send the selected information to the client.
  • the server generates two verification codes in advance, and after receiving the information acquisition request sent by the client, may obtain a verification code from the channel that stores the pre-generated verification code, and send the verification code to the client, and serve as the channel information. Set a valid time equal to the client.
  • the server may compare the information saved in the current channel with the received information for each channel, if both content and timeliness are If the information is consistent, the information is verified by the current channel. If the content or time difference of the two is inconsistent, the confirmation information does not pass the verification of the current channel.
  • the above information may be one or more of a verification code, a password, and a check gesture.
  • the number of pre-established channels is equal to the number of pre-generated information.
  • the client is located in the terminal, and the terminal may be a hardware device with an operating system such as a smart phone, a tablet computer, or a personal computer (PC).
  • the expired information may be cached into the container. Since the capacity of the container is limited, that is, the container can only store a predetermined amount of information, in the process of saving the expired information. First, it is determined whether the number of information in the container reaches a preset threshold, and if so, at least one information in the container is deleted.
  • the preset threshold is 3, when the expired information d is saved in the container, the number of saved information in the container can be determined first, assuming that three pieces of information have been saved in the container, according to the time saved in the container.
  • the three pieces of information in sequence are a, b, and c.
  • S102b If the information passes the verification of any channel, the verification is successful. If the verification of all the channels is not passed, the information in the container is checked whether the received information is present, and the verification is successful according to the query result.
  • the container containing the predetermined amount of information may be queried. Whether there is received information in the container, if there is received information in the container, it is determined according to the time information carried in the information whether the time difference between the receiving and transmitting information of the client is within the time limit of the corresponding information, and if yes, the verification is confirmed. Successful, if not, confirm that the verification failed.
  • the server receives the packets sent by the client. After the time-sensitive verification code, it can be compared with the verification code in the two channels. If the received verification code is the same as the content and aging of any of the two channels, the verification is successful, if the received If the information is not verified by all the channels, the corresponding information is stored in the container for the expired information in the cache channel. If the corresponding information is included, the client receives the information from the received information according to the time information carried in the information.
  • the time difference is within the time limit of the corresponding information, that is, whether the user inputs the verification code within the valid time of the client, and if it is determined that the user inputs the verification code within the valid time of the verification code, it is determined that the verification is passed, if the user is not in the verification code Enter the verification code within the valid time to determine the verification failure.
  • the embodiment can compare the received information with the content and the aging in at least one channel established in advance in a parallel manner, when the received information fails to pass all. After the channel is verified, the container containing the predetermined quantity of information can be queried whether the received information is included. If it is included, the verification is successful. If not, the verification fails. Therefore, a verification method of information is provided, which prevents the user from inputting information within the effective time of the client and cannot pass the verification, and needs to be re-verified, which reduces network traffic and resource consumption, and improves the user's Verify the experience.
  • the method for verifying information in the embodiment of the present application receives the time-sensitive information sent by the client, and checks the information through at least one channel established in advance, where the pre-established channel correspondingly stores the pre-generated information.
  • the expired information is cached in the container; and if the information passes the verification of any channel, the verification is successful.
  • the query is performed in the container. There is received information, and it is confirmed whether the verification is successful according to the query result. Therefore, the embodiment can verify the information through at least one channel established in advance, and query the container without verifying all the channels. Whether the received information exists to further complete the verification, avoiding the user inputting information within the effective time of the client and failing to pass the verification, and the need for re-verification occurs, reducing network traffic and resource consumption, and improving the user's Verify the experience.
  • the present application also proposes a verification device for a verification code.
  • FIG. 3 is a schematic structural diagram of a verification apparatus for a verification code according to an embodiment of the present application.
  • the verification device of the verification code includes a receiving module 31, a verification module 32, and a processing module 33, wherein:
  • the receiving module 31 is configured to receive the first verification code sent by the client, the verification module 32 is configured to verify the first verification code according to the at least two second verification codes stored in advance, and the processing module 33 is configured to determine the first Whether the verification code is consistent with at least one of the at least two second verification codes, and if they are consistent, the verification is passed.
  • the foregoing apparatus may further include a sending module 30, configured to send at least two second verification codes to the client before the receiving module 31 receives the first verification code sent by the client.
  • the first verification code is generated according to at least one of the second verification codes.
  • the verification module 32 is specifically configured to: verify the first verification code by using at least two channels established in advance.
  • the pre-established channel correspondingly saves the pre-generated second verification code, and the number of pre-established channels is equal to the number of pre-generated second verification codes.
  • the processing module 33 is specifically configured to: determine whether the first verification code passes the verification of any one channel.
  • the processing module 33 may compare the verification code saved in the current channel with the received verification code. If the content and the time limit of both are the same, the verification code is verified by the current channel. If the content or timelines of the two are inconsistent, confirm that the verification code has not passed the verification of the current channel.
  • the foregoing apparatus may further include a cache module 34, configured to cache the expired second verification code into the container when the second verification code saved in the channel expires.
  • the device may further include a deletion module 35, and the deletion module 35 is configured to determine whether the number of verification codes in the container reaches a preset threshold, and if so, delete the container. At least one verification code.
  • the preset threshold is preset in the system.
  • the preset threshold is 4.
  • the preset threshold is 3, when the expired verification code d is saved in the container, the number of the verification codes stored in the container may be determined first, and it is assumed that three verification codes have been saved in the container, and are saved in the container. In the chronological order, the three verification codes are a, b, and c.
  • the deletion module 35 can be the first.
  • the verification code a saved in the container is deleted, and then the cache module 34 saves the verification code d that has expired.
  • the use of the expired verification code for long-term storage of the server memory can be reduced, and resource consumption can be reduced.
  • the processing module 33 may further query whether the received first verification code exists in the container, and confirm whether the verification is passed according to the query result.
  • the processing module 33 may determine, according to the time information carried in the first verification code, whether the time difference from the receipt of the first verification code by the client is in the first verification code. Within the aging, if it is, confirm the verification pass, if not, confirm the verification failure.
  • FIG. 1a the process of verifying the verification code by the verification device of the above verification code
  • FIG. 1b the process of verifying the verification code by the verification device of the above verification code
  • FIG. 2 the process of verifying the verification code by the verification device of the above verification code
  • the verification device of the verification code in the embodiment of the present application receives the first verification code sent by the client by the receiving module, and then the verification module checks the first verification code according to the at least two second verification codes stored in advance, and The processing module determines whether the first verification code is consistent with at least one of the at least two second verification codes, and if they are consistent, the verification is performed, so that the embodiment receives the received at least two verification code pairs.
  • the verification code is verified, which prevents the user from entering the verification code within the valid time of the client and cannot pass the verification, and needs to be re-verified, which reduces network traffic and resource consumption, and improves the user's verification experience.
  • first and second are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated.
  • features defining “first” or “second” may include at least one of the features, either explicitly or implicitly.
  • the meaning of "a plurality” is at least two, such as two, three, etc., unless specifically defined otherwise.
  • a "computer-readable medium” can be any apparatus that can contain, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with the instruction execution system, apparatus, or device.
  • a more specific example (non-exhaustive list) of computer readable media includes the following: Electrical connection (electronic device) with one or more wires, portable computer case (magnetic device), random access memory (RAM), read only memory (ROM), erasable editable read only memory (EPROM or Flash memory), fiber optic devices, and portable compact disk read only memory (CDROM).
  • the computer readable medium may even be a paper or other suitable medium on which the program can be printed, as it may be optically scanned, for example by paper or other medium, followed by editing, interpretation or, if appropriate, other suitable The method is processed to obtain the program electronically and then stored in computer memory.
  • portions of the application can be implemented in hardware, software, firmware, or a combination thereof.
  • multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
  • each functional unit in each embodiment of the present application may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated modules, if implemented in the form of software functional modules and sold or used as stand-alone products, may also be stored in a computer readable storage medium.
  • the above mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like. While the embodiments of the present application have been shown and described above, it is understood that the above-described embodiments are illustrative and are not to be construed as limiting the scope of the present application. The embodiments are subject to variations, modifications, substitutions and variations.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请提出一种验证码的校验方法及装置。其中,该方法包括:接收客户端发送的第一验证码;根据预先保存的至少两条第二验证码对第一验证码进行校验;以及判断第一验证码与至少两条第二验证码中的至少一条是否一致,若一致,则通过校验。本申请实施例的验证码的校验方法及装置,可避免用户在客户端的有效时间内输入验证码而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。

Description

验证码的校验方法及装置
本申请要求2015年03月17日递交的申请号为201510117970.4、发明名称为“验证码的校验方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种验证码的校验方法及装置。
背景技术
随着互联网技术的迅猛发展,网络信息安全问题日益严峻,用户用于网上支付、交易等活动的用户账号容易被网上黑客、木马、病毒等恶意程序窃取,恶意程序严重威胁用户上网的安全。
目前在用户进行交易或者登录账号的过程中,服务器会在用户登录或者交易的过程中,为用户提供一个具有时间有效性的验证码,用户需要在有效时间内向服务器发送对应的验证码,以使服务器对对应的验证码进行校验,进而可验证使用者的合法性。
然而,现有的验证码校验方式存在的问题是,若用户在验证码即将过期时发送对应的验证码,例如,验证码的有效时间为10秒,用户在有效时间段的第9秒发送验证码,由于网络传输存在一定的时间延迟,服务器未在验证码的有效时间内接收到客户端发送的验证码,服务器中保存的验证码被删除,待服务器接收到客户端发送的正确的验证码时,无法完成对当前校验码的校验,当前校验码校验不通过,需要重新校验,对应的服务器需要重新产生并发送验证码,重新校验造成网络流量和资源的浪费,也影响用户的验证体验。
发明内容
本申请旨在至少在一定程度上解决相关技术中的技术问题之一。
为此,本申请的第一个目的在于提出一种验证码的校验方法,该方法避免了用户在客户端的有效时间内输入验证码而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
本申请的第二个目的在于提出一种验证码的校验装置。
为达上述目的,本申请第一方面实施例提出了一种信息的校验方法,包括:接收客户端发送的第一验证码;根据预先保存的至少两条第二验证码对所述第一验证码进行校 验;以及判断所述第一验证码与所述至少两条第二验证码中的至少一条是否一致,若一致,则通过校验。
本申请实施例的信息的校验方法,接收客户端发送的第一验证码,并根据预先保存的至少两条第二验证码对第一验证码进行校验;以及判断第一验证码与至少两条第二验证码中的至少一条是否一致,若一致,则通过校验,由此可见,该实施例通过预先保存的至少两条验证码对接收到的验证码进行校验,避免了用户在客户端的有效时间内输入验证码而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
为达上述目的,本申请第二方面实施例提出了一种信息的校验装置,包括:接收模块,用于接收客户端发送的第一验证码;校验模块,用于根据预先保存的至少两条第二验证码对所述第一验证码进行校验;以及处理模块,用于判断所述第一验证码与所述至少两条第二验证码中的至少一条是否一致,若一致,则通过校验。
本申请实施例的信息的校验装置,通过接收模块接收客户端发送的第一验证码,然后校验模块根据预先保存的至少两条第二验证码对第一验证码进行校验,以及处理模块判断第一验证码与至少两条第二验证码中的至少一条是否一致,若一致,则通过校验,由此可见,该实施例通过预先保存的至少两条验证码对接收到的验证码进行校验,避免了用户在客户端的有效时间内输入验证码而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
附图说明
图1a是本申请一个实施例的验证码的校验方法的流程图。
图1b是本申请另一个实施例的验证码的校验方法的流程图。
图2是本申请另一个实施例的验证码的校验方法的流程图。
图3是本申请一个实施例的验证码的校验装置的结构示意图。
图4是本申请另一个实施例的验证码的校验装置的结构示意图。
具体实施方式
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,旨在用于解释本申请,而不能理解为对本申请的限制。
下面参考附图描述本申请实施例的验证码的校验方法及装置。
图1a是本申请一个实施例的验证码的校验方法的流程图。
如图1a所示,该验证码的校验方法包括:
S101a,接收客户端发送的第一验证码。
在该实施例中,在执行步骤S101a之前,还可以向客户端发送至少两条第二验证码。
其中,上述第一验证码至少根据第二验证码中的一条生成。上述客户端位于终端中,上述终端可以为智能手机、平板电脑、个人计算机(PC)等具有各种操作系统的硬件设备。
S102a,根据预先保存的至少两条第二验证码对第一验证码进行校验。
具体地,在接收到客户端发送的第一验证码后,服务端可通过预先建立的至少两条通道对第一验证码进行校验。
其中,预先建立的通道中对应保存预先生成的第二验证码,且预先建立的通道的数量等于预先生成的第二验证码的数量。
S103a,判断第一验证码与至少两条第二验证码中的至少一条是否一致,若一致,则通过校验。
在该实施例中,可判断第一验证码是否通过任意一条通道的校验,若通过任意一个通道的验证,则确认校验通过。
具体地,针对每个通道,可将当前通道中保存的验证码与接收的第一验证码进行比对,若二者的内容和时效均一致,则确认第一验证码通过当前通道的校验,若二者的内容或时效不一致,则确认第一验证码未通过当前通道的校验。
在该实施例中,当通道中保存的第二验证码过期时,可将已过期的第二验证码缓存至容器中,由于容器的容量有限,即容器仅能保存预定数量的验证码,故在保存过期的第二验证码的过程中,可先判断容器中的验证码个数是否达到预设阈值,若达到,则删除容器中的至少一个验证码。
例如,预设阈值为3个,在向容器中保存已过期的验证码d时,可先判断容器中已保存的验证码个数,假定容器中已保存了3个验证码,按照保存在容器中的时间先后顺序三个验证码分别为a、b、c,在保存过期的验证码d时,由于容器中的验证码个数已经达到预设阈值,此时,可将最先保存在容器中的验证码a删除,由此,可减少长期保存过期的验证码对服务器内存的占用,减少资源消耗。
另外,若接收到的第一验证码未通过所有通道的校验,即接收到的验证码与所用通 道的验证码都不相同,则可查询包含预定数量的验证码的容器中是否存在接收到的第一验证码,并根据查询结果确认校验是否通过。
具体地,若容器中存在接收到的第一验证码,则根据第一验证码中携带的时间信息确定客户端从接收到发送验证码的时间差是否在对应验证码的时效内,若在,则确认校验通过,若不在,则确认校验失败。
例如,假定服务器预先建立的当前通道数为2个,服务器接收到客户端发送的具有时效性的验证码后,可与这2个通道中的验证码进行比较,若接收到的验证码与这两个通道中的任意一个的内容和时效均相同,则确认验证通过,若接收的验证码未通过所有通道的校验,则查询用于缓存通道中过期验证码的容器中是否保存对应的验证码,若包含对应的验证码,则根据验证码中携带的时间信息确定客户端从接收到发送验证码的时间差是否在对应验证码的时效内,即判断用户是否在客户端的有效时间内输入验证码,若确定用户在验证码的有效时间内输入验证码,则确定校验通过,若用户未在验证码的有效时间内输入验证码,则确定校验失败。
由此可见,该实施例在接收到客户端发送的验证码后,可通过并行的方式对接收到的验证码与预先建立的至少两条通道中的验证码进行比较,当接收到的验证码未通过所有通道的校验后,可查询包含预定数量验证码的容器中是否包含接收到的验证码,若包含,则确认校验通过,若不包含,则确认校验失败。由此,提供了一种验证码的校验方式,避免了用户在客户端的有效时间内输入验证码而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
本申请实施例的验证码的校验方法,接收客户端发送的第一验证码,并根据预先保存的至少两条第二验证码对第一验证码进行校验;以及判断第一验证码与至少两条第二验证码中的至少一条是否一致,若一致,则通过校验,由此可见,该实施例通过预先保存的至少两条验证码对接收到的验证码进行校验,避免了用户在客户端的有效时间内输入验证码而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
图1b是本申请另一个实施例的验证码的校验方法的流程图。
如图1b所示,该验证码的校验方法包括:
S101b,接收客户端发送的具有时效性的信息,并通过预先建立的至少一条通道对信息进行校验,其中,预先建立的通道中对应保存预先生成的信息,当通道中保存的信息 过期时,将已过期的信息缓存至容器中。
在该实施例中,如图2所示,在步骤S101b之前,还可以包括S100b。
S100b,接收客户端发送的信息获取请求,根据信息获取请求从预先生成的至少一个信息中选择一个信息,并向客户端发送选择的信息。
例如,服务器中预先生成了2个验证码,在接收到客户端发送的信息获取请求后,可从保存预先生成的验证码的通道中任取一个验证码发送给客户端,并为通道的信息设置了一个与客户端相同的有效时间。
在该实施例中,服务端在接收客户端发送的具有时效性的信息后,针对每个通道,可将当前通道中保存的信息与接收的信息进行比对,若二者的内容和时效均一致,则确认信息通过当前通道的校验,若二者的内容或时效不一致,则确认信息未通过当前通道的校验。
其中,上述信息可以为包括验证码、密码和校验手势中的一种或几种。预先建立的通道的条数等于预先生成的信息的个数。上述客户端位于终端中,上述终端可以为智能手机、平板电脑、个人计算机(PC)等具有操作系统的硬件设备。
在本实施例中,当通道中保存的信息过期时,可将已过期的信息缓存至容器中,由于容器的容量有限,即容器仅能保存预定数量的信息,故在保存过期信息的过程中,可先判断容器中的信息个数是否达到预设阈值,若达到,则删除容器中的至少一个信息。
例如,预设阈值为3个,在向容器中保存已过期的信息d时,可先判断容器中已保存的信息个数,假定容器中已保存了3个信息,按照保存在容器中的时间先后顺序三个信息分别为a、b、c,在保存过期的信息d时,由于容器中的信息个数已经达到预设阈值,此时,可将最先保存在容器中的信息a删除,由此,可减少长期保存过期的信息对服务器内存的占用,减少资源消耗。
S102b,若信息通过任意一条通道的校验,则确认校验成功,若未通过所有通道的校验,则查询容器中是否存在接收到的信息,并根据查询结果确认校验是否成功。
具体地,在接到收到客户端的信息后,若接收到的信息未通过所有通道的校验,即接收到的信息与所用通道的信息都不相同,则可查询包含预定数量的信息的容器中是否存在接收到的信息,若容器中存在接收到的信息,则根据信息中携带的时间信息确定客户端从接收到发送信息的时间差是否在对应信息的时效内,若在,则确认校验成功,若不在,则确认校验失败。
例如,假定服务器预先建立的当前通道数为2个,服务器接收到客户端发送的具有 时效性的验证码后,可与这2个通道中的验证码进行比较,若接收到的验证码与这两个通道中的任意一个的内容和时效均相同,则确认验证成功,若接收的信息未通过所有通道的校验,则查询用于缓存通道中过期信息的容器中是否保存对应的信息,若包含对应的信息,则根据信息中携带的时间信息确定客户端从接收到发送信息的时间差是否在对应信息的时效内,即判断用户是否在客户端的有效时间内输入验证码,若确定用户在验证码的有效时间内输入验证码,则确定校验通过,若用户未在验证码的有效时间内输入验证码,则确定校验失败。
由此可见,该实施例在接收到客户端发送的信息后,可通过并行的方式对接收到的信息与预先建立的至少一个通道中的内容和时效进行比较,当接收到的信息未通过所有通道的校验后,可查询包含预定数量信息的容器中是否包含接收到的信息,若包含,则确认校验成功,若不包含,则确认校验失败。由此,提供了一种信息的校验方式,避免了用户在客户端的有效时间内输入信息而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
本申请实施例的信息的校验方法,接收客户端发送的具有时效性的信息,并通过预先建立的至少一条通道对信息进行校验,其中,预先建立的通道中对应保存预先生成的信息,当通道中保存的信息过期时,将已过期的信息缓存至容器中;以及若信息通过任意一条通道的校验,则确认校验成功,若未通过所有通道的校验,则查询容器中是否存在接收到的信息,并根据查询结果确认校验是否成功,由此可见,该实施例通过预先建立的至少一条通道对信息进行校验,并在未通过所有通道校验的情况下,查询容器中是否存在接收到的信息以进一步完成校验,避免了用户在客户端的有效时间内输入信息而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
为了实现上述实施例,本申请还提出一种验证码的校验装置。
图3是本申请一个实施例的验证码的校验装置的结构示意图。
如图3所示,该验证码的校验装置包括接收模块31、校验模块32和处理模块33,其中:
接收模块31用于接收客户端发送的第一验证码;校验模块32用于根据预先保存的至少两条第二验证码对第一验证码进行校验;以及处理模块33用于判断第一验证码与至少两条第二验证码中的至少一条是否一致,若一致,则通过校验。
如图4,上述装置还可以包括发送模块30,该发送模块30用于在接收模块31接收客户端发送的第一验证码之前,向客户端发送至少两条第二验证码。
其中,上述第一验证码至少根据第二验证码中的一条生成。
上述校验模块32具体用于:通过预先建立的至少两条通道对第一验证码进行校验。
其中,预先建立的通道中对应保存预先生成的第二验证码,且预先建立的通道的数量等于预先生成的第二验证码的数量。
在该实施例中,上述处理模块33具体用于:判断第一验证码是否通过任意一条通道的校验。
具体地,针对每个通道,处理模块33可将当前通道中保存的验证码与接收的验证码进行比对,若二者的内容和时效均一致,则确认验证码通过当前通道的校验,若二者的内容或时效不一致,则确认验证码未通过当前通道的校验。
上述装置还可以包括缓存模块34,该缓存模块34用于当通道中保存的第二验证码过期时,将已过期的第二验证码缓存至容器中。
为了减少长期保存过期的验证码对服务器内存的占用,上述装置还可以包括删除模块35,该删除模块35用于判断容器中的验证码个数是否达到预设阈值,若达到,则删除容器中的至少一个验证码。
其中,上述预设阈值是系统中预先设置的。例如,预设阈值为4个。
例如,预设阈值为3个,在向容器中保存已过期的验证码d时,可先判断容器中已保存的验证码个数,假定容器中已保存了3个验证码,按照保存在容器中的时间先后顺序三个验证码分别为a、b、c,在保存过期的验证码d时,由于容器中的验证码个数已经达到预设阈值,此时,删除模块35可将最先保存在容器中的验证码a删除,然后缓存模块34保存已经过期的验证码d。由此,可减少长期保存过期的验证码对服务器内存的占用,减少资源消耗。
另外,在该实施例中,若第一验证码未通过所有通道的校验,则处理模块33还可以查询容器中是否存在接收到的第一验证码,并根据查询结果确认校验是否通过。
具体地,若容器中存在接收到的第一验证码,则处理模块33可根据第一验证码中携带的时间信息确定客户端从接收到发送第一验证码的时间差是否在第一验证码的时效内,若在,则确认校验通过,若不在,则确认校验失败。
需要说明的是,上述验证码的校验装置校验验证码的过程可参见图1a、图1b或者图2以及对应的文字描述,此处不赘述。
本申请实施例的验证码的校验装置,通过接收模块接收客户端发送的第一验证码,然后校验模块根据预先保存的至少两条第二验证码对第一验证码进行校验,以及处理模块判断第一验证码与至少两条第二验证码中的至少一条是否一致,若一致,则通过校验,由此可见,该实施例通过预先保存的至少两条验证码对接收到的验证码进行校验,避免了用户在客户端的有效时间内输入验证码而不能通过校验,需要重新校验的情况发生,减少了网络流量和资源消耗,提高了用户的校验体验。
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。
此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。在本申请的描述中,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本申请的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本申请的实施例所属技术领域的技术人员所理解。
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。计算机可读介质的更具体的示例(非穷尽性列表)包括以下:具 有一个或多个布线的电连接部(电子装置),便携式计算机盘盒(磁装置),随机存取存储器(RAM),只读存储器(ROM),可擦除可编辑只读存储器(EPROM或闪速存储器),光纤装置,以及便携式光盘只读存储器(CDROM)。另外,计算机可读介质甚至可以是可在其上打印所述程序的纸或其他合适的介质,因为可以例如通过对纸或其他介质进行光学扫描,接着进行编辑、解译或必要时以其他合适方式进行处理来以电子方式获得所述程序,然后将其存储在计算机存储器中。
应当理解,本申请的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。
此外,在本申请各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。
上述提到的存储介质可以是只读存储器,磁盘或光盘等。尽管上面已经示出和描述了本申请的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本申请的限制,本领域的普通技术人员在本申请的范围内可以对上述实施例进行变化、修改、替换和变型。

Claims (14)

  1. 一种验证码的校验方法,其特征在于,包括:
    接收客户端发送的第一验证码;
    根据预先保存的至少两条第二验证码对所述第一验证码进行校验;以及
    判断所述第一验证码与所述至少两条第二验证码中的至少一条是否一致,若一致,则通过校验。
  2. 根据权利要求1所述的方法,其特征在于,在所述接收客户端发送的第一验证码之前,还包括:
    向所述客户端发送所述至少两条第二验证码。
  3. 根据权利要求1所述的方法,其特征在于,所述第一验证码至少根据所述第二验证码中的一条生成。
  4. 根据权利要求1所述的方法,其特征在于,所述根据预先保存的至少两条第二验证码对所述第一验证码进行校验,包括:
    通过预先建立的至少两条通道对所述第一验证码进行校验,其中,所述预先建立的通道中对应保存预先生成的所述第二验证码,且所述预先建立的通道的数量等于预先生成的第二验证码的数量;
    所述判断所述第一验证码与所述至少两条第二验证码中的至少一条是否一致,包括:
    判断所述第一验证码是否通过任意一条通道的校验。
  5. 根据权利要求4所述的方法,其特征在于,还包括:当所述通道中保存的第二验证码过期时,将已过期的第二验证码缓存至容器中;
    在所述判断所述第一验证码是否通过任意一条通道的校验之后,还包括:若所述第一验证码未通过所有通道的校验,则查询所述容器中是否存在接收到的第一验证码,并根据查询结果确认校验是否通过。
  6. 根据权利要求5所述的方法,其特征在于,所述根据查询结果确认校验是否通过,包括:
    若所述容器中存在接收到的第一验证码,则根据所述第一验证码中携带的时间信息确定所述客户端从接收到发送所述第一验证码的时间差是否在所述第一验证码的时效内,若在,则确认校验通过,若不在,则确认校验失败。
  7. 根据权利要求5所述的方法,其特征在于,还包括:
    判断所述容器中的验证码个数是否达到预设阈值,若达到,则删除所述容器中的至少一个验证码。
  8. 一种验证码的校验装置,其特征在于,包括:
    接收模块,用于接收客户端发送的第一验证码;
    校验模块,用于根据预先保存的至少两条第二验证码对所述第一验证码进行校验;以及
    处理模块,用于判断所述第一验证码与所述至少两条第二验证码中的至少一条是否一致,若一致,则通过校验。
  9. 根据权利要求8所述的装置,其特征在于,还包括:
    发送模块,用于在所述接收模块接收客户端发送的第一验证码之前,向所述客户端发送所述至少两条第二验证码。
  10. 根据权利要求8所述的装置,其特征在于,所述第一验证码至少根据所述第二验证码中的一条生成。
  11. 根据权利要求8所述的装置,其特征在于,所述校验模块,具体用于:
    通过预先建立的至少两条通道对所述第一验证码进行校验,其中,所述预先建立的通道中对应保存预先生成的所述第二验证码,且所述预先建立的通道的数量等于预先生成的第二验证码的数量;
    所述处理模块,具体用于:
    判断所述第一验证码是否通过任意一条通道的校验。
  12. 根据权利要求11所述的装置,其特征在于,还包括:
    缓存模块,用于当所述通道中保存的第二验证码过期时,将已过期的第二验证码缓存至容器中;
    所述处理模块,还用于:若所述第一验证码未通过所有通道的校验,则查询所述容器中是否存在接收到的第一验证码,并根据查询结果确认校验是否通过。
  13. 根据权利要求12所述的装置,其特征在于,所述处理模块,具体用于:
    若所述容器中存在接收到的第一验证码,则根据所述第一验证码中携带的时间信息确定所述客户端从接收到发送所述第一验证码的时间差是否在所述第一验证码的时效内,若在,则确认校验通过,若不在,则确认校验失败。
  14. 根据权利要求12所述的装置,其特征在于,还包括:
    删除模块,用于判断所述容器中的验证码个数是否达到预设阈值,若达到,则删除 所述容器中的至少一个验证码。
PCT/CN2016/075940 2015-03-17 2016-03-09 验证码的校验方法及装置 Ceased WO2016146007A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510117970.4A CN106034126B (zh) 2015-03-17 2015-03-17 验证码的校验方法及装置
CN201510117970.4 2015-03-17

Publications (1)

Publication Number Publication Date
WO2016146007A1 true WO2016146007A1 (zh) 2016-09-22

Family

ID=56918332

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/075940 Ceased WO2016146007A1 (zh) 2015-03-17 2016-03-09 验证码的校验方法及装置

Country Status (2)

Country Link
CN (1) CN106034126B (zh)
WO (1) WO2016146007A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111614601A (zh) * 2019-02-25 2020-09-01 阿里巴巴集团控股有限公司 一种信息传输的实现方法、装置和系统
CN113283264A (zh) * 2021-04-16 2021-08-20 维沃移动通信有限公司 识别码的共享方法和装置
CN114238932A (zh) * 2021-12-22 2022-03-25 广州品唯软件有限公司 验证码校验方法、装置、存储介质及计算机设备
CN114662031A (zh) * 2022-03-16 2022-06-24 卓米私人有限公司 用户注册方法、装置、电子设备和存储介质
CN115150186A (zh) * 2022-07-27 2022-10-04 张瑜 验证码校验方法、系统、电子设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162275A (zh) * 2019-04-19 2019-08-23 深圳壹账通智能科技有限公司 保单打印控制方法及装置、电子设备及存储介质
CN112702301B (zh) * 2019-10-22 2024-04-12 中兴通讯股份有限公司 license验证控制方法、装置、设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101266638A (zh) * 2008-04-16 2008-09-17 北京飞天诚信科技有限公司 软件保护的方法和系统
CN101631023A (zh) * 2009-07-31 2010-01-20 北京飞天诚信科技有限公司 身份认证的方法和系统
CN103973636A (zh) * 2013-01-28 2014-08-06 深圳市腾讯计算机系统有限公司 一种验证方法、服务器及系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090212101A1 (en) * 2008-02-21 2009-08-27 Provalidate Method and system for providing product safety to a manufactured item with verification codes
CN103685384A (zh) * 2012-09-12 2014-03-26 中兴通讯股份有限公司 防恶意骚扰的用户身份验证方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101266638A (zh) * 2008-04-16 2008-09-17 北京飞天诚信科技有限公司 软件保护的方法和系统
CN101631023A (zh) * 2009-07-31 2010-01-20 北京飞天诚信科技有限公司 身份认证的方法和系统
CN103973636A (zh) * 2013-01-28 2014-08-06 深圳市腾讯计算机系统有限公司 一种验证方法、服务器及系统

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111614601A (zh) * 2019-02-25 2020-09-01 阿里巴巴集团控股有限公司 一种信息传输的实现方法、装置和系统
CN113283264A (zh) * 2021-04-16 2021-08-20 维沃移动通信有限公司 识别码的共享方法和装置
CN113283264B (zh) * 2021-04-16 2022-12-27 维沃移动通信有限公司 识别码的共享方法和装置
CN114238932A (zh) * 2021-12-22 2022-03-25 广州品唯软件有限公司 验证码校验方法、装置、存储介质及计算机设备
CN114662031A (zh) * 2022-03-16 2022-06-24 卓米私人有限公司 用户注册方法、装置、电子设备和存储介质
CN115150186A (zh) * 2022-07-27 2022-10-04 张瑜 验证码校验方法、系统、电子设备及存储介质

Also Published As

Publication number Publication date
CN106034126B (zh) 2019-06-11
CN106034126A (zh) 2016-10-19

Similar Documents

Publication Publication Date Title
US11784943B2 (en) Sharing account data between different interfaces to a service
WO2016146007A1 (zh) 验证码的校验方法及装置
US10880292B2 (en) Seamless transition between WEB and API resource access
US10171241B2 (en) Step-up authentication for single sign-on
US9756055B2 (en) Method and apparatus for controlling resources access
CN104468592B (zh) 登录方法和登录系统
US11283793B2 (en) Securing user sessions
CN104079409A (zh) 账号的登录方法及装置
KR101832535B1 (ko) 서비스로서 신뢰할 수 있는 장치 클레임 제공 기법
WO2019019646A1 (zh) 平台登录网站方法、装置、计算机设备以及可读存储介质
CN112491778A (zh) 认证方法、装置、系统及介质
CN107770192A (zh) 在多系统中身份认证的方法和计算机可读存储介质
US11528140B2 (en) Compromised access token invalidation in a singleton process
CN104579671A (zh) 身份验证方法及系统
KR102112897B1 (ko) 신뢰 및 비신뢰 플랫폼에 걸쳐 인터넷 액세스가능 애플리케이션 상태를 로밍하는 기법
CN105162802A (zh) Portal认证方法及认证服务器
CN111131409B (zh) 一种响应请求的方法、装置以及相关设备
US9544153B1 (en) Compression of cryptographic chaining certificates
CN116232754A (zh) 登录状态保持方法和装置
CN113536365A (zh) 一种文件访问方法、装置、设备及介质
CN117473547B (zh) 一种数据库权限管理的方法和装置
US20210044589A1 (en) Access control
CN115834252B (zh) 一种服务访问方法及系统
CN111294276A (zh) 一种基于邮箱的远程控制方法、系统、设备以及介质
CN105577643A (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: 16764188

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: 16764188

Country of ref document: EP

Kind code of ref document: A1