Summary of the invention
The application's technical problem to be solved provides a kind of network communication method based on HTTP, server, terminal, so as effectively to prevent because of the HTTP network requests by the Replay Attack that intercepting causes, improved the fail safe of HTTP network service.
In order to address the above problem, the application discloses a kind of network communication method based on HTTP, comprising: answer terminal request to send the very first time to the terminal and stab;
The network requests information that receiving terminal sends; Comprise said very first time stamp and time corresponding in the said network requests information and stab ciphertext; Said timestamp ciphertext is encrypted generation according to presetting AES to the algorithm factor that comprises said very first time stamp by the terminal;
Verify by the said AES that presets whether said timestamp ciphertext is effective, if invalid, then said network requests information is invalidation request.
Preferably, further comprise:
Verify very first time in the said network requests information stab with the interval of current time whether before the deadline, if exceed, then said network requests information is invalid.
Preferably, the said AES that presets is the encrypted signature algorithm,
Said terminal comprises the algorithm factor encryption rise time stamp ciphertext that comprises said very first time stamp according to presetting AES:
The terminal is encrypted the algorithm factor that comprises said very first time stamp according to said encrypted signature algorithm and is generated first digital signature makeup time stamp ciphertext;
Whether the said timestamp ciphertext of said checking effectively comprises:
By said encrypted signature algorithm the algorithm factor that comprises said very first time stamp is encrypted generation second digital signature;
Verify whether the first corresponding digital signature of said second digital signature and said timestamp ciphertext is consistent, if inconsistent, then said timestamp ciphertext is invalid.
Preferably, the said AES that presets is a symmetric encipherment algorithm,
Said terminal comprises the algorithm factor encryption rise time stamp ciphertext that comprises said very first time stamp according to presetting AES:
The terminal is used corresponding key that the algorithm factor that comprises said very first time stamp is encrypted between generation according to said symmetric encipherment algorithm and is stabbed ciphertext;
Whether the said timestamp ciphertext of said checking effectively comprises:
Use the corresponding key of said symmetric encipherment algorithm that said timestamp ciphertext is deciphered the timestamp information that obtains wherein as second timestamp; Judge whether the very first time stamp in said second timestamp and the network requests information is consistent; If inconsistent, then said timestamp ciphertext is invalid.
Preferably, the said AES that presets is a rivest, shamir, adelman,
Said terminal comprises the algorithm factor encryption rise time stamp ciphertext that comprises said very first time stamp according to presetting AES:
The terminal is used corresponding PKI that the algorithm factor that comprises said very first time stamp is encrypted between generation according to said rivest, shamir, adelman and is stabbed ciphertext;
Whether the said timestamp ciphertext of said checking effectively comprises:
Server uses the private key corresponding with said rivest, shamir, adelman that said timestamp ciphertext is deciphered the timestamp information that obtains wherein as second timestamp; Judge whether the very first time stamp in said second timestamp and the network requests information is consistent; If inconsistent, then said timestamp ciphertext is invalid.
Preferably, also comprise the voucher sign that generates by the terminal in the network requests information that send at said terminal; And
The said algorithm factor that comprises very first time stamp also comprises said voucher sign; Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Preferably, also comprise before the network requests information that said receiving terminal sends:
Receive the request for credentials information at terminal;
Generate the voucher sign corresponding with said request for credentials information;
Send said voucher sign to said terminal.
Preferably,
Also comprise said voucher sign in the networking solicited message of said reception;
The said algorithm factor that comprises very first time stamp also comprises said voucher sign; Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Preferably, said voucher sign is dynamically effective, and said method also comprises:
If comprise the voucher sign in the network requests information that send at said terminal, then whether this voucher sign of server authentication is effective, if invalid, then said network requests is an invalidation request.
For addressing the above problem, disclosed herein as well is a kind of network communication method based on HTTP, comprising:
Obtaining the very first time from server stabs;
Send network requests information to server; Comprise said very first time stamp and time corresponding in the said network requests information and stab ciphertext; Said timestamp ciphertext is according to presetting AES the algorithm factor that comprises said very first time stamp to be encrypted generation.
Preferably, the said AES that presets is the encrypted signature algorithm,
Said basis presets AES the algorithm factor encryption rise time stamp ciphertext that comprises said very first time stamp is comprised:
According to said encrypted signature algorithm the algorithm factor that comprises said very first time stamp is encrypted the generation first digital signature makeup time and stab ciphertext.
Preferably, the said AES that presets is a symmetric encipherment algorithm,
Said basis presets AES the algorithm factor encryption rise time stamp ciphertext that comprises said very first time stamp is comprised:
Use the key corresponding that the algorithm factor that comprises said very first time stamp is encrypted between generation and stab ciphertext with said symmetric encipherment algorithm.
Preferably, the said AES that presets is a rivest, shamir, adelman,
Said basis presets AES the algorithm factor encryption rise time stamp ciphertext that comprises said very first time stamp is comprised:
Use the PKI corresponding that the algorithm factor that comprises said very first time stamp is encrypted between generation and stab ciphertext with said rivest, shamir, adelman.
Preferably, also comprise the voucher sign in the said network requests information; And
The said algorithm factor that comprises very first time stamp also comprises said voucher sign; Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Preferably, saidly, server also comprises before sending network requests information:
Send request for credentials information to server;
The voucher sign that reception server sends.
For addressing the above problem, disclosed herein as well is a kind of server based on HTTP, comprising:
Receiver module, sending module, timestamp generation module and ciphertext verification module;
Wherein said receiver module comprises:
First receiving element is used for time of reception and stabs solicited message;
Second receiving element is used to receive network requests information; Comprise very first time stamp and time corresponding in the said network requests information and stab ciphertext; Said timestamp ciphertext is according to presetting AES the algorithm factor that comprises said very first time stamp to be encrypted generation;
Wherein said timestamp generation module is used for and should said timestamp solicited message generates very first time stamp;
Wherein said sending module comprises:
First transmitting element is used for transmitting time and stabs the very first time stamp that generation module generated;
Wherein said ciphertext verification module is used for verifying by the said AES that presets whether said timestamp ciphertext is effective, if invalid, then said network requests information is invalidation request.
Preferably,
Said server also comprises:
Timestamp verification module, the very first time that is used for verifying the network requests information that second receiving element receives stab with the interval of current time whether before the deadline, if exceed, then said network requests information is invalid.
Preferably, the said AES that presets is the encrypted signature algorithm,
Said ciphertext verification module also comprises:
The signature generation unit is used for by said encrypted signature algorithm the algorithm factor that comprises said very first time stamp being encrypted generation second signature;
First verification unit is used to verify whether the first corresponding digital signature of timestamp ciphertext that second digital signature that said signature generation unit generated and second receiving element received is consistent, if inconsistent, then said timestamp ciphertext is invalid.
Preferably, the said AES that presets is a symmetric encipherment algorithm,
Said ciphertext verification module also comprises:
Second verification unit; The timestamp ciphertext that is used to use the corresponding key of said symmetric encipherment algorithm that second receiving element is received is deciphered the timestamp information that obtains wherein as second timestamp; Judge whether consistent said second timestamp and the very first time in the network requests information that second receiving element is received stab; If inconsistent, then said timestamp ciphertext is invalid.
Preferably, the said AES that presets is a rivest, shamir, adelman,
Said ciphertext verification module also comprises:
The 3rd verification unit; The timestamp ciphertext that is used to use the private key corresponding with said rivest, shamir, adelman that second receiving element is received is deciphered the timestamp information that obtains wherein as second timestamp; Judge whether the very first time stamp in said second timestamp and the network requests information is consistent; If inconsistent, then said timestamp ciphertext is invalid.
Preferably, said receiver module also comprises:
The 3rd receiving element is used for the request for credentials of receiving terminal;
Said server also comprises:
Voucher sign generation unit, the request for credentials that is used for being received according to the 3rd receiving element generates the voucher sign;
Said sending module also comprises:
Second transmitting element is used to send the voucher sign voucher that generation unit generated sign.
Preferably, also comprise the voucher sign in the network requests information that said second receiving element is received;
The said algorithm factor that comprises very first time stamp also comprises said voucher sign; Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Preferably, said voucher sign dynamically effectively;
Said server also comprises:
Voucher verification module is used for verifying whether the network requests information that second receiving element is received comprises the voucher sign, if comprise and this voucher sign invalid, then said network requests information is invalid.
For addressing the above problem, disclosed herein as well is a kind of terminal based on HTTP, comprising:
Sending module, receiver module and ciphertext module;
Wherein said sending module comprises:
First transmitting element is used to send very first time stamp and obtains request;
Second transmitting element is used to send network requests information; The very first time that comprises said receiver module reception in the said network requests information stabs and the corresponding timestamp ciphertext by said ciphertext module generation;
Wherein said receiver module comprises:
First receiving element is used to receive very first time stamp;
Wherein said ciphertext module is used for according to presetting the algorithm factor encryption rise time stamp ciphertext that AES stabbed the very first time that includes said reception.
Preferably, the said AES that presets is the encrypted signature algorithm;
Said ciphertext module also comprises:
First ciphering unit is used for that the algorithm factor that comprises said very first time stamp is encrypted the generation first digital signature makeup time and stabs ciphertext.
Preferably, the said AES that presets is a symmetric encipherment algorithm;
Said ciphertext module also comprises:
Second ciphering unit is used to use the key corresponding with said symmetric encipherment algorithm that the algorithm factor that comprises said very first time stamp is encrypted between generation and stabs ciphertext.
Preferably, the said AES that presets is a rivest, shamir, adelman;
Said ciphertext module also comprises:
The 3rd ciphering unit is used to use the PKI corresponding with said rivest, shamir, adelman that the algorithm factor that comprises said very first time stamp is encrypted between generation and stabs ciphertext.
Preferably, also comprise:
Voucher sign generation module is used to generate the voucher sign;
The said algorithm factor that comprises very first time stamp also comprises the voucher sign that said voucher identification module generates;
Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Preferably,
Said transmitting element also comprises:
The 3rd transmitting element is used to send request for credentials information;
Said receiver module also comprises:
Second receiving element is used to receive the voucher sign;
Also comprise the voucher sign that the 3rd receiving element is received in the network requests information that said second transmitting element is sent;
The said algorithm factor that comprises very first time stamp also comprises said voucher sign; Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Compared with prior art, the application has the following advantages:
Consider that existing network service based on http protocol exists nothing connection, stateless characteristic; Solicited message is tackled the back server of resetting can't discern this problem; We propose joining day stamp in the solicited message that terminal to server sends; Server through the timestamp in the checking network requests information and the time interval of current time whether in its term of validity, exceed the term of validity as if the said time interval, think that then the current network request tackled playback; Be an invalidation request, therefore can effectively avoid generation to the http communication Replay Attack.
Further, in the scheme that the application provides, stab from the server acquisition time at the terminal, and the character string that comprises this timestamp is generated digital signature by the signature algorithm rule of arranging, and this digital signature is put the people in the network requests information that server sends.Server generates digital signature according to identical signature algorithm rule; And in the digital signature that generates of authentication server and the network requests information the digital signature of being with whether consistent; If it is inconsistent; Think that then the character string that comprises timestamp in the current network solicited message is distorted, think that this network requests is an invalidation request.So, timestamp pretends the possibility of effective information spoofs services device in the network requests information through distorting to have avoided attempt, thereby has further avoided the generation of Replay Attack.
Embodiment
For above-mentioned purpose, the feature and advantage that make the application can be more obviously understandable, the application is done further detailed explanation below in conjunction with accompanying drawing and embodiment.
With reference to Fig. 1, the schematic flow sheet of a kind of communication means embodiment one based on http protocol that shows that the application provides, the communication means based on http protocol of present embodiment may further comprise the steps:
Step 101, the terminal to server transmitting time is stabbed request.
Step 102, server generate very first time stamp.
Server can obtain generation very first time current time according to the international standard rule and stab.
Step 103, server will stab and be sent to the terminal very first time.
Step 104, the network requests information that the server receiving terminal sends; Comprise said very first time stamp and time corresponding in the said network requests information and stab ciphertext; Said timestamp ciphertext is encrypted generation according to presetting AES to the algorithm factor that comprises said very first time stamp by the terminal.
Step 105, server verifies by the said AES that presets whether said timestamp ciphertext is effective, if invalid, then said network requests information is invalidation request.
Step 106, very first time in the said network requests information of server authentication stab with the interval of current time whether before the deadline, if exceed, then said network requests information is invalid.This step is an optional step.
The algorithm factor that comprises very first time stamp is encrypted the rise time stab ciphertext; Server is effective according to this ciphertext of AES checking with the terminal agreement; If it is invalid; Can think that then the timestamp ciphertext possibly tackled or distort in transmission course, thereby can assert further that said very first time stamp is invalid with corresponding network requests.
For ease of describing, the timestamp that this paper answers terminal request to generate server, and the timestamp that in network requests information, directly comprises is called the very first time and stabs, the timestamp that will stab the rise time in the algorithm factor of ciphertext is called second timestamp.
Because timestamp generates by server is unified, can guarantee that this timestamp has strict accuracy.Server can be provided with the term of validity that this terminal time corresponding is stabbed according to the residing network application environment of different terminals.The timestamp term of validity is a time span normally; As 0.5 second, to be the terminal stabbed from the server acquisition time meaning, and the network requests that will contain this timestamp be sent to this process institute time-consuming of server should be in 0.5 second; If exceed; Think that then this network requests in transmission course delay has taken place, possibly or Replay Attack take place, be invalid network requests by interception.
One of ordinary skill in the art will readily recognize that can this Terminal Type time corresponding be set according to residing region, terminal, application complexity stabs the term of validity.
Step 107, server are returned the response message of network requests to the terminal.
If empirical tests network requests information is effective, then the response message that returns to the terminal of server just should comprise the effective information that this network requests is corresponding, like web page resources etc., otherwise, just contain the announcement information that network requests is failed in the said response message.
With reference to Fig. 2, the schematic flow sheet of a kind of communication means embodiment two based on http protocol that shows that the application provides, the communication means based on http protocol of present embodiment may further comprise the steps:
Step 201, terminal generate the voucher sign.
The terminal can be selected the composition mode of voucher sign according to practical application; As can obtain IP address and port numbers, network interface card sign and the current time composition voucher sign etc. at terminal, have uniqueness as long as guarantee the network requests of different terminals or the employed voucher sign of many wheels network requests at same terminal.
Step 202, the terminal to server transmitting time is stabbed request; The voucher sign that comprises said terminal in the said timestamp solicited message.
Because existing network service based on http protocol is not have connection, stateless communication, not contact between a plurality of requests that terminal to server sends.Therefore; We add unified voucher sign in a plurality of network requests that terminal to server sends; Can network requests related on a plurality of contents in front and back be set up contact through this voucher sign, make things convenient for the network requests of terminal and a plurality of relevances of server admin.
Step 203, server generate very first time stamp; Store configuration information, said configuration information store the corresponding voucher sign of current network solicited message, very first time stamp and the corresponding very first time stamp term of validity.
Server receives that whenever the timestamp at terminal obtains request, just stores new second timestamp and the term of validity of current voucher sign, also can empty this voucher sign second timestamp term of validity record before simultaneously.
Step 204, server will stab and be sent to the terminal very first time.
Step 205, the network requests information that the server receiving terminal sends; Comprise said very first time stamp and time corresponding in the said network requests information and stab ciphertext; Said timestamp ciphertext is encrypted generation according to presetting AES to comprising the algorithm factor that the said very first time stabs and voucher identifies by the terminal.
Step 206, whether server authentication timestamp ciphertext is effective, if invalid, then said network requests information is invalid.
Step 207, whether the very first time in the server authentication network requests stabs effective, if invalid, then said network requests information is invalid.
Server stabbed the effective period of from stored configuration information, obtaining this very first time stamp correspondence through the sign of the voucher in the current network request, the very first time; Whether the time interval of judging timestamp and server current time in the current network request then is in its corresponding term of validity; If exceed the term of validity; Think that then the timestamp of current network request lost efficacy, this network requests is an illegal request.
Preferably, said voucher sign dynamically effectively.Server can judge whether this voucher sign is effective according to certain condition; For example the corresponding terminal of this voucher sign whether off-line, broken string or long-time no response, exceed effective period etc.; If satisfy invalid condition; Server can be changed to disarmed state with this voucher sign; And interrupt the subsequent treatment of current network request and return the response message of request failure to the terminal, even so this voucher sign stolen by other people or utilize also can't legitimate correspondence, the fail safe that has effectively improved communication process.
Step 208, server is to terminal echo reply information.
In embodiment one; Server can only use the fixing term of validity to judge whether its network requests timestamp is effective to a certain Terminal Type; And in the foregoing description two; Server passes through the effective period of configuration information storage terminal voucher sign time corresponding stamp and this timestamp, because the different user that voucher identifies different terminals or use terminal has uniqueness, therefore; Configuration and judgement to the timestamp term of validity can improve the fineness of server authentication timestamp validity specific to each terminal and the different user that uses this terminal.
With reference to Fig. 3, the schematic flow sheet of a kind of communication means embodiment three based on http protocol that shows that the application provides, the communication means based on http protocol of present embodiment may further comprise the steps:
Step 301, terminal to server sends request for credentials.
Step 302, server response request for credentials generates the voucher sign by rule; The voucher sign is sent to the terminal.
Though the voucher sign can be produced by the terminal voluntarily, when terminal quantity, when concurrent request is too much, the voucher sign that is generated can't guarantee definitely unique.Then effectively avoided the problems referred to above according to the request for credentials at each terminal by the unified voucher sign that generates of preset rules by server, for example can generate the current unique sequence number in this terminal and identify as voucher by the IP address that comprises in the terminal request information, port numbers and time.
Step 303, the terminal to server transmitting time is stabbed request.
Step 304, server generate very first time stamp.
Step 305, server will stab and be sent to the terminal very first time.
Step 306, the terminal is encrypted rise time stamp ciphertext by presetting AES to the algorithm factor that comprises very first time stamp.
Step 307, the network requests information that the server receiving terminal sends; Comprise said very first time stamp, voucher sign and time corresponding in the said network requests information and stab ciphertext.
The timestamp ciphertext is to encrypt generation by presetting AES to comprising the algorithm factor that the very first time stabs, voucher identifies.
Preferably, whether the voucher sign in the server authentication current network solicited message is effective, if invalid, execution in step 308.
If current terminal is off-line, broken string or be in inactive state for a long time, the corresponding voucher sign in this terminal can only be invalid by server.
Step 308, server verifies by presetting AES whether said timestamp ciphertext is effective, if invalid, execution in step 310.
The said AES that presets is the good AES rule of terminal and server commitment.
Optional, said AES is the encrypted signature algorithm.The terminal is encrypted the algorithm factor that comprises said very first time stamp according to said encrypted signature algorithm and is generated first digital signature makeup time stamp ciphertext; Server is encrypted the algorithm factor that comprises said very first time stamp by said encrypted signature algorithm and is generated second digital signature; Verify whether the first corresponding digital signature of said second digital signature and said timestamp ciphertext is consistent, if inconsistent, then said timestamp ciphertext is invalid.
Said encrypted signature algorithmic rule can may further comprise the steps: at first organize algorithm factor by presetting rule; Then this algorithm factor is calculated digital signature by signature algorithm.For example, the organization regulation of algorithm factor can be ' a timestamp+voucher sign+other ' in this example, even can be with whole request message as algorithm factor; Employed signature algorithm can be Message Digest 5 (MD5, Message Digest Algorithm5) or other signature algorithms.
The MD5 algorithm is the widely used a kind of hash function of computer safety field, in order to the integrity protection that gives information.This algorithm can generate unique MD5 informative abstract, i.e. digital signature to an any file or a segment information.If anyone has done any change to file or information, its MD5 value all can change.
Optional, the said AES that presets is a symmetric encipherment algorithm; The terminal is used corresponding key that the algorithm factor that comprises said very first time stamp is encrypted between generation according to said symmetric encipherment algorithm and is stabbed ciphertext; Server uses the corresponding key of said symmetric encipherment algorithm that said timestamp ciphertext is deciphered the timestamp information that obtains wherein as second timestamp; Judge whether the very first time stamp in said second timestamp and the network requests information is consistent; If inconsistent, then said timestamp ciphertext is invalid.
With signature algorithm is the informative abstract of algorithm factor to be encrypted to obtain signature different, and using symmetric encipherment algorithm is whole algorithm factor character string to be encrypted obtain the timestamp ciphertext; Server uses identical key or corresponding decrypted program that the timestamp ciphertext is deciphered and obtains the algorithm factor original text.Algorithm such as Advanced Encryption Standard (Advanced Encryption Standard, AES) AES commonly used.
Optional, the said AES that presets is a rivest, shamir, adelman; The terminal is used corresponding PKI that the algorithm factor that comprises said very first time stamp is encrypted between generation according to said rivest, shamir, adelman and is stabbed ciphertext; Server uses the private key corresponding with said rivest, shamir, adelman that said timestamp ciphertext is deciphered the timestamp information that obtains wherein as second timestamp; Judge whether the very first time stamp in said second timestamp and the network requests information is consistent; If inconsistent, then said timestamp ciphertext is invalid.Rivest, shamir, adelman such as RSA cryptographic algorithms commonly used.
If empirical tests timestamp ciphertext is invalid, explain then in the network requests information and distorted that the current network request is no longer trusted and is illegal request with algorithm factor corresponding characters string.
Preferably, the application comprises the algorithm factor of the character string of timestamp and voucher sign as AES by the preset rules use.Because being the voucher sign of terminal distribution, server has uniqueness, therefore just unique unduplicated by its algorithm factor of forming.Because mostly timestamp is plain code in the HTTP request message, and the voucher sign is that server generates by presetting rule, only if therefore voucher sign generation rule is revealed, this voucher sign possibility of being distorted is very low so; Moreover the composition rule of algorithm factor is by terminal and server commitment; Externally not open; Even know and used timestamp and voucher sign in the algorithm factor, also be difficult to know the frequency and the permutation and combination method of its appearance, therefore if the timestamp ciphertext in the terminal network solicited message is invalid; Can think that then the timestamp in this character string is distorted, this request is illegal request.
Those skilled in the art should understand that; When implementing the application; Can determine timestamp to become the preset rules of algorithm factor with the voucher identified group as the case may be; And timestamp and voucher be identified at order and the number of times that occurs in the algorithm factor, for example can be timestamp+voucher sign, also can be voucher sign+timestamp+timestamp+voucher sign etc.
Step 309, very first time in the server authentication network requests stab with time interval of current time whether in its effective period, if exceed the term of validity, the current network request is an invalidation request.
Step 310, server is to terminal echo reply information.
In the foregoing description, comprise the voucher sign by the server unified distribution in the network requests information that terminal to server sends, server can verify earlier to the network requests information that contains this voucher sign whether this voucher sign is effective; If voucher is designated disarmed state; Then server can interrupt subsequent operation, directly returns the terminal invalidation request, has practiced thrift the server section operational order; Therefore to a certain degree practice thrift server resource, reduced server load.Secondly, add digital signature, can prevent effectively that network requests information from being distorted, and avoided the generation of Replay Attack in network requests information.Especially; The application uses by the voucher sign of server unified distribution and timestamp as the signature algorithm factor; Guarantee the uniqueness of the signature algorithm factor, avoided different terminals to produce the possibility of same signature and the possibility that timestamp is distorted, effectively prevented the network Replay Attack.
More than combine several embodiment that a kind of communication means based on http protocol that the application provides is described.Below in conjunction with concrete applied environment said method is done and to be further described:
Among the embodiment below, suppose the user, use user name, the website of password login of oneself, if server verifies successfully that to logging request server returns dynamic password Key and uses to the terminal through a terminal.The server of this website comprises logon server, encryption server.
Step S01, the voucher sign is obtained in user's login.
In the terminal, the user imports username and password and sends logging request to logon server.If login successfully, logon server returns the voucher sign to this terminal.This voucher sign is that logon server is according to this user's user name and unique authentication information string of other relevant information generation.
Step S02, stab from the encryption server acquisition time at the terminal.
The terminal is called the PostDownloadTimeStamp method and is sent the request of an acquisition timestamp to encryption server; Obtain up-to-date timestamp from encryption server, timestamp is an encryption server from the current accurate time that the full time synchronization server obtains.
Step S03, the terminal generates first signature and forms the timestamp ciphertext, and tissue checking request data package.
If timestamp obtains success, the terminal is called the RequestHeader_Stamp method and is generated signature and form the checking request data package.
Terminal stamp service time, voucher sign compute signature makeup time stab ciphertext, and its specific algorithm is: at first timestamp+timestamp+voucher sign+timestamp is formed the algorithm factor character string; Then this algorithm factor character string is carried out MD5 and generate a signature character string makeup time stamp ciphertext.
Step S04, the terminal uses the HTTPS mode to send the checking request to encryption server
The terminal uses the PostDownloadTimeStamp method will verify that request sends on the encryption server.
Step S05, encryption server use the rule identical with the terminal that timestamp, voucher sign are generated the checking request that second signature comes verification terminal to send, and consistent as if first signature that second signature and timestamp ciphertext are corresponding, then the timestamp ciphertext is legal effectively.
Step S06, the very first time in the checking network requests information stab with time interval of current time whether in the corresponding term of validity, as if exceeding, then said network requests is invalid.
Step S07, encryption server is to terminal echo reply information.
If checking is passed through, encryption server returns correct dynamic password key and gives the terminal, otherwise, return the announcement information that request is failed to the terminal.
The dynamic password Key that the terminal is obtained can be used for this user's subsequent operation, like dynamic password input etc.
Need to prove; For aforesaid each method embodiment, for simple description, so it all is expressed as a series of combination of actions; But those skilled in the art should know; The application does not receive the restriction of described sequence of movement, because according to the application, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the specification all belongs to preferred embodiment, and related action might not be that the application is necessary.
With reference to Fig. 4, be the said a kind of structural representation of the application embodiment based on the HTTP http server.
Said http server specifically comprises:
Receiver module 410, sending module 420, timestamp generation module 460 and ciphertext verification module 430;
Wherein said receiver module 410 comprises:
First receiving element 411 is used for time of reception and stabs solicited message;
Second receiving element 412 is used to receive network requests information; Comprise very first time stamp and time corresponding in the said network requests information and stab ciphertext; Said timestamp ciphertext is according to presetting AES the algorithm factor that comprises said very first time stamp to be encrypted generation;
Wherein said timestamp generation module 460 is used for and should said timestamp solicited message generates very first time stamp;
Wherein said sending module 420 comprises:
First transmitting element 421 is used for transmitting time and stabs the very first time stamp that generation module generated;
Wherein said ciphertext verification module 430 is used for verifying by the said AES that presets whether said timestamp ciphertext is effective, if invalid, then said network requests information is invalidation request.
Preferably,
Said server also comprises:
Timestamp verification module 470, the very first time that is used for verifying the network requests information that second receiving element 412 receives stab with the interval of current time whether before the deadline, if exceed, then said network requests information is invalid.
Optional, the said AES that presets is the encrypted signature algorithm,
Said ciphertext verification module 430 also comprises:
Signature generation unit 431 is used for by said encrypted signature algorithm the algorithm factor that comprises said very first time stamp being encrypted generation second signature;
First verification unit 432 is used to verify whether the first corresponding digital signature of timestamp ciphertext that second digital signature that said signature generation unit 431 generated and second receiving element 412 received is consistent, if inconsistent, then said timestamp ciphertext is invalid.
Optional, the said AES that presets is a symmetric encipherment algorithm,
Said ciphertext verification module 430 also comprises:
Second verification unit 433; The timestamp ciphertext that is used to use the corresponding key of said symmetric encipherment algorithm that second receiving element 412 is received is deciphered the timestamp information that obtains wherein as second timestamp; Judge whether consistent said second timestamp and the very first time in the network requests information that second receiving element is received stab; If inconsistent, then said timestamp ciphertext is invalid.
Optional, the said AES that presets is a rivest, shamir, adelman,
Said ciphertext verification module 430 also comprises:
The 3rd verification unit 434; Be used to use the private key corresponding to receive single 412 yuan of timestamp ciphertexts that received and decipher the timestamp information that obtains wherein as second timestamp to second with said rivest, shamir, adelman; Judge whether the very first time stamp in said second timestamp and the network requests information is consistent; If inconsistent, then said timestamp ciphertext is invalid.
Further, said receiver module 410 also comprises:
The 3rd receiving element 413 is used for the request for credentials of receiving terminal;
Said server also comprises:
Voucher sign generation unit 440, the request for credentials that is used for being received according to the 3rd receiving element 413 generates the voucher sign;
Said sending module 420 also comprises:
Second transmitting element 422 is used to send the voucher sign that voucher sign generation unit 440 is generated.
Preferably, also comprise the voucher sign in the network requests information that said second receiving element 412 is received;
The said algorithm factor that comprises very first time stamp also comprises said voucher sign; Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Preferably, said voucher sign dynamically effectively;
Said server also comprises:
Voucher verification module 450 is used for verifying whether the network requests information that second receiving element 412 is received comprises the voucher sign, if comprise and this voucher sign invalid, then said network requests information is invalid.
With reference to Fig. 5, be the said a kind of structural representation of the application embodiment based on HTTP HTTP terminal.
Said HTTP terminal comprises:
Sending module 510, receiver module 520 and ciphertext module 530;
Wherein said sending module 510 comprises:
First transmitting element 511 is used to send very first time stamp and obtains request;
Second transmitting element 512 is used to send network requests information; The very first time that comprises said receiver module reception in the said network requests information stabs and the corresponding timestamp ciphertext by said ciphertext module generation;
Wherein said receiver module 520 comprises:
First receiving element 521 is used to receive very first time stamp;
Wherein said ciphertext module is used for according to presetting the algorithm factor encryption rise time stamp ciphertext that AES stabbed the very first time that includes said reception.
Optional, the said AES that presets is the encrypted signature algorithm;
Said ciphertext module 530 also comprises:
First ciphering unit 531 is used for that the algorithm factor that comprises said very first time stamp is encrypted the generation first digital signature makeup time and stabs ciphertext.
Optional, the said AES that presets is a symmetric encipherment algorithm;
Said ciphertext module 530 also comprises:
Second ciphering unit 532 is used to use the key corresponding with said symmetric encipherment algorithm that the algorithm factor that comprises said very first time stamp is encrypted between generation and stabs ciphertext.
Optional, the said AES that presets is a rivest, shamir, adelman;
Said ciphertext module 530 also comprises:
The 3rd ciphering unit 533 is used to use the PKI corresponding with said rivest, shamir, adelman that the algorithm factor that comprises said very first time stamp is encrypted between generation and stabs ciphertext.
Optional, said terminal also comprises:
Voucher sign generation module 540 is used to generate the voucher sign;
The said algorithm factor that comprises very first time stamp also comprises the voucher sign that said voucher identification module generates;
Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
Preferably,
Said transmitting element 510 also comprises:
The 3rd transmitting element 513 is used to send request for credentials information;
Said receiver module 520 also comprises:
Second receiving element 522 is used to receive the voucher sign;
Also comprise the voucher sign that second receiving element 522 is received in the network requests information that said second transmitting element 512 is sent;
The said algorithm factor that comprises very first time stamp also comprises said voucher sign; Said algorithm factor was stabbed by the said very first time and said voucher sign is formed by preset rules.
With reference to Fig. 6, be the structural representation of the said a kind of system based on HTTP HTTP of the application embodiment.
Concrete, said system comprises HTTP terminal 6100, http server 6200;
Said HTTP terminal 6100 comprises:
Terminal sending module 6110, terminal receiver module 6120 and ciphertext module 6130;
Wherein said terminal sending module 6110 comprises:
First transmitting element 6111 is used to send very first time stamp and obtains request;
Second transmitting element 6112 is used to send network requests information; The very first time that comprises said receiver module reception in the said network requests information stabs and the corresponding timestamp ciphertext by said ciphertext module generation;
Wherein said terminal receiver module 6120 comprises:
First receiving element 6121 is used to receive very first time stamp;
Wherein said ciphertext module 6130 is used for according to presetting the algorithm factor encryption rise time stamp ciphertext that AES stabbed the very first time that includes said reception.
Said http server 6200 comprises:
Server receiver module 6210, server sending module 6220, timestamp generation module 6230 and ciphertext verification module 6240;
Wherein said server receiver module 6210 comprises:
First receiving element 6211 is used for time of reception and stabs solicited message;
Second receiving element 6212 is used to receive network requests information; Comprise very first time stamp and time corresponding in the said network requests information and stab ciphertext; Said timestamp ciphertext is according to presetting AES the algorithm factor that comprises said very first time stamp to be encrypted generation;
Wherein said timestamp generation module 6230 is used for and should said timestamp solicited message generates very first time stamp;
Wherein said server sending module 6220 comprises:
First transmitting element 6221 is used for transmitting time and stabs the very first time stamp that generation module generated;
Wherein said ciphertext verification module 6240 is used for verifying by the said AES that presets whether said timestamp ciphertext is effective that if invalid, then said network requests information is invalidation request.
The detailed structure of said system sees also above HTTP terminal, http server, and the explanation of method embodiment relevant portion.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed all is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.For system and/or device embodiment, because it is similar basically with method embodiment, so description is fairly simple, relevant part gets final product referring to the part explanation of method embodiment.
At last; Also need to prove; In this article; Relational terms such as first and second grades only is used for an entity or operation are made a distinction with another entity or operation, and not necessarily requires or hint relation or the order that has any this reality between these entities or the operation.
And, in the preceding text " and/or " expression this paper both comprised " with " relation, also comprised " or " relation, wherein: if option A and option b be " with " relation, then represent can to comprise option A and option b simultaneously among certain embodiment; If option A and option b be " or " relation, then represent can comprise option A separately among certain embodiment, perhaps comprise option b separately.
More than to a kind of network communication method, server, terminal that the application provided based on HTTP HTTP; Carried out detailed introduction; Used concrete example among this paper the application's principle and execution mode are set forth, the explanation of above embodiment just is used to help to understand the application's method and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to the application's thought, the part that on embodiment and range of application, all can change, in sum, this description should not be construed as the restriction to the application.