Legality verification method, device and electronic equipment

By determining and calculating the encoding of the target verification code, and based on these codes, the problems of high storage resources in the existing technologies and low verification efficiency are solved, and efficient legitimacy verification has been achieved.

CN110298691BActive Publication Date: 2025-01-28BEIJING SANKUAI ONLINE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN201910498639.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-10
Publication Date
2025-01-28
Estimated Expiration
2039-06-10

AI Technical Summary

Technical Problem

The prior art requires storing a large amount of data in legitimacy verification, resulting in high storage resource occupancy and low verification efficiency.

Method used

By determining the first encoding, second coding, and third encoding of the target verification code, obtain the target calculation algorithm corresponding to the first coding, calculate the second coding according to the target calculation algorithm, obtain the target coding, and based on the target coding and first The legitimacy of the three -coding verification target verification code.

Benefits of technology

No need to store a lot of data can achieve legitimacy verification, save storage resources, and improve verification efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110298691B_ABST
    Figure CN110298691B_ABST
Patent Text Reader

Abstract

The present application provides a method, device and electronic device for legitimacy verification. A specific implementation of the method includes: determining a first code, a second code and a third code corresponding to a target verification code; obtaining a target calculation algorithm corresponding to the first code; calculating the second code according to the target calculation algorithm to obtain a target code; and verifying the legitimacy of the target verification code based on the target code and the third code. This implementation can realize legitimacy verification without storing a large amount of data, and when performing legitimacy verification, there is no need to traverse a large amount of stored data. Not only does it save a lot of storage resources, but it also improves verification efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet application technology, and in particular to a legality verification method, device and electronic equipment. Background Art

[0002] At present, in the field of Internet application technology, in order to identify malicious false data, many businesses need to verify the legitimacy. For example, during the use of coupons or vouchers, the coupons or vouchers need to be verified for legitimacy. For another example, after the server receives the request from the client, it needs to verify the legitimacy of the client's request. In related technologies, legal data is generally stored, and the legitimacy is verified based on the pre-stored legal data. However, this method requires the storage of a large amount of data, which not only occupies a large amount of storage resources, but also has low verification efficiency. Summary of the invention

[0003] In order to solve one of the above technical problems, the present application provides a legitimacy verification method, device and electronic device.

[0004] According to a first aspect of an embodiment of the present application, a legitimacy verification method is provided, including:

[0005] Determine a first code, a second code, and a third code corresponding to the target verification code;

[0006] Obtaining a target calculation algorithm corresponding to the first code;

[0007] Calculate the second code according to the target calculation algorithm to obtain a target code;

[0008] The legitimacy of the target verification code is verified based on the target code and the third code.

[0009] Optionally, the determining of the first code, the second code, and the third code corresponding to the target verification code includes:

[0010] Determining preset extraction rules, the extraction rules including a rule for extracting the first code, a rule for extracting the second code, and a rule for extracting the third code;

[0011] The first code, the second code and the third code are extracted from the target verification code according to the extraction rule.

[0012] Optionally, the verifying the legitimacy of the target verification code based on the target code and the third code includes:

[0013] If the target code is the same as the third code, determining that the target verification code is legal;

[0014] If the target code is different from the third code, it is determined that the target verification code is illegal.

[0015] Optionally, before determining the first code, the second code and the third code corresponding to the target verification code, the method further includes:

[0016] receiving a target request, wherein the target request carries the target verification code;

[0017] After verifying the legitimacy of the target verification code based on the target code and the third code, the method further includes:

[0018] If the target verification code is legal, determining the target interface that the target requests to access;

[0019] If the target interface is a preset interface, obtaining service configuration information corresponding to the target interface; and

[0020] Obtain historical access data of the account corresponding to the target request;

[0021] Verifying the legitimacy of the target request based on the service configuration information and the historical access data;

[0022] If the target request is legal, an operation in response to the target request is performed.

[0023] Optionally, the verifying the legitimacy of the target request based on the service configuration information and the historical access data includes:

[0024] Acquire all basic service requests corresponding to the target interface from the service configuration information;

[0025] If the historical access data includes all the basic business requests, determining that the target request is legal;

[0026] If the historical access data does not include all of the basic service requests, it is determined that the target request is illegal.

[0027] Optionally, the method further includes:

[0028] Receiving a device code and an original code corresponding to the device code sent by a target account;

[0029] Decrypting the original code using a preset decryption algorithm to obtain a restoration code;

[0030] If the restoration code is consistent with the device code, a legitimate target verification code for the target account is generated based on the original code;

[0031] Send a valid target verification code for the target account.

[0032] Optionally, a legitimate target verification code is generated based on a first code, a second code and a third code corresponding to the target verification code according to a preset coding rule; wherein the third code is a result obtained by calculating the second code using a target calculation algorithm corresponding to the first code.

[0033] According to a second aspect of an embodiment of the present application, a legality verification device is provided, including:

[0034] A first determination module, used to determine a first code, a second code and a third code corresponding to a target verification code;

