WO2019134361A1 - Method and device for calling an interface and responding to an interface call, electronic device, and medium - Google Patents

Method and device for calling an interface and responding to an interface call, electronic device, and medium Download PDF

Info

Publication number
WO2019134361A1
WO2019134361A1 PCT/CN2018/097311 CN2018097311W WO2019134361A1 WO 2019134361 A1 WO2019134361 A1 WO 2019134361A1 CN 2018097311 W CN2018097311 W CN 2018097311W WO 2019134361 A1 WO2019134361 A1 WO 2019134361A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
verification code
keyword
verification
signature
Prior art date
Application number
PCT/CN2018/097311
Other languages
French (fr)
Chinese (zh)
Inventor
丁晶晶
徐国诚
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2019134361A1 publication Critical patent/WO2019134361A1/en

Links

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
    • H04L9/3226Cryptographic 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 using a predetermined code, e.g. password, passphrase or PIN
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/606Protecting data by securing the transmission between two devices or processes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • 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
    • H04L9/3247Cryptographic 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 involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/12Messaging; Mailboxes; Announcements
    • H04W4/14Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]

Definitions

  • the present application belongs to the field of Internet technologies, and in particular, to an interface calling method and a terminal device, a response method for an interface call, and a server.
  • the existing automatic call method of the interface also has a problem of low security, which may cause user data or server interface data to be stolen during the automatic call process.
  • the prior art has a problem of low automation and poor security when making interface calls.
  • the prior art has a problem of poor security in the interface call and save process.
  • a first aspect of the embodiment of the present application provides an interface calling method, including:
  • the signature operation generates a verification code signature field; assembles the device identifier, the interface encryption field, and the verification code signature field into an interface call request, and sends the interface call request to the server.
  • a second aspect of the embodiment of the present application provides a response method for an interface call, including:
  • the verification code signature field performs a decoding operation to obtain a verification code digest; and the interface verification code is restored according to the verification code digest; if the interface verification code is the same as the interface verification code sent by the server to the mobile device, Determining a decryption algorithm by using the decryption algorithm, and performing decryption calculation on the interface encryption field by using the decryption algorithm to generate an interface parameter; if the server has a parameter consistent with the interface parameter, corresponding to the interface parameter
  • the interface logic processes the to-be-processed data sent by the terminal.
  • a third aspect of the embodiments of the present application provides an interface calling apparatus, where the interface calling apparatus includes a module for executing the interface calling method described in the above first aspect.
  • a fourth aspect of the embodiments of the present application provides a response device for an interface call, the interface calling device comprising a module for executing the interface calling method described in the second aspect above.
  • a fifth aspect of the embodiments of the present application provides an electronic device including a memory and a processor, wherein the memory stores computer readable instructions executable on the processor, the processor executing the computer The steps of the interface invocation method as described in the first aspect are implemented when the instruction is read.
  • a sixth aspect of the embodiments of the present application provides an electronic device including a memory and a processor, wherein the memory stores computer readable instructions executable on the processor, the processor executing the computer The step of implementing the response method of the interface call as described in the second aspect when the instruction is read.
  • a seventh aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by a processor to implement the first aspect as described in the first aspect The steps of the interface call method.
  • An eighth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by a processor to implement the second aspect The steps of the response method.
  • the interface verification code is extracted from the interface verification short message, and the abstract of the interface verification code is respectively performed according to the algorithm corresponding to the device identifier. And encrypting the interface parameters, obtaining the interface encryption field and the verification code signature field, and assembling the device identification, the interface encryption field, and the verification code signature field into an interface call request, and sending the interface call request to the server to improve the interface call.
  • FIG. 2 is a specific implementation flowchart of an interface calling method S102 provided by an embodiment of the present application
  • FIG. 3 is a flowchart of additional extraction of a verification code provided by an embodiment of the present application.
  • FIG. 5 is a structural block diagram of an interface calling apparatus according to an embodiment of the present application.
  • FIG. 6 is a structural block diagram of a response device for an interface call provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a terminal device according to an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a server provided by an embodiment of the present application.
  • FIG. 1 shows an implementation flow of an interface calling method provided by an embodiment of the present application, where the method flow includes steps S101 to S106.
  • the specific implementation principle of each step is as follows.
  • S101 Receive a device identifier of the mobile device, an interface parameter, and an interface verification short message sent by the server to the mobile device.
  • the terminal device is configured to invoke an interface of the server to implement a function that the user needs to invoke
  • the mobile device is configured to receive an interface verification short message sent by the server
  • the server is configured to respond to the terminal device.
  • the interface calls the request to provide the corresponding service for the terminal device.
  • the webpage in our daily life, sometimes when we want to use a certain function of a webpage through a computer, the webpage often sends a text message containing a verification code to our mobile phone.
  • the computer You can use some feature of the web page.
  • the computer is used as the terminal device in the embodiment of the present application, and the mobile phone is used as the mobile device, and the server of the web page is used as the server in the embodiment of the present application.
  • the execution entity of the embodiment of the present application is not necessarily a terminal device different from the mobile device, and the mobile device and the terminal device may also be the same device.
  • the mobile phone can be used as a mobile device that receives a short message including a verification code, or as a terminal device that invokes an interface of the server.
  • the device identifier of the mobile device may be a physical address of the mobile device, a CPU identifier, or a model of the mobile phone, so the device identifier of the mobile device may be a unique identifier or may be The same as other mobile devices is just an identifier for distinguishing categories.
  • the interface parameter is input by the user, and is used to indicate to the server which parameter the interface needs to be invoked. It can be understood that after receiving the interface parameter, the server can provide the corresponding service to the terminal device according to the interface parameter.
  • the interface verification short message includes a verification code
  • the server may respond to the terminal device's interface call request. It can be understood that if the terminal device and the mobile device are different devices, the mobile device needs to forward the interface verification short message to the terminal device; if the terminal device and the mobile device are the same device, the terminal device can directly analyze the interface verification short message.
  • the interface verification code in the interface verification short message needs to be automatically extracted.
  • the foregoing S102 includes:
  • S1021 Identify, according to a preset keyword database, a keyword included in the interface verification short message and a key degree corresponding to the keyword, where the keyword database includes a correspondence between a keyword and a criticality.
  • the interface verification message received in our daily life will include one or more keywords, according to which the location of the verification code can be locked, thereby extracting the verification code.
  • an interface verification message is: "[Software A] 581458 (software A mobile phone verification code, please complete verification), if not, please ignore this message.”
  • Another interface verification message is: "[Software B] 934047 (Device Lock Verification Code), used for device verification with QQ number 12345678 login, please do not forward. If you do not want to receive such SMS, please reply T", in these two In the interface verification message, words such as “verification code” and "verification” can be used as keywords.
  • an interface verification message is: "[Software C] You are requesting to call the X function, please call 29834918", There is no “verification code” or "verification” as a keyword in this interface verification message.
  • the embodiment of the present application verifies a short message through a massive interface, and summarizes a keyword database, which contains multiple keys. word.
  • a keyword database which contains multiple keys. word.
  • an interface verification message may contain a plurality of keywords, and the probability of occurrence of a verification code in the periphery of different keywords in the interface verification message is different, each keyword is given a critical degree, so
  • the keyword database also includes the correspondence between keywords and criticality. It can be understood that the higher the criticality of a keyword, the greater the probability that a verification code appears around the keyword.
  • the keyword included in the interface verification short message can be identified by the text recognition algorithm.
  • an interface verification short message may include one or more keywords.
  • a method for verifying a short message by processing an interface containing only one keyword and an interface verifying a short message with multiple keywords are processed. The method is different, so it is necessary to first judge the number of keywords identified by the above-described text recognition algorithm.
  • a partial punctuation mark can be used as a preset cutoff mark.
  • an interface verification message is: "[Software A] 581458 (software A mobile phone verification code, please complete verification), if not, please ignore this message.”
  • the punctuation mark "]" and the punctuation mark ",” can be used as two preset cutoff marks. It can be understood that, since the verification code appears in the context of the keyword in the interface verification short message, and the number of characters is relatively small, the interval in which the verification code is located can be determined by identifying the preset blocking flag. Further, a number existing between the preset cutoff flag before the keyword and the preset cutoff flag after the keyword is used as the interface verification code.
  • the reason why the embodiment of the present application does not directly detect the number in the short message verification is because the excuses verify that there are often multiple numbers in the short message, such as a verification code, a time, a mobile phone number, a qq number, or other login account. Therefore, it is necessary to determine the interval in which the verification code may exist, and then perform digital extraction.
  • not all the punctuation marks are directly used as the preset blocking flag, but the preset blocking flag is determined according to the massive interface verification code short message.
  • an interface verification message is: "[Software A] 581458 (Software A mobile phone verification code, please complete the verification), if you are not operating, please ignore this SMS.
  • the preset partition mark before the keyword is "]” and the preset cutoff flag after the keyword is ",”, so the "] 581458 can be intercepted from the interface verification message by two preset cutoff flags (software A mobile phone verification) Code, please complete the verification),", by identifying the number in the section, get "581458” as the verification code in the interface verification SMS.
  • the method for setting a preset blocking flag includes: selecting a punctuation mark whose appearance frequency is greater than or equal to the first frequency threshold from the plurality of interface verification short messages, to obtain a first symbol group; and calculating each of the first symbols
  • the punctuation marks in the group appear in the frequency between the verification code and the keyword as the second frequency of each punctuation mark; the punctuation symbol in the first symbol group whose second frequency is greater than the second frequency threshold is deleted to obtain the second a symbol group; the punctuation marks in the second symbol group are used as a preset blocking flag.
  • the preset cutoff flag should be a punctuation symbol with a higher frequency appearing in the interface verification code short message but appearing between the verification code and the keyword, that is, the preset cutoff flag should not be verified.
  • the code is separated from the keyword, and the part where the verification code and the keyword are co-located should be separated from the other parts.
  • S1024 If the interface verification message includes multiple keywords, determine a special keyword, where the special keyword is a key position among the plurality of keywords included in the interface verification short message. The highest degree keyword, and the number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword is used as the interface verification code.
  • an interface verification code may have multiple keywords
  • the keyword with the highest degree of criticality is selected as a special keyword from among these keywords. If there are multiple keywords with the highest degree of juxtaposition, the one with the highest position among the key points is selected as the special keyword in the interface verification short message.
  • the interval of the verification code in the interface verification short message is divided, and the number of the interval is extracted as a verification code, thereby realizing automatic analysis of the interface verification short message. Extract the verification code without human intervention to improve the automation of the entire interface call process.
  • FIG. 3 shows the embodiment of the present application.
  • the verification code additional extraction process is provided, and the specific implementation principles of each step are as follows.
  • the legacy keyword is a keyword that is not used to extract the interface verification code
  • the keyword database includes a correspondence between a keyword and a criticality.
  • the embodiment of the present application is configured to cope with a process of receiving a verification code that does not match the feedback of the server, and the method for extracting the keyword in the short message according to the keyword database is introduced in other embodiments of the invention. I will not repeat them here. It can be understood that, since the verification code that is fed back by the server does not match the response, it is proved that the interface verification code has been extracted by a keyword. Therefore, in the embodiment of the present application, it is required to determine whether the interface verification message is still not used.
  • the keyword that extracts the interface verification code is the legacy keyword. It can be understood that the judgment result is divided into three kinds of cases, namely: 1, there is one legacy keyword; 2, there are multiple legacy keywords; 3, there is no legacy keyword. In the embodiment of the present application, there are three different processing methods for the above three cases.
  • the number existing between the preset cutoff flag before the legacy keyword and the preset cutoff flag after the legacy keyword is used as a number.
  • the interface verification code is used.
  • the method for extracting the interface verification code according to the keyword and the preset partition flag introduced in the above embodiment is extracted in this step by the legacy keyword and the preset partition flag. Interface verification code.
  • the interface verification short message includes a plurality of the legacy keywords, determining a special keyword, where the special keyword is the most located among the plurality of the legacy keywords included in the interface verification short message. a previous keyword with the highest degree of criticality, and a number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the Interface verification code.
  • the method for extracting the verification code from the interface verification short message introduced in the above embodiment is not applicable to the current interface verification short message.
  • the server may be notified in this case to resend an interface verification short message to the mobile device to re-analyze and extract the verification code based on the new interface verification message.
  • the verification code cannot be automatically identified, so the user needs to be notified to check the verification code received by the mobile device, and manually input the verification code. Code to get the interface.
  • the method introduced in the foregoing embodiment may not be applicable to the phrase arrangement rule of the current interface verification code short message, other methods for automatically identifying the verification code in the interface verification code short message may be automatically switched.
  • the number in the short message is directly recognized as a verification code.
  • different processing methods are respectively performed on the three situations, thereby improving the ability to respond to different interfaces for verifying the short message.
  • S103 Determine an encryption algorithm according to the device identifier, and encrypt the interface parameter by using the encryption algorithm to generate an interface encryption field.
  • the interface parameters need to be encrypted.
  • the device identifiers of different mobile devices may correspond to different encryption algorithms, so that others cannot know which algorithm to encrypt the interface parameters, and thus cannot be based on the known corresponding algorithm.
  • the interface encryption field is decrypted.
  • the embodiment of the present application if the verification code is stolen by others during the process of the interface call, the other person may invoke the relevant interface based on the verification code, so that the verification code loses the original meaning, in order to ensure the verification code is in the interface.
  • the embodiment of the present application encrypts the verification code by using a signature algorithm. In order to encrypt the verification code by the signature algorithm, it is necessary to first calculate a summary of the verification code. Alternatively, the digest of the verification code can be calculated by the existing MD5 algorithm.
  • S105 Determine a signature key according to the device identifier, and perform a signature operation on the verification code digest by using the signature key to generate a verification code signature field.
  • different mobile device identifiers correspond to different signature keys to prevent others from decoding the verification code signature field after intercepting the signature key, and obtaining a verification code.
  • the interface parameters and the verification code are separately encrypted by different algorithms, and the selected algorithm is related to the device identifier, and different device identifiers may correspond to different algorithms, which greatly improves some important functions in the interface calling process.
  • the data security of the data is separately encrypted by different algorithms, and the selected algorithm is related to the device identifier, and different device identifiers may correspond to different algorithms, which greatly improves some important functions in the interface calling process.
  • the interface verification code is extracted from the interface verification short message, and the abstract of the interface verification code is respectively performed according to the algorithm corresponding to the device identifier. And encrypting the interface parameters, obtaining the interface encryption field and the verification code signature field, and assembling the device identification, the interface encryption field, and the verification code signature field into an interface call request, and sending the interface call request to the server to improve the interface call.
  • FIG. 4 shows an implementation flow of a response method for an interface call provided by an embodiment of the present application, where the method flow includes steps S401 to S407.
  • the specific implementation principle of each step is as follows.
  • a terminal device configured to invoke an interface of the server to implement a function that the user needs to invoke
  • the mobile device is configured to receive an interface verification short message sent by the server
  • the server is configured to respond to the terminal.
  • the interface of the device invokes the request to provide the corresponding service for the terminal device.
  • the interface call request is sent by the terminal device, and the server needs to verify the related data in the interface call request, and determine whether to use the relevant interface logic to process the data for the terminal device.
  • the server side needs to separate the three types of data from the interface call request.
  • S403. Determine a signature key according to the device identifier, and perform a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest.
  • the signature keys corresponding to one device identifier include parameters d and n, respectively.
  • the character and the symbol mod are the remainder operators.
  • the process calculates the verification code signature field S on the premise that the verification code signature field S and the parameters d and n of the signature key are known.
  • the verification code digest can be restored to the interface verification code, notably, the algorithm for calculating the verification code digest of the verification code or the algorithm for restoring the verification code from the verification code digest and There is no need to distinguish between different mobile devices or terminal devices.
  • the MD5 algorithm or other algorithm for calculating the digest can be used to calculate the verification code received by each mobile device. Therefore, in the embodiment of the present application, the MD5 algorithm or other calculation digest can also be uniformly used. The algorithm restores the verification code digest.
  • the server stores a verification code sent to each mobile device in a preset unit time period, and the server may find an interface verification code sent to the mobile device by using the device identifier of the mobile device, so that the server can determine
  • the interface verification code parsed in the port invocation request is the same as the interface verification code sent by the server to the mobile device.
  • the server sends a verification code mismatch notification to the mobile device, which is convenient for prompting the user to request the verification code again, or reminding the user that the related data may be being stolen by others.
  • the server can also determine the corresponding decryption algorithm according to the device identifier, and the decryption algorithm is
  • the interface encryption field performs decryption calculation and generates interface parameters.
  • the server needs to determine whether the interface parameter of the interface exists in the interface and the interface call request sent by the terminal device.
  • the interface parameters are the same. If they are consistent, the data to be processed sent by the terminal is processed according to the interface logic corresponding to the interface parameter.
  • the interface is invoked by the interface that is sent by the terminal device; the device identifier, the interface encryption field, and the verification code signature field of the mobile device are parsed from the interface call request; the signature key is determined according to the device identifier, and the signature is obtained.
  • the key is decoded by the verification code signature field to obtain a verification code digest; the interface verification code is restored according to the verification code digest; if the interface verification code is the same as the interface verification code sent by the server to the mobile device, the decryption algorithm is determined according to the device identifier.
  • FIG. 5 is a structural block diagram of the interface calling device provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
  • the apparatus includes:
  • the receiving unit 51 is configured to receive a device identifier of the mobile device, an interface parameter, and an interface verification short message sent by the server to the mobile device, and an extracting unit 52, configured to extract an interface verification code from the interface verification short message, and the generating unit 53 And determining, by the device identifier, an encryption algorithm, and encrypting the interface parameter by using the encryption algorithm to generate an interface encryption field; and the calculating unit 54 is configured to calculate a summary of the interface verification code, as a verification code summary.
  • a signature unit 55 configured to determine a signature key according to the device identifier, and perform a signature operation on the verification code digest by using the signature key to generate a verification code signature field
  • an assembly unit 56 configured to: use the device The identification, the interface encryption field, and the verification code signature field are assembled into an interface call request, and the interface call request is sent to the server.
  • the signature unit 55 includes:
  • FIG. 6 is a structural block diagram of the response device of the interface call provided by the embodiment of the present application. For the convenience of description, only the related to the embodiment of the present application is shown. section.
  • the receiving unit 61 is configured to receive an interface call request sent by the terminal device.
  • the parsing unit 62 is configured to parse out the device identifier, the interface encryption field, and the verification code signature field of the mobile device from the interface call request.
  • the decoding unit 63 is configured to determine a signature key according to the device identifier, and perform a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest.
  • the restoring unit 64 is configured to restore the interface verification code according to the verification code digest.
  • the determining unit 65 is configured to determine whether the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device.
  • the first execution unit 66 is configured to: if the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device, determine a decryption algorithm according to the device identifier, and pass the The decryption algorithm performs decryption calculation on the interface encryption field to generate an interface parameter.
  • the second execution unit 67 is configured to process the to-be-processed data sent by the terminal according to the interface logic corresponding to the interface parameter, if a parameter that is consistent with the interface parameter exists in the server.
  • FIG. 7 is a schematic diagram of a terminal device according to an embodiment of the present application.
  • the terminal device 7 of this embodiment includes a processor 70, a memory 71, and computer readable instructions 72 stored in the memory 71 and operable on the processor 70, such as an interface caller. .
  • the processor 70 when executing the computer readable instructions 72, implements the steps in the various interface invocation method embodiments described above, such as steps 101 through 106 shown in FIG.
  • the processor 70 when executing the computer readable instructions 72, implements the functions of the various modules/units in the various apparatus embodiments described above, such as the functions of the units 51-56 shown in FIG.
  • the computer readable instructions 72 may be partitioned into one or more modules/units that are stored in the memory 71 and executed by the processor 70, To complete this application.
  • the terminal device 7 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the processor 70 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), and application specific integrated circuits (Application). Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device,
  • the memory 71 may be an internal storage unit of the terminal device 7, such as a hard disk of the terminal device 7. Or memory.
  • FIG. 8 is a schematic diagram of a server according to an embodiment of the present application.
  • the server 8 of this embodiment includes a processor 80, a memory 81, and computer readable instructions 82 stored in the memory 81 and executable on the processor 80, such as an interface call response. program.
  • the processor 80 executes the computer readable instructions 82 to implement the steps in the response method embodiments of the various interface calls described above, such as steps 401 through 407 shown in FIG.
  • the processor 80 executes the computer readable instructions 82, the functions of the various modules/units in the various apparatus embodiments described above are implemented, such as the functions of the units 66 through 67 shown in FIG.
  • the computer readable instructions 82 may be partitioned into one or more modules/units that are stored in the memory 81 and executed by the processor 80, To complete this application.
  • the server 8 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the server may include, but is not limited to, a processor 80, a memory 81. It will be understood by those skilled in the art that FIG. 8 is merely an example of the server 8, does not constitute a limitation of the server 8, may include more or less components than those illustrated, or combine some components, or different components, such as
  • the server may also include an input and output device, a network access device, a bus, and the like.

