Summary of the invention
The technical problem that the present invention will solve is: a kind of authentication method of the synchronous anti-replay-attack that do not take time is provided, and this method has improved the fail safe of Verification System.
In order to solve the problems of the technologies described above, the technical scheme that the present invention adopted is:
A kind of authentication method of anti-replay-attack may further comprise the steps:
Client is sent login request message to the login authentication server;
The login authentication server generates the authentication authority that comprises the very first time stamp that identifies the current time and gives client;
Client is sent services request, is arrived application server from the authentication authority of login authentication server and the one-way data chain value that oneself generates;
Application server will comprise that the information of authentication authority and one-way data chain value sends to the login authentication server;
The login authentication server judges the correctness of said authentication authority and calculates the current time and time difference that the very first time stabs, and result of determination, the said time difference of the correctness of the authentication authority that will be used to prove whether the user has logined and the one-way data chain value that receives are packaged into check information and send to application server;
Application server receives check information, judges whether the one-way data chain value that receives is up-to-date one-way data chain value, then is judged to be message playback if not, directly abandons this verification message; If then the services request of client is carried out service response according to check information.
Further as preferred embodiment, said application server carries out service response according to check information to the services request of client and may further comprise the steps:
Compared the effective time of time difference in the check information and setting, and whether the judgement time difference is greater than the effective time of setting, if then abandon this check information; Then carry out next step if not;
Judge whether result of determination is correct,, then abandon this check information if not if authentication authority is correctly then carried out service response.
Further as preferred embodiment, the effective time of said setting is from the application server end.
Further as preferred embodiment, the effective time of said setting is from the login authentication server end.
Further as preferred embodiment, can artificially adjust the effective time of said setting.
The invention has the beneficial effects as follows: the authentication method of anti-replay-attack of the present invention; To the verification of the Service Ticket term of validity time; It or not time difference at application server end verification Service Ticket; But the login authentication server end is transferred in the verification of the Service Ticket term of validity, and because stabbing by the login authentication server, produces the very first time on the Service Ticket, when the term of validity of verification Service Ticket, adopt the time of login authentication server local side and the very first time to stab relatively; Guarantee the accuracy of verification, do not needed the time of application server and login authentication server to carry out synchronously; The legal services request that has further guaranteed the user through the one-way data chain not by Replay Attack maybe.
Embodiment
With reference to Fig. 1, a kind of authentication method of anti-replay-attack may further comprise the steps:
Client is sent login request message to the login authentication server;
The login authentication server generates and comprises the very first time stamp Time that identifies the current timeSignOnAuthentication authority give client;
Client is sent services request, is arrived application server from the authentication authority of login authentication server and the one-way data chain value that oneself generates;
Application server will comprise that the information of authentication authority and one-way data chain value sends to the login authentication server;
The login authentication server is judged the correctness of said authentication authority and is calculated current time TimeCurrentStab Time with the very first timeSignOnTime difference, result of determination, the said time difference of the correctness of the authentication authority that will be used to prove whether the user has logined and the one-way data chain value that receives are packaged into check information and send to application server;
Application server receives check information; Judge whether the one-way data chain value that receives is up-to-date one-way data chain value; Above-mentioned deterministic process is specially: the one-way data chain value that receives is carried out the hash function operation; Judge whether the result that hash function draws is consistent with the one-way data chain value of application server for storage,, and the data chainning value that receives is preserved the one-way data chain value of the original storage of replacement if consistently then the services request of client is carried out service response according to check information; Then be judged to be message playback if not, directly abandon this verification message.Application server first the customer in response end send services request the time; The one-way data chain value that receives is up-to-date one-way data chain value; So directly be stored on the application server, in the follow-up service response, application server needs that all the one-way data chain value in the check information is carried out the hash function operation and compares with the one-way data chain value of storing; Judge whether the one-way data chain value that receives is up-to-date one-way data chain value, to avoid the Replay Attack of client-side service request.
With reference to Fig. 4, one-way data chain (One-Way Chains) is also claimed hash chain, is a kind of cryptoguard scheme in insecure environments, but in the present invention, uses the playback that this mechanism prevents the service request information that client is sent.Fig. 4 has provided the formation structure and the application structure of one-way data chain, and the one-way data chain is by unidirectional execution one-way function (also claiming hash function) F generation repeatedly, and one-way function F algorithm is irreversible, can generate multistage one-way data chain value S like thisi, i.e. F (Si)=SI-1, and Fi(Si)=S0Because when using, to SiValue choose the reversed in order that order just generates with this data chainning, even therefore the third party has stolen a certain one-way data chain value of having used, also can't learn the one-way data chain value after the renewal, thereby can't carry out Replay Attack authentication message.The service request information that application server of the present invention utilizes the one-way data chain can guarantee that client is sent is reliably, and non-Replay Attack produces.
Further as preferred embodiment, with reference to Fig. 2, said application server carries out service response according to check information to the services request of client and may further comprise the steps:
Compared the effective time of time difference in the check information and setting, and whether the judgement time difference is greater than the effective time of setting, if then abandon this check information; Then carry out next step if not;
Judge whether result of determination is correct,, then abandon this check information if not if authentication authority is correctly then carried out service response.
Further as preferred embodiment, for example the effective time of this setting can from the internal memory of application server read from the application server end effective time of said setting.
Further as preferred embodiment; The effective time of said setting is from the login authentication server end; For example be included in the effective time of this setting in the check information of encapsulation; Application server can read from check information, has guaranteed to adjust at the login authentication server end value of predefined effective time like this.
Further as preferred embodiment, can artificially adjust the effective time of said setting, to adapt to different application scenarios.
Fig. 3 is the sketch map of the authentication method application scenarios of anti-replay-attack of the present invention;
S1: client is sent logging request to the login authentication server;
S2: the login authentication server sends login response and gives client, and login response is the authentication authority that generates at the login authentication server end, and this authentication authority comprises the very first time stamp Time that identifies the current timeSignOn, also comprise other information that are used for authentication, for example whether check code etc. logins success with identifying user;
S3: the user sends services request through client and gives application server, and this services request comprises that simultaneously including the very first time stabs TimeSignOnAuthentication authority and one-way data chain value etc.; The subscription client self maintained one-way data chain (One-Way Chains) with and up-to-date chain value, for example up-to-date chain value S12
S4: application server is with authentication authority and one-way data chain value S12Send to the login authentication server etc. relevant information etc.; Application server self is preserved the one-way data chain value S of checking last time11
S5: the login authentication server is judged the generation result of determination according to the authentication information of storage to the correctness of authentication authority, and this result of determination is used to prove whether the user logins, and calculates the current time Time of selfCurrentStab Time with the very first timeSignOnTime difference, with result of determination, time difference and one-way data chain value S12Be packaged into check information and send to application server;
S6: application server receives check information, judges the one-way data chain value S that receives12Whether be up-to-date one-way data chain value, promptly to one-way data chain value S12Carry out hash function operation, judged result whether with the one-way data chain value S of storage11Unanimity then directly abandons this verification message if not; If then continue to read result of determination and time difference in the check information, if services request authentication success in the effective time of setting, then application server carries out service response.One-way data chain value in the storage of application server end can be updated to S12Even the listener-in smells and visits one-way data chain value S like this12, owing to can't derive up-to-date one-way data chain value S13Thereby, avoided Replay Attack.
The authentication method of anti-replay-attack of the present invention; The local zone time that is stabbed the login authentication server that stabs with this very first time of generation the very first time on the authentication authority compares; Thereby saved the trouble of time synchronized; Not only avoided the complicacy of system or agreement but also evaded the delay that time synchronized causes, through use legal services request that the one-way data chain guarantees the user not by Replay Attack maybe.
More than be that preferable enforcement of the present invention is specified; But the invention is not limited to said embodiment; Those of ordinary skill in the art can also make all equivalent variations or replacement under the prerequisite of spirit of the present invention, distortion that these are equal to or replacement all are included in the application's claim institute restricted portion.