[0035] A first acquisition module, used to acquire a target calculation algorithm corresponding to the first code;

[0036] A calculation module, used for calculating the second code according to the target calculation algorithm to obtain a target code;

[0037] The first verification module is used to verify the legitimacy of the target verification code based on the target code and the third code.

[0038] According to a third aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the first aspects is implemented.

[0039] According to a fourth aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of the first aspects is implemented.

[0040] The technical solution provided by the embodiments of the present application may have the following beneficial effects:

[0041] The legitimacy verification method and device provided by the embodiment of the present application determine the target calculation algorithm through the first code corresponding to the target verification code, calculate the second code corresponding to the target verification code according to the target calculation algorithm to obtain the target code, and perform legitimacy verification based on the target code and the third code corresponding to the target verification code. Therefore, legitimacy verification can be achieved without storing a large amount of data, and when performing legitimacy verification, there is no need to traverse a large amount of stored data. Not only does it save a lot of storage resources, but it also improves verification efficiency.

[0042] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0044] Figure 1 A schematic diagram of an exemplary system architecture for applying an embodiment of the present application;

[0045] Figure 2 is a flow chart of a method for legitimacy verification according to an exemplary embodiment of the present application;

[0046] Figure 3 is a flow chart of another method for legitimacy verification according to an exemplary embodiment of the present application;

[0047] Figure 4 is a flow chart of another method for legitimacy verification according to an exemplary embodiment of the present application;

[0048] Figure 5 is a block diagram of a legality verification device according to an exemplary embodiment of the present application;

[0049] Figure 6 is a block diagram of another legality verification device according to an exemplary embodiment of the present application;

[0050] Figure 7 is a block diagram of another legality verification device according to an exemplary embodiment of the present application;

[0051] Figure 8 is a block diagram of another legality verification device according to an exemplary embodiment of the present application;

[0052] Fig. 9 is a block diagram of another legality verification device according to an exemplary embodiment of the present application;

[0053] Fig.10 It is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0054] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0055] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0056] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0057] See also Figure 1 , is a schematic diagram of an exemplary system architecture for applying an embodiment of the present application:

[0058] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, a network 103 and a server 104. It should be understood that Figure 1 The number or type of terminal devices, networks, and servers in the embodiment are merely illustrative. Any number or type of terminal devices, networks, and servers may be provided as required.

[0059] The network 103 is used to provide a medium for communication links between terminal devices and servers. The network 103 may include various connection types, such as wired or wireless communication links or optical fiber cables.

[0060] The terminal devices 101 and 102 can interact with the server through the network 103 to receive or send requests or information, etc. The terminal devices 101 and 102 can be various electronic devices, including but not limited to smart phones, tablet computers, smart wearable devices, laptop portable computers, desktop computers, etc.

[0061] The server 104 may be a server that provides various services. The server may store, analyze, and process the received data, or send control commands or requests to terminal devices or other servers. The server may provide services in response to user service requests. It is understood that a server may provide one or more services, and the same service may be provided by multiple servers.

[0062] based on Figure 1In the system architecture shown, in the embodiment of the present application, the terminal device 101 or the terminal device 102 can send a verification request to the server 104 through the network 103, and the verification request carries the target verification code to be verified. After receiving the above verification request, the server 104 can obtain the target verification code from the verification request and determine the first code, the second code and the third code corresponding to the target verification code. Then, the target calculation algorithm corresponding to the first code is obtained, and the second code is calculated according to the target calculation algorithm to obtain the target code. Finally, the legitimacy of the target verification code can be verified based on the target code and the third code.

[0063] The present application will be described in detail below with reference to specific embodiments.

[0064] like Figure 2 As shown, Figure 2 1 is a flow chart of a method for legitimacy verification according to an exemplary embodiment, which can be applied to a server. The method includes the following steps:

[0065] In step 201, a first code, a second code and a third code corresponding to a target verification code are determined.

[0066] In this embodiment, the target verification code is the verification code to be verified, and the target verification code may be a verification code carried in a request sent by a client installed on a terminal device to a server. For example, in one application scenario, the target verification code may be a coupon number or voucher number provided by a customer and sent by a client. For another example, in another application scenario, the target verification code may also be a verification code included in a header parameter in a target request sent by a client. It is understood that the target verification code may also be other verification codes used for verification, and this application does not limit this aspect.

[0067] In this embodiment, the legal target verification code is generated by processing the predetermined first code, second code and third code according to the preset coding rules. Among them, the third code can be obtained according to the first code and the second code. Specifically, the target calculation algorithm corresponding to the first code can be used to calculate the second code, and the third code can be determined according to the result of the calculation. For example, the result of the calculation can be used as the third code. The result of the calculation can also be simply processed (such as adjusting the order of the numbers in the result of the calculation according to the preset arrangement method, etc.), and the processed result is used as the third code. Therefore, the first code, the second code and the third code corresponding to the legal target verification code can satisfy the above-mentioned calculation relationship.