Abstract

The present invention is applicable to the technical field of the Internet, and provides a method and device for calling an interface and responding to an interface call, an electronic device, and a medium. The method for calling an interface comprises: receiving a device identifier of a mobile device, interface parameters, and an interface verification SMS message; extracting an interface verification code from the interface verification SMS message; performing a signing operation on a digest of the interface verification code and respectively encrypting the interface parameters on the basis of an algorithm corresponding to the device identifier, to obtain an interface encryption field and a verification code signature field; assembling the device identifier, the interface encryption field, and the verification code signature field into an interface call request, and sending the interface call request to a server, so as to improve the automation level and security of interface calls.

Description

接口调用及接口调用的响应方法、装置、电子设备及介质Interface call and interface call response method, device, electronic device and medium
本申请要求于2018年01月02日提交中国专利局、申请号为201810001742.4、发明名称为“接口调用方法及终端设备、接口调用的响应方法及服务器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on January 2, 2018, the Chinese Patent Office, the application number is 201810001742.4, and the invention name is "interface calling method and terminal device, response method and server called interface", all contents thereof This is incorporated herein by reference.
技术领域Technical field
本申请属于互联网技术领域,尤其涉及一种接口调用方法及终端设备、一种接口调用的响应方法及服务器。The present application belongs to the field of Internet technologies, and in particular, to an interface calling method and a terminal device, a response method for an interface call, and a server.
背景技术Background technique
当前很多终端设备在实现某种功能时都需要从服务器调用相关的接口,一般情况下,终端设备的用户在输入待调用接口的参数后,还需要手动进行后续操作以实现接口的调用,这给用户带来了极大的不便。为了让用户更加便捷的使用终端设备,现有技术中存在一些接口自动调用的方法,但是当服务器需要终端设备提供验证码时,现有的接口自动调用方法便无法实现。At present, many terminal devices need to call related interfaces from the server when implementing certain functions. Generally, after inputting the parameters of the interface to be called, the user of the terminal device needs to manually perform subsequent operations to implement the interface call, which gives The user has brought great inconvenience. In order to make the terminal device more convenient for users, there are some methods for automatically calling the interface in the prior art, but when the server needs the terminal device to provide the verification code, the existing interface automatic calling method cannot be implemented.
除此之外,现有的接口自动调用方法也存在安全性较低的问题,可能使得用户数据或服务器接口数据在自动调用过程中被盗取。In addition, the existing automatic call method of the interface also has a problem of low security, which may cause user data or server interface data to be stolen during the automatic call process.
综上,现有技术在进行接口调用时,存在自动化程度低以及安全性差的问题。In summary, the prior art has a problem of low automation and poor security when making interface calls.
技术问题technical problem
现有技术在接口调用和保存过程中存在的安全性差的问题。The prior art has a problem of poor security in the interface call and save process.
技术解决方案Technical solution
本申请实施例的第一方面提供了一种接口调用方法,包括:A first aspect of the embodiment of the present application provides an interface calling method, including:
接收移动设备的设备标识、接口参数以及服务器发送给所述移动设备的接口验证短信;从所述接口验证短信中提取接口验证码;根据所述设备标识确定加密算法,并通过所述加密算法对所述接口参数进行加密,生成接口加密字段;计算所述接口验证码的摘要,作为验证码摘要;根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段;将所述设备标识、所述接口加密字段以及所述验证码签名字段组装成接口调用请求,并将所述接口调用请求发送至服务器。Receiving a device identifier of the mobile device, an interface parameter, and an interface verification message sent by the server to the mobile device; extracting an interface verification code from the interface verification short message; determining an encryption algorithm according to the device identifier, and using the encryption algorithm Encrypting the interface parameter to generate an interface encryption field; calculating a summary of the interface verification code as a verification code digest; determining a signature key according to the device identifier, and performing the verification code digest by using the signature key The signature operation generates a verification code signature field; assembles the device identifier, the interface encryption field, and the verification code signature field into an interface call request, and sends the interface call request to the server.
本申请实施例的第二方面提供了一种接口调用的响应方法,包括:A second aspect of the embodiment of the present application provides a response method for an interface call, including:
接收终端发送的接口调用请求;从所述接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段;根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码签名字段进行解码运算,得到验证码摘要;根据所述验证码摘要还原出接口验证码;若所述接口验证码与服务器发送给所述移动设备的接口验证码相同,则根据所述设备标识确定解密算法,并通过所述解密算法对所述接口加密字段进行解密计算,生成接口参数;若所述服务器中存在与所述接口参数一致的参数,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。Receiving an interface call request sent by the terminal; parsing the device identifier, the interface encryption field, and the verification code signature field of the mobile device from the interface call request; determining a signature key according to the device identifier, and using the signature key pair The verification code signature field performs a decoding operation to obtain a verification code digest; and the interface verification code is restored according to the verification code digest; if the interface verification code is the same as the interface verification code sent by the server to the mobile device, Determining a decryption algorithm by using the decryption algorithm, and performing decryption calculation on the interface encryption field by using the decryption algorithm to generate an interface parameter; if the server has a parameter consistent with the interface parameter, corresponding to the interface parameter The interface logic processes the to-be-processed data sent by the terminal.
本申请实施例的第三方面提供了一种接口调用装置,该接口调用装置包括用于执行上述第一方面所述的接口调用方法的模块。A third aspect of the embodiments of the present application provides an interface calling apparatus, where the interface calling apparatus includes a module for executing the interface calling method described in the above first aspect.
本申请实施例的第四方面提供了一种接口调用的响应装置,该接口调用装置包括用于执行上述第二方面所述的接口调用方法的模块。A fourth aspect of the embodiments of the present application provides a response device for an interface call, the interface calling device comprising a module for executing the interface calling method described in the second aspect above.
本申请实施例的第五方面提供了一种电子设备,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如第一方面所述的接口调用方法的步骤。A fifth aspect of the embodiments of the present application provides an electronic device including a memory and a processor, wherein the memory stores computer readable instructions executable on the processor, the processor executing the computer The steps of the interface invocation method as described in the first aspect are implemented when the instruction is read.
本申请实施例的第六方面提供了一种电子设备,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如第二方面所述的接口调用的响应方法的步骤。A sixth aspect of the embodiments of the present application provides an electronic device including a memory and a processor, wherein the memory stores computer readable instructions executable on the processor, the processor executing the computer The step of implementing the response method of the interface call as described in the second aspect when the instruction is read.
本申请实施例的第七方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如第一方面所述的接口调用方法的步骤。A seventh aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by a processor to implement the first aspect as described in the first aspect The steps of the interface call method.
本申请实施例的第八方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如第二方面所述的的响应方法的步骤。An eighth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by a processor to implement the second aspect The steps of the response method.
有益效果Beneficial effect
在本申请实施例中,通过接收移动设备的设备标识、接口参数以及接口验证短信,从接口验证短信中提取接口验证码,并基于设备标识对应的算法,分别对接口验证码的摘要进行签名运算,以及对接口参数进行加密,得到接口加密字段和验证码签名字段,并将设备标识、接口加密字段以及验证码签名字段组装成接口调用请求,并将接口调用请求发送给服务器,以提高接口调用时的自动化水平以及安全性。In the embodiment of the present application, by receiving the device identifier, the interface parameter, and the interface verification short message of the mobile device, the interface verification code is extracted from the interface verification short message, and the abstract of the interface verification code is respectively performed according to the algorithm corresponding to the device identifier. And encrypting the interface parameters, obtaining the interface encryption field and the verification code signature field, and assembling the device identification, the interface encryption field, and the verification code signature field into an interface call request, and sending the interface call request to the server to improve the interface call. The level of automation and safety.
附图说明DRAWINGS
图1是本申请实施例提供的接口调用方法的实现流程图;1 is a flowchart of an implementation of an interface calling method provided by an embodiment of the present application;
图2是本申请实施例提供的接口调用方法S102的具体实现流程图;2 is a specific implementation flowchart of an interface calling method S102 provided by an embodiment of the present application;
图3是本申请实施例提供的验证码附加提取流程图;3 is a flowchart of additional extraction of a verification code provided by an embodiment of the present application;
图4是本申请实施例提供的接口调用的响应方法的实现流程图;4 is a flowchart of an implementation of a response method of an interface call provided by an embodiment of the present application;
图5是本申请实施例提供的接口调用装置的结构框图;FIG. 5 is a structural block diagram of an interface calling apparatus according to an embodiment of the present application;
图6是本申请实施例提供的接口调用的响应装置的结构框图;6 is a structural block diagram of a response device for an interface call provided by an embodiment of the present application;
图7是本申请实施例提供的终端设备的示意图;FIG. 7 is a schematic diagram of a terminal device according to an embodiment of the present application;
图8是本申请实施例提供的服务器的示意图。FIG. 8 is a schematic diagram of a server provided by an embodiment of the present application.
本发明的实施方式Embodiments of the invention
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to explain the technical solutions described in the present application, the following description will be made by way of specific embodiments.
图1示出了本申请实施例提供的接口调用方法的实现流程,该方法流程包括步骤S101至S106。各步骤的具体实现原理如下。FIG. 1 shows an implementation flow of an interface calling method provided by an embodiment of the present application, where the method flow includes steps S101 to S106. The specific implementation principle of each step is as follows.
S101:接收移动设备的设备标识、接口参数以及服务器发送给所述移动设备的接口验证短信。S101: Receive a device identifier of the mobile device, an interface parameter, and an interface verification short message sent by the server to the mobile device.
本申请实施例中,存在终端设备、移动设备以及服务器,其中终端设备用于调用服务器的接口以实现用户需要调用的功能,移动设备用于接收服务器发送的接口验证短信,服务器用于响应终端设备的接口调用请求,为终端设备提供相应的服务。In the embodiment of the present application, there is a terminal device, a mobile device, and a server, where the terminal device is configured to invoke an interface of the server to implement a function that the user needs to invoke, and the mobile device is configured to receive an interface verification short message sent by the server, and the server is configured to respond to the terminal device. The interface calls the request to provide the corresponding service for the terminal device.
示例性地,在我们日常生活中,有时希望通过计算机使用网页的某种功能时,网页经常会向我们的手机发送一个包含验证码的短信,当我们通过计算机输入短信中的验证码后,计算机就可以使用网页的某种功能了。在这个示例中,计算机就作为本申请实施例中的终端设备,手机作为移动设备,而网页的服务器作为本申请实施例中的服务器。Illustratively, in our daily life, sometimes when we want to use a certain function of a webpage through a computer, the webpage often sends a text message containing a verification code to our mobile phone. When we input the verification code in the short message through the computer, the computer You can use some feature of the web page. In this example, the computer is used as the terminal device in the embodiment of the present application, and the mobile phone is used as the mobile device, and the server of the web page is used as the server in the embodiment of the present application.
可以理解地,本申请实施例的执行主体并不一定是与移动设备不同的终端设备,移动设备和终端设备也可以是同一个设备。例如,手机既可以作为接收包含验证码的短信的移动设备,也可以作为调用服务器的接口的终端设备。It can be understood that the execution entity of the embodiment of the present application is not necessarily a terminal device different from the mobile device, and the mobile device and the terminal device may also be the same device. For example, the mobile phone can be used as a mobile device that receives a short message including a verification code, or as a terminal device that invokes an interface of the server.
可选地,在本申请实施例中,移动设备的设备标识可以是移动设备的物理地址、CPU识别码或者手机的型号,所以移动设备的设备标识既可以是唯一确定的标识,也可以是可能与其他移动设备相同的只是用于区分种类的标识。Optionally, in the embodiment of the present application, the device identifier of the mobile device may be a physical address of the mobile device, a CPU identifier, or a model of the mobile phone, so the device identifier of the mobile device may be a unique identifier or may be The same as other mobile devices is just an identifier for distinguishing categories.
具体地,接口参数为用户输入的,用于向服务器指明需要调用何种接口的参数,可以理解地,服务器在接收到接口参数后可以根据接口参数为终端设备提供相应的服务。Specifically, the interface parameter is input by the user, and is used to indicate to the server which parameter the interface needs to be invoked. It can be understood that after receiving the interface parameter, the server can provide the corresponding service to the terminal device according to the interface parameter.
具体地,如上文所述,接口验证短信包含一个验证码,只有通过终端设备输入正确的验证码后,服务器才有可能响应终端设备的接口调用请求。可以理解地,若终端设备与移动设备为不同的设备,则移动设备需要将接口验证短信转发至终端设备中;若终端设备与移动设备为相同的设备,则终端设备可以直接分析接口验证短信。Specifically, as described above, the interface verification short message includes a verification code, and only after the correct verification code is input through the terminal device, the server may respond to the terminal device's interface call request. It can be understood that if the terminal device and the mobile device are different devices, the mobile device needs to forward the interface verification short message to the terminal device; if the terminal device and the mobile device are the same device, the terminal device can directly analyze the interface verification short message.
S102,从所述接口验证短信中提取接口验证码。S102. Extract an interface verification code from the interface verification short message.
在本申请实施例中,在终端设备接口道接口验证短信后需要自动提取接口验证短信中的接口验证码。In the embodiment of the present application, after the terminal device interface interface verifies the short message, the interface verification code in the interface verification short message needs to be automatically extracted.
作为本申请的一个实施例,如图2所示,上述S102包括:As an embodiment of the present application, as shown in FIG. 2, the foregoing S102 includes:
S1021:根据预设的关键词数据库,识别所述接口验证短信中包含的关键词以及所述关键词对应的关键度,所述关键词数据库包括关键词与关键度的对应关系。S1021: Identify, according to a preset keyword database, a keyword included in the interface verification short message and a key degree corresponding to the keyword, where the keyword database includes a correspondence between a keyword and a criticality.
可以理解地,我们日常生活中接收到的接口验证短信中都会包括一个或多个关键词,根据这些关键词就可以锁定验证码所在的位置,从而提取出验证码。Understandably, the interface verification message received in our daily life will include one or more keywords, according to which the location of the verification code can be locked, thereby extracting the verification code.
示例性地,一个接口验证短信为:“【软件A】581458(软件A手机验证码,请完成验证),如非本人操作,请忽略本短信”。另一个接口验证短信为:“【软件B】934047(设备锁验证码),用于QQ号12345678登录的设备验证,请勿转发。如不想接收此类短信,请回复T”,在这两条接口验证短信中,“验证码”、“验证”等词就可以作为关键词。Exemplarily, an interface verification message is: "[Software A] 581458 (software A mobile phone verification code, please complete verification), if not, please ignore this message." Another interface verification message is: "[Software B] 934047 (Device Lock Verification Code), used for device verification with QQ number 12345678 login, please do not forward. If you do not want to receive such SMS, please reply T", in these two In the interface verification message, words such as "verification code" and "verification" can be used as keywords.
可以理解地,并不是所有的接口验证短信都有类似“验证码”这么明显的关键词,例如一个接口验证短信为:“【软件C】您正在请求调用X功能,请凭29834918进行调用”,这个接口验证短信中就没有“验证码”或“验证”作为关键词。Understandably, not all interface verification messages have such obvious keywords as "verification code". For example, an interface verification message is: "[Software C] You are requesting to call the X function, please call 29834918", There is no "verification code" or "verification" as a keyword in this interface verification message.
如上文示例所述,为了应对各种不同的接口验证短信中关键词的多样性,本申请实施例通过海量的接口验证短信,总结出一个关键词数据库,该关键词数据库中包含了多个关键词。此外,由于考虑到一个接口验证短信中可能包含多个关键词,而在接口验证短信中不同的关键词的周边出现验证码的概率是不同的,因此为每个关键词赋予一个关键度,所以该关键词数据库还包括了关键词与关键度的对应关系。可以理解地,一个关键词的关键度越高,代表该关键词的周边出现验证码的概率越大。As described in the above example, in order to respond to various interfaces to verify the diversity of keywords in a short message, the embodiment of the present application verifies a short message through a massive interface, and summarizes a keyword database, which contains multiple keys. word. In addition, since it is considered that an interface verification message may contain a plurality of keywords, and the probability of occurrence of a verification code in the periphery of different keywords in the interface verification message is different, each keyword is given a critical degree, so The keyword database also includes the correspondence between keywords and criticality. It can be understood that the higher the criticality of a keyword, the greater the probability that a verification code appears around the keyword.
具体地,基于关键词数据库,通过文本识别算法可以识别出接口验证短信中包含的关键词。Specifically, based on the keyword database, the keyword included in the interface verification short message can be identified by the text recognition algorithm.
S1022:判断所述接口验证短信中包含关键词的个数。S1022: Determine the number of keywords included in the interface verification short message.
如上文所述,一个接口验证短信中可能包括一个或多个关键词,在本申请实施例中,由于处理只含有一个关键词的接口验证短信的方法与处理含有多个关键词的接口验证短信的方法不同,所以需要首先判断根据上述文本识别算法识别出的关键词的个数。As described above, an interface verification short message may include one or more keywords. In the embodiment of the present application, a method for verifying a short message by processing an interface containing only one keyword and an interface verifying a short message with multiple keywords are processed. The method is different, so it is necessary to first judge the number of keywords identified by the above-described text recognition algorithm.
S1023:若所述接口验证短信中只包含一个所述关键词,则将所述关键词之前的预设隔断标志与所述关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。S1023: If the interface verification message includes only one keyword, the number existing between the preset blocking flag before the keyword and the preset blocking flag after the keyword is used as the Interface verification code.
在本申请实施例中,为了识别出接口验证短信中的验证码,除了识别关键词以外还需要识别预设隔断标志。可选地,可以将部分标点符号作为预设隔断标志。In the embodiment of the present application, in order to identify the verification code in the interface verification short message, in addition to identifying the keyword, it is necessary to identify the preset isolation flag. Alternatively, a partial punctuation mark can be used as a preset cutoff mark.
示例性地,如上文示例所述:一个接口验证短信为:“【软件A】581458(软件A手机验证码,请完成验证),如非本人操作,请忽略本短信”。可以将标点符号“】”以及标点符号“,”作为两个预设隔断标志。可以理解地,由于在接口验证短信中,验证码会出现在关键词的上下文中,且相隔的字符比较少,所以可以通过识别预设隔断标志的方式,确定验证码所在区间。进一步地,将所述关键词之前的预设隔断标志与所述关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。可以理解地,本申请实施例之所以不直接检测借口验证短信中的数字,是因为借口验证短信中经常存在多个数字,例如:验证码、时间、手机号、qq号或者其他登录账号等,所以需要确定验证码可能存在的区间,之后再进行数字提取。值得注意地,在本申请实施例中,并不是直接将所有的标点符号作为预设隔断标志,而是根据海量的接口验证码短信确定出预设隔断标志。Exemplarily, as described in the above example: an interface verification message is: "[Software A] 581458 (software A mobile phone verification code, please complete verification), if not, please ignore this message." The punctuation mark "]" and the punctuation mark "," can be used as two preset cutoff marks. It can be understood that, since the verification code appears in the context of the keyword in the interface verification short message, and the number of characters is relatively small, the interval in which the verification code is located can be determined by identifying the preset blocking flag. Further, a number existing between the preset cutoff flag before the keyword and the preset cutoff flag after the keyword is used as the interface verification code. It can be understood that the reason why the embodiment of the present application does not directly detect the number in the short message verification is because the excuses verify that there are often multiple numbers in the short message, such as a verification code, a time, a mobile phone number, a qq number, or other login account. Therefore, it is necessary to determine the interval in which the verification code may exist, and then perform digital extraction. Notably, in the embodiment of the present application, not all the punctuation marks are directly used as the preset blocking flag, but the preset blocking flag is determined according to the massive interface verification code short message.
示例性地,若词语“验证码”为关键词,标点符号“】”以及标点符号“,”为预设隔断标志,仍以上文示例为例:一个接口验证短信为:“【软件A】581458(软件A手机验证码,请完成验证),如非本人操作,请忽略本短信”。关键词之前的预设隔断标志为“】”,关键词之后的预设隔断标志为“,”,所以通过两个预设隔断标志可以从接口验证短信中截取出“】581458(软件A手机验证码,请完成验证),”,通过识别该部分中的数字,得到“581458”作为接口验证短信中的验证码。Exemplarily, if the word "verification code" is a keyword, the punctuation mark "]" and the punctuation mark "," are preset partition marks, still the above example is taken as an example: an interface verification message is: "[Software A] 581458 (Software A mobile phone verification code, please complete the verification), if you are not operating, please ignore this SMS. The preset partition mark before the keyword is "]", and the preset cutoff flag after the keyword is ",", so the "] 581458 can be intercepted from the interface verification message by two preset cutoff flags (software A mobile phone verification) Code, please complete the verification),", by identifying the number in the section, get "581458" as the verification code in the interface verification SMS.
可选地,设定预设隔断标志的方法包括:从多个接口验证短信中,筛选出出现频率大于或等于第一频率阈值的标点符号,得到第一符号组;计算各个所述第一符号组里的标点符号出现在验证码与关键词之间的频率,作为各个标点符号的第二频率;将所述第一符号组中第二频率大于第二频率阈值的标点符号删除,得到第二符号组;将所述第二符号组内的标点符号作为预设隔断标志。可以理解地,预设隔断标志应为在接口验证码短信中出现频率较高,但是出现在验证码与关键词之间的频率较低的标点符号,也就是说预设隔断标志不应该将验证码与关键词隔开,而应该将验证码与关键词共同所在的部分与其他部分隔开。Optionally, the method for setting a preset blocking flag includes: selecting a punctuation mark whose appearance frequency is greater than or equal to the first frequency threshold from the plurality of interface verification short messages, to obtain a first symbol group; and calculating each of the first symbols The punctuation marks in the group appear in the frequency between the verification code and the keyword as the second frequency of each punctuation mark; the punctuation symbol in the first symbol group whose second frequency is greater than the second frequency threshold is deleted to obtain the second a symbol group; the punctuation marks in the second symbol group are used as a preset blocking flag. It can be understood that the preset cutoff flag should be a punctuation symbol with a higher frequency appearing in the interface verification code short message but appearing between the verification code and the keyword, that is, the preset cutoff flag should not be verified. The code is separated from the keyword, and the part where the verification code and the keyword are co-located should be separated from the other parts.
S1024:若所述接口验证短信中包含多个所述关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个关键词中位置最靠前的一个关键度最高的关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。S1024: If the interface verification message includes multiple keywords, determine a special keyword, where the special keyword is a key position among the plurality of keywords included in the interface verification short message. The highest degree keyword, and the number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword is used as the interface verification code.
具体地,若一个接口验证码可能存在多个关键词,则从这些关键词中选择关键度最高的关键词作为特殊关键词。如果存在多个关键词的关键度并列最高,则在这些关键度并列最高的关键词中选择在接口验证短信中位置最靠前的一个,作为特殊关键词。Specifically, if an interface verification code may have multiple keywords, the keyword with the highest degree of criticality is selected as a special keyword from among these keywords. If there are multiple keywords with the highest degree of juxtaposition, the one with the highest position among the key points is selected as the special keyword in the interface verification short message.
在本申请实施例中,通过对关键词以及预设隔断标志的提取,划分出验证码在接口验证短信中的区间,提取该区间的数字作为验证码,实现了对接口验证短信的自动化分析,在无人工干预的情况下提取验证码,提高整个接口调用过程的自动化程度。In the embodiment of the present application, by extracting keywords and preset partition marks, the interval of the verification code in the interface verification short message is divided, and the number of the interval is extracted as a verification code, thereby realizing automatic analysis of the interface verification short message. Extract the verification code without human intervention to improve the automation of the entire interface call process.
由于如果一个接口验证短信中存在多个关键词时,可能存在特殊关键词定位不准的情况,所以可能出现验证码提取不正确的情况发生。另一方面,一些短信可能并没有明确的关键词,或者验证码与关键词在接口验证短信中的位置关系比较特殊,则也可能导致验证码提取错误。可以理解地,如果验证码提取错误,则在将接口调用请求发送给服务器后,会接收到服务器反馈的验证码不匹配响应,为了更好地应对上述情况,图3示出了本申请实施例提供的验证码附加提取流程,各步骤的具体实现原理如下。If an interface is verified to have multiple keywords in a short message, there may be cases where the special keyword is not accurately located, so that the verification code may be incorrectly extracted. On the other hand, some short messages may not have clear keywords, or the location relationship between the verification code and the keyword in the interface verification message is special, which may also lead to error in the verification code extraction. It can be understood that, if the verification code is incorrectly extracted, after the interface call request is sent to the server, the verification code that is fed back by the server does not match the response. In order to better cope with the above situation, FIG. 3 shows the embodiment of the present application. The verification code additional extraction process is provided, and the specific implementation principles of each step are as follows.
S301,若接收到服务器反馈的验证码不匹配响应,则根据预设的关键词数据库,判断所述接口验证短信中是否存在遗留关键词。S301. If the verification code fed back by the server does not match the response, determine, according to the preset keyword database, whether the interface verifies that there is a legacy keyword in the short message.
所述遗留关键词为未被用于提取所述接口验证码的关键词,所述关键词数据库包括关键词与关键度的对应关系。本申请实施例用于应对接收到服务器反馈的验证码不匹配响应后的处理过程,其中具体地根据关键词数据库提取接口验证短信中的关键词的方法已在其他发明实施例中进行了介绍,在此不进行赘述。可以理解地,既然接到了服务器反馈的验证码不匹配响应,则证明之前已经通过一个关键词提取过接口验证码,所以在本申请实施例中需要判断接口验证短信中是否还有未被用于提取接口验证码的关键词即遗留关键词。可以理解地,判断结果分为3种情况,分别为:1,存在一个遗留关键词;2,存在多个遗留关键词;3,不存在遗留关键词。在本申请实施例中,针对上述3种情况存在3种不同的处理方法。The legacy keyword is a keyword that is not used to extract the interface verification code, and the keyword database includes a correspondence between a keyword and a criticality. The embodiment of the present application is configured to cope with a process of receiving a verification code that does not match the feedback of the server, and the method for extracting the keyword in the short message according to the keyword database is introduced in other embodiments of the invention. I will not repeat them here. It can be understood that, since the verification code that is fed back by the server does not match the response, it is proved that the interface verification code has been extracted by a keyword. Therefore, in the embodiment of the present application, it is required to determine whether the interface verification message is still not used. The keyword that extracts the interface verification code is the legacy keyword. It can be understood that the judgment result is divided into three kinds of cases, namely: 1, there is one legacy keyword; 2, there are multiple legacy keywords; 3, there is no legacy keyword. In the embodiment of the present application, there are three different processing methods for the above three cases.
S302,若所述接口验证短信中存在一个所述遗留关键词,则将所述遗留关键词之前的预设隔断标志与所述遗留关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。S302. If one of the legacy keywords exists in the interface verification short message, the number existing between the preset cutoff flag before the legacy keyword and the preset cutoff flag after the legacy keyword is used as a number. The interface verification code.
可以理解地,如果只存在一个遗留关键词,则通过上文实施例中介绍的根据关键词和预设隔断标志提取接口验证码的方法,在本步骤中通过遗留关键词和预设隔断标志提取接口验证码。It can be understood that if there is only one legacy keyword, the method for extracting the interface verification code according to the keyword and the preset partition flag introduced in the above embodiment is extracted in this step by the legacy keyword and the preset partition flag. Interface verification code.
S303,若所述接口验证短信中包含多个所述遗留关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个所述遗留关键词中位置最靠前的一个关键度最高的所述遗留关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。S303. If the interface verification short message includes a plurality of the legacy keywords, determining a special keyword, where the special keyword is the most located among the plurality of the legacy keywords included in the interface verification short message. a previous keyword with the highest degree of criticality, and a number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the Interface verification code.
可以理解地,如果存在多个遗留关键词,则再次从这些遗留关键词中选取一个特殊关键词,并再次基于这个特殊关键词和预设隔断标志提取接口验证码。It can be understood that if there are multiple legacy keywords, one special keyword is selected from these legacy keywords again, and the interface verification code is extracted again based on the special keyword and the preset partition flag.
S304,若所述接口验证短信中不存在所述遗留关键词,则通知用户查看所述验证短信或通知服务器重新发送新的验证短信。S304. If the legacy keyword is not present in the interface verification short message, notify the user to view the verification short message or notify the server to resend the new verification short message.
在本申请实施例中,如果接口验证短信中已不存在遗留关键词,则证明上文实施例介绍的从接口验证短信中提取验证码的方法不适用于当前接口验证短信。可选地,由于可能出现的是意外情况,所以在这种情况下可以通知服务器向移动设备重新发送一个接口验证短信,从而基于新的接口验证短信重新分析并提取验证码。可选地,由于上文实施例介绍的方法可能的确不适用于当前接口验证码短信的词组排列规则,所以无法自动识别验证码,因此需要通知用户查看移动设备接收的验证码,并手动输入验证码以调取接口。可选地,虽然上文实施例介绍的方法可能不适用于当前接口验证码短信的词组排列规则,但是可以自动切换其他自动识别接口验证码短信中验证码的方法。例如,不通过关键词,而是直接识别出短信中的数字作为验证码。在本申请实施例中,通过判断接口验证短信中是否存在遗留关键词,分别对3种情况进行不同的处理方法,提高了应对不同接口验证短信的能力。In the embodiment of the present application, if there is no legacy keyword in the interface verification short message, the method for extracting the verification code from the interface verification short message introduced in the above embodiment is not applicable to the current interface verification short message. Alternatively, since an unexpected situation may occur, the server may be notified in this case to resend an interface verification short message to the mobile device to re-analyze and extract the verification code based on the new interface verification message. Optionally, since the method introduced in the foregoing embodiment may not be applicable to the phrase arrangement rule of the current interface verification code short message, the verification code cannot be automatically identified, so the user needs to be notified to check the verification code received by the mobile device, and manually input the verification code. Code to get the interface. Optionally, although the method introduced in the foregoing embodiment may not be applicable to the phrase arrangement rule of the current interface verification code short message, other methods for automatically identifying the verification code in the interface verification code short message may be automatically switched. For example, instead of keywords, the number in the short message is directly recognized as a verification code. In the embodiment of the present application, by determining whether the interface has a legacy keyword in the short message, different processing methods are respectively performed on the three situations, thereby improving the ability to respond to different interfaces for verifying the short message.
S103,根据所述设备标识确定加密算法,并通过所述加密算法对所述接口参数进行加密,生成接口加密字段。S103. Determine an encryption algorithm according to the device identifier, and encrypt the interface parameter by using the encryption algorithm to generate an interface encryption field.
在本申请实施例中,为了保证在接口调用过程中,他人无法盗用接口参数,需要对接口参数进行加密。值得注意地,在本申请实施例中,不同的移动设备的设备标识可以对应着不同加密算法,使得他人无法知道用何种算法对接口参数进行的加密,因而无法根据已知的相应的算法对接口加密字段进行解密。In the embodiment of the present application, in order to ensure that others cannot steal interface parameters during the interface call, the interface parameters need to be encrypted. Notably, in the embodiment of the present application, the device identifiers of different mobile devices may correspond to different encryption algorithms, so that others cannot know which algorithm to encrypt the interface parameters, and thus cannot be based on the known corresponding algorithm. The interface encryption field is decrypted.
S104,计算所述接口验证码的摘要,作为验证码摘要。S104. Calculate a summary of the interface verification code as a verification code digest.
在本申请实施例中,如果验证码在接口调用的过程中被他人盗用,则他人可能可以基于该验证码调用相关的接口,从而使验证码失去了原本存在的意义,为了保证验证码在接口调用的传输过程中的安全性,本申请实施例通过签名算法对验证码进行加密。为了通过签名算法对验证码进行加密,需要首先计算出验证码的摘要。可选地,可以通过现有的MD5算法计算验证码的摘要。In the embodiment of the present application, if the verification code is stolen by others during the process of the interface call, the other person may invoke the relevant interface based on the verification code, so that the verification code loses the original meaning, in order to ensure the verification code is in the interface. For security in the transmission process of the call, the embodiment of the present application encrypts the verification code by using a signature algorithm. In order to encrypt the verification code by the signature algorithm, it is necessary to first calculate a summary of the verification code. Alternatively, the digest of the verification code can be calculated by the existing MD5 algorithm.
S105,根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段。S105. Determine a signature key according to the device identifier, and perform a signature operation on the verification code digest by using the signature key to generate a verification code signature field.
在本申请实施例中,不同的移动设备标识对应着不同的签名密钥,以防止他人在截获签名密钥后对验证码签名字段进行解码,得到验证码。具体地,本申请实施例中,一个签名密钥包括两个参数,假设根据预设的设备标识与签名密钥映射表,一个设备标识对应的签名密钥包括的参数分别为d以及n。则通过公式:S=(h(m)^d) mod n计算出所述验证码签名字段,其中S为所述验证码签名字段、h(m)为验证码摘要、符号^为幂计算符以及符号mod为取余数计算符。在本申请实施例中,通过不同的算法分别对接口参数以及验证码进行加密,而且选用的算法与设备标识相关,不同的设备标识可能对应不同的算法,极大地提升了接口调用过程中一些重要数据的数据安全度。In the embodiment of the present application, different mobile device identifiers correspond to different signature keys to prevent others from decoding the verification code signature field after intercepting the signature key, and obtaining a verification code. Specifically, in the embodiment of the present application, one signature key includes two parameters. Assume that the signature key corresponding to a device identifier includes d and n according to a preset device identifier and a signature key mapping table. Then, the verification code signature field is calculated by a formula: S=(h(m)^d) mod n, where S is the verification code signature field, h(m) is a verification code digest, and the symbol ^ is a power operator And the symbol mod is the remainder operator. In the embodiment of the present application, the interface parameters and the verification code are separately encrypted by different algorithms, and the selected algorithm is related to the device identifier, and different device identifiers may correspond to different algorithms, which greatly improves some important functions in the interface calling process. The data security of the data.
S106,将所述设备标识、所述接口加密字段以及所述验证码签名字段组装成接口调用请求,并将所述接口调用请求发送至服务器。S106. Assemble the device identifier, the interface encryption field, and the verification code signature field into an interface call request, and send the interface call request to the server.
在本申请实施例中,通过接收移动设备的设备标识、接口参数以及接口验证短信,从接口验证短信中提取接口验证码,并基于设备标识对应的算法,分别对接口验证码的摘要进行签名运算,以及对接口参数进行加密,得到接口加密字段和验证码签名字段,并将设备标识、接口加密字段以及验证码签名字段组装成接口调用请求,并将接口调用请求发送给服务器,以提高接口调用时的自动化水平以及安全性。In the embodiment of the present application, by receiving the device identifier, the interface parameter, and the interface verification short message of the mobile device, the interface verification code is extracted from the interface verification short message, and the abstract of the interface verification code is respectively performed according to the algorithm corresponding to the device identifier. And encrypting the interface parameters, obtaining the interface encryption field and the verification code signature field, and assembling the device identification, the interface encryption field, and the verification code signature field into an interface call request, and sending the interface call request to the server to improve the interface call. The level of automation and safety.
图4示出了本申请实施例提供的接口调用的响应方法的实现流程,该方法流程包括步骤S401至S407。各步骤的具体实现原理如下。FIG. 4 shows an implementation flow of a response method for an interface call provided by an embodiment of the present application, where the method flow includes steps S401 to S407. The specific implementation principle of each step is as follows.
S401,接收终端设备发送的接口调用请求。S401. Receive an interface call request sent by the terminal device.
在本申请实施例中,存在终端设备、移动设备以及服务器,其中终端设备用于调用服务器的接口以实现用户需要调用的功能,移动设备用于接收服务器发送的接口验证短信,服务器用于响应终端设备的接口调用请求,为终端设备提供相应的服务。In the embodiment of the present application, there are a terminal device, a mobile device, and a server, where the terminal device is configured to invoke an interface of the server to implement a function that the user needs to invoke, and the mobile device is configured to receive an interface verification short message sent by the server, and the server is configured to respond to the terminal. The interface of the device invokes the request to provide the corresponding service for the terminal device.
在本申请实施例中,接口调用请求是由终端设备发送的,服务器需要验证接口调用请求中的相关数据,判断是否使用相关接口逻辑为终端设备处理数据。In the embodiment of the present application, the interface call request is sent by the terminal device, and the server needs to verify the related data in the interface call request, and determine whether to use the relevant interface logic to process the data for the terminal device.
S402,从所述接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段。S402. Parse the device identifier, the interface encryption field, and the verification code signature field of the mobile device from the interface call request.
由于在终端设备一侧,终端设备将设备标识、接口加密字段以及验证码签名字段组装成接口调用请求,所以在服务器侧需要从接口调用请求中分离出这3类数据。Since the terminal device assembles the device identification, the interface encryption field, and the verification code signature field into an interface call request on the terminal device side, the server side needs to separate the three types of data from the interface call request.
S403,根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码签名字段进行解码运算,得到验证码摘要。S403. Determine a signature key according to the device identifier, and perform a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest.
示例性地,假设在终端设备侧,一个设备标识对应的签名密钥包括的参数分别为d以及n。而且是通过公式:S=(h(m)^d) mod n计算出所述验证码签名字段,其中S为所述验证码签名字段、h(m)为验证码摘要、符号^为幂计算符以及符号mod为取余数计算符。Exemplarily, it is assumed that on the terminal device side, the signature keys corresponding to one device identifier include parameters d and n, respectively. Moreover, the verification code signature field is calculated by a formula: S=(h(m)^d) mod n, where S is the verification code signature field, h(m) is a verification code digest, and the symbol ^ is a power calculation. The character and the symbol mod are the remainder operators.
则在服务器侧,同样通过设备标识确定签名密钥,并通过签名计算的逆过程计算出验证码摘要字段,例如在本示例中,通过公式S=(h(m)^d) mod n的逆过程,在已知验证码签名字段S、签名密钥的参数d以及n的前提下,计算出验证码签名字段S。On the server side, the signature key is also determined by the device identifier, and the verification code summary field is calculated by the inverse process of the signature calculation. For example, in this example, by the formula S=(h(m)^d) the inverse of mod n The process calculates the verification code signature field S on the premise that the verification code signature field S and the parameters d and n of the signature key are known.
S404,根据所述验证码摘要还原出接口验证码。S404. Restore an interface verification code according to the verification code digest.
可以理解地,根据终端设备侧的摘要算法的逆过程,可以将验证码摘要还原成接口验证码,值得注意地,计算验证码的验证码摘要的算法或者从验证码摘要还原验证码的算法并不需要根据不同的移动设备或者终端设备进行区分。由于在上文所述的发明实施例中可以统一使用MD5算法或其他计算摘要的算法计算各个移动设备接收的验证码,所以在本申请实施例中,同样也可以统一使用MD5算法或其他计算摘要的算法将验证码摘要还原。It can be understood that, according to the inverse process of the digest algorithm on the terminal device side, the verification code digest can be restored to the interface verification code, notably, the algorithm for calculating the verification code digest of the verification code or the algorithm for restoring the verification code from the verification code digest and There is no need to distinguish between different mobile devices or terminal devices. In the embodiment of the present invention, the MD5 algorithm or other algorithm for calculating the digest can be used to calculate the verification code received by each mobile device. Therefore, in the embodiment of the present application, the MD5 algorithm or other calculation digest can also be uniformly used. The algorithm restores the verification code digest.
S405,判断从所述验证码摘要中还原出的接口验证码与服务器发送给所述移动设备的接口验证码是否相同。S405. Determine whether the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device.
在本申请实施例中,服务器存储有预设单位时间段内发送给各个移动设备的验证码,通过移动设备的设备标识,服务器可以查找到发送给该移动设备的接口验证码,从而可以判断从端口调用请求中解析出的接口验证码与服务器发送给所述移动设备的接口验证码相同。In the embodiment of the present application, the server stores a verification code sent to each mobile device in a preset unit time period, and the server may find an interface verification code sent to the mobile device by using the device identifier of the mobile device, so that the server can determine The interface verification code parsed in the port invocation request is the same as the interface verification code sent by the server to the mobile device.
S406,若从所述验证码摘要中还原出的接口验证码与服务器发送给所述移动设备的接口验证码不相同,则向所述移动设备发出验证码不匹配通知。S406. If the interface verification code restored from the verification code digest is different from the interface verification code sent by the server to the mobile device, send a verification code mismatch notification to the mobile device.
在本申请实施例中,服务器向移动设备发出验证码不匹配通知,有利于提示用户以再次请求验证码,或提醒用户其相关数据可能正被他人盗用。In the embodiment of the present application, the server sends a verification code mismatch notification to the mobile device, which is convenient for prompting the user to request the verification code again, or reminding the user that the related data may be being stolen by others.
S407,若从所述验证码摘要中还原出的接口验证码与服务器发送给所述移动设备的接口验证码相同,则根据所述设备标识确定解密算法,并通过所述解密算法对所述接口加密字段进行解密计算,生成接口参数。S407, if the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device, determining a decryption algorithm according to the device identifier, and using the decryption algorithm to the interface The encrypted field is decrypted and calculated to generate interface parameters.
可以理解地,由于在终端设备侧,根据设备标识确定的加密算法对接口参数进行了加密,所以在本申请实施例中,服务器同样根据设备标识可以确定出相应的解密算法,并通过解密算法对所述接口加密字段进行解密计算,生成接口参数。It can be understood that, in the embodiment of the present application, the server can also determine the corresponding decryption algorithm according to the device identifier, and the decryption algorithm is The interface encryption field performs decryption calculation and generates interface parameters.
S408,若所述服务器中存在与所述接口参数一致的参数,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。S408. If a parameter that is consistent with the interface parameter exists in the server, process the to-be-processed data sent by the terminal according to the interface logic corresponding to the interface parameter.
可以理解地,用户在终端设备中输入接口参数的目的是调用服务器的相关接口,所以在本申请实施例中,服务器需要判断本服务器是否存在一个接口的接口参数与终端设备发送的接口调用请求中的接口参数一致,如果一致,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。It is to be understood that the purpose of the interface parameter input by the user in the terminal device is to invoke the relevant interface of the server. Therefore, in the embodiment of the present application, the server needs to determine whether the interface parameter of the interface exists in the interface and the interface call request sent by the terminal device. The interface parameters are the same. If they are consistent, the data to be processed sent by the terminal is processed according to the interface logic corresponding to the interface parameter.
在本申请实施例中,通过接收终端设备发送的接口调用请求;从接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段;根据设备标识确定签名密钥,并通过签名密钥对验证码签名字段进行解码运算,得到验证码摘要;根据验证码摘要还原出接口验证码;若接口验证码与服务器发送给移动设备的接口验证码相同,则根据设备标识确定解密算法,并通过解密算法对接口加密字段进行解密计算,生成接口参数;若服务器中存在与接口参数一致的参数,则根据接口参数对应的接口逻辑对终端发送的待处理数据进行处理,以自动验证终端设备发送的接口调用请求,提升整个系统的自动化程度。In the embodiment of the present application, the interface is invoked by the interface that is sent by the terminal device; the device identifier, the interface encryption field, and the verification code signature field of the mobile device are parsed from the interface call request; the signature key is determined according to the device identifier, and the signature is obtained. The key is decoded by the verification code signature field to obtain a verification code digest; the interface verification code is restored according to the verification code digest; if the interface verification code is the same as the interface verification code sent by the server to the mobile device, the decryption algorithm is determined according to the device identifier. And decrypting the interface encryption field by using a decryption algorithm to generate an interface parameter; if the server has a parameter consistent with the interface parameter, processing the to-be-processed data sent by the terminal according to the interface logic corresponding to the interface parameter, to automatically verify the terminal device The sent interface calls the request to increase the automation of the entire system.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence of the steps in the above embodiments does not mean that the order of execution is performed. The order of execution of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
对应于上文实施例所述的接口调用方法,图5示出了本申请实施例提供的接口调用装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the interface calling method described in the foregoing embodiment, FIG. 5 is a structural block diagram of the interface calling device provided by the embodiment of the present application. For the convenience of description, only the parts related to the embodiment of the present application are shown.
参照图5,该装置包括:Referring to Figure 5, the apparatus includes:
接收单元51,用于接收移动设备的设备标识、接口参数以及服务器发送给所述移动设备的接口验证短信;提取单元52,用于提取从所述接口验证短信中提取接口验证码;生成单元53,用于根据所述设备标识确定加密算法,并通过所述加密算法对所述接口参数进行加密,生成接口加密字段;计算单元54,用于计算所述接口验证码的摘要,作为验证码摘要;签名单元55,用于根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段;组装单元56,用于将所述设备标识、所述接口加密字段以及所述验证码签名字段组装成接口调用请求,并将所述接口调用请求发送至服务器。The receiving unit 51 is configured to receive a device identifier of the mobile device, an interface parameter, and an interface verification short message sent by the server to the mobile device, and an extracting unit 52, configured to extract an interface verification code from the interface verification short message, and the generating unit 53 And determining, by the device identifier, an encryption algorithm, and encrypting the interface parameter by using the encryption algorithm to generate an interface encryption field; and the calculating unit 54 is configured to calculate a summary of the interface verification code, as a verification code summary. a signature unit 55, configured to determine a signature key according to the device identifier, and perform a signature operation on the verification code digest by using the signature key to generate a verification code signature field; and an assembly unit 56, configured to: use the device The identification, the interface encryption field, and the verification code signature field are assembled into an interface call request, and the interface call request is sent to the server.
可选地,所述签名单元55包括:Optionally, the signature unit 55 includes:
参数确定子单元,用于根据预设的设备标识与签名密钥的对应关系,确定所述签名密钥,所述签名密钥包括参数d以及参数n;摘要计算子单元,用于通过公式S=(h(m)^d) mod n计算出所述验证码签名字段,其中S为所述验证码签名字段、h(m)为验证码摘要、符号^为幂计算符以及符号mod为取余数计算符。a parameter determining subunit, configured to determine the signature key according to a preset correspondence between a device identifier and a signature key, where the signature key includes a parameter d and a parameter n; and the digest calculation subunit is used to pass the formula S =(h(m)^d) mod n calculates the verification code signature field, where S is the verification code signature field, h(m) is the verification code digest, the symbol ^ is the power operator, and the symbol mod is taken Remainder operator.
对应于上文实施例所述的接口调用的响应方法,图6示出了本申请实施例提供的接口调用的响应装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the response method of the interface call described in the above embodiment, FIG. 6 is a structural block diagram of the response device of the interface call provided by the embodiment of the present application. For the convenience of description, only the related to the embodiment of the present application is shown. section.
接收单元61,用于接收终端设备发送的接口调用请求。解析单元62,用于从所述接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段。解码单元63,用于根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码签名字段进行解码运算,得到验证码摘要。还原单元64,用于根据所述验证码摘要还原出接口验证码。判断单元65,用于判断从所述验证码摘要中还原出的接口验证码与服务器发送给所述移动设备的接口验证码是否相同。第一执行单元66,用于若从所述验证码摘要中还原出的接口验证码与服务器发送给所述移动设备的接口验证码相同,则根据所述设备标识确定解密算法,并通过所述解密算法对所述接口加密字段进行解密计算,生成接口参数。第二执行单元67,用于若所述服务器中存在与所述接口参数一致的参数,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。The receiving unit 61 is configured to receive an interface call request sent by the terminal device. The parsing unit 62 is configured to parse out the device identifier, the interface encryption field, and the verification code signature field of the mobile device from the interface call request. The decoding unit 63 is configured to determine a signature key according to the device identifier, and perform a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest. The restoring unit 64 is configured to restore the interface verification code according to the verification code digest. The determining unit 65 is configured to determine whether the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device. The first execution unit 66 is configured to: if the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device, determine a decryption algorithm according to the device identifier, and pass the The decryption algorithm performs decryption calculation on the interface encryption field to generate an interface parameter. The second execution unit 67 is configured to process the to-be-processed data sent by the terminal according to the interface logic corresponding to the interface parameter, if a parameter that is consistent with the interface parameter exists in the server.
图7是本申请一实施例提供的终端设备的示意图。如图7所示,该实施例的终端设备7包括:处理器70、存储器71以及存储在所述存储器71中并可在所述处理器70上运行的计算机可读指令72,例如接口调用程序。所述处理器70执行所述计算机可读指令72时实现上述各个接口调用方法实施例中的步骤,例如图1所示的步骤101至106。或者,所述处理器70执行所述计算机可读指令72时实现上述各装置实施例中各模块/单元的功能,例如图5所示单元51至56的功能。FIG. 7 is a schematic diagram of a terminal device according to an embodiment of the present application. As shown in FIG. 7, the terminal device 7 of this embodiment includes a processor 70, a memory 71, and computer readable instructions 72 stored in the memory 71 and operable on the processor 70, such as an interface caller. . The processor 70, when executing the computer readable instructions 72, implements the steps in the various interface invocation method embodiments described above, such as steps 101 through 106 shown in FIG. Alternatively, the processor 70, when executing the computer readable instructions 72, implements the functions of the various modules/units in the various apparatus embodiments described above, such as the functions of the units 51-56 shown in FIG.
示例性的,所述计算机可读指令72可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器71中,并由所述处理器70执行,以完成本申请。所述终端设备7可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所称处理器70可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件,所述存储器71可以是所述终端设备7的内部存储单元,例如终端设备7的硬盘或内存。Illustratively, the computer readable instructions 72 may be partitioned into one or more modules/units that are stored in the memory 71 and executed by the processor 70, To complete this application. The terminal device 7 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The processor 70 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), and application specific integrated circuits (Application). Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, the memory 71 may be an internal storage unit of the terminal device 7, such as a hard disk of the terminal device 7. Or memory.
图8是本申请一实施例提供的服务器的示意图。如图8所示,该实施例的服务器8包括:处理器80、存储器81以及存储在所述存储器81中并可在所述处理器80上运行的计算机可读指令82,例如接口调用的响应程序。所述处理器80执行所述计算机可读指令82时实现上述各个接口调用的响应方法实施例中的步骤,例如图1所示的步骤401至407。或者,所述处理器80执行所述计算机可读指令82时实现上述各装置实施例中各模块/单元的功能,例如图6所示单元66至67的功能。FIG. 8 is a schematic diagram of a server according to an embodiment of the present application. As shown in FIG. 8, the server 8 of this embodiment includes a processor 80, a memory 81, and computer readable instructions 82 stored in the memory 81 and executable on the processor 80, such as an interface call response. program. The processor 80 executes the computer readable instructions 82 to implement the steps in the response method embodiments of the various interface calls described above, such as steps 401 through 407 shown in FIG. Alternatively, when the processor 80 executes the computer readable instructions 82, the functions of the various modules/units in the various apparatus embodiments described above are implemented, such as the functions of the units 66 through 67 shown in FIG.
示例性的,所述计算机可读指令82可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器81中,并由所述处理器80执行,以完成本申请。所述服务器8可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述服务器可包括,但不仅限于,处理器80、存储器81。本领域技术人员可以理解,图8仅仅是服务器8的示例,并不构成对服务器8的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述服务器还可以包括输入输出设备、网络接入设备、总线等。Illustratively, the computer readable instructions 82 may be partitioned into one or more modules/units that are stored in the memory 81 and executed by the processor 80, To complete this application. The server 8 can be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The server may include, but is not limited to, a processor 80, a memory 81. It will be understood by those skilled in the art that FIG. 8 is merely an example of the server 8, does not constitute a limitation of the server 8, may include more or less components than those illustrated, or combine some components, or different components, such as The server may also include an input and output device, a network access device, a bus, and the like.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing embodiments. The technical solutions described in the examples are modified or equivalently replaced with some of the technical features; and the modifications or substitutions do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in Within the scope of protection of this application.

