Cookie data processing method, device, computer equipment and storage medium
By converting and encoding the cookie data according to preset rules, and using the terminal address identifier for double encryption, the problem of insufficient cookie data encryption security in the existing technology is solved, and the security of the data is significantly improved.
Patent Information
- Application Number
- CN201811021157.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-09-03
- Publication Date
- 2024-08-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, the encryption method of cookie data is not highly secure and can be easily cracked by attackers, resulting in data insecurity.
By converting and encoding user information and record information with preset rules, a cookie file is generated, and the terminal address identifier is used for double encryption, and a key file is generated to encrypt the cookie file to improve data security.
It effectively improves the security of cookie data, prevents data from being cracked, and ensures the security of data during transmission and storage.
Smart Images

Figure CN109409099B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a cookie data processing method, apparatus, computer equipment and storage medium for information security. Background Art
[0002] With the rapid development of computer technology, data caching is a very important technology in the field of Internet information technology. Cookie data is important data related to users stored when users visit web pages. Hard disks with large data caches have great advantages in accessing scattered files. For example, after the user terminal accesses the browser, the server can obtain the cookie data generated by the user terminal during the process of accessing the web page, and encrypt it, so that when the user terminal visits the web page again, the server can obtain the corresponding cookie data for loading, thereby speeding up browsing.
[0003] In the traditional way, the cookie data is usually encrypted using a key stored on the server. However, the current cookie data encryption method is not very secure, and attackers can easily crack the encryption algorithm, resulting in the security of the cookie data not being guaranteed. Therefore, how to effectively improve the security of cookie data has become a technical problem that needs to be solved. Summary of the invention
[0004] Based on this, it is necessary to provide a cookie data processing method, device, computer equipment and storage medium that can effectively improve the security of cookie data in response to the above technical problems.
[0005] A cookie data processing method, comprising:
[0006] Receiving a first access request sent by a user terminal, wherein the first access request includes a request identifier and a terminal address identifier;
[0007] Acquire cookie data according to the first access request, wherein the cookie data includes user information and record information;
[0008] Converting the user information and the record information according to preset rules;
[0009] Encode the converted user information and record information according to preset rules, and generate a cookie file according to the encoded user information and record information;
[0010] Encrypting the cookie file according to the terminal address identifier;
[0011] The encrypted cookie file is sent to the user terminal.
[0012] In one of the embodiments, the user information and the record information are converted according to preset rules, including: obtaining the character type and character length of the user information and the record information; inserting preset characters between a preset number of characters of the user information and the record information; and connecting and converting the user information and the record information through preset spacing characters.
[0013] In one of the embodiments, encrypting the cookie file according to the terminal address identifier includes: obtaining a corresponding preset file and key according to the request identifier; encoding the key according to the terminal address identifier to obtain an encoded key; adding the encoded key to a preset position in the preset file, generating a key file and storing it; and encrypting the cookie file using the key in the key file.
[0014] In one of the embodiments, adding the encoded key to the preset position in the preset file includes: marking the number of characters in the encoded key string as the number of key characters; deleting multiple characters starting from the preset position of the string corresponding to the preset file, and the number of deleted characters is the same as the number of key characters; adding the encoded key string to the position corresponding to the deleted characters to generate a key file.
[0015] In one of the embodiments, a second access request sent by the user terminal is received, the second access request carrying a request identifier and a terminal address identifier; a corresponding cookie file and a key file are obtained according to the request identifier; the key file is parsed to obtain a corresponding key; the cookie file is decrypted using the key to obtain a cookie file; user information and record information in the cookie file are decoded according to preset rules to obtain corresponding user information and record information; the user information and the record information are verified; and when the verification passes, a web page corresponding to the second access request identifier is returned to the user terminal.
[0016] In one of the embodiments, the method also includes: receiving problem feedback information sent by a user terminal, and sending a feedback prompt to a debugging terminal according to the problem feedback information; receiving a log printing instruction sent by the debugging terminal according to the feedback prompt, wherein the log printing instruction includes a request identifier; calling corresponding cookie data according to the request identifier; obtaining a corresponding function identifier according to the request identifier, calling a corresponding log printing interface from an interface library according to the function identifier, and printing the cookie data using the log printing interface.
[0017] A cookie data processing device, comprising:
[0018] A receiving module, configured to receive a first access request sent by a user terminal, wherein the first access request includes a request identifier and a terminal address identifier;
[0019] an acquisition module, configured to acquire cookie data according to the first access request, wherein the cookie data includes user information and record information;
[0020] An encoding module, used to convert the user information and record information according to a preset rule; encode the converted user information and record information according to the preset rule, and generate a cookie file according to the encoded user information and record information;
[0021] An encryption module, used for encrypting the cookie file according to the terminal address identifier;
[0022] The sending module is used to send the encrypted cookie file to the user terminal.
[0023] In one of the embodiments, the encryption module is also used to obtain the corresponding preset file and key according to the request identifier; encode the key according to the terminal address identifier to obtain the encoded key; add the encoded key to the preset position in the preset file, generate a key file and store it; and encrypt the cookie file using the key in the key file.
[0024] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0025] Receiving a first access request sent by a user terminal, wherein the first access request includes a request identifier and a terminal address identifier;
[0026] Acquire cookie data according to the first access request, wherein the cookie data includes user information and record information;
[0027] Converting the user information and the record information according to preset rules;
[0028] Encode the converted user information and record information according to preset rules, and generate a cookie file according to the encoded user information and record information;
[0029] Encrypting the cookie file according to the terminal address identifier;
[0030] The encrypted cookie file is sent to the user terminal.
[0031] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0032] Receiving a first access request sent by a user terminal, wherein the first access request includes a request identifier and a terminal address identifier;
[0033] Acquire cookie data according to the first access request, wherein the cookie data includes user information and record information;
[0034] Converting the user information and the record information according to preset rules;
[0035] Encode the converted user information and record information according to preset rules, and generate a cookie file according to the encoded user information and record information;
[0036] Encrypting the cookie file according to the terminal address identifier;
[0037] The encrypted cookie file is sent to the user terminal.
[0038] In the above-mentioned cookie data processing method, device, computer equipment and storage medium, the server receives a first access request sent by a user terminal, and the first access request includes a request identifier and a terminal address identifier. The server obtains cookie data according to the first access request, and the cookie data includes user information and record information. Then the server converts the user information and record information according to preset rules; encodes the converted user information and record information according to the preset rules, and generates a cookie file according to the encoded user information and record information. The server further encrypts the cookie file according to the terminal address identifier, and sends the encrypted cookie file to the user terminal. By double encrypting the cookie data content and the cookie file, the security of the cookie data is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is an application scenario diagram of a cookie data processing method in an embodiment;
[0040] Figure 2 The following is a flowchart of a cookie data processing method in one embodiment;
[0041] Figure 3 is a flowchart of the steps of converting user information and record information in one embodiment;
[0042] Figure 4A schematic diagram of a process for encrypting a cookie file in one embodiment;
[0043] Figure 5 is a structural block diagram of a cookie data processing device in one embodiment;
[0044] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The cookie data processing method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the user terminal 102 communicates with the server 104 through the network through the network. Among them, the user terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers. The server 104 receives the first access request including the request identifier and the terminal address identifier sent by the user terminal 102. When the user accesses the web page through the user terminal 102, the user terminal 102 will generate cookie data during the access process. The server 104 obtains the corresponding cookie data according to the first access request, and the cookie data includes user information and record information. The server 104 converts the user information and record information according to the preset rules, encodes the converted user information and record information according to the preset rules, and generates a cookie file according to the encoded user information and record information. The server 104 further encrypts the cookie file according to the specified address identifier, and sends the encrypted cookie file to the user terminal 102. By double encrypting the content of the cookie data and the cookie file, the security of the cookie data is effectively improved.
[0047] In one embodiment, Figure 2 As shown, a cookie data processing method is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0048] Step 202: Receive a first access request sent by a user terminal, where the first access request includes a request identifier and a terminal address identifier.
[0049] When a user terminal accesses a web page for the first time, the user terminal sends a first access request to the server, and the access request carries a request identifier and a terminal address identifier of the user terminal. After receiving the first access request sent by the user terminal, the server obtains the corresponding web page according to the first access request and returns the corresponding web page to the user terminal. The user terminal generates cookie data in the process of accessing the web page.
[0050] Step 204: Obtain cookie data according to the first access request, where the cookie data includes user information and record information.
[0051] After receiving the first access request sent by the user terminal, the server obtains the cookie data of the corresponding web page according to the first access request. The cookie data includes user information and record information. Among them, the user information may include information such as the user name and password used to log in to the corresponding web page; the record information may include information such as the request identifier, the designated address identifier, the access time, and the validity period.
[0052] Step 206: convert the user information and the record information according to preset rules.
[0053] Step 208: Encode the converted user information and record information according to a preset rule, and generate a cookie file according to the encoded user information and record information.
[0054] After the server obtains the cookie data of the corresponding webpage according to the first access request, the server encodes the user information and the record information in the cookie data. Specifically, the server can convert the user information and the record information according to a preset rule, and encode the converted user information and the record information. The conversion method of the user information and the record information can be the same or different.
[0055] For example, the server may obtain the character type and character length of the user information and the record information, insert a first preset character between a preset number of characters in the user information, insert a second preset character between a preset number of characters in the record information, and connect the user information and the record information with the preset characters added by using a spacer character, so as to convert the user information and the record information, and encode the converted user information and the record information in a preset manner. The server generates a cookie file according to the encoded cookie data.
[0056] Step 210, encrypting the cookie file according to the terminal address identifier.
[0057] After the server generates a cookie file based on the encoded cookie data, it further encrypts the cookie file. Specifically, the server can obtain a preset file and a key based on the request identifier in the first access request, and the corresponding decryption rules can be stored in the preset file. The server further encodes the key using the specified address identifier to obtain the encoded key. The server adds the encoded key to the preset position in the preset file and generates a key file. The server encrypts the cookie file using the key in the key file. The key file is used by the server to decrypt the obtained cookie file when the user terminal visits the corresponding web page again.
[0058] Step 212, sending the encrypted cookie file to the user terminal.
[0059] After the server encrypts the cookie file, it sends the encrypted cookie file to the user terminal. When the user terminal accesses the webpage again, the server can obtain the corresponding cookie data to access the corresponding webpage, thereby increasing the speed of browsing the webpage. The server effectively improves the security of the cookie data by double encrypting the content and files of the cookie data.
[0060] In the above cookie data processing method, the server receives a first access request sent by a user terminal, and the first access request includes a request identifier and a terminal address identifier. The server obtains cookie data according to the first access request, and the cookie data is the cookie data generated by the user terminal during the process of accessing the web page, including user information and record information. Then the server encodes the user information and record information in the cookie data, and generates a cookie file according to the encoded cookie data; the server further encrypts the cookie file according to the terminal address identifier, and sends the encrypted cookie file to the user terminal. By double encrypting the cookie data content and the cookie file, the security of the cookie data is effectively improved.
[0061] In one embodiment, Figure 3 As shown, the steps of converting the user information and record information in the cookie data according to the preset rules specifically include the following:
[0062] Step 302, obtaining the character type and character length of the user information and record information.
[0063] Step 304: insert a preset character between the user information and a preset number of characters of the recorded information.
[0064] Step 306: Connect and convert the user information and the record information using a preset spacing character.
[0065] When a user terminal accesses a web page for the first time, the user terminal sends a first access request to the server, and the access request carries a request identifier and a terminal address identifier of the user terminal. After receiving the first access request sent by the user terminal, the server obtains the cookie data of the corresponding web page according to the first access request. The cookie data includes user information and record information.
[0066] The server further converts the user information and the record information in the cookie data. Specifically, the server can convert the user information and the record information in the cookie data according to a preset rule, wherein the conversion method of the user information and the record information can be the same or different.
[0067] The server may obtain the character type and character length of the user information and the recorded information, generate a preset number of first preset characters according to the character type and character length of the user information, and insert the first preset characters between the preset number of characters of the user information. Further, the server generates a preset number of second preset characters according to the character type and character length of the recorded information, and inserts the second preset characters between the preset number of characters of the recorded information. The server further generates a preset number of spacing characters according to the character type and character length of the user information and the recorded information, and connects the user information and the recorded information to which the preset characters are added through the spacing characters, so as to convert the user information and the recorded information.
[0068] The server encodes the converted user information and record information according to a preset rule. Specifically, the converted user information and record information form a new string, and the server can encode the new string after the connection conversion, for example, Base64 encoding can be used. The server generates a cookie file based on the encoded cookie data. By converting and encoding the cookie data in a preset manner, the cookie data can be effectively encrypted, thereby effectively improving the security of the cookie data.
[0069] For example, the user information may include a user name and a password. Each cookie data may be pre-set with a valid duration, and the cookie data is valid only within the valid duration. The server may determine whether the cookie data is valid based on the access time and the valid duration. The server may also generate a cookie data identifier for the cookie data in a preset manner, and add the cookie data identifier to the record information. Thus, the record information may include information such as a request identifier, a designated address identifier, a cookie data identifier, an access time, and a valid duration. The server may first insert a first preset character of "*" between a preset number of characters in the user name. Due to the particularity of the password, the server may also insert a first preset character of "*" between a preset number of characters in the password, and perform MD5 encryption on the password with the second preset character added. The server further inserts a second preset character such as "#" or "^" between the preset characters for each information in the record information. Then, the server connects the user information and the record information after adding the preset characters through a preset spacing character "|", and performs Base64 encoding on the connected user information and the record information. By converting and encoding the cookie data in a preset manner, the cookie data can be effectively encrypted, thereby effectively improving the security of the cookie data.
[0070] In one embodiment, Figure 4 As shown, the steps of encrypting the cookie file according to the terminal address identifier specifically include the following contents:
[0071] Step 402: Obtain the corresponding preset file and key according to the request identifier.
[0072] Step 404: encode the key according to the terminal address identifier to obtain the encoded key.
[0073] When a user terminal accesses a web page for the first time, the user terminal sends a first access request to the server, and the access request carries a request identifier and a terminal address identifier of the user terminal. After receiving the first access request sent by the user terminal, the server obtains the cookie data of the corresponding web page according to the first access request. The cookie data includes user information and record information.
[0074] After the server obtains the cookie data of the corresponding web page according to the first access request, it encodes the user information and record information in the cookie data, and generates a cookie file according to the encoded cookie data.
[0075] After the server generates a cookie file according to the encoded cookie data, it is necessary to further encrypt the cookie file. Specifically, a database is deployed in the server. The database stores a variety of preset files and keys corresponding to the request identifier. Different access requests can use different keys. Different keys can generate corresponding key files through different preset files. The server can obtain the preset file and key according to the request identifier in the first access request.
[0076] The server further encodes the key using the terminal address identifier. Specifically, the server may add the terminal address identifier to the key in a preset manner. The key may be a preset string or a preset graphic. The server may encode the preset string in a preset encoding manner or may encode the preset graphic in a preset encoding manner, thereby obtaining an encoded key. There may be multiple preset encoding methods. For example, the preset encoding method may be a base64 encoding method. The encoded key includes an encoded key string and a key graphic, etc.
[0077] Step 406, add the encoded key to a preset position in the preset file, generate a key file and store it.
[0078] Step 408, encrypt the cookie file using the key in the key file.
[0079] After the server obtains the encoded key, it adds the encoded key to the preset position in the preset file and generates a key file. The server uses the key in the key file to encrypt the cookie file. The key file is used when the user terminal visits the corresponding web page again, and the server decrypts the obtained cookie file. By double encrypting the content and file of the cookie data, the security of the cookie data is effectively improved.
[0080] In one embodiment, the encoded key is added to a preset position in a preset file, a key file is generated and stored, including: marking the number of characters in the encoded key string as the number of key characters; starting from the preset position of the string corresponding to the preset file, deleting multiple characters, the number of deleted characters is the same as the number of key characters; adding the encoded key string to the position corresponding to the deleted characters to generate a key file.
[0081] After the server obtains the cookie data of the corresponding web page according to the first access request, it encodes the user information and record information in the cookie data, and generates a cookie file according to the encoded cookie data. After the server generates the cookie file according to the encoded cookie data, it needs to further encrypt the cookie file. Specifically, a database is deployed in the server. The database stores a variety of preset files and keys corresponding to the request identifier. Different access requests can use different keys. Different keys can generate corresponding key files through different preset files. The server can obtain the preset file and key according to the request identifier in the first access request.
[0082] The server further encodes the key using the terminal address identifier. Specifically, the server may add the terminal address identifier to the key in a preset manner, thereby obtaining the encoded key.
[0083] After the server obtains the encoded key, it adds the encoded key at a preset position in the preset file. Specifically, the server deletes multiple characters starting from the first position of the character string corresponding to the preset file, and the number of deleted characters is the same as the number of key characters. Among them, the server can continuously delete the same number of characters as the number of key characters starting from the first position. It can also start from the first position and delete multiple characters in a dispersed manner according to a preset rule, and the number of deleted characters is the same as the number of key characters. For example, the number of characters in the key character string is 20. The server can continuously delete 20 characters starting from the first position in the character string corresponding to the preset file. The server can also start from the first position and delete multiple characters in a dispersed manner, for example, delete 5 characters starting from the first position, then skip 10 characters and continue to delete 5 characters, then skip 10 characters and continue to delete 5 characters, and so on, until the number of deleted characters reaches 20. When the server deletes characters in a dispersed manner, the number of partial characters deleted continuously at different positions can be the same or different.
[0084] The server adds the encoded key string to the position corresponding to the deleted character. The server can add the encoded key string continuously from the first position, or can add the encoded key string in a scattered manner from the first position, so that the encoded string replaces the original multiple characters in the preset file, generates a corresponding key file, and stores it. The server uses the key in the key file to encrypt the cookie file. Encoding and hiding the key according to a preset special method reduces the probability of the key being cracked, effectively improves the security of the key, and effectively ensures the security of the cookie file.
[0085] In one embodiment, the method also includes: receiving a second access request sent by a user terminal, the second access request carrying a request identifier and a terminal address identifier; obtaining a corresponding cookie file and a key file according to the request identifier; parsing the key file to obtain a corresponding key; decrypting the cookie file using the key to obtain a cookie file; decoding the user information and record information in the cookie file according to preset rules to obtain corresponding user information and record information; verifying the user information and record information; and when the verification passes, returning a web page corresponding to the second access request identifier to the user terminal.
[0086] When the user terminal visits the webpage again, a second access request is sent to the server. After receiving the second access request sent by the user terminal, the server obtains the corresponding cookie file and key file according to the request identifier and the specified address identifier carried in the second access request. The server parses the key file according to the preset decryption rules to obtain the corresponding key.
[0087] The server further uses the terminal address identifier to parse the key to obtain a decryption key. The server can then use the key to decrypt the cookie file to obtain the cookie file. After the server obtains the cookie file, it also needs to decode the content of the cookie data. Specifically, the server decodes the user information and record information in the cookie file according to a preset decoding rule, and parses it in a preset manner to obtain the corresponding user information and record information.
[0088] After the server obtains the user information and record information, it also needs to verify the user information and record information. Specifically, the server needs to verify the user information. For example, the server first verifies the validity of the cookie data according to the access time. If it is within the valid time, it means that the current cookie data is valid. The server can further verify the user name and password information to confirm whether the user's access identity is valid. The server can also identify the terminal address to verify whether the accessed user terminal is consistent.
[0089] After the server verifies the user information and record information in the cookie data, it quickly obtains the corresponding web page according to the cookie data, and returns the web page corresponding to the second access request identifier to the user terminal. The server decodes and decrypts the cookie data according to the decryption rules, thereby obtaining valid cookie data, and uses the decrypted cookie data to load the corresponding web page, thereby accelerating the access speed of the user terminal. By double encrypting and decrypting the cookie data content and files, the security of the cookie data during use is effectively guaranteed.
[0090] In one embodiment, the method also includes: receiving problem feedback information sent by the user terminal, and sending a feedback prompt to the debugging terminal according to the problem feedback information; receiving a log printing instruction sent by the debugging terminal according to the feedback prompt, the log printing instruction including a request identifier; calling the corresponding cookie data according to the request identifier; obtaining the corresponding function identifier according to the request identifier, calling the corresponding log printing interface from the interface library according to the function identifier, and printing the cookie data using the log printing interface.
[0091] The server receives a first access request sent by a user terminal, the first access request including a request identifier and a terminal address identifier. The server obtains cookie data according to the first access request, the cookie data being the cookie data generated by the user terminal during the process of accessing a web page, including user information and record information. The server then encodes the user information and record information in the cookie data, and generates a cookie file according to the encoded cookie data. The server further encrypts the cookie file according to the terminal address identifier, and sends the encrypted cookie file to the user terminal.
[0092] When a user terminal encounters a problem or failure during the access process, it can send problem feedback information to the server. The server sends feedback prompt information to the debugging terminal based on the problem feedback information. After receiving the feedback information, the debugging terminal can obtain the corresponding cookie data through the server to understand the specific problems that exist in the user terminal during the access process and perform debugging. Specifically, after receiving the feedback information, the debugging terminal sends a log printing instruction to the server according to the feedback prompt, and the log printing instruction includes a request identifier.
[0093] After receiving the log printing instruction, the server calls the corresponding cookie data according to the request identifier, obtains the corresponding function identifier according to the request identifier, and calls the corresponding log printing interface from the interface library according to the function identifier. There are multiple log printing interfaces in the interface library, and each interface has a corresponding function type. After the server calls the log printing interface corresponding to the function identifier, it obtains the encapsulation information of the log printing interface from the stack and matches it with the function identifier. A successful match indicates that the function type matches the currently called function. The server then uses the encapsulation information in the stack to print the cookie data information. In this way, the corresponding log printing interface can be effectively used to print out the corresponding cookie data information. In this way, the printed log information can be used to effectively analyze user behavior, thereby debugging existing problems.
[0094] It should be understood that although Figure 2-4The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0095] In one embodiment, Figure 5 As shown, a cookie data processing device is provided, including: a receiving module 502, an acquisition module 504, an encoding module 506, an encryption module 508 and a sending module 510, wherein:
[0096] The receiving module 502 is used to receive a first access request sent by a user terminal, where the first access request includes a request identifier and a terminal address identifier;
[0097] An acquisition module 504 is used to acquire cookie data according to the first access request, where the cookie data includes user information and record information;
[0098] The encoding module 506 is used to convert the user information and the record information according to the preset rules; encode the converted user information and the record information according to the preset rules, and generate a cookie file according to the encoded user information and the record information;
[0099] An encryption module 508, used to encrypt the cookie file according to the terminal address identifier;
[0100] The sending module 510 is used to send the encrypted cookie file to the user terminal.
[0101] In one embodiment, the encoding module 506 is also used to obtain the character type and character length of the user information and the record information; insert preset characters between a preset number of characters of the user information and the record information; and connect and convert the user information and the record information through preset spacing characters.
[0102] In one embodiment, the encryption module 508 is also used to obtain the corresponding preset file and key according to the request identifier; encode the key according to the terminal address identifier to obtain the encoded key; add the encoded key to the preset position in the preset file, generate a key file and store it; and encrypt the cookie file using the key in the key file.
[0103] In one embodiment, the encryption module 508 is also used to mark the number of characters in the encoded key string as the number of key characters; starting from a preset position of the string corresponding to a preset file, delete multiple characters, and the number of deleted characters is the same as the number of key characters; add the encoded key string to the position corresponding to the deleted characters to generate a key file.
[0104] In one embodiment, the receiving module 502 is also used to receive a second access request sent by a user terminal, and the second access request carries a request identifier and a terminal address identifier. The obtaining module 504 is also used to obtain the corresponding cookie file and key file according to the request identifier. The device also includes a decryption module, a decoding module and a verification module, wherein the decryption module is used to parse the key file to obtain the corresponding key; and use the key to decrypt the cookie file to obtain the cookie file. The decoding module is used to decode the user information and record information in the cookie file according to preset rules to obtain the corresponding user information and record information. The verification module is used to verify the user information and record information. The sending module 510 is also used to return the web page corresponding to the second access request identifier to the user terminal when the verification is passed.
[0105] For the specific definition of the cookie data processing device, please refer to the definition of the cookie data processing method above, which will not be repeated here. Each module in the above-mentioned cookie data processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0106] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as user information, record information and cookie files. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a cookie data processing method is implemented.
[0107] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0108] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0109] Receiving a first access request sent by a user terminal, the first access request including a request identifier and a terminal address identifier;
[0110] Obtain cookie data according to the first access request, where the cookie data includes user information and record information;
[0111] Convert user information and record information according to preset rules;
[0112] Encode the converted user information and record information according to preset rules, and generate a cookie file according to the encoded user information and record information;
[0113] Encrypt the cookie file according to the terminal address identifier;
[0114] The encrypted cookie file is sent to the user terminal.
[0115] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the character type and character length of the user information and the record information; inserting preset characters between a preset number of characters of the user information and the record information; and connecting and converting the user information and the record information through preset spacing characters.
[0116] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the corresponding preset file and key according to the request identifier; encoding the key according to the terminal address identifier to obtain the encoded key; adding the encoded key to the preset position in the preset file, generating a key file and storing it; and encrypting the cookie file using the key in the key file.
[0117] In one embodiment, when the processor executes the computer program, the following steps are also implemented: marking the number of characters in the encoded key string as the number of key characters; deleting multiple characters starting from a preset position of the string corresponding to the preset file, and the number of deleted characters is the same as the number of key characters; adding the encoded key string to the position corresponding to the deleted characters to generate a key file.
[0118] In one embodiment, when the processor executes the computer program, the following steps are also implemented: receiving a second access request sent by a user terminal, the second access request carrying a request identifier and a terminal address identifier; obtaining the corresponding cookie file and key file according to the request identifier; parsing the key file to obtain the corresponding key; using the key to decrypt the cookie file to obtain the cookie file; decoding the user information and record information in the cookie file according to preset rules to obtain the corresponding user information and record information; verifying the user information and record information; when the verification passes, returning the web page corresponding to the second access request identifier to the user terminal.
[0119] In one embodiment, the processor also implements the following steps when executing the computer program: receiving problem feedback information sent by the user terminal, and sending a feedback prompt to the debugging terminal according to the problem feedback information; receiving a log printing instruction sent by the debugging terminal according to the feedback prompt, the log printing instruction including a request identifier; calling the corresponding cookie data according to the request identifier; obtaining the corresponding function identifier according to the request identifier, calling the corresponding log printing interface from the interface library according to the function identifier, and printing the cookie data using the log printing interface.
[0120] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0121] Receiving a first access request sent by a user terminal, the first access request including a request identifier and a terminal address identifier;
[0122] Obtain cookie data according to the first access request, where the cookie data includes user information and record information;
[0123] Convert user information and record information according to preset rules;
[0124] Encode the converted user information and record information according to preset rules, and generate a cookie file according to the encoded user information and record information;
[0125] Encrypt the cookie file according to the terminal address identifier;
[0126] The encrypted cookie file is sent to the user terminal.
[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the character type and character length of the user information and the record information; inserting preset characters between a preset number of characters of the user information and the record information; and connecting and converting the user information and the record information through preset spacing characters.
[0128] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the corresponding preset file and key according to the request identifier; encoding the key according to the terminal address identifier to obtain the encoded key; adding the encoded key to the preset position in the preset file, generating a key file and storing it; and encrypting the cookie file using the key in the key file.
[0129] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: marking the number of characters in the encoded key string as the number of key characters; deleting multiple characters starting from a preset position of the string corresponding to the preset file, and the number of deleted characters is the same as the number of key characters; adding the encoded key string to the position corresponding to the deleted characters to generate a key file.
[0130] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving a second access request sent by a user terminal, the second access request carrying a request identifier and a terminal address identifier; obtaining a corresponding cookie file and a key file according to the request identifier; parsing the key file to obtain a corresponding key; decrypting the cookie file using the key to obtain a cookie file; decoding the user information and record information in the cookie file according to preset rules to obtain corresponding user information and record information; verifying the user information and record information; and when the verification passes, returning the web page corresponding to the second access request identifier to the user terminal.
[0131] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving problem feedback information sent by the user terminal, and sending a feedback prompt to the debugging terminal according to the problem feedback information; receiving a log printing instruction sent by the debugging terminal according to the feedback prompt, the log printing instruction includes a request identifier; calling the corresponding cookie data according to the request identifier; obtaining the corresponding function identifier according to the request identifier, calling the corresponding log printing interface from the interface library according to the function identifier, and printing the cookie data using the log printing interface.
[0132] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0133] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0134] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A cookie data processing method, comprising: Receiving a first access request sent by a user terminal, wherein the first access request includes a request identifier and a terminal address identifier; Acquire cookie data according to the first access request, wherein the cookie data includes user information and record information; Obtaining the character type and character length of the user information and the record information, generating a preset number of first preset characters according to the character type and character length of the user information, inserting the first preset characters between the preset number of characters of the user information, and encrypting the password with the first preset characters inserted in the user information; generating a preset number of second preset characters according to the character type and character length of the record information, inserting the second preset characters between the preset number of characters of the user information; generating a preset number of spacing characters according to the character type and character length of the user information and the record information, and connecting and converting the user information and the record information with the preset characters added thereto through the spacing characters; Encode the converted user information and record information according to preset rules, and generate a cookie file according to the encoded user information and record information; Obtaining the corresponding preset file and key according to the request identifier; Adding the terminal address identifier to the key in a preset manner to obtain an encoded key; Add the encoded key to a preset position in the preset file, generate a key file and store it; Encrypting the cookie file using the key in the key file; The encrypted cookie file is sent to the user terminal.
2. The method according to claim 1, characterized in that The method further comprises: Acquire a corresponding web page according to the first access request, and return the web page to the user terminal; The first access request is a request sent by the user terminal when accessing the webpage for the first time.
3. The method according to claim 1, characterized in that Adding the encoded key at a preset position in the preset file includes: Marking the number of characters in the encoded key string as the number of key characters; Starting from a preset position of the character string corresponding to the preset file, a plurality of characters are deleted, and the number of the deleted characters is the same as the number of key characters; The encoded key character string is added to the position corresponding to the deleted character to generate a key file.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: receiving a second access request sent by the user terminal, where the second access request carries a request identifier and a terminal address identifier; Obtain the corresponding cookie file and key file according to the request identifier; Parsing the key file to obtain a corresponding key; Decrypting the cookie file using the key to obtain a cookie file; Decoding the user information and record information in the cookie file according to preset rules to obtain corresponding user information and record information; Verifying the user information and the record information; When the verification is successful, the web page corresponding to the second access request identifier is returned to the user terminal.
5. The method according to claim 4, characterized in that The recorded information includes access time; the verifying the user information and the recorded information includes: The validity of the user information is verified according to the access time, and if it is within the valid time, the user information is determined to be valid.
6. The method according to claim 1, characterized in that The method further comprises: Receive problem feedback information sent by the user terminal, and send a feedback prompt to the debugging terminal according to the problem feedback information; receiving a log printing instruction sent by the debugging terminal according to the feedback prompt, wherein the log printing instruction includes a request identifier; Calling corresponding cookie data according to the request identifier; A corresponding function identifier is obtained according to the request identifier, a corresponding log printing interface is called from an interface library according to the function identifier, and the cookie data is printed using the log printing interface.
7. A cookie data processing device, comprising: A receiving module, configured to receive a first access request sent by a user terminal, wherein the first access request includes a request identifier and a terminal address identifier; an acquisition module, configured to acquire cookie data according to the first access request, wherein the cookie data includes user information and record information; An encoding module, used for obtaining the character type and character length of the user information and the record information, generating a preset number of first preset characters according to the character type and character length of the user information, inserting the first preset characters between the preset number of characters of the user information, and encrypting the password of the user information with the first preset characters inserted therein; generating a preset number of second preset characters according to the character type and character length of the record information, inserting the second preset characters between the preset number of characters of the user information; generating a preset number of spacing characters according to the character type and character length of the user information and the record information, connecting and converting the user information and the record information with the preset characters added thereto through the spacing characters; encoding the converted user information and record information according to a preset rule, and generating a cookie file according to the encoded user information and record information; An encryption module, used to obtain a corresponding preset file and key according to the request identifier; Adding the terminal address identifier to the key in a preset manner to obtain an encoded key; Add the encoded key to a preset position in the preset file, generate a key file and store it; Encrypting the cookie file using the key in the key file; The sending module is used to send the encrypted cookie file to the user terminal.
8. The device according to claim 7, characterized in that The encryption module is also used to obtain the corresponding preset file and key according to the request identifier; encode the key according to the terminal address identifier to obtain the encoded key; Add the encoded key to a preset position in the preset file, generate a key file and store it; The cookie file is encrypted using the key in the key file.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