[0068] In this embodiment, the first code, the second code, and the third code corresponding to the received target verification code may be determined first. Then, the first code, the second code, and the third code corresponding to the target verification code may be verified to determine whether the above calculation relationship is satisfied, thereby determining whether the target verification code is legal. Specifically, the first code, the second code, and the third code corresponding to the received target verification code may be determined in the following manner: a preset extraction rule may be determined, and the extraction rule may include a rule for extracting the first code, a rule for extracting the second code, and a rule for extracting the third code. Then, the first code, the second code, and the third code corresponding to the target verification code are extracted from the above target verification code according to the extraction rule.

[0069] In step 202, a target calculation algorithm corresponding to the first code is obtained.

[0070] In one implementation, different calculation algorithms may be set in advance for each possible first code, and each possible first code may be stored in association with the corresponding calculation algorithm. After the first code corresponding to the target verification code is determined, the calculation algorithm associated with the first code may be obtained from the pre-stored data as the target calculation algorithm corresponding to the first code.

[0071] For example, the possible first codes include 1, 2, and 3. Calculation algorithm A can be set for 1, calculation algorithm B can be set for 2, and calculation algorithm C can be set for 3. Then, 1 and calculation algorithm A can be stored in association, 2 and calculation algorithm B can be stored in association, and 3 and calculation algorithm C can be stored in association. If it is determined that the first code corresponding to the target verification code is 2, calculation algorithm B associated with 2 can be obtained from the pre-stored data as the target calculation algorithm.

[0072] In another implementation, different calculation algorithms may be set for each possible first code. Then, each possible first code is encrypted to obtain ciphertext data corresponding to the first code. For each possible first code, the ciphertext data corresponding to the first code is stored in association with the calculation algorithm corresponding to the first code. After determining the first code corresponding to the target verification code, the first code corresponding to the target verification code may be encrypted first, and then the calculation algorithm associated with the obtained ciphertext data may be obtained from the pre-stored data as the target calculation algorithm corresponding to the first code.

[0073] For example, the possible first codes include 1, 2, and 3. Calculation algorithm A can be set for 1, calculation algorithm B can be set for 2, and calculation algorithm C can be set for 3. Then, 1, 2, and 3 are encrypted respectively, and the corresponding ciphertext data are 7, 8, and 9 respectively. 7 can be stored in association with calculation algorithm A, 8 can be stored in association with calculation algorithm B, and 9 can be stored in association with calculation algorithm C. If it is determined that the first code corresponding to the target verification code is 1, 1 can be encrypted first to obtain ciphertext data 7. Then, the calculation algorithm A associated with 7 is obtained from the pre-stored data as the target calculation algorithm.

[0074] In step 203, the second code is calculated according to a target calculation algorithm to obtain a target code.

[0075] In step 204, the validity of the target verification code is verified based on the target code and the third code.

[0076] In this embodiment, first, the second code can be calculated according to the target calculation algorithm to obtain the target code. For example, the second code is 631, and the target calculation algorithm is to sum the numbers on each digit. Therefore, the second code is calculated according to the target calculation algorithm, and the target code 10 can be obtained. For another example, the second code is 631, and the target calculation algorithm is to sum the differences between the numbers on adjacent digits. Therefore, the second code is calculated according to the target calculation algorithm, and the target code 5 can be obtained.

[0077] Then, the legitimacy of the target verification code can be verified based on the third encoding corresponding to the target code and the target verification code. Specifically, in one implementation, if the target code is the same as the third encoding, the target verification code is determined to be legal. If the target code is different from the third encoding, the target verification code is determined to be illegal. In another implementation, the target code is simply processed (such as, adjusting the order of the numbers in the target code, etc.), and the processed result is compared with the third encoding. If the processed result is the same as the third encoding, the target verification code is determined to be legal. If the processed result is different from the third encoding, the target verification code is determined to be illegal.

[0078] In this embodiment, in one application scenario, the target verification code is a coupon number or voucher number provided by the customer and sent by the client. If the coupon number or voucher number is legal, it means that the coupon or voucher is valid and can be further used for subsequent operations.

[0079] In another application scenario, the target verification code is a verification code included in a header parameter of a target request sent by the client. If the verification code is legal, it means that the target request is a legal request, and further operations in response to the target request can be performed.

[0080] The legitimacy verification method provided by the above-mentioned embodiment of the present application determines the target calculation algorithm through the first code corresponding to the target verification code, calculates the second code corresponding to the target verification code according to the target calculation algorithm to obtain the target code, and performs legitimacy verification based on the target code and the third code corresponding to the target verification code. Therefore, legitimacy verification can be achieved without storing a large amount of data, and when performing legitimacy verification, there is no need to traverse a large amount of stored data. Not only does it save a lot of storage resources, but it also improves verification efficiency.