Claims (20)

  1. 一种接口调用方法,其特征在于,包括:An interface calling method, comprising:
    接收移动设备的设备标识、接口参数以及服务器发送给所述移动设备的接口验证短信;Receiving a device identifier of the mobile device, an interface parameter, and an interface verification message sent by the server to the mobile device;
    从所述接口验证短信中提取接口验证码;Extracting an interface verification code from the interface verification short message;
    根据所述设备标识确定加密算法,并通过所述加密算法对所述接口参数进行加密,生成接口加密字段;Determining an encryption algorithm according to the device identifier, and encrypting the interface parameter by using the encryption algorithm to generate an interface encryption field;
    计算所述接口验证码的摘要,作为验证码摘要;Calculating a summary of the interface verification code as a verification code summary;
    根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段;Determining a signature key according to the device identifier, and performing a signature operation on the verification code digest by using the signature key to generate a verification code signature field;
    将所述设备标识、所述接口加密字段以及所述验证码签名字段组装成接口调用请求,并将所述接口调用请求发送至服务器。The device identifier, the interface encryption field, and the verification code signature field are assembled into an interface call request, and the interface call request is sent to the server.
  2. 如权利要求1所述的接口调用方法,其特征在于,所述从所述接口验证短信中提取接口验证码,包括:The method for invoking an interface according to claim 1, wherein the extracting the interface verification code from the interface verification short message comprises:
    根据预设的关键词数据库,识别所述接口验证短信中包含的关键词以及所述关键词对应的关键度,所述关键词数据库包括关键词与关键度的对应关系;Determining, according to a preset keyword database, a keyword included in the interface verification short message and a key degree corresponding to the keyword, where the keyword database includes a correspondence between a keyword and a criticality;
    若所述接口验证短信中只包含一个所述关键词,则将所述关键词之前的预设隔断标志与所述关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes only one of the keywords, the number existing between the preset blocking flag before the keyword and the preset blocking flag after the keyword is used as the interface verification. code;
    若所述接口验证短信中包含多个所述关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个关键词中位置最靠前的一个关键度最高的关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。If the interface verification message includes a plurality of the keywords, determining a special keyword, where the special keyword is the highest priority among the plurality of keywords included in the interface verification message And a number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code.
  3. 如权利要求1所述的接口调用方法,其特征在于,所述根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段,包括:The interface calling method according to claim 1, wherein the determining a signature key according to the device identifier, and performing a signature operation on the verification code digest by using the signature key to generate a verification code signature field, include:
    根据预设的设备标识与签名密钥的对应关系,确定所述签名密钥,所述签名密钥包括参数d以及参数n;Determining, according to a preset correspondence between the device identifier and the signature key, the signature key, where the signature key includes a parameter d and a parameter n;
    通过公式S=(h(m)^d) mod n计算出所述验证码签名字段,其中S为所述验证码签名字段、h(m)为验证码摘要、符号^为幂计算符以及符号mod为取余数计算符。The verification code signature field is calculated by the formula S=(h(m)^d) mod n, where S is the verification code signature field, h(m) is the verification code digest, the symbol ^ is the power operator, and the symbol Mod is the remainder operator.
  4. 如权利要求1所述的接口调用方法,其特征在于,还包括:The interface calling method according to claim 1, further comprising:
    若接收到服务器反馈的验证码不匹配响应,则根据预设的关键词数据库,判断所述接口验证短信中是否存在遗留关键词,所述遗留关键词为未被用于提取所述接口验证码的关键词,所述关键词数据库包括关键词与关键度的对应关系;If the verification code received by the server does not match the response, determining, according to the preset keyword database, whether the interface verifies that there is a legacy keyword in the short message, and the legacy keyword is not used to extract the interface verification code. Keywords, the keyword database includes a correspondence between keywords and critical degrees;
    若所述接口验证短信中存在一个所述遗留关键词,则将所述遗留关键词之前的预设隔断标志与所述遗留关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If there is one of the legacy keywords in the interface verification short message, the number existing between the preset cutoff flag before the legacy keyword and the preset cutoff flag after the legacy keyword is used as the Interface verification code;
    若所述接口验证短信中包含多个所述遗留关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个所述遗留关键词中位置最靠前的一个关键度最高的所述遗留关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes a plurality of the legacy keywords, determining a special keyword, where the special keyword is the top position among the plurality of the legacy keywords included in the interface verification short message a legacy keyword having the highest degree of criticality, and verifying the number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code;
    若所述接口验证短信中不存在所述遗留关键词,则通知用户查看所述验证短信或通知服务器重新发送新的验证短信。If the legacy keyword is not present in the interface verification message, the user is notified to view the verification message or the notification server resends the new verification message.
  5. 一种接口调用的响应方法,其特征在于,包括:A response method for an interface call, comprising:
    接收终端设备发送的接口调用请求;Receiving an interface call request sent by the terminal device;
    从所述接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段;Parsing out a device identifier, an interface encryption field, and a verification code signature field of the mobile device from the interface call request;
    根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码签名字段进行解码运算,得到验证码摘要;Determining a signature key according to the device identifier, and performing a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest;
    根据所述验证码摘要还原出接口验证码;Restore an interface verification code according to the verification code digest;
    若从所述验证码摘要中还原出的所述接口验证码与服务器发送给移动设备的接口验证码相同,则根据所述设备标识确定解密算法,并通过所述解密算法对所述接口加密字段进行解密计算,生成接口参数;And if the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device, determining a decryption algorithm according to the device identifier, and encrypting the field by using the decryption algorithm Perform decryption calculation to generate interface parameters;
    若所述服务器中存在与所述接口参数一致的参数,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。And if the parameter is consistent with the interface parameter, the to-be-processed data sent by the terminal is processed according to the interface logic corresponding to the interface parameter.
  6. 一种接口调用装置,其特征在于,包括:An interface calling device, comprising:
    接收单元,用于接收移动设备的设备标识、接口参数以及服务器发送给所述移动设备的接口验证短信;a receiving unit, configured to receive a device identifier of the mobile device, an interface parameter, and an interface verification short message sent by the server to the mobile device;
    提取单元,用于提取从所述接口验证短信中提取接口验证码;An extracting unit, configured to extract an interface verification code from the interface verification short message;
    生成单元,用于根据所述设备标识确定加密算法,并通过所述加密算法对所述接口参数进行加密,生成接口加密字段;a generating unit, configured to determine an encryption algorithm according to the device identifier, and encrypt the interface parameter by using the encryption algorithm to generate an interface encryption field;
    计算单元,用于计算所述接口验证码的摘要,作为验证码摘要;a calculation unit, configured to calculate a summary of the interface verification code, as a verification code summary;
    签名单元,用于根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段;a signature unit, configured to determine a signature key according to the device identifier, and perform a signature operation on the verification code digest by using the signature key to generate a verification code signature field;
    组装单元,用于将所述设备标识、所述接口加密字段以及所述验证码签名字段组装成接口调用请求,并将所述接口调用请求发送至服务器。And an assembly unit, configured to assemble the device identifier, the interface encryption field, and the verification code signature field into an interface call request, and send the interface call request to the server.
  7. 根据权利要求6所述的接口调用装置,其特征在于,所述从所述接口验证短信中提取接口验证码,包括:The interface calling device according to claim 6, wherein the extracting the interface verification code from the interface verification short message comprises:
    根据预设的关键词数据库,识别所述接口验证短信中包含的关键词以及所述关键词对应的关键度,所述关键词数据库包括关键词与关键度的对应关系;Determining, according to a preset keyword database, a keyword included in the interface verification short message and a key degree corresponding to the keyword, where the keyword database includes a correspondence between a keyword and a criticality;
    若所述接口验证短信中只包含一个所述关键词,则将所述关键词之前的预设隔断标志与所述关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes only one of the keywords, the number existing between the preset blocking flag before the keyword and the preset blocking flag after the keyword is used as the interface verification. code;
    若所述接口验证短信中包含多个所述关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个关键词中位置最靠前的一个关键度最高的关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。If the interface verification message includes a plurality of the keywords, determining a special keyword, where the special keyword is the highest priority among the plurality of keywords included in the interface verification message And a number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code.
  8. 根据权利要求6所述的接口调用装置,其特征在于,所述根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段,包括:The interface calling device according to claim 6, wherein the determining a signature key according to the device identifier, and performing a signature operation on the verification code digest by using the signature key to generate a verification code signature field, include:
    根据预设的设备标识与签名密钥的对应关系,确定所述签名密钥,所述签名密钥包括参数d以及参数n;Determining, according to a preset correspondence between the device identifier and the signature key, the signature key, where the signature key includes a parameter d and a parameter n;
    通过公式S=(h(m)^d) mod n计算出所述验证码签名字段,其中S为所述验证码签名字段、h(m)为验证码摘要、符号^为幂计算符以及符号mod为取余数计算符。The verification code signature field is calculated by the formula S=(h(m)^d) mod n, where S is the verification code signature field, h(m) is the verification code digest, the symbol ^ is the power operator, and the symbol Mod is the remainder operator.
  9. 根据权利要求6所述的接口调用装置,其特征在于,还包括:The interface calling device according to claim 6, further comprising:
    若接收到服务器反馈的验证码不匹配响应,则根据预设的关键词数据库,判断所述接口验证短信中是否存在遗留关键词,所述遗留关键词为未被用于提取所述接口验证码的关键词,所述关键词数据库包括关键词与关键度的对应关系;If the verification code received by the server does not match the response, determining, according to the preset keyword database, whether the interface verifies that there is a legacy keyword in the short message, and the legacy keyword is not used to extract the interface verification code. Keywords, the keyword database includes a correspondence between keywords and critical degrees;
    若所述接口验证短信中存在一个所述遗留关键词,则将所述遗留关键词之前的预设隔断标志与所述遗留关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If there is one of the legacy keywords in the interface verification short message, the number existing between the preset cutoff flag before the legacy keyword and the preset cutoff flag after the legacy keyword is used as the Interface verification code;
    若所述接口验证短信中包含多个所述遗留关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个所述遗留关键词中位置最靠前的一个关键度最高的所述遗留关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes a plurality of the legacy keywords, determining a special keyword, where the special keyword is the top position among the plurality of the legacy keywords included in the interface verification short message a legacy keyword having the highest degree of criticality, and verifying the number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code;
    若所述接口验证短信中不存在所述遗留关键词,则通知用户查看所述验证短信或通知服务器重新发送新的验证短信。If the legacy keyword is not present in the interface verification message, the user is notified to view the verification message or the notification server resends the new verification message.
  10. 一种接口调用的响应装置,其特征在于,包括:A response device called by an interface, comprising:
    接收单元,用于接收终端设备发送的接口调用请求。The receiving unit is configured to receive an interface call request sent by the terminal device.
    解析单元,用于从所述接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段。And a parsing unit, configured to parse out a device identifier, an interface encryption field, and a verification code signature field of the mobile device from the interface call request.
    解码单元,用于根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码签名字段进行解码运算,得到验证码摘要。And a decoding unit, configured to determine a signature key according to the device identifier, and perform a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest.
    还原单元,用于根据所述验证码摘要还原出接口验证码。And a restoring unit, configured to restore the interface verification code according to the verification code digest.
    判断单元65,用于判断从所述验证码摘要中还原出的接口验证码与服务器发送给所述移动设备的接口验证码是否相同。The determining unit 65 is configured to determine whether the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device.
    第一执行单元,用于若从所述验证码摘要中还原出的接口验证码与服务器发送给所述移动设备的接口验证码相同,则根据所述设备标识确定解密算法,并通过所述解密算法对所述接口加密字段进行解密计算,生成接口参数。a first execution unit, configured to: if an interface verification code restored from the verification code digest is the same as an interface verification code sent by the server to the mobile device, determine a decryption algorithm according to the device identifier, and perform the decryption by using the The algorithm performs decryption calculation on the interface encryption field to generate an interface parameter.
    第二执行单元,用于若所述服务器中存在与所述接口参数一致的参数,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。The second execution unit is configured to process the to-be-processed data sent by the terminal according to the interface logic corresponding to the interface parameter, if a parameter that is consistent with the interface parameter exists in the server.
  11. 一种电子设备,其特征在于,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:An electronic device, comprising: a memory and a processor, wherein the memory stores computer readable instructions executable on the processor, and the processor implements the following steps when the computer readable instructions are executed :
    接收移动设备的设备标识、接口参数以及服务器发送给所述移动设备的接口验证短信;Receiving a device identifier of the mobile device, an interface parameter, and an interface verification message sent by the server to the mobile device;
    从所述接口验证短信中提取接口验证码;Extracting an interface verification code from the interface verification short message;
    根据所述设备标识确定加密算法,并通过所述加密算法对所述接口参数进行加密,生成接口加密字段;Determining an encryption algorithm according to the device identifier, and encrypting the interface parameter by using the encryption algorithm to generate an interface encryption field;
    计算所述接口验证码的摘要,作为验证码摘要;Calculating a summary of the interface verification code as a verification code summary;
    根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段;Determining a signature key according to the device identifier, and performing a signature operation on the verification code digest by using the signature key to generate a verification code signature field;
    将所述设备标识、所述接口加密字段以及所述验证码签名字段组装成接口调用请求,并将所述接口调用请求发送至服务器。The device identifier, the interface encryption field, and the verification code signature field are assembled into an interface call request, and the interface call request is sent to the server.
  12. 如权利要求11所述的电子设备,其特征在于,所述从所述接口验证短信中提取接口验证码,包括:The electronic device according to claim 11, wherein the extracting the interface verification code from the interface verification short message comprises:
    根据预设的关键词数据库,识别所述接口验证短信中包含的关键词以及所述关键词对应的关键度,所述关键词数据库包括关键词与关键度的对应关系;Determining, according to a preset keyword database, a keyword included in the interface verification short message and a key degree corresponding to the keyword, where the keyword database includes a correspondence between a keyword and a criticality;
    若所述接口验证短信中只包含一个所述关键词,则将所述关键词之前的预设隔断标志与所述关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes only one of the keywords, the number existing between the preset blocking flag before the keyword and the preset blocking flag after the keyword is used as the interface verification. code;
    若所述接口验证短信中包含多个所述关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个关键词中位置最靠前的一个关键度最高的关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。If the interface verification message includes a plurality of the keywords, determining a special keyword, where the special keyword is the highest priority among the plurality of keywords included in the interface verification message And a number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code.
  13. 如权利要求11所述的电子设备,其特征在于,所述根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段,包括:The electronic device according to claim 11, wherein the determining a signature key according to the device identifier, and performing a signature operation on the verification code digest by using the signature key to generate a verification code signature field, including :
    根据预设的设备标识与签名密钥的对应关系,确定所述签名密钥,所述签名密钥包括参数d以及参数n;Determining, according to a preset correspondence between the device identifier and the signature key, the signature key, where the signature key includes a parameter d and a parameter n;
    通过公式S=(h(m)^d) mod n计算出所述验证码签名字段,其中S为所述验证码签名字段、h(m)为验证码摘要、符号^为幂计算符以及符号mod为取余数计算符。The verification code signature field is calculated by the formula S=(h(m)^d) mod n, where S is the verification code signature field, h(m) is the verification code digest, the symbol ^ is the power operator, and the symbol Mod is the remainder operator.
  14. 如权利要求11所述的电子设备,其特征在于,还包括:The electronic device according to claim 11, further comprising:
    若接收到服务器反馈的验证码不匹配响应,则根据预设的关键词数据库,判断所述接口验证短信中是否存在遗留关键词,所述遗留关键词为未被用于提取所述接口验证码的关键词,所述关键词数据库包括关键词与关键度的对应关系;If the verification code received by the server does not match the response, determining, according to the preset keyword database, whether the interface verifies that there is a legacy keyword in the short message, and the legacy keyword is not used to extract the interface verification code. Keywords, the keyword database includes a correspondence between keywords and critical degrees;
    若所述接口验证短信中存在一个所述遗留关键词,则将所述遗留关键词之前的预设隔断标志与所述遗留关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If there is one of the legacy keywords in the interface verification short message, the number existing between the preset cutoff flag before the legacy keyword and the preset cutoff flag after the legacy keyword is used as the Interface verification code;
    若所述接口验证短信中包含多个所述遗留关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个所述遗留关键词中位置最靠前的一个关键度最高的所述遗留关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes a plurality of the legacy keywords, determining a special keyword, where the special keyword is the top position among the plurality of the legacy keywords included in the interface verification short message a legacy keyword having the highest degree of criticality, and verifying the number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code;
    若所述接口验证短信中不存在所述遗留关键词,则通知用户查看所述验证短信或通知服务器重新发送新的验证短信。If the legacy keyword is not present in the interface verification message, the user is notified to view the verification message or the notification server resends the new verification message.
  15. 一种电子设备,其特征在于,包括存储器以及处理器,所述存储器中存储有可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:An electronic device, comprising: a memory and a processor, wherein the memory stores computer readable instructions executable on the processor, and the processor implements the following steps when the computer readable instructions are executed :
    接收终端设备发送的接口调用请求;Receiving an interface call request sent by the terminal device;
    从所述接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段;Parsing out a device identifier, an interface encryption field, and a verification code signature field of the mobile device from the interface call request;
    根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码签名字段进行解码运算,得到验证码摘要;Determining a signature key according to the device identifier, and performing a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest;
    根据所述验证码摘要还原出接口验证码;Restore an interface verification code according to the verification code digest;
    若从所述验证码摘要中还原出的所述接口验证码与服务器发送给移动设备的接口验证码相同,则根据所述设备标识确定解密算法,并通过所述解密算法对所述接口加密字段进行解密计算,生成接口参数;And if the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device, determining a decryption algorithm according to the device identifier, and encrypting the field by using the decryption algorithm Perform decryption calculation to generate interface parameters;
    若所述服务器中存在与所述接口参数一致的参数,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。And if the parameter is consistent with the interface parameter, the to-be-processed data sent by the terminal is processed according to the interface logic corresponding to the interface parameter.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A computer readable storage medium storing computer readable instructions, wherein the computer readable instructions, when executed by at least one processor, implement the following steps:
    接收移动设备的设备标识、接口参数以及服务器发送给所述移动设备的接口验证短信;Receiving a device identifier of the mobile device, an interface parameter, and an interface verification message sent by the server to the mobile device;
    从所述接口验证短信中提取接口验证码;Extracting an interface verification code from the interface verification short message;
    根据所述设备标识确定加密算法,并通过所述加密算法对所述接口参数进行加密,生成接口加密字段;Determining an encryption algorithm according to the device identifier, and encrypting the interface parameter by using the encryption algorithm to generate an interface encryption field;
    计算所述接口验证码的摘要,作为验证码摘要;Calculating a summary of the interface verification code as a verification code summary;
    根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段;Determining a signature key according to the device identifier, and performing a signature operation on the verification code digest by using the signature key to generate a verification code signature field;
    将所述设备标识、所述接口加密字段以及所述验证码签名字段组装成接口调用请求,并将所述接口调用请求发送至服务器。The device identifier, the interface encryption field, and the verification code signature field are assembled into an interface call request, and the interface call request is sent to the server.
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述从所述接口验证短信中提取接口验证码,包括:The computer readable storage medium according to claim 16, wherein the extracting the interface verification code from the interface verification short message comprises:
    根据预设的关键词数据库,识别所述接口验证短信中包含的关键词以及所述关键词对应的关键度,所述关键词数据库包括关键词与关键度的对应关系;Determining, according to a preset keyword database, a keyword included in the interface verification short message and a key degree corresponding to the keyword, where the keyword database includes a correspondence between a keyword and a criticality;
    若所述接口验证短信中只包含一个所述关键词,则将所述关键词之前的预设隔断标志与所述关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes only one of the keywords, the number existing between the preset blocking flag before the keyword and the preset blocking flag after the keyword is used as the interface verification. code;
    若所述接口验证短信中包含多个所述关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个关键词中位置最靠前的一个关键度最高的关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码。If the interface verification message includes a plurality of the keywords, determining a special keyword, where the special keyword is the highest priority among the plurality of keywords included in the interface verification message And a number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code.
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码摘要进行签名运算,生成验证码签名字段,包括:The computer readable storage medium according to claim 16, wherein the determining a signature key according to the device identifier, and performing a signature operation on the verification code digest by the signature key to generate a verification code signature Fields, including:
    根据预设的设备标识与签名密钥的对应关系,确定所述签名密钥,所述签名密钥包括参数d以及参数n;Determining, according to a preset correspondence between the device identifier and the signature key, the signature key, where the signature key includes a parameter d and a parameter n;
    通过公式S=(h(m)^d) mod n计算出所述验证码签名字段,其中S为所述验证码签名字段、h(m)为验证码摘要、符号^为幂计算符以及符号mod为取余数计算符。The verification code signature field is calculated by the formula S=(h(m)^d) mod n, where S is the verification code signature field, h(m) is the verification code digest, the symbol ^ is the power operator, and the symbol Mod is the remainder operator.
  19. 如权利要求16所述的计算机可读存储介质,其特征在于,还包括:The computer readable storage medium of claim 16 further comprising:
    若接收到服务器反馈的验证码不匹配响应,则根据预设的关键词数据库,判断所述接口验证短信中是否存在遗留关键词,所述遗留关键词为未被用于提取所述接口验证码的关键词,所述关键词数据库包括关键词与关键度的对应关系;If the verification code received by the server does not match the response, determining, according to the preset keyword database, whether the interface verifies that there is a legacy keyword in the short message, and the legacy keyword is not used to extract the interface verification code. Keywords, the keyword database includes a correspondence between keywords and critical degrees;
    若所述接口验证短信中存在一个所述遗留关键词,则将所述遗留关键词之前的预设隔断标志与所述遗留关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If there is one of the legacy keywords in the interface verification short message, the number existing between the preset cutoff flag before the legacy keyword and the preset cutoff flag after the legacy keyword is used as the Interface verification code;
    若所述接口验证短信中包含多个所述遗留关键词,则确定特殊关键词,所述特殊关键词为在所述接口验证短信中包含的多个所述遗留关键词中位置最靠前的一个关键度最高的所述遗留关键词,并将所述特殊关键词之前的所述预设隔断标志与所述特殊关键词之后的所述预设隔断标志之间存在的数字作为所述接口验证码;If the interface verification message includes a plurality of the legacy keywords, determining a special keyword, where the special keyword is the top position among the plurality of the legacy keywords included in the interface verification short message a legacy keyword having the highest degree of criticality, and verifying the number existing between the preset cutoff flag before the special keyword and the preset cutoff flag after the special keyword as the interface verification code;
    若所述接口验证短信中不存在所述遗留关键词,则通知用户查看所述验证短信或通知服务器重新发送新的验证短信。If the legacy keyword is not present in the interface verification message, the user is notified to view the verification message or the notification server resends the new verification message.
  20. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被至少一个处理器执行时实现如下步骤:A computer readable storage medium storing computer readable instructions, wherein the computer readable instructions, when executed by at least one processor, implement the following steps:
    接收终端设备发送的接口调用请求;Receiving an interface call request sent by the terminal device;
    从所述接口调用请求中解析出移动设备的设备标识、接口加密字段以及验证码签名字段;Parsing out a device identifier, an interface encryption field, and a verification code signature field of the mobile device from the interface call request;
    根据所述设备标识确定签名密钥,并通过所述签名密钥对所述验证码签名字段进行解码运算,得到验证码摘要;Determining a signature key according to the device identifier, and performing a decoding operation on the verification code signature field by using the signature key to obtain a verification code digest;
    根据所述验证码摘要还原出接口验证码;Restore an interface verification code according to the verification code digest;
    若从所述验证码摘要中还原出的所述接口验证码与服务器发送给移动设备的接口验证码相同,则根据所述设备标识确定解密算法,并通过所述解密算法对所述接口加密字段进行解密计算,生成接口参数;And if the interface verification code restored from the verification code digest is the same as the interface verification code sent by the server to the mobile device, determining a decryption algorithm according to the device identifier, and encrypting the field by using the decryption algorithm Perform decryption calculation to generate interface parameters;
    若所述服务器中存在与所述接口参数一致的参数,则根据所述接口参数对应的接口逻辑对所述终端发送的待处理数据进行处理。And if the parameter is consistent with the interface parameter, the to-be-processed data sent by the terminal is processed according to the interface logic corresponding to the interface parameter.
