Embodiment
By reference to the accompanying drawings the present invention is described in further detail below by embodiment.
At first, the embodiment of the invention is carried out brief description.The embodiment of the invention has proposed a kind of linking processing method, comprising: server end is received the http request of request access door chain file; From described http request, obtain relevant information, described relevant information comprises at least one of time, User IP, user MAC, the default password of the described relevant information obtained or server end or both combinations is encrypted with the first method produces the first key; Whether the second key that comprises in judging described the first key and http asking is consistent; If unanimously, then return the data of request.Further, can also comprise: after detecting the request that the user accesses the door chain file, Website server is processed the chained address of described door chain file, produces described http request, and described http request comprises with described the first method encrypts described the second key that obtains; The encryption acts of described web site server end for information comprise at least one of time, User IP, user MAC and described server end preset password.
Can find out by above-mentioned brief description, the embodiment of the invention is by after the http request of receiving access door chain file, produce the first key by the first method, and then whether second key of relatively carrying in this http request is consistent with this first key, if unanimously then allow access.By this method, only have those users by legal web page access door chain file just to have the consistent key that calculates with server, the situation of having avoided stealing chain occurs.This is because the key that validated user obtains is to adopt the first method to encrypt the address that obtains by the webpage backstage, and is inevitable consistent by the key that described the first method obtains with server, so validated user can be accessed this door chain file.But just can not normally access by the link that robber's chain website provides, because certain has accessed this door chain file by legal means to suppose to steal the chain person, and obtained him by interception URL and worked as time chained address and the key of this door chain file of access, address and key that he uses interception to obtain are placed in the website of oneself as stealing the chain address, but because correct key changes, and correct key and time, User IP, user MAC, in the password that server end is preset at least one is relevant, so even he uses the address of this robber's chain and key to steal chain, the key that also will produce owing to server and inconsistent the causing of key of this robber's chain can't be accessed.
The embodiment of the invention produces key by the door chain file being encrypted process, then judge that the key in the http request of this door chain file of request access is whether identical with the key that encryption obtains, only have and identically just can allow normal access, so just make the user who steals the chain connection can't access these files, prevented from stealing the generation of chain.
Described the first method specifically can have a variety of, below describes in detail for example.
Method one:
According to the different different keys of period generation;
The described period can be with the sky, hour, 30 minutes or other suitable even chronomeres; Also can be the default inhomogeneous period, for example: 12:00-18:00 be a period, and 18:00-19:00 is a period, and 19:00-20:00 is a period;
Described different key can be the key of determining that sets in advance in database; It also can be the key that produces at random; Can also be the key that calculates according to some Varying parameters, the key that for example calculates by certain rule according to Hour Minute Second six bit digital of the current time that switches key;
Method two:
Use in the described relevant information at least one to calculate key by default cryptographic algorithm;
For example, current date and User IP can be obtained key as combination by calculating the MD5 value;
Certainly, described relevant parameter not only includes only current date and User IP, such as comprising the parameters such as user MAC;
Method three:
Calculate key by the default password of server end and at least one in the relevant information;
For example, the default password of described server end can be 123456, this password and current date and User IP can be obtained key as combination by calculating MD5 value so;
Preferably adopting MD5 as coded system, is that method own is also fairly simple because the irreversibility of the coded system of MD5 can't obtain the default password of server end so steal the chain person, and such mode has very strong fail safe; The password that server end is default and some information are carried out together md5 encryption and are obtained a MD5 value, because the irreversibility of MD5 algorithm can't be known the set password of server by inference; The MD5 value that this linking processing method only obtains encryption is added in the request URL, and this URL does not comprise the cleartext information of terminal, steals the chain person and can't learn it is which information is carried out the MD5 value that computing obtains; More than make door chain be difficult to be cracked, improved reliability and the fail safe of door chain;
Further, the default password of this server end can change according to default method, for example can be along with the time change, and 00:00-12:00 is that 123456,12:00-24:00 is 654321, the person just more is difficult to crack to steal the chain like this;
Further, on method two and three basis, open the cryptographic calculations mode that can adopt variation, for example calculate with the MD5 method with the combination of User IP by the default password of server end at time period 18:00-19:00, at time period 19:00-20:00 by server end default password and the combination of user MAC SHA1 method calculating.
Below for example understand several encryption methods; but all methods of limit not herein; those of ordinary skills may also can obtain a variety of concrete methods after reading said method, give unnecessary details no longer one by one, but these methods also belong within protection scope of the present invention herein.
Said method is illustrated mainly with the MD5 coded system, in fact other coded systems also can, methods such as SHA1, CRC32.
After having produced key, described key can be placed on after the chained address of door chain file, as the part of new chained address.
Whether consistent mode is illustrated said method with key relatively, in fact, and also can be by the new chained address that relatively produces consistent mode whether.
Correspondingly, the invention allows for a kind of link treatment system, comprising:
Receiving element: be used for receiving the http request of request access door chain file;
The first ciphering unit: be used for obtaining relevant information from described http request, described relevant information comprises at least one of time, User IP, user MAC, the default password of the described relevant information obtained or server end or both combinations is encrypted with the first method produces the first key;
Judging unit: whether the second key that comprises in judging described the first key and http asking is consistent; If unanimously, then return the data of request.
Further, described link treatment system can also comprise:
Web site server end: after accessing the request of door chain file to the user, the chained address of described door chain file is processed, produce described http request, described http request comprises with described the first method encrypts described the second key that obtains;
The encryption acts of described web site server end for information comprise at least one of time, User IP, user MAC and described server end preset password.
Preferably, described the first method is: use the default password of server end and User IP, date to calculate the MD5 value and obtain key.
Describe below in conjunction with accompanying drawing and a specific embodiment:
Processing method for normal legal link at first is described among the embodiment of a kind of linking processing method of the present invention:
Suppose server ip: 192.168.50.11, server end at first arrange password (for example being set to 123456) in option, and determine to arrange file or the catalogue of door chain.For the webpage client, usually the following http of chained address form that shows in the webpage: // 192.168.50.11/1.rmvb, if in the server this document is provided with door chain, then should link can encrypt through the backstage, this linking request should be when arriving server: http: // 192.168.50.11/1.rmvb? keyCode=2db5549d642d24283f8a26aed9168b58.Link after the above-mentioned encryption has comprised a keycode, the key in the embodiment of the invention namely, and in the present embodiment, this key can obtain by (Arabic numerals of the default password+User IP of server end+date) are calculated the MD5 value.For instance, the user that on August 20th, 2011, the IP address was 192.168.50.10 carries out program request to this door chain file, then: keycode=MD5 (123456192.168.50.102011820)=2db5549d642d24283f8a26aed9168b58, so the link of program request just should be the link after the encryption mentioned above: http: // 192.168.50.11/1.rmvb when sending to server? keyCode=2db5549d642d24283f8a26aed9168b58.
When accessing described door chain file, described web page user produces the http request, destination address in the described http request is the chained address after encrypting, after server is received described address, will be according to IP address and the time of this http acquisition request client, and then according to above-mentioned encryption method calculating MD5 value, namely be exactly to calculate keycode=MD5 (123456192.168.50.102011820)=2db5549d642d24283f8a26aed9168b58, then judge whether the keycode in the chained address in the result calculate and the described http request is identical, if identical then the permission normally accessed.
Be illustrated in figure 1 as the schematic flow sheet of an embodiment of a kind of linking processing method of the present invention, as shown in the figure, the method comprises:
101, receive the http linking request of client;
The relevant information that comprises file destination in the described linking request, such as client ip,, time etc.;
103, judge whether described file destination is provided with door chain;
If 105 are provided with door chain, obtain client ip and time;
107, calculate the MD5 value;
Calculate according to described client ip, time, the default password of server end;
109, judge whether the MD5 value of carrying in described MD5 value and the described http request is consistent;
If 111 is consistent, then return correct chained address and allow normal access;
When inconsistent, denied access then.
Be illustrated in figure 2 as a kind of module diagram that links an embodiment for the treatment of system of the present invention, as shown in the figure, this system comprises:
201, information acquisition unit:
Be used for obtaining the http request of client, obtain at least file destination information, client ip, time according to the http request of described client;
203, computing unit:
Be used for to calculate key, as according to as described in client ip, time, the default password of server end calculate the MD5 value as key;
205, authentication unit:
Be used for judging whether the 203 MD5 values that calculate are consistent with the MD5 value of the http request of client, if unanimously then return the data of request, allow normally to access.
Further, described link treatment system also comprises the webpage background server, described webpage background server is used for will having comprised that according to the user's of current accessed client ip, time, the default cryptographic calculations MD5 value of server end the door chain file address of described MD5 value offers the user.
Above content is the further description of the present invention being done in conjunction with concrete execution mode, can not assert that implementation of the present invention is confined to these explanations.For the general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, can also make some simple deduction or replace, all should be considered as belonging to protection scope of the present invention.