[0081] like Figure 3 As shown, Figure 3 According to a flowchart of another legitimacy verification method shown in an exemplary embodiment, the embodiment describes a process of determining a first code, a second code, and a third code corresponding to a target verification code. The method can be applied to a server and includes the following steps:

[0082] In step 301, a preset extraction rule is determined, and the extraction rule includes a rule for extracting a first code, a rule for extracting a second code, and a rule for extracting a third code.

[0083] In step 302, a first code, a second code and a third code are extracted from the target verification code according to the extraction rule.

[0084] In this embodiment, the legal target verification code is generated by processing the predetermined first code, second code and third code according to the preset coding rules. Among them, the third code can be obtained according to the first code and the second code. Specifically, the target calculation algorithm corresponding to the first code can be used to calculate the second code, and the third code can be determined according to the result of the calculation. For example, the result of the calculation can be used as the third code. The result of the calculation can also be simply processed (such as adjusting the order of the numbers in the result of the calculation according to the preset arrangement method, etc.), and the processed result is used as the third code. Therefore, the first code, the second code and the third code corresponding to the legal target verification code can satisfy the above-mentioned calculation relationship.

[0085] In this embodiment, the preset extraction rule may be a rule corresponding to the above-mentioned preset encoding rule. For example, the first encoding, the second encoding, and the third encoding are predetermined, wherein the number of digits of the first encoding is 1, the number of digits of the second encoding is 6, and the number of digits of the third encoding is 2. The preset encoding rule may be to arrange the first encoding, the second encoding, and the third encoding in sequence to generate a legal verification code. The first digit of the legal verification code is the first encoding, the 2nd to 7th digits are the second encoding, and the 8th to 9th digits are the third encoding. Then the extraction rule corresponding to the encoding rule may be to extract the first digit of the target verification code as the first encoding corresponding to the target verification code, extract the 2nd to 7th digits of the target verification code as the second encoding corresponding to the target verification code, and extract the 8th to 9th digits of the target verification code as the third encoding corresponding to the target verification code.

[0086] For another example, the preset coding rule can also be to arrange the second code, the third code and the first code in sequence to generate a legal verification code. The 1st to 6th digits of the legal verification code are the second code, the 7th to 8th digits are the third code, and the 9th digit is the first code. Then the extraction rule corresponding to the coding rule can be to extract the 1st to 6th digits of the target verification code as the second code corresponding to the target verification code, extract the 7th to 8th digits of the target verification code as the third code corresponding to the target verification code, and extract the 9th digit of the target verification code as the first code corresponding to the target verification code. It can be understood that the preset coding rule and the preset extraction rule can also be any other reasonable rules, and the present application does not limit the specific content of the preset coding rule and the preset extraction rule.

[0087] In this embodiment, the first code, the second code, and the third code corresponding to the target verification code may be extracted from the target verification code according to the extraction rule.

[0088] In step 303, a target calculation algorithm corresponding to the first code is obtained.

[0089] In step 304, the second code is calculated according to the target calculation algorithm to obtain the target code.

[0090] In step 305, the validity of the target verification code is verified based on the target code and the third code.

[0091] It should be noted that Figure 3 The same steps as in the embodiment, in the above Figure 2 The embodiments will not be described in detail. For related contents, please refer to Figure 2 Example.

[0092] The legitimacy verification method provided by the above-mentioned embodiment of the present application determines a preset extraction rule, which includes a rule for extracting a first code, a rule for extracting a second code, and a rule for extracting a third code, and extracts the first code, the second code, and the third code from the target verification code according to the extraction rule. Obtain the target calculation algorithm corresponding to the first code, calculate the second code according to the target calculation algorithm to obtain the target code, and verify the legitimacy of the target verification code based on the target code and the third code. It not only helps to save a lot of storage resources, but also further improves the verification efficiency.

[0093] like Figure 4 As shown, Figure 4 According to a flowchart of another legitimacy verification method shown in an exemplary embodiment, the embodiment describes in detail the process of verifying the target request. The method can be applied to the server and includes the following steps:

[0094] In step 401, a target request is received, the target request carrying a target verification code.

[0095] In this embodiment, some requests received by the server involve interests, such as requests for receiving red envelopes, or requests for grabbing coupons, or requests for receiving task rewards, etc. Therefore, malicious users may send illegal requests to the server to obtain illegal interests. Therefore, the server needs to verify the legitimacy of the received requests involving interests.

[0096] In this embodiment, the target request received by the server may be sent by a client installed on the terminal device, and the header parameter of the target request carries a target verification code. If the target verification code is legal, the legal target verification code may be generated based on the device code corresponding to the terminal device.

[0097] In step 402, a first code, a second code and a third code corresponding to the target verification code are determined.

[0098] In step 403, a target calculation algorithm corresponding to the first code is obtained.

[0099] In step 404, the second code is calculated according to the target calculation algorithm to obtain the target code.

[0100] In step 405, the validity of the target verification code is verified based on the target code and the third code.

[0101] In step 406, if the target verification code is legal, the target interface that the target requests to access is determined.

