CN112671740A - HPPT message transmission method and related device - Google Patents

HPPT message transmission method and related device Download PDF

Info

Publication number
CN112671740A
CN112671740A CN202011492695.1A CN202011492695A CN112671740A CN 112671740 A CN112671740 A CN 112671740A CN 202011492695 A CN202011492695 A CN 202011492695A CN 112671740 A CN112671740 A CN 112671740A
Authority
CN
China
Prior art keywords
random string
server
request message
key
http request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011492695.1A
Other languages
Chinese (zh)
Inventor
何卫萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011492695.1A priority Critical patent/CN112671740A/en
Publication of CN112671740A publication Critical patent/CN112671740A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the application discloses a method and a related device for transmitting HPPT messages, which are applied to electronic equipment, wherein the method comprises the following steps: the electronic equipment firstly acquires a first secret key from a server, wherein the first secret key is a communication certificate of the electronic equipment and the server, then generates a first random string of a first HTTP request message when a transmission instruction aiming at the first HTTP request message to be transmitted is detected, then encrypts the first HTTP request message through the first random string to obtain a second HTTP request message, then encrypts the first random string through the first secret key to obtain a second random string, then transmits the second HTTP request message and the second random string to the server, and finally receives a target HTTP response message from the server, wherein the target HTTP response message is a response request acquired by the server according to the first secret key, the second random string and the second HTTP request message. The embodiment of the application is beneficial to improving the safety of HPPT message transmission.

Description