PCT/CN2018/097311 2018-01-02 2018-07-27 Method and device for calling an interface and responding to an interface call, electronic device, and medium WO2019134361A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810001742.4A CN108365961B (en) 2018-01-02 2018-01-02 The response method and server that interface call method and terminal device, interface call
CN201810001742.4 2018-01-02

Publications (1)

Publication Number Publication Date
WO2019134361A1 true WO2019134361A1 (en) 2019-07-11

Family

ID=63010948

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/097311 WO2019134361A1 (en) 2018-01-02 2018-07-27 Method and device for calling an interface and responding to an interface call, electronic device, and medium

Country Status (2)

Country Link
CN (1) CN108365961B (en)
WO (1) WO2019134361A1 (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446052B (en) * 2018-09-03 2023-12-19 中企瑞铭科技(北京)有限公司 Verification method and device for application program
CN109492358A (en) * 2018-09-25 2019-03-19 国网浙江省电力有限公司信息通信分公司 A kind of open interface uniform authentication method
CN109376021A (en) * 2018-09-26 2019-02-22 深圳壹账通智能科技有限公司 The response method and server that interface calls
CN109347843A (en) * 2018-10-26 2019-02-15 深圳点猫科技有限公司 A kind of parameter confidentiality agreement and electronic equipment based on educational system
CN109818746A (en) * 2018-12-28 2019-05-28 深圳竹云科技有限公司 A kind of method of safe offer restful interface
CN109993759A (en) * 2019-02-27 2019-07-09 深圳点猫科技有限公司 A kind of data calling method and device for education resource platform
CN110381114B (en) * 2019-06-14 2022-08-23 平安科技(深圳)有限公司 Interface request parameter processing method and device, terminal equipment and medium
CN110457564A (en) * 2019-07-31 2019-11-15 深圳市钱海网络技术有限公司 A kind of plaintext parameter transmission method and device for browser
CN110851210A (en) * 2019-11-12 2020-02-28 北京字节跳动网络技术有限公司 Interface program calling method, device, equipment and storage medium
CN111182025B (en) * 2019-11-26 2021-04-20 腾讯科技(深圳)有限公司 Message processing method, device, server and storage medium
CN110891249A (en) * 2019-12-31 2020-03-17 合肥美的智能科技有限公司 Short message interface allocation method, server, client and system
CN111756544A (en) * 2020-05-11 2020-10-09 北京明略软件系统有限公司 Interface calling validity checking method and device
CN114996040B (en) * 2022-08-04 2022-10-04 飞天诚信科技股份有限公司 Service interface calling method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7987451B1 (en) * 2006-11-20 2011-07-26 Mcafee, Inc. System, method and computer program product for verifying invocations of interfaces
US20140279455A1 (en) * 2013-03-18 2014-09-18 Boku, Inc. Merchant managed subscriptions at a billing server
CN105159533A (en) * 2015-08-31 2015-12-16 努比亚技术有限公司 Mobile terminal and automatic verification code input method thereof
CN106101258A (en) * 2016-07-08 2016-11-09 腾讯科技(深圳)有限公司 A kind of interface interchange method of mixed cloud, Apparatus and system
CN106656953A (en) * 2016-09-23 2017-05-10 焦点科技股份有限公司 Method for realizing safe interface calling between systems based on Internet

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101499904A (en) * 2008-02-01 2009-08-05 华为技术有限公司 Method, apparatus and system for safe interface call
US8874896B2 (en) * 2010-06-18 2014-10-28 Intertrust Technologies Corporation Secure processing systems and methods
US20120089519A1 (en) * 2010-10-06 2012-04-12 Prasad Peddada System and method for single use transaction signatures
CN102238193A (en) * 2011-08-09 2011-11-09 深圳市德卡科技有限公司 Data authentication method and system using same
CN103067402B (en) * 2013-01-10 2016-01-20 天地融科技股份有限公司 The generation method and system of digital certificate
CN104618120B (en) * 2015-03-04 2018-01-23 青岛微智慧信息有限公司 A kind of mobile terminal key escrow digital signature method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7987451B1 (en) * 2006-11-20 2011-07-26 Mcafee, Inc. System, method and computer program product for verifying invocations of interfaces
US20140279455A1 (en) * 2013-03-18 2014-09-18 Boku, Inc. Merchant managed subscriptions at a billing server
CN105159533A (en) * 2015-08-31 2015-12-16 努比亚技术有限公司 Mobile terminal and automatic verification code input method thereof
CN106101258A (en) * 2016-07-08 2016-11-09 腾讯科技(深圳)有限公司 A kind of interface interchange method of mixed cloud, Apparatus and system
CN106656953A (en) * 2016-09-23 2017-05-10 焦点科技股份有限公司 Method for realizing safe interface calling between systems based on Internet

Also Published As

Publication number Publication date
CN108365961A (en) 2018-08-03
CN108365961B (en) 2019-07-19

Similar Documents

Publication Publication Date Title
WO2019134361A1 (en) Method and device for calling an interface and responding to an interface call, electronic device, and medium
CN109241484B (en) Method and equipment for sending webpage data based on encryption technology
US20150007265A1 (en) Secure data transmission and verification with untrusted computing devices
US20130315394A1 (en) Data encryption method, data verification method and electronic apparatus
WO2022022009A1 (en) Message processing method and apparatus, device, and storage medium
CN114416773B (en) Data processing method, device, storage medium and server
CN111193741A (en) Information sending method, information obtaining method, device and equipment
CN113992432A (en) Message processing method, message bus system, computer device, and storage medium
CN113038463B (en) Communication encryption authentication experimental device
CN114117482A (en) Database encryption method and device, electronic equipment and storage medium
CN116488919B (en) Data processing method, communication node and storage medium
CN111400743B (en) Transaction processing method, device, electronic equipment and medium based on blockchain network
CN110602051B (en) Information processing method based on consensus protocol and related device
US20170279777A1 (en) File signature system and method
TWI546698B (en) Login system based on servers, login authentication server, and authentication method thereof
WO2019242163A1 (en) Data security verification method, apparatus and system, and computer device and storage medium
US9203607B2 (en) Keyless challenge and response system
CN114692120B (en) National password authentication method, virtual machine, terminal equipment, system and storage medium
CN111935122B (en) Data security processing method and device
CN114117388A (en) Device registration method, device registration apparatus, electronic device, and storage medium
KR20180129302A (en) Method for executing of security keyboard, apparatus and system for executing the method
CN111435518A (en) Trusted hardware-based block chain private transaction method, device and system
CN114793156B (en) Data processing method, device, equipment and storage medium
CN111918224B (en) Short message verification method, device, equipment and storage medium
CN112839132B (en) Method and system for realizing mobile phone input method with information encryption function

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 16/11/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18898114

Country of ref document: EP

Kind code of ref document: A1