[0102] In step 407, if the target interface is a preset interface, the service configuration information corresponding to the target interface is obtained.

[0103] In this embodiment, the preset interface may be a sensitive type interface involving interests (such as an interface for collecting rewards, or an interface for collecting points, etc.). When it is determined that the target verification code is legal, the target interface that the target request accesses may be further determined, and it may be determined whether the target interface is a preset interface involving interests. If the target interface is a preset interface, the business configuration information corresponding to the target interface may be obtained, and the business configuration information may include information such as all basic business requests corresponding to the target interface. All basic business requests corresponding to the target interface may be requests that must have been made before accessing the target interface. For example, before requesting access to the target interface C, access to interface A and interface B must have been requested, then the business request requesting access to interface A and the business request requesting access to interface B are all basic business requests corresponding to the target interface C.

[0104] In step 408, historical access data of the account corresponding to the target request is obtained.

[0105] In this embodiment, historical access data of the account corresponding to the target request may be obtained, and the historical access data may include all access data performed by the account corresponding to the target request within a preset historical period. For example, the historical access data may include all interfaces accessed by the account corresponding to the target request within a preset historical period.

[0106] In step 409, the legitimacy of the target request is verified based on the service configuration information and the historical access data.

[0107] In this embodiment, the legitimacy of the target request can be verified based on the above-mentioned business configuration information and the above-mentioned historical access data. Specifically, all basic business requests corresponding to the target interface can be obtained from the above-mentioned business configuration information. If the above-mentioned historical access data includes all basic business requests, it can be determined that the target request is legal. If the above-mentioned historical access data does not include all basic business requests, it can be determined that the target request is illegal.

[0108] For example, the client sends a target request to the server through account A to request access to target interface C. Before requesting access to target interface C, it must have requested access to interface A and interface B. Then the business request requesting access to interface A and the business request requesting access to interface B are all the basic business requests corresponding to target interface C. The historical access data of account A can be obtained, and it can be determined whether account A has requested access to interface A and interface B based on the historical access data of account A. If account A has requested access to interface A and interface B, it means that the target request is legal. If account A skips any one of interface A and interface B and directly requests access to target interface C, it means that the target request is illegal.

[0109] In step 410, if the target request is legal, an operation in response to the target request is performed.

[0110] In this embodiment, if it is determined that the target request is legitimate, an operation of responding to the target request may be further performed.

[0111] It should be noted that Figure 2 and Figure 3 The same steps as in the embodiment, in the above Figure 4 The embodiments will not be described in detail. For related contents, please refer to Figure 2 and Figure 3 Example.

[0112] The legitimacy verification method provided by the above-mentioned embodiment of the present application, when determining that the target verification code carried by the received target request is legal, further determines whether the target interface accessed by the target request is a preset interface, and when the target interface is the preset interface, further verifies whether the target request is legal based on the business configuration information corresponding to the target interface and the historical access data of the account corresponding to the target request, thereby being able to further filter out some malicious false requests while saving a large amount of storage resources and improving verification efficiency.

[0113] In some optional embodiments, Figure 4 Based on the embodiment, the method may further include: receiving the device code sent by the target account and the original code corresponding to the device code, decrypting the original code using a preset decryption algorithm to obtain a restoration code. If the restoration code is consistent with the device code, a legitimate target verification code for the target account is generated based on the original code, and the legitimate target verification code for the target account is sent.

[0114] In this embodiment, when a target account of a client is logged in for the first time on a terminal device, the device code of the terminal device (for example, the MAC address of the terminal device, or the device serial number of the terminal device, etc.) can be obtained first. Then, the device code of the terminal device is encrypted using a preset encryption algorithm to obtain the original code corresponding to the device code, and the device code of the terminal device and the original code corresponding to the device code are sent to the server through the target account.

[0115] In this embodiment, after the server receives the device code sent by the target account and the original code corresponding to the device code, it can use a preset decryption algorithm to decrypt the original code to obtain a restoration code. The preset decryption algorithm is a decryption algorithm corresponding to the preset encryption algorithm. Therefore, if the device code and the original code corresponding to the device code are legal, the restoration code obtained by decrypting the original code using the preset decryption algorithm should be consistent with the device code. If it is determined that the above restoration code is consistent with the device code, the server can generate a legal target verification code for the target account based on the original code, and send the above legal target verification code to the terminal device that has logged in to the client target account.

[0116] Specifically, a legal target verification code for a target account can be generated based on the original code in the following manner: First, a first code and a second code can be obtained based on the original code. For example, the number on the first preset digit in the original code can be extracted as the first code, and the number on the second preset digit in the original code can be extracted as the second code. For another example, a simple calculation can be performed on the number on the first preset digit in the original code as the first code, and a simple calculation can be performed on the number on the second preset digit in the original code as the second code. It can be understood that the first code and the second code can also be obtained based on the original code in any other reasonable manner, and the present application does not limit the specific manner of obtaining the first code and the second code.