HPPT message transmission method and related device
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a HPPT packet transmission method and a related device.
Background
With the progress of science and technology, data transmission modes are more and more diversified, as an important data transmission mode, hypertext Transfer Protocol (HTTP) message transmission is more and more important, a basic work flow of HTTP message transmission is that an electronic device sends an HTTP message request (which indicates a resource which the electronic device wants to access and a requested action), after a server receives the request, the server starts to process the request, makes a corresponding action according to the request to access the server resource, and finally returns a result to the electronic device by sending an HTTP response.
In the prior art, a hypertext transfer protocol (HPPT) message is generally transmitted through plaintext, both an electronic device and a server end cannot verify the identity of the other party, the content may be intercepted, according to a working mechanism of a TCP/IP protocol family, the risk that the communication content is intercepted exists in any corner on the internet, and the HTTP protocol itself does not have an encryption function, the transmitted content is the plaintext, in this case, an attacker intercepts the transmission message between a web browser and a website server, and can directly know the transmitted information, so that the privacy leakage is caused.
Disclosure of Invention
The embodiment of the application provides a hypertext transfer protocol HPPT message transmission method and a related device, so that hypertext transfer protocol HPPT message transmission can be realized by judging a correction effect, the correction effect is improved, and the watching accuracy is improved.
In a first aspect, an embodiment of the present application provides a hypertext transfer protocol HPPT packet transmission method, which is applied to an electronic device in an HPPT packet transmission system, where the HPPT packet transmission system includes the electronic device and a server, and the method includes:
acquiring a first key from the server;
when a first HTTP request message to be transmitted is detected, generating a first random string according to the first HTTP request message;
encrypting the first HTTP request message through the first random string to obtain a second HTTP request message;
encrypting the first random string through the first key to obtain a second random string;
sending the second HTTP request message and the second random string to the server;
and receiving a target HTTP response message of the second HTTP request message from the server.
In one possible example, the encrypting the first random string with the first key to obtain a second random string includes: and splicing the first key and the first random string to obtain the second random string.
In one possible example, the encrypting the first HTTP request packet by the first random string to obtain a second HTTP request packet includes:
determining at least one of a request address and a request parameter of the first HTTP request message;
and encrypting at least one of the request address and the request parameter through the first random string to obtain a second HTTP request message.
In one possible example, the obtaining the first key from the server includes:
when an account login operation is detected, generating an account login request according to the account login operation, sending the account login request to the server, wherein the account login request is used for indicating the server to verify a target account which is requested to be logged in, and controlling the electronic equipment to log in the target account when the verification is passed;
after the target account is successfully logged in, sending a key request to the server, where the key request is used to instruct the server to generate the first key, and sending the first key to the server;
a first key is received from the server.
In one possible example, the target HTTP response packet is obtained by the server performing the following operations:
when the second HTTP request message and the second random string are received, the first secret key is obtained;
decrypting the second random string through the first key to obtain the first random string;
decrypting the second HTTP request message through the first random string to obtain the first HTTP request message;
and obtaining the target HTTP response message according to the first HTTP request message.
In one possible example, the first key is obtained by the server performing the following operations:
obtaining a token logged in by the target account, wherein the token is used for reflecting the first secret key agreed by the electronic equipment and the server;
and acquiring the first key according to the token.
In one possible example, the target HTTP response packet aspect is obtained by the server performing the following operations:
obtaining a first HTTP response message according to the first HTTP request message;
generating a third random string according to the first HTTP response message, and encrypting the first HTTP response message through the third random string to obtain a second HTTP response message;
and encrypting the third random string through the first key to obtain a fourth random string, wherein the target HTTP response message comprises the second HTTP response message and the fourth random string.
In one possible example, after receiving the target HTTP response packet from the server, the method further includes:
obtaining the third random string according to the first key and the fourth random string;
and obtaining a first HTTP response message request according to the third random string and the target HTTP response message.
In a second aspect, an embodiment of the present application provides an HPPT packet transmission method, which is applied to a server in an HPPT packet transmission system, where the HPPT packet transmission system includes an electronic device and the server, and the method includes:
acquiring a first secret key and sending the first secret key to the electronic equipment;
receiving a second HTTP request message and a second random string sent by the electronic equipment, wherein the second HTTP request message is a to-be-processed first HTTP request message encrypted by a first random string, and the second random string is the first random string encrypted by the first secret key;
and obtaining the first HTTP request message according to the second HTTP request message and the second random string.
In a third aspect, an embodiment of the present application provides an HPPT messaging apparatus for hypertext transfer protocol application, where the apparatus is applied to an electronic device in an HPPT messaging system, the HPPT messaging system includes the electronic device and a server, the apparatus includes a communication unit and a processing unit, where,
the processing unit is used for acquiring a first key from the server through the communication unit; the acquisition unit is used for generating a first random string according to a first HTTP request message when the acquisition unit detects the first HTTP request message to be transmitted, and is used for encrypting the first HTTP request message through the first random string to obtain a second HTTP request message; and encrypting the first random string by the first key to obtain a second random string; and for sending the second HTTP request message and the second random string to the server via the communication unit; and a target HTTP response message for receiving the second HTTP request message from the server through the communication unit.
In a fourth aspect, an embodiment of the present application provides an HPPT messaging apparatus for hypertext transfer protocol, where the apparatus is applied to a server in an HPPT messaging system, where the HPPT messaging system includes an electronic device and the server, and the apparatus includes a communication unit and a processing unit, where: the processing unit is used for acquiring a first secret key and sending the first secret key to the electronic equipment through the communication unit; the communication unit is used for receiving a second HTTP request message and a second random string sent by the electronic equipment, wherein the second HTTP request message is a first HTTP request message to be processed and encrypted by a first random string, and the second random string is the first random string encrypted by the first secret key; and the second HTTP request message is used for obtaining the first HTTP request message according to the second HTTP request message and the second random string.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps in any of the methods of the first aspect of the embodiment of the present application.
In a sixth aspect, embodiments of the present application provide a server, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing steps in any of the methods of the second aspect of the embodiments of the present application.
In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic request exchange, where the computer program enables a computer to perform some or all of the steps described in any one of the methods of the first aspect or the second aspect of the embodiments of the present application.
In an eighth aspect, embodiments of the present application provide a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, where the computer program is operable to cause a computer to perform some or all of the steps as described in any of the methods of the first or second aspects of the embodiments of the present application. The computer program product may be a software installation package.
It can be seen that, in the embodiment of the application, an electronic device first obtains a first key from a server, where the first key is a communication certificate of the electronic device and the server, then generates a first random string of a first HTTP request message when detecting a transmission instruction for the first HTTP request message to be transmitted, then encrypts the first HTTP request message through the first random string to obtain a second HTTP request message, then encrypts the first random string through the first key to obtain a second random string, then sends the second HTTP request message and the second random string to the server, and finally receives a target HTTP response message from the server, where the target HTTP response message is a response request obtained by the server according to the first key, the second random string, and the second request message. Therefore, on the basis of encrypting the HTTP plaintext request through the random string, the electronic equipment further encrypts the random string based on the key acquired from the server, namely, the security of the HTTP message data transmitted from the electronic equipment to the server is improved through double encryption.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of a system for HPPT packet transmission according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for transmitting an HPPT packet according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another HPPT packet transmission method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
FIG. 5 is a block diagram illustrating functional units of an HPPT packet transmission apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a server provided in an embodiment of the present application;
fig. 7 is a block diagram illustrating functional units of another HPPT packet transmission apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," and the like in the description and claims of the present application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
As shown in fig. 1, fig. 1 is a schematic diagram of a HPPT messaging system 100, where the HPPT messaging system 100 includes an electronic device 110 and a server 120, the electronic device 110 is connected to the server 120, the electronic device 110 can send an HTTP message request to the server 120 to request a resource to be accessed and an action to be completed, the server 120 can process the request after receiving the request, make a corresponding action according to the request to access the server resource, and finally return the result to the electronic device 110 by sending an HTTP response. The electronic device related to the present application may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem, and various forms of User Equipment (UE), Mobile Stations (MS), terminal devices (terminal device), and so on.
At present, HPPT messages are generally transmitted through plaintext, an electronic device and a server end cannot verify the identity of the other party, contents can be intercepted, according to a working mechanism of a TCP/IP protocol family, communication contents are intercepted at any corner of the Internet, the HTTP protocol does not have an encryption function, the transmitted contents are all plaintext, and under the condition that an attacker intercepts transmitted messages between a web browser and a website server, the transmitted information can be directly known, so that privacy leakage is caused.
In order to solve the above problem, the present application provides a method for transmitting an HPPT packet, and the following describes an embodiment of the present application in detail with reference to the accompanying drawings.
Referring to fig. 2, fig. 2 is a flowchart illustrating an HPPT packet transmission method according to an embodiment of the present application, applied to an electronic device in the HPPT packet transmission system shown in fig. 1, where as shown in fig. 2, the HPPT packet transmission method includes steps S201 to S206:
s201, the electronic device acquires a first key from the server.
In a specific implementation, an implementation manner of the electronic device obtaining the first key from the server is as follows: when the electronic equipment detects account login operation, generating an account login request according to the account login operation, and sending the account login request to the server, wherein the account login request is used for indicating the server to verify a target account which requests login, and controlling the electronic equipment to log in the target account when the verification is passed; after the target account number is successfully logged in, the electronic device sends a secret key request to the server, wherein the secret key request is used for indicating the server to generate the first secret key and sending the first secret key to the server; the electronic device receives a first key from the server.
The first key is a random key, namely the first key, obtained from the server after the account login is successful, and then the electronic device stores the first key, wherein the first key is valid during the account login period and is used as one of the credentials for communication between the electronic device and the server.
For example, after the user successfully logs in the account a through the electronic device with the account password, the electronic device can obtain a random key a from the server, then the electronic device saves a, and is valid during the login, one of the credentials for server communication is that, after the user logs out of the account a, the key a is invalid, after the user successfully logs in the account a through the electronic device with the account password again, the electronic device can obtain a new random key B from the server, where the key B and the key a are different, then the electronic device saves B, and is valid during the login again, one of the credentials for server communication.
Therefore, in this example, the electronic device can obtain the key from the server, and the obtained key is different each time, so that the variability of the key can be ensured, and the key is not easy to be cracked by other terminal devices.
S202, when the electronic equipment detects a first HTTP request message to be transmitted, a first random string is generated according to the first HTTP request message.
Wherein the first random string may include, but is not limited to, a 16-bit random string.
When detecting a first HTTP request packet to be transmitted, the electronic device may generate a first random string according to the first HTTP request packet in an implementation manner: when the electronic equipment detects a first HTTP request message to be transmitted, a first random string is randomly generated according to the first HTTP request message.
S203, the electronic equipment encrypts the first HTTP request message through the first random string to obtain a second HTTP request message.
The electronic device encrypts the first HTTP request packet through the first random string to obtain a second HTTP request packet, including: the electronic equipment determines at least one of a request address and a request parameter of the first HTTP request message; and the electronic equipment encrypts at least one of the request address and the request parameter through the first random string to obtain a second HTTP request message.
The first electronic device generates a 16-bit random string before initiating the HTTP request, and the random string is used for encrypting at least one of a request address and a request parameter of the HTTP request message to be transmitted, so that the electronic device transmits the encrypted HTTP request message to be transmitted to the server as a request body.
As can be seen, in this example, the electronic device can randomly generate a random string to encrypt the HTTP request packet to be transmitted, so as to improve the security of the HTTP request packet to be transmitted.
S204, the electronic equipment encrypts the first random string through the first secret key to obtain a second random string.
Optionally, the electronic device encrypts the first random string by using the first key, and an implementation manner of obtaining the second random string may be: and splicing the first key and the first random string to obtain the second random string.
In a specific implementation, if the first key is a character string a and the first random string is a character string C, the second random string may be a character string a + C, and the second random string may also be a character string C + a, and a splicing manner of the first key and the first random string is not particularly limited.
The method includes that a random string which is randomly generated by the electronic equipment and used for encrypting an HTTP request message to be transmitted is encrypted through a first secret key acquired from a server to obtain an encrypted random string, the encrypted random string is stored in a header, and finally the encrypted random string is transmitted to the server.
S205, the electronic device sends the second HTTP request packet and the second random string to the server.
The electronic equipment can transmit the encrypted HTTP request message to be transmitted to the server as a request body and transmit the encrypted random string to the server.
S206, the electronic equipment receives a target HTTP response message of the second HTTP request message from the server.
The target HTTP response packet may be obtained by the server performing the following operations: when the second HTTP request message and the second random string are received, the first secret key is obtained; decrypting the second random string through the first key to obtain the first random string; decrypting the second HTTP request message through the first random string to obtain the first HTTP request message; and obtaining the target HTTP response message according to the first HTTP request message.
Further, the first key may be obtained by the server performing the following operations: obtaining a token logged in by the target account, wherein the token is used for reflecting the first secret key agreed by the electronic equipment and the server; and acquiring the first key according to the token.
That is, after receiving the request, the server obtains the first key through the logged token, decrypts the first random string through the first key, and decrypts the encrypted request address of the HTTP request message to be transmitted and/or the request parameter through the first random string.
It can be seen that, in the embodiment of the application, an electronic device first obtains a first key from a server, where the first key is a communication certificate of the electronic device and the server, then generates a first random string of a first HTTP request message when detecting a transmission instruction for the first HTTP request message to be transmitted, then encrypts the first HTTP request message through the first random string to obtain a second HTTP request message, then encrypts the first random string through the first key to obtain a second random string, then sends the second HTTP request message and the second random string to the server, and finally receives a target HTTP response message from the server, where the target HTTP response message is a response request obtained by the server according to the first key, the second random string, and the second request message. Therefore, on the basis of encrypting the HTTP plaintext request through the random string, the electronic equipment further encrypts the random string based on the key acquired from the server, namely, the security of the HTTP message data transmitted from the electronic equipment to the server is improved through double encryption.
In one possible example, the target HTTP response packet aspect is obtained by the server performing the following operations: obtaining a first HTTP response message according to the first HTTP request message; generating a third random string according to the first HTTP response message, and encrypting the first HTTP response message through the third random string to obtain a second HTTP response message; and encrypting the third random string through the first key to obtain a fourth random string, wherein the target HTTP response message comprises the second HTTP response message and the fourth random string.
Wherein the third random string may include, but is not limited to, a 16-bit random string.
The implementation manner of encrypting the third random string by the first key to obtain the fourth random string is the same as the implementation manner of encrypting the first random string by the first key to obtain the second random string.
For example, after obtaining a first HTTP response packet corresponding to the first HTTP request packet from the electronic device, the server may generate a third random string D according to the first HTTP response packet, encrypt the first HTTP response packet through the third random string D to obtain a second HTTP response packet, encrypt the third random string D through a first key a agreed with the electronic device to obtain a fourth random string (which may be a + D or D + a), where the target HTTP response packet includes the second HTTP response packet and the fourth random string.
Further, after the electronic device receives a target HTTP response packet from the server, the method further includes: the electronic equipment obtains the third random string according to the first secret key and the fourth random string; and the electronic equipment obtains a first HTTP response message request according to the third random string and the target HTTP response message.
In a specific implementation, after a user logs in an account through an electronic device and successfully logs in the account a, a random key a can be obtained from a server, the electronic device stores the key a, the key a is valid during the current login of the account a, the key a is used as one of credentials for server communication, the electronic device generates a random string 1 of a 16-bit random string before sending an HTTP request message (plaintext) to the server, encrypts one of a request url and an encryption request parameter of the HTTP request message through the random string 1, then transmits the encrypted HTTP request message as a request body to the server, encrypts the random string 1 through the key a, transmits the encrypted random string 1 (which may be a +1 or 1+ a) to the server, and after receiving the encrypted HTTP request message and the encrypted random string 1, the method comprises the steps that a secret key A is obtained through a token logged in by an account A, the encrypted random string 1 is decrypted through the secret key A to obtain a random string 1, the encrypted HTTP request message is decrypted through the random string 1 to obtain an HTTP request message, a server obtains an HTTP response message based on the HTTP request message, then a random string 2 is generated randomly, the HTTP response message is encrypted through the random string 1, the secret key A is obtained through a login token of a user, the random string 2 is encrypted through the secret key A, the encrypted HTTP response message and the encrypted random string 2 (A +2 or 2+ A) are sent to the electronic equipment, the electronic equipment receives the encrypted HTTP response message and the encrypted random string 2, the random string 2 is decrypted through the secret key A, and the HTTP response message is decrypted through the random string 2.
As can be seen, in this example, the HTTP request message and the HTTP response message between the electronic device and the server can be transmitted after being doubly encrypted, so that the HTTP message is transmitted more safely, and the security of the HTTP data transmitted between the electronic device and the server is further improved.
Referring to fig. 3, in accordance with the embodiment shown in fig. 2, fig. 3 is a schematic flowchart of a method for HPPT messaging according to a hypertext transfer protocol, which is applied to a server in an HPPT messaging system, where the HPPT messaging system includes an electronic device and the server, and the method includes steps S301 to S303:
the server acquires a first secret key and sends the first secret key to the electronic equipment;
the server receives a second HTTP request message and a second random string sent by the electronic equipment, wherein the second HTTP request message is a to-be-processed first HTTP request message encrypted through a first random string, and the second random string is the first random string encrypted through the first secret key;
and the server receives a target HTTP response message of the second HTTP request message from the server.
It can be seen that, in the embodiment of the present application, a server first obtains a first key, sends the first key to an electronic device, then receives a second HTTP request message and a second random string sent from the electronic device, where the second HTTP request message is a to-be-processed first HTTP request message encrypted by a first random string, and the second random string is the first random string encrypted by the first key, and finally receives a target HTTP response message of the second HTTP request message from the server. Therefore, the server can provide the key for the electronic equipment to obtain the encrypted HTTP request message which is obtained by doubly encrypting the HTTP request message through the key from the electronic equipment, and can decrypt the encrypted HTTP request message to obtain the HTTP request message, so that the electronic equipment can transmit the HTTP request message to the server more safely.
In accordance with the embodiment shown in fig. 2, please refer to fig. 4, fig. 4 is a schematic structural diagram of an electronic device 400 provided in an embodiment of the present application, and as shown in the drawing, the electronic device 400 includes a processor 410, a memory 420, a communication interface 430, and one or more programs 421, where the one or more programs 421 are stored in the memory 420 and configured to be executed by the processor 410, and the one or more programs 421 include instructions for performing the following steps;
acquiring a first key from the server;
when a first HTTP request message to be transmitted is detected, generating a first random string according to the first HTTP request message;
encrypting the first HTTP request message through the first random string to obtain a second HTTP request message;
encrypting the first random string through the first key to obtain a second random string;
sending the second HTTP request message and the second random string to the server;
and receiving a target HTTP response message of the second HTTP request message from the server.
It can be seen that, in the embodiment of the application, an electronic device first obtains a first key from a server, where the first key is a communication certificate of the electronic device and the server, then generates a first random string of a first HTTP request message when detecting a transmission instruction for the first HTTP request message to be transmitted, then encrypts the first HTTP request message through the first random string to obtain a second HTTP request message, then encrypts the first random string through the first key to obtain a second random string, then sends the second HTTP request message and the second random string to the server, and finally receives a target HTTP response message from the server, where the target HTTP response message is a response request obtained by the server according to the first key, the second random string, and the second request message. Therefore, on the basis of encrypting the HTTP plaintext request through the random string, the electronic equipment further encrypts the random string based on the key acquired from the server, namely, the security of the HTTP message data transmitted from the electronic equipment to the server is improved through double encryption.
In one possible example, in the aspect that the first random string is encrypted by the first key to obtain a second random string, the instructions in the one or more programs 421 are specifically configured to: and splicing the first key and the first random string to obtain the second random string.
In one possible example, in the aspect that the first HTTP request packet is encrypted by the first random string to obtain the second HTTP request packet, the instructions in the one or more programs 421 are specifically configured to: determining at least one of a request address and a request parameter of the first HTTP request message; and encrypting at least one of the request address and the request parameter through the first random string to obtain a second HTTP request message.
In one possible example, in the obtaining the first key from the server, the instructions in the one or more programs 421 are specifically configured to: when an account login operation is detected, generating an account login request according to the account login operation, sending the account login request to the server, wherein the account login request is used for indicating the server to verify a target account which is requested to be logged in, and controlling the electronic equipment to log in the target account when the verification is passed; after the target account is successfully logged in, sending a key request to the server, where the key request is used to instruct the server to generate the first key, and sending the first key to the server; a first key is received from the server.
In one possible example, the target HTTP response packet is obtained by the server performing the following operations: when the second HTTP request message and the second random string are received, the first secret key is obtained; decrypting the second random string through the first key to obtain the first random string; decrypting the second HTTP request message through the first random string to obtain the first HTTP request message; and obtaining the target HTTP response message according to the first HTTP request message.
In one possible example, the first key is obtained by the server performing the following operations: obtaining a token logged in by the target account, wherein the token is used for reflecting the first secret key agreed by the electronic equipment and the server; and acquiring the first key according to the token.
In one possible example, the target HTTP response packet aspect is obtained by the server performing the following operations: obtaining a first HTTP response message according to the first HTTP request message; generating a third random string according to the first HTTP response message, and encrypting the first HTTP response message through the third random string to obtain a second HTTP response message; and encrypting the third random string through the first key to obtain a fourth random string, wherein the target HTTP response message comprises the second HTTP response message and the fourth random string.
In one possible example, the one or more programs 421 further include instructions for performing the steps of: after receiving the target HTTP response message from the server, obtaining the third random string according to the first key and the fourth random string; and obtaining a first HTTP response message request according to the third random string and the target HTTP response message.
The above description has introduced the solution of the embodiment of the present application mainly from the perspective of the method-side implementation process. It is understood that the electronic device comprises corresponding hardware structures and/or software modules for performing the respective functions in order to realize the above-mentioned functions. Those of skill in the art will readily appreciate that the present application is capable of hardware or a combination of hardware and computer software implementing the various illustrative elements and algorithm steps described in connection with the embodiments provided herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional units according to the method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
Fig. 5 is a block diagram of functional units of an HPPT packet forwarding apparatus 500 according to an embodiment of the present application, which is applied to an electronic device, and includes a processing unit 501 and a communication unit 502, where,
the processing unit 501 is configured to obtain a first key from the server through the communication unit 502; the acquisition unit is used for generating a first random string according to a first HTTP request message when the acquisition unit detects the first HTTP request message to be transmitted, and is used for encrypting the first HTTP request message through the first random string to obtain a second HTTP request message; and encrypting the first random string by the first key to obtain a second random string; and for sending the second HTTP request message and the second random string to the server via the communication unit 502; and a target HTTP response message for receiving the second HTTP request message from the server through the communication unit 502.
The HPPT messaging apparatus 500 may further include a storage unit 503 for storing program codes and requests of electronic devices. The processing unit 501 may be a processor, the communication unit 502 may be a touch display screen or a transceiver, and the storage unit 503 may be a memory.
It can be seen that, in the embodiment of the application, an electronic device first obtains a first key from a server, where the first key is a communication certificate of the electronic device and the server, then generates a first random string of a first HTTP request message when detecting a transmission instruction for the first HTTP request message to be transmitted, then encrypts the first HTTP request message through the first random string to obtain a second HTTP request message, then encrypts the first random string through the first key to obtain a second random string, then sends the second HTTP request message and the second random string to the server, and finally receives a target HTTP response message from the server, where the target HTTP response message is a response request obtained by the server according to the first key, the second random string, and the second request message. Therefore, on the basis of encrypting the HTTP plaintext request through the random string, the electronic equipment further encrypts the random string based on the key acquired from the server, namely, the security of the HTTP message data transmitted from the electronic equipment to the server is improved through double encryption.
In a possible example, in the aspect that the first random string is encrypted by the first key to obtain a second random string, the processing unit 501 is specifically configured to: and splicing the first key and the first random string to obtain the second random string.
In a possible example, in the aspect that the first HTTP request packet is encrypted by the first random string to obtain a second HTTP request packet, the processing unit 501 is specifically configured to: determining at least one of a request address and a request parameter of the first HTTP request message; and encrypting at least one of the request address and the request parameter through the first random string to obtain a second HTTP request message.
In one possible example, in the aspect of acquiring the first key from the server, the processing unit 501 is specifically configured to: when an account login operation is detected, generating an account login request according to the account login operation, sending the account login request to the server, wherein the account login request is used for indicating the server to verify a target account which is requested to be logged in, and controlling the electronic equipment to log in the target account when the verification is passed; after the target account is successfully logged in, sending a key request to the server, where the key request is used to instruct the server to generate the first key, and sending the first key to the server; a first key is received from the server.
In one possible example, the target HTTP response packet is obtained by the server performing the following operations: when the second HTTP request message and the second random string are received, the first secret key is obtained; decrypting the second random string through the first key to obtain the first random string; decrypting the second HTTP request message through the first random string to obtain the first HTTP request message; and obtaining the target HTTP response message according to the first HTTP request message.
In one possible example, the first key is obtained by the server performing the following operations: obtaining a token logged in by the target account, wherein the token is used for reflecting the first secret key agreed by the electronic equipment and the server; and acquiring the first key according to the token.
In one possible example, the target HTTP response packet aspect is obtained by the server performing the following operations: obtaining a first HTTP response message according to the first HTTP request message; generating a third random string according to the first HTTP response message, and encrypting the first HTTP response message through the third random string to obtain a second HTTP response message; and encrypting the third random string through the first key to obtain a fourth random string, wherein the target HTTP response message comprises the second HTTP response message and the fourth random string.
In one possible example, the processing unit 501 is further configured to: after receiving the target HTTP response message from the server, obtaining the third random string according to the first key and the fourth random string; and obtaining a first HTTP response message request according to the third random string and the target HTTP response message.
Referring to fig. 6 in accordance with the embodiment shown in fig. 3, fig. 6 is a schematic structural diagram of a server 600 according to an embodiment of the present application, and as shown in the figure, the server 600 includes a processor 610, a memory 620, a communication interface 630, and one or more programs 621, where the one or more programs 621 are stored in the memory 620 and configured to be executed by the processor 610, and the one or more programs 621 include instructions for performing the following steps;
acquiring a first secret key and sending the first secret key to the electronic equipment;
receiving a second HTTP request message and a second random string sent by the electronic equipment, wherein the second HTTP request message is a to-be-processed first HTTP request message encrypted by a first random string, and the second random string is the first random string encrypted by the first secret key;
and obtaining the first HTTP request message according to the second HTTP request message and the second random string.
It can be seen that, in the embodiment of the present application, a server first obtains a first key, sends the first key to an electronic device, then receives a second HTTP request message and a second random string sent from the electronic device, where the second HTTP request message is a to-be-processed first HTTP request message encrypted by a first random string, and the second random string is the first random string encrypted by the first key, and finally receives a target HTTP response message of the second HTTP request message from the server. Therefore, the server can provide the key for the electronic equipment to obtain the encrypted HTTP request message which is obtained by doubly encrypting the HTTP request message through the key from the electronic equipment, and can decrypt the encrypted HTTP request message to obtain the HTTP request message, so that the electronic equipment can transmit the HTTP request message to the server more safely.
Fig. 7 is a block diagram of functional units of another HPPT messaging apparatus 700 according to an embodiment of the present invention, as shown in fig. 7, where the apparatus 700 is applied to a server in the HPPT messaging system shown in fig. 1, the HPPT messaging apparatus includes a processing unit 701 and a communication unit 702, where,
the processing unit 701 is configured to obtain a first key from the server through the communication unit 702; the acquisition unit is used for generating a first random string according to a first HTTP request message when the acquisition unit detects the first HTTP request message to be transmitted, and is used for encrypting the first HTTP request message through the first random string to obtain a second HTTP request message; and encrypting the first random string by the first key to obtain a second random string; and is configured to send the second HTTP request packet and the second random string to the server through the communication unit 702; and the second HTTP request message is used for obtaining the first HTTP request message according to the second HTTP request message and the second random string.
The HPPT messaging apparatus 700 may further include a storage unit 703 for storing program codes and requests of electronic devices. The processing unit 701 may be a processor, the communication unit 702 may be a touch display screen or a transceiver, and the storage unit 703 may be a memory.
It can be seen that, in the embodiment of the present application, a server first obtains a first key, sends the first key to an electronic device, then receives a second HTTP request message and a second random string sent from the electronic device, where the second HTTP request message is a to-be-processed first HTTP request message encrypted by a first random string, and the second random string is the first random string encrypted by the first key, and finally receives a target HTTP response message of the second HTTP request message from the server. Therefore, the server can provide the key for the electronic equipment to obtain the encrypted HTTP request message which is obtained by doubly encrypting the HTTP request message through the key from the electronic equipment, and can decrypt the encrypted HTTP request message to obtain the HTTP request message, so that the electronic equipment can transmit the HTTP request message to the server more safely.
It can be understood that, since the embodiment of the HPPT packet transmission method and the embodiment of the HPPT packet transmission apparatus are different presentation forms of the same technical concept, the content of the embodiment of the HPPT packet transmission method in the present application should be synchronously adapted to the embodiment of the HPPT packet transmission apparatus, and is not described herein again.
Embodiments of the present application further provide a computer storage medium, where the computer storage medium stores a computer program for electronic request exchange, and the computer program, when executed by a computer, implements part or all of the steps of any one of the methods described in the above method embodiments, and the computer includes an electronic device.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods as described in the above method embodiments. The computer program product may be a software installation package, the computer comprising an electronic device.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer readable memory if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above-mentioned method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A hypertext transfer protocol (HPPT) message transmission method is applied to an electronic device in an HPPT message transmission system, the HPPT message transmission system comprises the electronic device and a server, and the method comprises the following steps:
acquiring a first key from the server;
when a first HTTP request message to be transmitted is detected, generating a first random string according to the first HTTP request message;
encrypting the first HTTP request message through the first random string to obtain a second HTTP request message;
encrypting the first random string through the first key to obtain a second random string;
sending the second HTTP request message and the second random string to the server;
and receiving a target HTTP response message of the second HTTP request message from the server.
2. The method of claim 1, wherein said encrypting the first random string with the first key to obtain a second random string comprises:
and splicing the first key and the first random string to obtain the second random string.
3. The method according to claim 1, wherein said encrypting the first HTTP request message with the first random string to obtain a second HTTP request message comprises:
determining at least one of a request address and a request parameter of the first HTTP request message;
and encrypting at least one of the request address and the request parameter through the first random string to obtain a second HTTP request message.
4. The method of claim 1, wherein obtaining the first key from the server comprises:
when an account login operation is detected, generating an account login request according to the account login operation, sending the account login request to the server, wherein the account login request is used for indicating the server to verify a target account which is requested to be logged in, and controlling the electronic equipment to log in the target account when the verification is passed;
after the target account is successfully logged in, sending a key request to the server, where the key request is used to instruct the server to generate the first key, and sending the first key to the server;
a first key is received from the server.
5. The method according to claim 1, wherein the target HTTP response packet is obtained by the server performing the following operations:
when the second HTTP request message and the second random string are received, the first secret key is obtained;
decrypting the second random string through the first key to obtain the first random string;
decrypting the second HTTP request message through the first random string to obtain the first HTTP request message;
and obtaining the target HTTP response message according to the first HTTP request message.
6. The method of claim 5, wherein the first key is obtained by the server performing the following operations:
obtaining a token logged in by the target account, wherein the token is used for reflecting the first secret key agreed by the electronic equipment and the server;
and acquiring the first key according to the token.
7. The method of claim 5, wherein the target HTTP response message aspect is obtained by the server performing the following operations:
obtaining a first HTTP response message according to the first HTTP request message;
generating a third random string according to the first HTTP response message, and encrypting the first HTTP response message through the third random string to obtain a second HTTP response message;
and encrypting the third random string through the first key to obtain a fourth random string, wherein the target HTTP response message comprises the second HTTP response message and the fourth random string.
8. The method according to any of claims 1-7, wherein after receiving the target HTTP response message from the server, the method further comprises:
obtaining the third random string according to the first key and the fourth random string;
and obtaining a first HTTP response message request according to the third random string and the target HTTP response message.
9. An HPPT message transmission method, applied to a server in an HPPT message transmission system, the HPPT message transmission system comprising an electronic device and the server, the method comprising:
acquiring a first secret key and sending the first secret key to the electronic equipment;
receiving a second HTTP request message and a second random string sent by the electronic equipment, wherein the second HTTP request message is a to-be-processed first HTTP request message encrypted by a first random string, and the second random string is the first random string encrypted by the first secret key;
and obtaining the first HTTP request message according to the second HTTP request message and the second random string.
10. HPPT messaging apparatus for application in an electronic device in an HPPT messaging system comprising the electronic device and a server, the apparatus comprising a communication unit and a processing unit, wherein,
the processing unit is used for acquiring a first key from the server through the communication unit; the acquisition unit is used for generating a first random string according to a first HTTP request message when the acquisition unit detects the first HTTP request message to be transmitted, and is used for encrypting the first HTTP request message through the first random string to obtain a second HTTP request message; and encrypting the first random string by the first key to obtain a second random string; and for sending the second HTTP request message and the second random string to the server via the communication unit; and a target HTTP response message for receiving the second HTTP request message from the server through the communication unit.
CN202011492695.1A 2020-12-17 2020-12-17 HPPT message transmission method and related device Pending CN112671740A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011492695.1A CN112671740A (en) 2020-12-17 2020-12-17 HPPT message transmission method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011492695.1A CN112671740A (en) 2020-12-17 2020-12-17 HPPT message transmission method and related device