[0117] Next, the target calculation algorithm corresponding to the first code can be obtained, and the target calculation algorithm corresponding to the first code can be used to calculate the second code, and the third code can be determined based on the calculated result. The first code, the second code, and the third code are processed according to the preset coding rules to generate a legal target verification code for the target account.

[0118] In this embodiment, after receiving the above-mentioned legal target verification code, the terminal device logged in to the target account of the client can store the above-mentioned legal target verification code in association with the target account. When the user sends a request to the server through the target account of the client on the terminal device in the future, the legal target verification code will be carried in the header parameter of the request for the server to verify the legitimacy.

[0119] Since this embodiment first performs a verification after receiving the device code sent by the target account and the original code corresponding to the device code, after the verification is passed, a legal target verification code for the target account can be generated and sent based on the original code. Because the original code is the code obtained by encrypting the device code, the security of the target verification code is increased.

[0120] It should be noted that although the operations of the method of the present application are described in a specific order in the above embodiments, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be changed in the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.

[0121] The present application scheme is schematically illustrated below in conjunction with a complete application example.

[0122] The application scenario may be: the process of issuing and using coupons.

[0123] Specifically, the coupon issuance process is as follows: First, the server obtains the original code of the coupon to be issued, which can be randomly generated or generated according to a specified rule. Then, the server can extract the first code and the second code from the original code. For example, if the original code is 123456, the first digit 1 of the original code can be used as the first code, and the 2nd to 6th digits 23456 of the original code can be used as the second code.

[0124] Next, the server can find the target calculation algorithm M associated with the first code, calculate the second code using the target calculation algorithm M, and determine the third code based on the calculation result. For example, the target calculation algorithm M is to sum the numbers on each digit, and the second code is 23456. Then, by calculating the second code using the target calculation algorithm M, 20 can be obtained, and 20 can be directly used as the third code.

[0125] Finally, the predetermined first code, second code, and third code may be processed according to the preset coding rule to generate a legal coupon code. For example, the first code is 1, the second code is 23456, and the third code is 20. The preset coding rule is that the first digit is the first code, the 2nd to 6th digits are the second code, and the 7th to 8th digits are the third code. Then the legal coupon code that can be generated is 12345620. The server can issue the generated legal coupon code to the account of the legal user for the user to use.

[0126] The process of using the coupon is as follows: when using the coupon, the customer can provide the merchant with a coupon code and input the coupon code into the merchant client, and the merchant client can send the coupon code to the server for verification. After receiving the coupon code, the server uses the coupon code as the target verification code and extracts the first code, the second code, and the third code corresponding to the target verification code according to the preset extraction rules. The preset extraction rule corresponds to the above-mentioned preset encoding rule. For example, if the target verification code is 12345620, the preset encoding rule is that the first digit is the first code, the 2nd to 6th digits are the second code, and the 7th to 8th digits are the third code. Then the preset extraction rule is to extract the first digit of the target verification code as the first code, extract the 2nd to 6th digits of the target verification code as the second code, and extract the 7th to 8th digits of the target verification code as the third code. Therefore, the first code, the second code, and the third code corresponding to the target verification code are 1, 23456, and 20, respectively.

[0127] Next, the target calculation algorithm M corresponding to the first code can be obtained, and the target calculation algorithm M is used to calculate the second code to obtain the target code, and the legitimacy of the target verification code is verified based on the obtained target code and the third code. For example, the target calculation algorithm M is to sum the numbers on each digit, and the target calculation algorithm M is used to calculate the second code to obtain the target code 20. By comparing the target code 20 with the third code 20, it can be determined that the target code is the same as the third code, and therefore, it can be determined that the target verification code is legal. The legality of the target verification code indicates that the coupon code provided by the customer to the merchant is legal and valid and can be used, and the server can further perform corresponding preferential operations based on the coupon.

[0128] It can be seen that by applying the above solution, the legitimacy verification can be realized without storing a large amount of data, and when performing the legitimacy verification, there is no need to traverse a large amount of stored data, which not only saves a large amount of storage resources but also improves the verification efficiency.

[0129] The present application scheme is schematically illustrated below in conjunction with another complete application example.

[0130] The application scenario can be: the request verification process for receiving task rewards.

[0131] Specifically, the process of generating a legal verification code is as follows: First, when logging into the target account of the client for the first time on the terminal device S, the device code E of the terminal device S can be obtained first. Then, the device code E is encrypted using a preset encryption algorithm to obtain the corresponding original code F, and the device code E and the original code F are sent to the server through the target account.

[0132] Next, the server may use a preset decryption algorithm corresponding to the preset encryption algorithm to decrypt the original code F. If the decrypted restoration code is the same as the device code E, the first code and the second code may be further extracted based on the original code F.

[0133] Finally, the server can find the target calculation algorithm N associated with the first code, calculate the second code using the target calculation algorithm N, and determine the third code based on the calculation result. The first code, the second code, and the third code can be processed according to the preset coding rules to generate a legal verification code H for the target account. The server can return the legal verification code H to the terminal device S.

[0134] The process of claiming the task reward is as follows: the user logs in to the target account of the client through the terminal device S, and sends a target request for claiming the task reward to the server, and the header parameter of the target request carries the verification code H. After receiving the target request, the server extracts the verification code H from the header parameter of the target request, and extracts the first code, the second code and the third code corresponding to the target verification code according to the preset extraction rule, and the preset extraction rule corresponds to the above-mentioned preset encoding rule.

[0135] Next, the target calculation algorithm N corresponding to the first code can be obtained, the target calculation algorithm N is used to calculate the second code to obtain the target code, and the legality of the verification code H is verified based on the obtained target code and the third code. When it is determined that the verification code H is legal, the target interface P that the target request accesses can be further determined. The target interface P is an interface for receiving task rewards, and therefore, it is a sensitive type interface involving interests. Therefore, it is necessary to further obtain the business configuration information corresponding to the target interface P, and the business configuration information may include information such as all basic business requests corresponding to the target interface P. The prerequisite for receiving task rewards is that you must submit to complete task a and task b. Therefore, all basic business requests corresponding to the target interface P include a request to submit to complete task a and a request to submit to complete task b.

[0136] Then, the server can obtain the historical access data of the target account, which includes all access data of the target account within a preset historical period. It can be checked whether the historical access data includes a request to submit a completed task a and a request to submit a completed task b. If the historical access data includes both a request to submit a completed task a and a request to submit a completed task b, it can be determined that the target request is a legitimate request, and the server can issue a corresponding reward to the target account. Otherwise, it can be determined that the target request is an illegal request, and the server can refuse to issue a reward to the target account.

[0137] It can be seen that the application of the above solution can further filter out some malicious false requests while saving a lot of storage resources and improving verification efficiency.

[0138] Corresponding to the aforementioned legality verification method embodiment, the present application also provides an embodiment of a legality verification device.

[0139] like Figure 5 As shown, Figure 5 It is a block diagram of a legality verification device according to an exemplary embodiment of the present application. The device may include: a first determination module 501, a first acquisition module 502, a calculation module 503 and a first verification module 504.

[0140] The first determination module 501 is used to determine the first code, the second code and the third code corresponding to the target verification code.

[0141] The first acquisition module 502 is used to acquire a target calculation algorithm corresponding to the first code.

[0142] The calculation module 503 is used to calculate the second code according to the target calculation algorithm to obtain the target code.

[0143] The first verification module 504 is used to verify the legitimacy of the target verification code based on the target code and the third code.

[0144] like Figure 6 As shown, Figure 6 is a block diagram of another legality verification device according to an exemplary embodiment of the present application. Figure 5 On the basis of the illustrated embodiment, the first determination module 501 may include: a first determination submodule 601 and an extraction submodule 602 .

[0145] The first determination submodule 601 is used to determine a preset extraction rule, which includes a rule for extracting the first code, a rule for extracting the second code, and a rule for extracting the third code.

[0146] The extraction submodule 602 is used to extract the first code, the second code and the third code from the target verification code according to the extraction rule.

[0147] like Figure 7 As shown, Figure 7 is a block diagram of another legality verification device according to an exemplary embodiment of the present application. Figure 5 Based on the illustrated embodiment, the first verification module 504 may include: a first verification submodule 701 and a second verification submodule 702 .

[0148] The first verification submodule 701 is used to determine whether the target verification code is legal when the target code is the same as the third code.

[0149] The second verification submodule 702 is used to determine that the target verification code is illegal when the target code is different from the third code.

[0150] like Figure 8 As shown, Figure 8 is a block diagram of another legality verification device according to an exemplary embodiment of the present application. Figure 5 On the basis of the illustrated embodiment, the device may further include: a first receiving module 505 , a second determining module 506 , a second acquiring module 507 , a third acquiring module 508 , a second verifying module 509 and an executing module 510 .

[0151] The first receiving module 505 is used to receive a target request, where the target request carries a target verification code.

[0152] The second determination module 506 is used to determine the target interface that the target requests to access when the target verification code is legal.

[0153] The second acquisition module 507 is used to acquire the service configuration information corresponding to the target interface when the target interface is a preset interface.

[0154] The third acquisition module 508 is used to acquire the historical access data of the account corresponding to the target request.

[0155] The second verification module 509 is used to verify the legitimacy of the target request based on the service configuration information and the historical access data.

[0156] The execution module 510 is used to execute an operation in response to the target request when the target request is legal.

[0157] like Fig. 9 As shown, Fig. 9 is a block diagram of another legality verification device according to an exemplary embodiment of the present application. Figure 8 On the basis of the illustrated embodiment, the second verification module 509 may include: an acquisition submodule 901 , a second determination submodule 902 and a third determination submodule 903 .

[0158] The acquisition submodule 901 is used to acquire all basic service requests corresponding to the target interface from the above service configuration information.