Publications (1)

Publication Number Publication Date
CN112671740A true CN112671740A (en) 2021-04-16

Family

ID=75404473

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011492695.1A Pending CN112671740A (en) 2020-12-17 2020-12-17 HPPT message transmission method and related device

Country Status (1)

Country Link
CN (1) CN112671740A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506552A (en) * 2016-12-28 2017-03-15 北京奇艺世纪科技有限公司 A kind of HTTP request transmission method and device
CN108347419A (en) * 2017-01-24 2018-07-31 腾讯科技(深圳)有限公司 Data transmission method and device
CN110048994A (en) * 2018-12-05 2019-07-23 香港乐蜜有限公司 A kind of communication means and device
CN110417543A (en) * 2018-04-27 2019-11-05 腾讯科技(深圳)有限公司 A kind of data ciphering method, device and storage medium
CN111193704A (en) * 2019-10-28 2020-05-22 腾讯科技(深圳)有限公司 HTTP communication method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506552A (en) * 2016-12-28 2017-03-15 北京奇艺世纪科技有限公司 A kind of HTTP request transmission method and device
CN108347419A (en) * 2017-01-24 2018-07-31 腾讯科技(深圳)有限公司 Data transmission method and device
CN110417543A (en) * 2018-04-27 2019-11-05 腾讯科技(深圳)有限公司 A kind of data ciphering method, device and storage medium
CN110048994A (en) * 2018-12-05 2019-07-23 香港乐蜜有限公司 A kind of communication means and device
CN111193704A (en) * 2019-10-28 2020-05-22 腾讯科技(深圳)有限公司 HTTP communication method and device