[0159] The second determination submodule 902 is configured to determine whether the target request is legal when the historical access data includes all basic business requests.

[0160] The third determination submodule 903 is used to determine that the target request is illegal when the historical access data does not include all basic service requests.

[0161] In some optional implementations, the device may further include: a second receiving module, a decryption module, a generating module and a sending module (not shown in the figure).

[0162] The second receiving module is used to receive the device code sent by the target account and the original code corresponding to the device code.

[0163] The decryption module is used to decrypt the original code using a preset decryption algorithm to obtain a restoration code.

[0164] The generation module is used to generate a legal target verification code for the target account based on the original code when the restoration code is consistent with the device code.

[0165] The sending module is used to send a legitimate target verification code for the target account.

[0166] In some other optional implementations, the legal target verification code is generated based on the first code, the second code and the third code corresponding to the target verification code according to a preset coding rule, wherein the third code is the result of calculating the second code using the target calculation algorithm corresponding to the first code.

[0167] It should be understood that the above device can be pre-set in the server, or loaded into the server by downloading, etc. The corresponding modules in the above device can cooperate with the modules in the server to implement the legality verification solution.

[0168] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0169] The present application also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figures 2 to 4 Any one of the embodiments provides a method for verifying the legitimacy of the invention.

[0170] Corresponding to the above-mentioned legality verification method, the present application embodiment also proposes Fig.10The schematic structural diagram of an electronic device according to an exemplary embodiment of the present application is shown in FIG. Fig.10 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and of course may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a legality verification device at the logical level. Of course, in addition to software implementations, this application does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0171] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0172] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for legitimacy verification, characterized in that: The method comprises: Receiving a device code and an original code corresponding to the device code sent by a target account; Decrypting the original code using a preset decryption algorithm to obtain a restoration code; If the restoration code is consistent with the device code, a legitimate target verification code for the target account is generated based on the original code; Sending a legitimate target verification code for the target account; receiving a target request, wherein the target request carries the target verification code; Determine a first code, a second code, and a third code corresponding to the target verification code; Obtaining a target calculation algorithm corresponding to the first code; Calculate the second code according to the target calculation algorithm to obtain a target code; Verifying the legitimacy of the target verification code based on the target code and the third code; The determining of the first code, the second code and the third code corresponding to the target verification code includes: Determining preset extraction rules, the extraction rules including a rule for extracting the first code, a rule for extracting the second code, and a rule for extracting the third code; Extracting the first code, the second code and the third code from the target verification code according to the extraction rule; The verifying the legitimacy of the target verification code based on the target code and the third code includes: If the target code is the same as the third code, determining that the target verification code is legal; If the target code is different from the third code, determining that the target verification code is illegal; The legal target verification code is generated based on the first code, the second code and the third code corresponding to the target verification code according to the preset coding rules; wherein the third code is the result of calculating the second code using the target calculation algorithm corresponding to the first code.

2. The method according to claim 1, characterized in that After verifying the legitimacy of the target verification code based on the target code and the third code, the method further includes: If the target verification code is legal, determining the target interface that the target requests to access; If the target interface is a preset interface, obtaining service configuration information corresponding to the target interface; and Obtain historical access data of the account corresponding to the target request; Verifying the legitimacy of the target request based on the service configuration information and the historical access data; If the target request is legal, an operation in response to the target request is performed.

3. The method according to claim 2, characterized in that The verifying the legitimacy of the target request based on the service configuration information and the historical access data includes: Acquire all basic service requests corresponding to the target interface from the service configuration information; If the historical access data includes all the basic business requests, determining that the target request is legal; If the historical access data does not include all of the basic service requests, it is determined that the target request is illegal.

4. A legality verification device, characterized in that: The device comprises: A generating module, configured to receive a device code sent by a target account and an original code corresponding to the device code, decrypt the original code using a preset decryption algorithm to obtain a restoration code, and if the restoration code is consistent with the device code, generate a legitimate target verification code for the target account based on the original code, and send the legitimate target verification code for the target account; A first determination module is configured to receive a target request, the target request carrying the target verification code, and determine a first code, a second code, and a third code corresponding to the target verification code, including: determining a preset extraction rule, the extraction rule including a rule for extracting the first code, a rule for extracting the second code, and a rule for extracting the third code, and extracting the first code, the second code, and the third code from the target verification code according to the extraction rule; A first acquisition module, used to acquire a target calculation algorithm corresponding to the first code; A calculation module, used for calculating the second code according to the target calculation algorithm to obtain a target code; The first verification module is used to verify the legality of the target verification code based on the target code and the third code. If the target code is the same as the third code, the target verification code is determined to be legal; if the target code is different from the third code, the target verification code is determined to be illegal; the legal target verification code is generated based on the first code, the second code and the third code corresponding to the target verification code according to the preset coding rules; wherein the third code is the result obtained by calculating the second code using the target calculation algorithm corresponding to the first code.

5. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Safety verification method and device, server and terminal

    CN105450592A