Similar Documents

Publication Publication Date Title
CN105207774B (en) The cryptographic key negotiation method and device of verification information
EP2779524A1 (en) Secure data transmission method, device and system
JP2017521934A (en) Method of mutual verification between client and server
US20110264913A1 (en) Method and apparatus for interworking with single sign-on authentication architecture
US20060005033A1 (en) System and method for secure communications between at least one user device and a network entity
EP3299990A1 (en) Electronic device server and method for communicating with server
US11470060B2 (en) Private exchange of encrypted data over a computer network
CN109067739B (en) Communication data encryption method and device
CN108322416B (en) Security authentication implementation method, device and system
CN109167802B (en) Method, server and terminal for preventing session hijacking
CN105634737B (en) Data transmission method, terminal and system
CN103428221A (en) Safety logging method, system and device of mobile application
CN103237305B (en) Password protection method for smart card on facing moving terminal
CN103391292A (en) Mobile-application-oriented safe login method, system and device
JP5829574B2 (en) Authentication system, authentication apparatus, authentication method, and program
CN106506552B (en) HTTP request transmission method and device
KR20130131682A (en) Method for web service user authentication
WO2016056987A1 (en) Generating a symmetric encryption key
CN109218334B (en) Data processing method, device, access control equipment, authentication server and system
WO2020019477A1 (en) Communication data encryption method and apparatus
CN105491073B (en) Data downloading method, device and system
CN109684129B (en) Data backup recovery method, storage medium, encryption machine, client and server
CN105447715A (en) Method and apparatus for anti-theft electronic coupon sweeping by cooperating with third party
CN111970109B (en) Data transmission method and system
CN112672342B (en) Data transmission method, device, equipment, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination