WO2019134278A1 - 聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质 - Google Patents

聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质 Download PDF

Info

Publication number
WO2019134278A1
WO2019134278A1 PCT/CN2018/081391 CN2018081391W WO2019134278A1 WO 2019134278 A1 WO2019134278 A1 WO 2019134278A1 CN 2018081391 W CN2018081391 W CN 2018081391W WO 2019134278 A1 WO2019134278 A1 WO 2019134278A1
Authority
WO
WIPO (PCT)
Prior art keywords
function
encryption
chat
forged
chat content
Prior art date
Application number
PCT/CN2018/081391
Other languages
English (en)
French (fr)
Inventor
周志刚
张文明
陈少杰
Original Assignee
武汉斗鱼网络科技有限公司
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 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2019134278A1 publication Critical patent/WO2019134278A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0478Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload applying multiple layers of encryption, e.g. nested tunnels or encrypting the content with a first key and then with at least a second key
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms

Definitions

  • the present application relates to the field of computer technology, and in particular, to a chat encryption method, a chat decryption method, an apparatus, an electronic terminal, and a readable storage medium.
  • chat content chat software will perform encrypted transmission, since the encryption method used by the electronic terminal is the encryption method carried by the instant communication application, the corresponding decryption method is stored in the server, so the chat server can decrypt the chat content. Therefore, the chat server can always obtain the plain text chat content.
  • some users with higher security requirements may wish that even the chat server can't get the plaintext chat content.
  • the purpose of the embodiments of the present application includes providing a chat encryption method, a chat decryption method, an apparatus, an electronic terminal, and a readable storage medium.
  • a chat encryption method is provided in an embodiment of the present application.
  • the electronic terminal is connected to a server, and the instant messaging application is installed in the electronic terminal.
  • the chat encryption method includes:
  • the chat content to be sent is encrypted twice using the forged encryption function to obtain the target encrypted chat content.
  • the embodiment of the present application further provides a chat encryption device, which is applied to an electronic terminal, where the electronic terminal is in communication connection with a server, and the electronic terminal is installed with an instant communication application, and the chat encryption device includes:
  • a lookup module configured to search for a process flow of the chat content by the instant messaging application by dynamically debugging a process of the instant messaging application
  • a replacement module configured to replace an address of the original encryption function executed after the packaging process point with an address of a preset forged encryption function, where the forged encryption function includes the original encryption function and a secondary encryption function;
  • the encryption module is configured to perform the encryption of the chat content to be sent by using the forged encryption function to obtain the target encrypted chat content.
  • the embodiment of the present application further provides a chat encryption method, which is applied to an electronic terminal, where the instant messaging application is installed, and the instant communication application level is configured to generate chat content, including:
  • the function address of the original encryption function is replaced with a function address of the forged encryption function to invoke the forged encryption function by the function address of the forged encryption function, and the chat content is encrypted to obtain encrypted chat content.
  • the embodiment of the present application further provides a chat decryption method, which is applied to an electronic terminal, where the instant messaging application is installed in the electronic terminal, and the chat decryption method includes:
  • the encrypted chat content is decrypted by the forged decryption function to obtain the decrypted chat content.
  • the embodiment of the present application further provides a chat encryption device, which is applied to an electronic terminal, where the instant messaging application is installed, and the instant communication application level is configured to generate chat content, including:
  • a first processing module configured to determine a function address of the original encryption function when encrypting the chat content
  • a first processing module configured to determine a function address of the forged encryption function corresponding to the original encryption function
  • An encryption module configured to replace a function address of the original encryption function with a function address of the forged encryption function, to invoke the forged encryption function by using a function address of the forged encryption function, to encrypt the chat content, Get encrypted chat content.
  • the embodiment of the present application further provides a chat decryption device, which is applied to an electronic terminal, where the instant messaging application is installed in the electronic terminal, and the chat decryption device includes:
  • a monitoring module configured to monitor a communication process of the instant messaging application
  • a content determining module configured to determine encrypted chat content received by the instant messaging application
  • a first determining module configured to determine an original decryption function corresponding to the encrypted chat content
  • a second determining module configured to determine a forged decryption function corresponding to the original decryption function
  • the decryption module is configured to decrypt the encrypted chat content by using the forged decryption function to obtain the decrypted chat content.
  • the embodiment of the present application further provides an electronic terminal, including:
  • the real-time animation display device is stored in the memory and controlled by the processor to execute.
  • the embodiment of the present application further provides a readable storage medium, on which a computer program is stored, and the computer program implements the above-described chat encryption method when executed.
  • the chat encryption method, device, electronic terminal and readable storage medium of the embodiments of the present application It is safer to use chat content by replacing the original encryption function of the instant messaging application with a forged encryption function containing the original encryption function and the secondary encryption function to double encrypt the chat content.
  • the server can also obtain the plain text chat content through two encryptions, further ensuring that the chat content can only enable the target user to view and improve the security of the chat content.
  • FIG. 1 is a schematic block diagram of an electronic terminal according to a preferred embodiment of the present application.
  • FIG. 2 is a flowchart of a method for encrypting a chat provided by a preferred embodiment of the present application.
  • FIG. 3 is a detailed flowchart of step S103 of the chat encryption method according to the preferred embodiment of the present application.
  • FIG. 4 is another detailed flowchart of step S103 of the chat encryption method according to the preferred embodiment of the present application.
  • FIG. 5 is a flowchart of a method for encrypting a chat provided by another preferred embodiment of the present application.
  • FIG. 6 is a schematic diagram of functional modules of a chat encryption apparatus according to a preferred embodiment of the present application.
  • FIG. 7 is a detailed block diagram of an encryption module of a chat encryption apparatus according to a preferred embodiment of the present application.
  • FIG. 1 it is a block schematic diagram of the electronic terminal 100.
  • the electronic terminal 100 includes a chat encryption device 110, a memory 111, a memory controller 112, a processor 113, a peripheral interface 114, an input and output unit 115, and a display unit 116.
  • a chat encryption device 110 receives a chat message from the electronic terminal 100.
  • a memory controller 112 receives a chat message from the electronic terminal 100.
  • a processor 113 a processor 113
  • peripheral interface 114 a peripheral interface
  • an input and output unit 115 a display unit 116.
  • the structure shown in FIG. 1 is merely illustrative, and does not limit the structure of the electronic terminal 100.
  • the electronic terminal 100 may also include more or less components than those shown in FIG. 1, or have a different configuration than that shown in FIG.
  • an instant messaging application is installed in the electronic terminal 100.
  • the instant messaging application is configured to receive or send chat content.
  • the electronic terminal 100 can be in communication with a chat server for data communication or interaction.
  • the electronic terminal 100 may send the chat content to the chat server, and the electronic terminal 100 may further receive the chat content sent by the chat server.
  • the components of the memory 111, the memory controller 112, the processor 113, the peripheral interface 114, the input and output unit 115, and the display unit 116 are electrically connected directly or indirectly to each other to implement data transmission or interaction.
  • the components can be electrically connected to one another via one or more communication buses or signal lines.
  • the chat encryption device 110 includes at least one software function module that can be stored in the memory 111 or is solidified in an operating system (OS) of the electronic terminal 100 in the form of software or firmware.
  • the processor 113 is configured to execute an executable module stored in a memory, such as a software function module or computer program included in the chat encryption device 110.
  • the memory 111 can be, but not limited to, a random access memory (RAM), a read only memory (ROM), and a programmable read-only memory (PROM). Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), and the like.
  • RAM random access memory
  • ROM read only memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read-Only Memory
  • EEPROM Electric Erasable Programmable Read-Only Memory
  • the memory 111 is configured to store a program, and the processor 113 executes the program after receiving the execution instruction.
  • the method executed by the electronic terminal 100 defined by the process disclosed in any embodiment of the present application may be applied to the processing. In the device 113, or implemented by the processor 113.
  • the processor 113 may be an integrated circuit chip with signal processing capabilities.
  • the processor 113 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP processor, etc.), or a digital signal processor (DSP), an application specific integrated circuit. (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component.
  • CPU central processing unit
  • NP processor network processor
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA Field Programmable Gate Array
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • peripheral interface 114 couples various input/input devices to the processor 113 and the memory 111.
  • peripheral interface 114, processor 113, and memory controller 112 can be implemented in a single chip. In other instances, they can be implemented by separate chips.
  • the input and output unit 115 is configured to provide input data to a user.
  • the input and output unit 115 may be, but not limited to, a mouse, a keyboard, and the like.
  • the display unit 116 provides an interactive interface (eg, a user operation interface) between the electronic terminal 100 and a user or is configured to display image data for user reference.
  • the display unit may be a liquid crystal display or a touch display.
  • a touch display it can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-touch operations. Supporting single-point and multi-touch operations means that the touch display can sense the simultaneous touch operation from one or more positions on the touch display, and the touch operation is performed by the processor. Calculation and processing.
  • FIG. 2 is a flowchart of a chat encryption method applied to the electronic terminal shown in FIG. 1 according to a preferred embodiment of the present application. The specific flow shown in FIG. 2 will be described in detail below.
  • Step S101 Search for a process flow of the chat content by the instant messaging application by dynamically debugging the process of the instant messaging application.
  • each instant messaging application version only needs to be searched once, and when the instant messaging application is started again, there is no need to further search for the packaging process point. Further, when the electronic terminal updates the version of the instant messaging application, step S101 needs to be performed again to find the packaging process point.
  • the chat process of the instant messaging application may be analyzed by disassembling, so as to find that a specific function function packages the plaintext chat content received by the electronic terminal, encrypts it, and sends it through the network programming interface. Give the chat server.
  • the process of the instant messaging application can be dynamically debugged by the dynamic debugging tool WinDbg provided by Windows to find out which function function is associated with the chat content in the instant messaging application.
  • WinDbg provided by Windows to find out which function function is associated with the chat content in the instant messaging application.
  • you can find the packaging process point of the chat content.
  • the plaintext information before the chat content is encrypted and transmitted may also be obtained here.
  • the specific implementation is as follows:
  • the encryption function found by the dynamic debugging tool WinDbg is:
  • the parameter char*pContent represents the chat content of the plaintext
  • the parameter int nLen represents the length of the chat content of the plaintext
  • the completed chat content is encrypted by the function Encrypt, and then sent to the server through the programming interface Socket.
  • the specific sending function is:
  • the parameter char*pData indicates the content to be sent, that is, the chat content after the chat content is encrypted in the above step; the parameter int nLen indicates the length of the sent content.
  • Step S102 replacing the address of the original encryption function executed after the packing process point with the address of the preset forged encryption function.
  • the forgery encryption function includes the original encryption function and a secondary encryption function.
  • step S102 only needs to be performed when the instant messaging application is launched.
  • step S102 can also be performed each time the chat content is sent.
  • the Detours library may be used to process the spoofed encryption function HOOK after the packetization process point to encrypt the chat content, so that the chat content of the plaintext can be obtained.
  • the Detours library is a set of function functions for performing HOOK on the program.
  • the chat content of the instant messaging application can be encrypted by the function Encrypt, and then the HOOK function can obtain the plaintext chat content generated by the instant messaging application.
  • the electronic terminal may pre-store or download the forged encryption function MyEncrypt function. Then replace the original encryption function Encrypt function with the fake encryption function MyEncrypt function through the Hook tool.
  • the forged encryption function MyEncrypt can be:
  • the parameter char*pContent represents the chat content of the plaintext
  • the parameter int nLen represents the length of the chat content of the plaintext
  • the original encryption function Encrypt is replaced by calling the function function of the Detours library.
  • DetourAttach indicates the function function HOOK provided by Detours library
  • parameter &(PVOID&)Encrypt indicates the function address of HOOK, which is the address of the original encryption function
  • parameter MyEncrypt indicates the function address replaced after HOOK, which is the address of the forged encryption function.
  • the secondary encryption function may implement encryption of the chat content using a symmetric encryption algorithm, and the same KEY may be used for encryption and decryption by using a symmetric encryption algorithm.
  • the secondary encryption function may be a DES encryption algorithm to secondary encrypt the chat content.
  • the secondary encryption function can be implemented in the following manner:
  • the interface DES.Encrypt is configured to provide encryption for the chat content; the parameter char*pContent indicates the encrypted content; the parameter int nLen indicates the length of the encrypted content; and the parameter char*pKEY indicates the encrypted KEY value set by the user.
  • the encrypted KEY value is also the decrypted KEY value.
  • the encrypted KEY value may be input by the user and may be automatically generated.
  • a person skilled in the art can set the manner of generating the encrypted KEY value according to requirements.
  • Step S103 performing two encryptions on the chat content to be sent by using the forged encryption function to obtain the target encrypted chat content.
  • the replaced MyEncrypt function is called without calling the original Encrypt function of the instant messaging application.
  • the forged encryption function can encrypt the chat content by using the secondary encryption function in addition to the original encryption function, thereby implementing secondary encryption of the chat content.
  • the forged encryption function can be implemented in the following manner:
  • the function DES.Encrypt is called to encrypt the chat content; then, the original encryption function Encrypt of the instant messaging application is called to encrypt the encrypted chat content.
  • the self-set encryption function is used to encrypt the chat content, and then the encrypted content is encrypted by using the original encryption function of the instant messaging application.
  • the forged encryption function can be implemented in the following manner:
  • chat content is encrypted by calling the original encryption function Encrypt of the instant messaging application; then, the encrypted content is encrypted by calling the function DES.Encrypt.
  • the recipient of the chat content does not have a pre-set decryption plug-in and then receives the encrypted chat content, the plaintext chat content that cannot be displayed.
  • the step S103 includes: step S1031 and step S1032.
  • Step S1031 Encrypt the to-be-sent chat content by using a preset encryption password as a parameter of the secondary encryption function to obtain the initial encrypted chat content.
  • Step S1032 Perform the first encryption of the initial encrypted chat content using the original encryption function in the forged encryption function to obtain the target encrypted chat content.
  • the electronic terminal may send the target encrypted chat content to the chat server, so that the chat server sends the target encrypted chat content to the corresponding receiving terminal.
  • the step S103 includes: step S1033 and step S1034.
  • Step S1033 the CreateRemoteThread function of the Windows API function is called to create an encryption thread in the process of the instant messaging application, and the encryption thread is configured to call the Windows API function LoadLibrary to load the address of the forged encryption function.
  • Step S1034 Perform the forged encryption function to perform two times encryption on the to-be-sent chat content to obtain the target encrypted chat content.
  • memory can be allocated in the memory space of the instant messaging application's memory through the WindowsAPI function VirtualAllocEx function. Again, the disk path of the forged encryption function is written to the already allocated memory by the Windows API function WriteProcessMemory. Finally, the Windows API function CreateRemoteThread function is called to create an encryption thread in the process of the instant messaging application, the encryption thread being configured to call the Windows API function LoadLibrary to load the address of the forged encryption function. In this way, a thread is opened in the target process, and a module is loaded by the thread, so that the process of the instant messaging application is injected into the forged encryption function. In this embodiment, the allocation space and the disk path in which the forged encryption function is written in the space only need to be executed once. After the execution is successful, the address of the forged encryption function can be directly loaded by starting a thread to implement encryption.
  • Step S104 After receiving the chat content, decrypt the chat content by using a forged decryption function that replaces the original decryption function.
  • the forgery decryption function is inserted and executed by dynamically debugging an instant messaging application process to find an unpacking process point of the chat content by the instant messaging application;
  • the address of the decryption function is replaced with the address of the preset forgery decryption function, and the forgery decryption function includes the original decryption function and the secondary decryption function.
  • the chat process of the instant messaging application can be analyzed by disassembling to find that a specific function receives the chat and then decrypts.
  • the process of the instant messaging application can be dynamically debugged by the dynamic debugging tool WinDbg provided by Windows to find out which function function is associated with the chat content in the instant messaging application. Through the reverse analysis and searching for chat content in memory, you can find the unpacking process point of the chat content.
  • the decryption function found by the dynamic debugging tool WinDbg is:
  • the parameter char*pContent indicates the encrypted chat content
  • the parameter int nLen indicates the length of the encrypted chat content
  • the electronic terminal displays the chat content through the chat box.
  • the original decryption function Decrypt is replaced with a forged decryption function MY Decrypt.
  • the forgery decryption function MYDecrypt can be:
  • the forgery decryption function MYDecrypt includes an original decryption function and a secondary decryption function.
  • the original decryption function of the instant messaging application is first called to decrypt the chat content.
  • the secondary decryption function DES.Decrypt is called to decrypt the decrypted content again, thereby obtaining the plaintext information of the chat content.
  • the forgery decryption function MYDecrypt can be:
  • the forgery decryption function MYDecrypt includes an original decryption function and a secondary decryption function.
  • the secondary decryption function DES.Decrypt is first called to decrypt the chat content, and then the original decryption function of the instant messaging application is called to decrypt the decrypted content again. Thereby obtaining the plaintext information of the chat content.
  • the secondary decryption function can be implemented in the following ways:
  • the interface DES.Decrypt is configured to provide decryption of the chat content; the parameter char*pContent represents the decrypted content; the parameter int nLen represents the length of the decrypted content; and the parameter char*pKEY represents the decrypted KEY value set by the user. At the same time, this decrypted KEY value is also the encrypted KEY value.
  • the chat encryption method of the embodiment of the present application It is safer to use chat content by replacing the original encryption function of the instant messaging application with a forged encryption function containing the original encryption function and the secondary encryption function to double encrypt the chat content.
  • the server can also obtain the plain text chat content through two encryptions, further ensuring that the chat content can only enable the target user to view and improve the security of the chat content.
  • the embodiment of the present application further provides a chat encryption method, which is applied to an electronic terminal, wherein the electronic terminal is installed with an instant communication application, and the degree of the instant communication application is configured to generate chat content, including the following steps.
  • Step S201 when encrypting the chat content, determining a function address of the original encryption function.
  • the electronic terminal can receive the chat content input by the user through the input module, and after the instant communication application receives the chat content input by the user, and the user determines the target user that the chat content needs to be sent, the user can input a send instruction, and the chat content is You can enter the sending process.
  • the chat content needs to be encrypted and packaged first.
  • the encrypted and packaged chat content is sent to the server, and the server then forwards the chat content to the target user according to the target user who needs to receive the information.
  • the encryption function is used to encrypt the chat content to ensure the security during the information transmission process.
  • the instant messaging application is configured with the original encryption function, and the original encryption function can be used to encrypt the chat content.
  • the original encryption function is pre-uniformly configured, its security is low, and the corresponding original decryption function is pre-configured on the server.
  • the encrypted chat content can be decrypted.
  • the chat content on the server is actually in a clear text state, and its security is very low, which easily causes leakage of chat content.
  • the original encryption function is pre-configured with a corresponding function address, and the original encryption function can be called according to the function address.
  • Step S202 determining a function address of the forged encryption function corresponding to the original encryption function.
  • the encryption of the chat content does not use the original encryption function, and the electronic terminal is pre-configured with a forged encryption function, which can be independent of the instant messaging application in the form of a plug-in. After the function address of the original encryption function is determined, the corresponding forged encryption function may be determined according to the original encryption function.
  • the forged encryption function in the embodiment of the present application is an encryption function different from the original encryption function, and the encryption key used in the forged encryption function is used.
  • the key and encryption algorithm can be predetermined, but the encryption key and encryption algorithm used by the forged encryption function are different from the original encryption function.
  • One or more forged encryption functions may be preset in the electronic terminal, and the forged encryption function corresponds to the original encryption function, and the original encryption function is determined to determine the corresponding forged encryption function. It can be understood that the forged encryption function is also configured with a corresponding function address, and the corresponding forged encryption function can be determined according to the function address of the forged encryption function.
  • Step S203 replacing a function address of the original encryption function with a function address of the forged encryption function, by calling the forged encryption function by using a function address of the forged encryption function, encrypting the chat content, and obtaining an encryption. Chat content.
  • the function address of the original encryption function is used, and the corresponding original encryption function is called.
  • the function address used in the encryption process may be replaced with the function address of the forged encryption function, such that When the encryption function is called, the original encryption function is not actually called, but the forged encryption function is called according to the replaced function address. Making excessive encryption of the chat content does not use the original encryption function, but instead uses a new forged encryption function.
  • the server that communicates with the electronic terminal only has a decryption function corresponding to the original encryption function, and since the forged encryption function is customized, the server does not have a decryption function corresponding to the forged encryption function, and the server cannot encrypt the use of forgery.
  • the encrypted content of the function is decrypted, so that the encrypted chat content is sent from the electronic terminal to the server, and then the server forwards to the electronic terminal of the target user, and the chat content is in an encrypted state, which significantly improves the information transmission process. safety.
  • the method further comprises the following steps.
  • Step S204 calling the original encryption function to perform secondary encryption on the encrypted chat content according to the function address of the original encryption function
  • Step S205 the second encrypted encrypted chat content is sent to the external terminal.
  • the encrypted content that has been encrypted may be secondarily encrypted by using the original encryption function. Even if the original encryption function is used for secondary encryption, since the chat content has been encrypted by the forgery encryption function, the server does not have the decryption function corresponding to the forged encryption function, even if the decryption function pair corresponding to the original encryption function is utilized.
  • the encrypted chat content is decrypted, and the obtained chat content is still encrypted by the forged encryption function, and the encrypted chat content cannot be further decrypted.
  • the security of the chat content delivery process is further enhanced by two encryptions.
  • the forged encryption function is pre-configured with a forged encryption algorithm and a forged encryption key, and the chat content is encrypted, and the step of obtaining the encrypted chat content includes: using the forged encryption algorithm according to the forged encryption key Encrypting the chat content to obtain the encrypted chat content.
  • the chat content of the plaintext can be converted into ciphertext according to the determined forged encryption key and the forged encryption algorithm, and the converted ciphertext is the encrypted chat content.
  • the electronic terminal is communicatively coupled to other electronic terminals, the other electronic terminal is configured with the instant messaging application, and the method further includes the following steps.
  • Step S206 Generate the forged encryption key according to a preset rule, and send the forged encryption key to the other electronic terminal.
  • the forged encryption key can be used as the Key value used in the encryption process, and the Key value can be determined according to a predetermined rule, or can be selected by the user.
  • the forged encryption algorithm is used as a function to convert plaintext into ciphertext, and the cryptographic key is used as a parameter in the calculation process of the falsified encryption algorithm.
  • the decryption function used in the decryption process may also include a decryption algorithm and a decryption key. In the embodiment of the present application, in order to improve the decryption efficiency, the decryption key may be the same as the forgery encryption key.
  • the user can inform the recipient of the specific value of the forged encryption key through other channels, such as text messages, telephone calls, etc., and the recipient can obtain the encrypted encrypted content when decrypted.
  • the value of the forged cryptographic key is decrypted as a decryption key.
  • the embodiment of the present application further provides a chat decryption method, which is applied to an electronic terminal, where the instant messaging application is installed in the electronic terminal, and the chat decryption method includes the following steps.
  • Step S301 monitoring a communication process of the instant messaging application.
  • Step S302 determining encrypted chat content received by the instant messaging application.
  • the instant messaging application is used as an interactive tool, and the user can use it to send chat content, and correspondingly, it can also receive chat content sent by other users. If the chat content is encrypted by the above encryption method. Then, you also need to use the corresponding decryption method for decryption.
  • the electronic terminal can monitor the communication process of the instant messaging application, and when receiving the encrypted chat content, determine the specific form of the encrypted chat content.
  • Step S303 determining an original decryption function corresponding to the encrypted chat content.
  • the original decryption function corresponding to the encrypted chat content can be determined first.
  • the original function address of the original decryption function corresponding to the encrypted chat content may be determined before the instant messaging application decrypts the encrypted chat content. Determining an original decryption function corresponding to the encrypted chat content according to the original function address.
  • Step S304 determining a forgery decryption function corresponding to the original decryption function.
  • the correspondence between the forgery decryption function and the original decryption function may be pre-established, and the corresponding forgery decryption function may be determined according to the correspondence relationship.
  • Step S305 decrypting the encrypted chat content by using the forged decryption function to obtain the decrypted chat content.
  • the instant messaging application decrypts the encrypted chat
  • the original function address is replaced with the forged function address.
  • a corresponding forgery decryption function is called according to the forged function address.
  • the encrypted chat content is decrypted using the forged decryption function.
  • the forgery decryption function includes a forged decryption key and a forgery decryption algorithm.
  • the forged encryption key corresponding to the encrypted chat content may be obtained first.
  • a forged decryption key corresponding to the forged encryption key is then determined.
  • the forged decryption algorithm is invoked to decrypt the encrypted chat content.
  • the forgery decryption key may be the same as the forgery encryption key, and the sender of the chat content may inform the recipient of the used forged encryption key in advance, and obtain the forged encryption key when decrypting the encrypted chat content.
  • the parameters can be used as a forgery decryption key and used during the decryption process to decrypt correctly.
  • the encrypted chat content is encrypted by a forged encryption function and then encrypted by a first encryption function, where the first encryption function is pre-configured with a corresponding first decryption function, and the forged decryption is utilized.
  • the method further comprises the following steps.
  • Step S306 calling the first decryption function to decrypt the encrypted chat content for the first time.
  • the first encryption function may be the original encryption function or other predetermined functions.
  • the instant messaging application is pre-configured with the first encryption function and the corresponding first decryption function.
  • the first decryption function may adopt an original decryption function, which is pre-configured by the instant messaging application.
  • the encrypted chat content is encrypted twice, correspondingly, it must be decrypted twice to get the plain text of the chat content. If the encrypted chat content is first encrypted with a forged encryption function and then encrypted with the original encryption function, when decrypting, it is first decrypted using the original decryption function, and then decrypted using the forged decryption function. If the encrypted chat content is first encrypted with the original encryption function and then double-encrypted using the forged encryption function, when decrypting, it can be decrypted first using the forged decryption function, and then decrypted using the original decryption function.
  • the original decryption function when decrypting the encrypted chat content, the original decryption function can be replaced by the forgery decryption function. Since the forgery decryption function is independent of the instant messaging application, the server does not have the forgery decryption function, and thus cannot Decrypt the encrypted chat content.
  • the chat content is always in the encrypted state, not the plaintext state, which significantly improves the security of information transmission.
  • the embodiment of the present application further provides a chat encryption device, which is applied to an electronic terminal, where the instant messaging application is installed, and the instant communication application level is configured to generate chat content, including:
  • a first processing module configured to determine a function address of the original encryption function when encrypting the chat content
  • a first processing module configured to determine a function address of the forged encryption function corresponding to the original encryption function
  • An encryption module configured to replace a function address of the original encryption function with a function address of the forged encryption function, to invoke the forged encryption function by using a function address of the forged encryption function, to encrypt the chat content, Get encrypted chat content.
  • the embodiment of the present application further provides a chat decryption device, which is applied to an electronic terminal, wherein the electronic terminal is installed with an instant communication application, and the chat decryption device includes:
  • a monitoring module configured to monitor a communication process of the instant messaging application
  • a content determining module configured to determine encrypted chat content received by the instant messaging application
  • a first determining module configured to determine an original decryption function corresponding to the encrypted chat content
  • a second determining module configured to determine a forged decryption function corresponding to the original decryption function
  • the decryption module is configured to decrypt the encrypted chat content by using the forged decryption function to obtain the decrypted chat content.
  • FIG. 6 is a functional block diagram of the chat encryption apparatus 110 shown in FIG. 1 according to a preferred embodiment of the present application.
  • the modules and units in the chat encryption apparatus 110 in this embodiment are configured to perform the steps in the above method embodiments.
  • the chat encryption device 110 includes a lookup module 1101, a replacement module 1102, and an encryption module 1103.
  • the searching module 1101 is configured to search for a process flow of the chat content by the instant messaging application by dynamically debugging a process of the instant messaging application.
  • the replacement module 1102 is configured to replace an address of the original encryption function executed after the packing process point with an address of a preset forged encryption function, where the forged encryption function includes the original encryption function and a secondary encryption function.
  • the encryption module 1103 is configured to perform two times of encrypting the chat content to be sent by using the forged encryption function to obtain the target encrypted chat content.
  • the encryption module 1103 is configured to encrypt the to-be-sent chat content by using a preset encryption password as a parameter of the secondary encryption function to obtain the initial encrypted chat content;
  • the original encryption function in the forged encryption function performs the first encryption on the initial encrypted chat content to obtain the target encrypted chat content.
  • the encryption module 1103 includes a thread creation unit 11031 and an encryption execution unit 11032.
  • the thread creation unit 11031 is configured to call a CreateRemoteThread function of the Windows API function to create an encryption thread in the process of the instant messaging application, the encryption thread configured to call the Windows API function LoadLibrary to load the address of the forged encryption function.
  • the encryption execution unit 11032 is configured to execute the forged encryption function to perform encryption on the to-be-sent chat content to obtain the target encrypted chat content.
  • the chat encryption apparatus 110 further includes: a decryption module 1104, configured to: after receiving the chat content, decrypt the chat content by using a forged decryption function that replaces the original decryption function .
  • the forgery decryption function is inserted and executed by dynamically debugging an instant messaging application process to find an unpacking process point of the chat content by the instant messaging application;
  • the address of the decryption function is replaced with the address of the preset forgery decryption function, and the forgery decryption function includes the original decryption function and the secondary decryption function.
  • the chat encryption device of the embodiment of the present application It is safer to use chat content by replacing the original encryption function of the instant messaging application with a forged encryption function containing the original encryption function and the secondary encryption function to double encrypt the chat content.
  • the server can also obtain the plain text chat content through two encryptions, further ensuring that the chat content can only enable the target user to view and improve the security of the chat content.
  • the embodiment of the present application provides a readable storage medium, on which a computer program is stored, and the computer program implements the chat encryption method provided by the foregoing embodiment when executed.
  • each block of the flowchart or block diagram can represent a module, a program segment, or a portion of code that comprises one or more of the Executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may also occur in a different order than those illustrated in the drawings.
  • each block of the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented in a dedicated hardware-based system that performs the specified function or function. Or it can be implemented by a combination of dedicated hardware and computer instructions.
  • each functional module in each embodiment of the present application may be integrated to form a separate part, or each module may exist separately, or two or more modules may be integrated to form a separate part.
  • the functions, if implemented in the form of software functional modules and sold or used as separate products, may be stored in a computer readable storage medium.
  • the technical solution of the present application which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
  • the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present application.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
  • the present disclosure provides a chat encryption method, a chat decryption method, a device, an electronic terminal, and a readable storage medium, which can implement encryption of a chat content using a forged encryption function, so that the chat content is always in an encrypted state during transmission, and does not It is decrypted by the server to avoid information leakage during the process of chatting content and improve the security of confidence transmission.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Storage Device Security (AREA)

Abstract

本申请实施例提供一种聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质。所述聊天加密方法包括:通过动态调试即时通信应用程序的进程,查找所述即时通信应用程序对聊天内容的打包流程点;将该打包流程点后执行的原始加密函数的地址替换为预设的伪造加密函数的地址,所述伪造加密函数包括所述原始加密函数及二次加密函数;使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标加密聊天内容。

Description

聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质
相关申请的交叉引用
本申请要求于2018年01月02日提交中国专利局的申请号为2018100012577,名称为“聊天加密方法、装置、电子终端及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体而言,涉及一种聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质。
背景技术
目前,即时通信应用程序已经覆盖了大部分的上网用户。不管是哪种聊天服务器都会进行聊天内容的中转与保存,也就是说,聊天服务器可以获取到所有的聊天内容。虽然聊天内容聊天软件都会进行加密传输,但是由于电子终端使用的加密方式是即时通信应用程序携带的加密方式,服务器中存储有对应的解密方式,因此聊天服务器可以对聊天内容进行解密。因此聊天服务器总是可以获取到明文的聊天内容。然而一些保密要求更高的用户可能会希望即使是聊天服务器也没办法获取到明文的聊天内容。
发明内容
有鉴于此,本申请实施例的目的包括提供一种聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质。
本申请实施例提供的一种聊天加密方法,应用于电子终端,所述电子终端与服务器通信连接,所述电子终端中安装有即时通信应用程序,所述聊天加密方法包括:
通过动态调试即时通信应用程序的进程,查找所述即时通信应用程序对聊天内容的打包流程点;
将该打包流程点后执行的原始加密函数的地址替换为预设的伪造加密函数的地址,所述伪造加密函数包括所述原始加密函数及二次加密函数;
使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标加密聊天内容。
本申请实施例还提供一种聊天加密装置,应用于电子终端,所述电子终端与服务器通信连接,所述电子终端中安装有即时通信应用程序,所述聊天加密装置包括:
查找模块,配置成通过动态调试即时通信应用程序的进程,查找所述即时通信应用程序对聊天内容的打包流程点;
替换模块,配置成将该打包流程点后执行的原始加密函数的地址替换为预设的伪造加密函数的地址,所述伪造加密函数包括所述原始加密函数及二次加密函数;
加密模块,配置成使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标 加密聊天内容。
本申请实施例还提供一一种聊天加密方法,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述即时通信应用程度配置成生成聊天内容,包括:
在对所述聊天内容进行加密时,确定原始加密函数的函数地址;
确定与所述原始加密函数对应的伪造加密函数的函数地址;
将所述原始加密函数的函数地址替换为所述伪造加密函数的函数地址,以通过所述伪造加密函数的函数地址调用所述伪造加密函数,对所述聊天内容进行加密,得到加密聊天内容。
本申请实施例还提供一一种聊天解密方法,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天解密方法包括:
监视所述即时通信应用程序的通信过程;
确定所述即时通信应用程序接收到的加密聊天内容;
确定与所述加密聊天内容对应的原始解密函数;
确定与所述原始解密函数对应的伪造解密函数;
利用所述伪造解密函数对所述加密聊天内容进行解密,得到解密后的聊天内容。本申请实施例还提供一种聊天加密装置,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述即时通信应用程度配置成生成聊天内容,包括:
第一处理模块,配置成在对所述聊天内容进行加密时,确定原始加密函数的函数地址;
第一处理模块,配置成确定与所述原始加密函数对应的伪造加密函数的函数地址;
加密模块,配置成将所述原始加密函数的函数地址替换为所述伪造加密函数的函数地址,以通过所述伪造加密函数的函数地址调用所述伪造加密函数,对所述聊天内容进行加密,得到加密聊天内容。
本申请实施例还提供一种聊天解密装置,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天解密装置包括:
监听模块,配置成监视所述即时通信应用程序的通信过程;
内容确定模块,配置成确定所述即时通信应用程序接收到的加密聊天内容;
第一确定模块,配置成确定与所述加密聊天内容对应的原始解密函数;
第二确定模块,配置成确定与所述原始解密函数对应的伪造解密函数;
解密模块,配置成利用所述伪造解密函数对所述加密聊天内容进行解密,得到解密后的聊天内容。
本申请实施例还提供一种电子终端,包括:
存储器;
处理器;
上述的聊天加密装置,该实时动画显示装置存储于所述存储器并由所述处理器控制执行。
本申请实施例还提供一种可读存储介质,其上存储有计算机程序,所述计算机程序在执行时实现上述的聊天加密方法。
与现有技术相比,本申请实施例的聊天加密方法、装置、电子终端及可读存储介质。通过将即时通信应用程序的原始加密函数替换为有包含有原始加密函数及二次加密函数的伪造加密函数,以对聊天内容进行双重加密可以使用聊天内容更加安全。另外,通过两次加密可以使服务器也不能获取明文的聊天内容,进一步地确保了聊天内容可以仅仅能够使目标用户可以查看,提高聊天内容的安全性。
为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。
图1为本申请较佳实施例提供的电子终端的方框示意图。
图2为本申请较佳实施例提供的聊天加密方法的流程图。
图3为本申请较佳实施例提供的聊天加密方法的步骤S103的详细流程图。
图4为本申请较佳实施例提供的聊天加密方法的步骤S103的另一详细流程图。
图5为本申请另一较佳实施例提供的聊天加密方法的流程图。
图6为本申请较佳实施例提供的聊天加密装置的功能模块示意图。
图7为本申请较佳实施例提供的聊天加密装置的加密模块的详细模块示意图。
具体实施方式
下面将结合本申请实施例中附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。同时,在本申请的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
如图1所示,是所述电子终端100的方框示意图。所述电子终端100包括聊天加密装置110、存储器111、存储控制器112、处理器113、外设接口114、输入输出单元115、显示单元116。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对电子终端100的结构造成限定。例如,电子终端100还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。
本实施例中,所述电子终端100中安装有即时通信应用程序。所述即时通信应用程序配置成接收或发送聊天内容。所述电子终端100可以与一聊天服务器通信连接,以进行数据通信或交互。所述电子终端100可以向所述聊天服务器发送聊天内容,所述电子终端100还可以接收所述聊天服务器发送的聊天内容。
所述存储器111、存储控制器112、处理器113、外设接口114、输入输出单元115及显示单元116各元件相互之间直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条或多条通讯总线或信号线实现电性连接。所述聊天加密装置110包括至少一个可以软件或固件(Firmware)的形式存储于所述存储器111中或固化在所述电子终端100的操作系统(Operating System,OS)中的软件功能模块。所述处理器113配置成执行存储器中存储的可执行模块,例如所述聊天加密装置110包括的软件功能模块或计算机程序。
其中,所述存储器111可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。其中,存储器111配置成存储程序,所述处理器113在接收到执行指令后,执行所述程序,本申请实施例任一实施例揭示的过程定义的电子终端100所执行的方法可以应用于处理器113中,或者由处理器113实现。
所述处理器113可能是一种集成电路芯片,具有信号的处理能力。上述的处理器113可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述外设接口114将各种输入/输入装置耦合至处理器113以及存储器111。在一些实施例中,外设接口114,处理器113以及存储控制器112可以在单个芯片中实现。在其他一些实例中,他们可以分别由独立的芯片实现。
所述输入输出单元115配置成提供给用户输入数据。所述输入输出单元115可以是,但不限于,鼠标和键盘等。
所述显示单元116在所述电子终端100与用户之间提供一个交互界面(例如用户操作界面)或配置成显示图像数据给用户参考。在本实施例中,所述显示单元可以是液晶显示器或触控显示器。若为触控显示器,其可为支持单点和多点触控操作的电容式触控屏或电阻式触控屏等。支持单点和多点触控操作是指触控显示器能感应到来自该触控显示器上一个或多个位置处同时产生的触控操作,并将该感应到的触控操作交由处理器进行计算和处理。
请参阅图2,是本申请较佳实施例提供的应用于图1所示的电子终端的聊天加密方法的流程图。下面将对图2所示的具体流程进行详细阐述。
步骤S101,通过动态调试即时通信应用程序的进程,查找所述即时通信应用程序对聊天内容的打包流程点。
本实施例中,每个即时通信应用程序版本仅需要查找一次,再次启动使用即时通信应用程序时,不需要进一步地查找所述打包流程点。进一步地,当所述电子终端更新了所述即时通信应用程序的版本时,需要再次执行步骤S101以查找所述打包流程点。
在一种实施方式中,可以通过反汇编分析所述即时通信应用程序的聊天进程,以查找到具体的某功能函数会将电子终端接收到的明文聊天内容打包后进行加密再通过网络编程接口发送给聊天服务器。
在一个实例中,可以通过Windows提供的动态调试工具WinDbg动态调试所述即时通信应用程序的进程,以查找所述即时通信应用程序中是哪个功能函数和聊天内容相关。通过逆向分析以及在内存中搜索聊天内容可以查找到聊天内容的打包流程点。进一步地,在此处也可以获取到聊天内容被加密发送前的明文信息。具体实现如下:
例如,通过动态调试工具WinDbg找到的加密函数是:
Int Encrypt(char*pContent,int nLen);
其中,参数char*pContent表示明文的聊天内容;参数int nLen表示明文的聊天内容的长度。
通过函数Encrypt加密完成后的聊天内容,再通过编程接口Socket发送给服务器,具体发送函数是:
Void SendData(char*pData,int nLen);
其中,参数char*pData表示发送的内容,即是上面步骤聊天内容加密后的聊天内容;参数int nLen表示发送的内容的长度。
步骤S102,将该打包流程点后执行的原始加密函数的地址替换为预设的伪造加密函数的地址。
本实施例中,所述伪造加密函数包括所述原始加密函数及二次加密函数。
在一种实施方式中,所述步骤S102仅需要在启动所述即时通信应用程序时执行。当然,在其它实施方式中,步骤S102也可以在每次发送聊天内容时执行。
在一个实例中,可以使用Detours库将所述伪造加密函数HOOK在所述打包流程点后的将聊天内容进行加密发送的流程点,从而可以获取明文的聊天内容。其中,所述Detours库是一套函数功能库,用于对程序进行HOOK。
首先,在一个实例中,所述即时通信应用程序的聊天内容可以通过函数Encrypt进行加密,那么通过HOOK此函数则可以获取到所述即时通信应用程序产生的明文聊天内容。
首先,所述电子终端可预先存储或下载伪造加密函数MyEncrypt函数。再通过Hook工具将原始加密函数Encrypt函数替换成伪造加密函数MyEncrypt函数。
具体实现如下:
所述伪造加密函数MyEncrypt可以是:
Int MyEncrypt(char*pContent,int nLen);
其中,参数char*pContent表示明文的聊天内容;参数int nLen表示明文的聊天内容的长度。
本实例中,通过调用Detours库的功能函数对原始加密函数Encrypt进行替换。
DetourAttach(&(PVOID&)Encrypt,MyEncrypt);
其中,DetourAttach表示Detours库提供的功能函数HOOK;参数&(PVOID&)Encrypt表示需要HOOK的函数地址,也就是原始加密函数的地址;参数MyEncrypt表示HOOK后替换的函数地址,也就是伪造加密函数的地址。
在一种实施方式中,所述二次加密函数是可以使用对称加密算法实现对聊天内容的加密,通过使用对称加密算法可以加密和解密使用同样的KEY。
在一个实例中,所述二次加密函数可以是DES加密算法来对聊天内容进行二次加密。所述二次加密函数可以通过以下方式实现:
Void DES.Encrypt(char*pContent,int nLen,char*pKEY);
其中,接口DES.Encrypt,配置成提供对聊天内容进行加密;参数char*pContent表示加密的内容;参数int nLen表示加密的内容的长度;参数char*pKEY表示用户设置的加密的KEY值。本实例中,此加密KEY值也是解密的KEY值。
本实施例中,加密的KEY值可以是由用户输入的,可以是自动生成的。本领域的技术人员可以根据需求设置所述加密的KEY值的生成方式。
步骤S103,使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标加密聊天内容。
本实施例中的替换操作后,所述即时通信应用程序对聊天内容进行加密时,会调用替换后的MyEncrypt函数而不会调用即时通信应用程序的原始的Encrypt函数。
本实施例中,所述伪造加密函数除了可以使用原始加密函数进行加密还能使用二次加密函数对聊天内容进行加密,从而实现对聊天内容进行二次加密。
在一个实例中,所述伪造加密函数可以通过以下方式实现:
Figure PCTCN2018081391-appb-000001
首先,调用函数DES.Encrypt对聊天内容进行加密;然后,调用即时通信应用程序的原始加密函数Encrypt加密上述加密后的聊天内容。
从而实现了在即时通信应用程序进行加密前,先使用了自设置的加密函数对聊天内容进行加密,加密后再将加密的内容使用即时通信应用程序的原始加密函数进行加密。
在另一个实例中,所述伪造加密函数可以通过以下方式实现:
Figure PCTCN2018081391-appb-000002
首先,调用即时通信应用程序的原始加密函数Encrypt对聊天内容进行加密;然后,调用函数DES.Encrypt对加密后的聊天内容进行加密。
因此,如果聊天内容的接收方没有预先设置的解密插件则收到的也是加密后的聊天内容,则不能够显示的明文聊天内容。
本实施例中,如图3所示,所述步骤S103包括:步骤S1031及步骤S1032。
步骤S1031,将预设的加密密码作为所述二次加密函数的参数对所述待发送的聊天内容进行加密以得到所述初始加密聊天内容。
步骤S1032,使用所述伪造加密函数中的原始加密函数对所述初始加密聊天内容进行 第一次加密得到目标加密聊天内容。
进一步地,所述电子终端可以将所述目标加密聊天内容发送给聊天服务器,以使聊天服务器将所述目标加密聊天内容发送给对应的接收终端。
本实施例中,如图4所示,所述步骤S103包括:步骤S1033及步骤S1034。
步骤S1033,调用WindowsAPI函数的CreateRemoteThread函数在所述即时通信应用程序的进程中创建一个加密线程,所述加密线程配置成调用WindowsAPI函数LoadLibrary加载所述伪造加密函数的地址。
步骤S1034,执行所述伪造加密函数以对所述待发送的聊天内容进行两次加密得到所述目标加密聊天内容。
在一个实例中,首先,可以通过WindowsAPI函数VirtualAllocEx函数在即时通信应用程序的进程的内存空间中分配内存。再次,通过WindowsAPI函数WriteProcessMemory来将所述伪造加密函数的磁盘路径写入到已经分配的内存中。最后,调用WindowsAPI函数CreateRemoteThread函数来在即时通信应用程序的进程中创建一个加密线程,所述加密线程配置成调用WindowsAPI函数LoadLibrary加载所述伪造加密函数的地址。这样就实现了在目标进程开启一个线程,通过线程来加载一个模块,实现了在即时通信应用程序的进程注入所述伪造加密函数。本实施例中,分配空间和在空间中写入伪造加密函数的磁盘路径仅需要执行一次,执行成功后,则可以直接通过启动一线程来实现加载所述伪造加密函数的地址,以实现加密。
如图5所示,所述方法还包括:步骤S104,接收到聊天内容后,使用替换原始解密函数的伪造解密函数对所述聊天内容进行解密后显示。
本实施例中,所述伪造解密函数通过以下方式插入执行:通过动态调试即时通信应用程序进程,以查找即时通信应用程序对聊天内容的解包流程点;将该解包流程点后执行的原始解密函数的地址替换为预设的伪造解密函数的地址,所述伪造解密函数包括所述原始解密函数及二次解密函数。
在一种实施方式中,可以通过去反汇编分析所述即时通信应用程序的聊天进程,以查找到具体的某功能函数会接收聊天,然后进行解密。
在一个实例中,可以通过Windows提供的动态调试工具WinDbg动态调试所述即时通信应用程序的进程,以查找所述即时通信应用程序中是哪个功能函数和聊天内容相关。通过逆向分析以及在内存中搜索聊天内容则可以查找到聊天内容的解包流程点。
例如,通过动态调试工具WinDbg找到的解密函数是:
Int Decrypt(char*pContent,int nLen);
其中,参数char*pContent表示加密的聊天内容;参数int nLen表示加密的聊天内容的 长度。
解密完成后,所述电子终端会通过聊天框显示聊天内容。
本实施例中的方法,将所述原始解密函数Decrypt替换为伪造解密函数MY Decrypt。
在一个实例中,所述伪造解密函数MYDecrypt可以是:
Figure PCTCN2018081391-appb-000003
所述伪造解密函数MYDecrypt包括原始解密函数和二次解密函数。本实例中,首先调用即时通信应用程序的原始解密函数来对聊天内容进行解密。然后再调用二次解密函数DES.Decrypt对上述解密的内容再次解密,从而得到聊天内容的明文信息。
在另一个实例中,所述伪造解密函数MYDecrypt可以是:
Figure PCTCN2018081391-appb-000004
所述伪造解密函数MYDecrypt包括原始解密函数和二次解密函数。本实例中,首先调用二次解密函数DES.Decrypt对聊天内容进行解密,然后再调用即时通信应用程序的原始解密函数对上述解密的内容再次解密。从而得到聊天内容的明文信息。
在一个实例中,二次解密函数可以通过以下方式实现:
Void DES.Decrypt(char*pContent,int nLen,char*pKEY);
其中,接口DES.Decrypt配置成提供对聊天内容进行解密;参数char*pContent表示解密的内容;参数int nLen表示解密的内容的长度;参数char*pKEY表示用户设置的解密的KEY值。同时此解密KEY值也是加密的KEY值。
本申请实施例的聊天加密方法。通过将即时通信应用程序的原始加密函数替换为有包含有原始加密函数及二次加密函数的伪造加密函数,以对聊天内容进行双重加密可以使用聊天内容更加安全。另外,通过两次加密可以使服务器也不能获取明文的聊天内容,进一步地确保了聊天内容可以仅仅能够使目标用户可以查看,提高聊天内容的安全性。
本申请实施例还提供了一种聊天加密方法,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述即时通信应用程度配置成生成聊天内容,包括以下步骤。
步骤S201,在对所述聊天内容进行加密时,确定原始加密函数的函数地址。
电子终端可以通过输入模块接收用户输入的聊天内容,即时通信应用程序在接收到用户输入的聊天内容后,且用户确定了该聊天内容需要发送的目标用户后,用户可以输入发送指令,聊天内容就可以进入发送流程。聊天内容在发送过程中,需要先进行加密、打包等流程。加密打包后的聊天内容会发送到服务器,服务器再根据需要接收信息的目标用户,将聊天内容再转发至目标用户。在加密过程中,需要使用加密函数对聊天内容进行加密,以保证信息传递过程中的安全性。即时通信应用程序中会配置有原始加密函数,可以使用原始加密函数对聊天内容进行加密,但原始加密函数由于是预先统一配置,其安全性较低,服务器上预先配置有对应的原始解密函数,可以对加密后的聊天内容进行解密。使得服务器上的聊天内容实际上是处于明文状态的,其安全性很低,很容易造成聊天内容的泄露。
在本申请实施例中,原始加密函数预先配置有对应的函数地址,根据该函数地址可以调用原始加密函数。在对聊天内容进行加密时,可以先确定需要使用的原始加密函数的函数地址。
步骤S202,确定与所述原始加密函数对应的伪造加密函数的函数地址。
在本申请实施例中,为了提高信息传递过程中的安全性。聊天内容的加密不使用原始加密函数,电子终端中预先配置有伪造加密函数,该伪造加密函数可以以插件的形式独立于即时通信应用程序。在确定了原始加密函数的函数地址后,可以根据原始加密函数确定对应的伪造加密函数,本申请实施例中的伪造加密函数是不同于原始加密函数的加密函数,伪造加密函数中使用的加密密钥和加密算法可以预先确定,但伪造加密函数使用的加密密钥和加密算法都是不同于原始加密函数的。电子终端中可以预先设置一个或多个伪造加密函数,伪造加密函数与原始加密函数相对应,确定了原始加密函数即可确定对应的伪造加密函数。可以理解的是,伪造加密函数也配置有对应的函数地址,根据伪造加密函数的函数地址可以确定对应的伪造加密函数。
步骤S203,将所述原始加密函数的函数地址替换为所述伪造加密函数的函数地址,以通过所述伪造加密函数的函数地址调用所述伪造加密函数,对所述聊天内容进行加密,得到加密聊天内容。
在使用原始加密函数对聊天内容进行加密过程中,会使用原始加密函数的函数地址,调用对应的原始加密函数。在本申请实施例中,在确定了原始加密函数的函数地址,并确定了对应的伪造加密函数的函数地址后,就可以将加密过程中使用的函数地址替换为伪造加密函数的函数地址,这样在进行加密函数的调用时,实际上就没有调用原始加密函数,而是根据替换后的函数地址调用了伪造加密函数。使得对聊天内容 过多加密没有使用原始加密函数,而是使用了新的伪造加密函数。与电子终端通信连接的服务器中仅仅具有与原始加密函数对应的解密函数,而由于伪造加密函数是自定义的,服务器中并没有与伪造加密函数对应的解密函数,服务器也就不能对使用伪造加密函数加密后的聊天内容进行解密,使得加密聊天内容从电子终端发送至服务器,再由服务器转发至目标用户的电子终端过程中,聊天内容都是处于加密状态的,显著提高了信息传递过程中的安全性。
在一种具体实施方式中,该方法还包括以下步骤。
步骤S204,根据所述原始加密函数的函数地址,调用所述原始加密函数对所述加密聊天内容进行二次加密;
步骤S205,将二次加密后的加密聊天内容发送至外部终端。
在本申请实施例中,在使用伪造加密函数对聊天内容进行加密后,为了进一步的提高信息传递过程中的安全性,还可以再使用原始加密函数对已经加密的聊天内容进行二次加密。即使采用了原始加密函数进行二次加密,由于聊天内容已经经过了伪造加密函数的加密,服务器在不具备与伪造加密函数对应的解密函数的前提下,即使利用与原始加密函数对应的解密函数对加密聊天内容进行了解密,得到的仍然是经过了伪造加密函数加密的聊天内容,也无法对加密聊天内容进行进一步的解密。通过两次加密,进一步增强聊天内容传递过程中的安全性。
详细的,所述伪造加密函数预先配置有伪造加密算法和伪造加密密钥,对所述聊天内容进行加密,得到加密聊天内容的步骤包括:根据所述伪造加密密钥,利用所述伪造加密算法对所述聊天内容进行加密,得到所述加密聊天内容。
加密过程中,可以根据确定的伪造加密密钥结合伪造加密算法将明文的聊天内容转换为密文,转换得到的密文即为加密聊天内容。
在另一种具体实施方式中,所述电子终端与其他电子终端通信连接,所述其他电子终端配置有所述即时通信应用程序,该方法还包括以下步骤。
步骤S206,根据预设规则生成所述伪造加密密钥,将所述伪造加密密钥发送至所述其他电子终端。
详细的,伪造加密密钥可以作为加密过程中使用的Key值,该Key值可以根据预先规则确定,也可以用户自行选择。伪造加密算法作为把明文转换成密文的函数,伪造加密密钥作为伪造加密算法计算过程中的参数。解密过程中使用的解密函数也可以包括解密算法和解密密钥,在本申请实施例中,为了提高解密效率,解密密钥可以与伪造加密密钥相同。用户在使用即时聊天应用程序时,可以通过其他渠道,例如短信、电话等方式,将伪造加密密钥的具体数值告知接受者,接收者在对接收到的加密聊天 内容进行解密时,可以将获取到的伪造加密密钥的数值作为解密密钥进行解密。
本申请实施例还提供了一种聊天解密方法,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天解密方法包括以下步骤。
步骤S301,监视所述即时通信应用程序的通信过程。
步骤S302,确定所述即时通信应用程序接收到的加密聊天内容。
即时通信应用程序作为交互工具,用户可以使用其发送聊天内容,相应的,也可以通过其接收到其他用户发送的聊天内容。如果聊天内容是经过上述加密方法进行加密的。那么,也需要使用对应的解密方法进行解密。在本申请实施例中,电子终端可以监视即时通信应用程序的通信过程,在接受到加密聊天内容时,确定该加密聊天内容具体形式。
步骤S303,确定与所述加密聊天内容对应的原始解密函数。
如果加密聊天内容是使用了伪造加密函数加密,而没有使用原始加密函数加密的话,使用原始解密函数就不能进行正常的解密。可以先确定加密聊天内容对应的原始解密函数。
详细的,可以在所述即时通信应用程序对所述加密聊天内容进行解密前,确定与所述加密聊天内容对应的原始解密函数的原始函数地址。根据所述原始函数地址确定所述加密聊天内容对应的原始解密函数。
步骤S304,确定与所述原始解密函数对应的伪造解密函数。
伪造解密函数与所述原始解密函数的对应关系可以是预先建立的,根据对应关系可以确定对应的伪造解密函数。
步骤S305,利用所述伪造解密函数对所述加密聊天内容进行解密,得到解密后的聊天内容。
详细的,在所述即时通信应用程序对所述加密聊天进行解密时,将所述原始函数地址替换为所述伪造函数地址。根据所述伪造函数地址调用对应的伪造解密函数。利用所述伪造解密函数对所述加密聊天内容进行解密。
通过函数地址的替换,在解密过程中,在进行解密函数的调用时,就不会调用到原始解密函数,而是会根据替换后的地址调用伪造解密函数。使用伪造解密函数对加密聊天内容进行解密。
所述伪造解密函数包括伪造解密密钥和伪造解密算法,详细的,在进行解密时,可以先获得与所述加密聊天内容对应的伪造加密密钥。再确定与所述伪造加密密钥对应的伪造解密密钥。再利用所述伪造解密密钥,调用所述伪造解密算法对所述加密聊天内容进行解密。
如前所述,伪造解密密钥可以与伪造加密密钥相同,聊天内容的发送者可以预先将使用的伪造加密密钥告知接收者,在对加密聊天内容进行解密时,获得的伪造加密密钥的参数就可以作为伪造解密密钥,在解密过程中使用,以正确进行解密。
在另一种具体实施方式中,所述加密聊天内容通过伪造加密函数加密后再通过第一加密函数加密,所述第一加密函数预先配置有对应的第一解密函数,在利用所述伪造解密函数对所述加密聊天内容进行解密的步骤之前,该方法还包括以下步骤。
步骤S306,调用第一解密函数对所述加密聊天内容第一次解密。
第一加密函数可以是原始加密函数,也可以是预先确定的其他函数。即时通信应用程序会预先配置有该第一加密函数和对应的第一解密函数。相应的,在第一加密函数采用原始加密函数时,第一解密函数可以采用原始解密函数,该原始解密函数是即时通信应用程序预先配置的。、
如果加密聊天内容是经过了两次加密的,相应的,也必须进过两次解密,才能得到聊天内容的明文。如果加密聊天内容是先用伪造加密函数加密,再使用原始加密函数二次加密,在解密时,就需要先使用原始解密函数解密,再使用伪造解密函数二次解密。如果加密聊天内容是先用原始加密函数加密,再使用伪造加密函数二次加密,在解密时,就可以先使用伪造解密函数解密,再使用原始解密函数二次解密。
通过上述聊天解密方法,在对加密聊天内容进行解密时,可以使用伪造解密函数替换掉原始解密函数,由于伪造解密函数是独立于即时通信应用程序的,服务器并不具备伪造解密函数,也就无法对加密聊天内容进行解密。使得聊天内容在传递过程中,是始终处于加密状态,而不是明文状态,显著提高信息传递的安全性。
本申请实施例还提供了一种聊天加密装置,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述即时通信应用程度配置成生成聊天内容,包括:
第一处理模块,配置成在对所述聊天内容进行加密时,确定原始加密函数的函数地址;
第一处理模块,配置成确定与所述原始加密函数对应的伪造加密函数的函数地址;
加密模块,配置成将所述原始加密函数的函数地址替换为所述伪造加密函数的函数地址,以通过所述伪造加密函数的函数地址调用所述伪造加密函数,对所述聊天内容进行加密,得到加密聊天内容。
本申请实施例还提供了一种聊天解密装置,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天解密装置包括:
监听模块,配置成监视所述即时通信应用程序的通信过程;
内容确定模块,配置成确定所述即时通信应用程序接收到的加密聊天内容;
第一确定模块,配置成确定与所述加密聊天内容对应的原始解密函数;
第二确定模块,配置成确定与所述原始解密函数对应的伪造解密函数;
解密模块,配置成利用所述伪造解密函数对所述加密聊天内容进行解密,得到解密后的聊天内容。
请参阅图6,是本申请较佳实施例提供的图1所示的聊天加密装置110的功能模块示意图。本实施例中的聊天加密装置110中的各个模块及单元配置成执行上述方法实施例中的各个步骤。所述聊天加密装置110包括:查找模块1101、替换模块1102以及加密模块1103。
所述查找模块1101,配置成通过动态调试即时通信应用程序的进程,查找所述即时通信应用程序对聊天内容的打包流程点。
所述替换模块1102,配置成将该打包流程点后执行的原始加密函数的地址替换为预设的伪造加密函数的地址,所述伪造加密函数包括所述原始加密函数及二次加密函数。
所述加密模块1103,配置成使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标加密聊天内容。
本实施例中,所述加密模块1103配置成将预设的加密密码作为所述二次加密函数的参数对所述待发送的聊天内容进行加密以得到所述初始加密聊天内容;还配置成使用所述伪造加密函数中的原始加密函数对所述初始加密聊天内容进行第一次加密得到目标加密聊天内容。
本实施例中,如图7所示,所述加密模块1103包括:线程创建单元11031及加密执行单元11032。
所述线程创建单元11031,配置成调用WindowsAPI函数的CreateRemoteThread函数在所述即时通信应用程序的进程中创建一个加密线程,所述加密线程配置成调用WindowsAPI函数LoadLibrary加载所述伪造加密函数的地址。
所述加密执行单元11032,配置成执行所述伪造加密函数以对所述待发送的聊天内容进行两次加密得到所述目标加密聊天内容。
本实施例中,请再次参阅图6,所述聊天加密装置110还包括:解密模块1104,配置成接收到聊天内容后,使用替换原始解密函数的伪造解密函数对所述聊天内容进行解密后显示。
本实施例中,所述伪造解密函数通过以下方式插入执行:通过动态调试即时通信应用程序进程,以查找即时通信应用程序对聊天内容的解包流程点;将该解包流程点后执行的原始解密函数的地址替换为预设的伪造解密函数的地址,所述伪造解密函数包括所述原始解密函数及二次解密函数。
关于本实施例的其它细节可以进一步地参考上述方法实施例中的描述,在此不再赘述。
本申请实施例的聊天加密装置。通过将即时通信应用程序的原始加密函数替换为有包含有原始加密函数及二次加密函数的伪造加密函数,以对聊天内容进行双重加密可以使用聊天内容更加安全。另外,通过两次加密可以使服务器也不能获取明文的聊天内容,进一步地确保了聊天内容可以仅仅能够使目标用户可以查看,提高聊天内容的安全性。
本申请实施例提供一种可读存储介质,其上存储有计算机程序,所述计算机程序在执行时实现上述实施例提供的聊天加密方法。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本申请的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个配置成实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
另外,在本申请各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并 不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。
工业实用性
本公开提供了一种聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质,可以实现对聊天内容使用伪造加密函数进行加密,使得聊天内容在传输过程中始终处于加密状态,不会被服务器解密,避免聊天内容过程中的信息泄露,提高信心传输的安全性。

Claims (25)

  1. 一种聊天加密方法,其特征在于,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天加密方法包括:
    通过动态调试即时通信应用程序的进程,查找所述即时通信应用程序对聊天内容的打包流程点;
    将该打包流程点后执行的原始加密函数的地址替换为预设的伪造加密函数的地址,所述伪造加密函数包括所述原始加密函数及二次加密函数;
    使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标加密聊天内容。
  2. 如权利要求1所述的聊天加密方法,其特征在于,所述使用所述伪造加密函数对聊天内容进行两次加密得到目标加密聊天内容的步骤包括:
    将预设的加密密码作为所述二次加密函数的参数对所述待发送的聊天内容进行加密以得到初始加密聊天内容;
    使用所述伪造加密函数中的原始加密函数对所述初始加密聊天内容进行第一次加密得到目标加密聊天内容。
  3. 如权利要求1或2所述的聊天加密方法,其特征在于,所述伪造加密函数预先配置有调用地址,所述使用所述伪造加密函数对聊天内容进行两次加密得到目标加密聊天内容的步骤包括:
    确定所述伪造加密函数的函数地址;
    根据所述函数地址,确定对应的伪造加密函数;
    使用所述伪造加密函数替换所述原始加密函数;
    执行所述伪造加密函数对所述待发送的聊天内容进行加密,得到所述目标加密聊天内容。
  4. 如权利要求1至3任意一项所述的聊天加密方法,其特征在于,所述即时通信应用程序预先配置有第一加密函数,使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标加密聊天内容的步骤包括:
    根据所述伪造加密函数的地址调用所述伪造加密函数对所述待发送的聊天内容进行第一次加密;
    调用所述第一加密函数对经过第一次加密的聊天内容进行第二次加密,得到所述目标加密聊天内容。
  5. 如权利要求1至4任意一项所述的聊天加密方法,其特征在于,所述使用所述伪造加密函数对聊天内容进行两次加密得到目标加密聊天内容的步骤包括:
    调用WindowsAPI函数的CreateRemoteThread函数在所述即时通信应用程序的进程中创建一个加密线程,所述加密线程配置成调用WindowsAPI函数LoadLibrary加载所述伪造加密函数的地址;
    执行所述伪造加密函数以对所述待发送的聊天内容进行两次加密得到所述目标加密聊天内容。
  6. 如权利要求1至5任意一项所述的聊天加密方法,其特征在于,所述方法还包括:
    接收到聊天内容后,使用替换原始解密函数的伪造解密函数对所述聊天内容进行解密后显示。
  7. 如权利要求1至6任意一项所述的聊天加密方法,其特征在于,所述伪造解密函数通过以下方式插入执行:
    通过动态调试即时通信应用程序进程,以查找即时通信应用程序对聊天内容的解包流程点;
    将该解包流程点后执行的原始解密函数的地址替换为预设的伪造解密函数的地址,所述伪造解密函数包括所述原始解密函数及二次解密函数。.
  8. 一种聊天加密方法,其特征在于,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述即时通信应用程度配置成生成聊天内容,包括:
    在对所述聊天内容进行加密时,确定原始加密函数的函数地址;
    确定与所述原始加密函数对应的伪造加密函数的函数地址;
    将所述原始加密函数的函数地址替换为所述伪造加密函数的函数地址,以通过所述伪造加密函数的函数地址调用所述伪造加密函数,对所述聊天内容进行加密,得到加密聊天内容。
  9. 根据权利要求8所述的聊天加密方法,其特征在于,该方法还包括:
    根据所述原始加密函数的函数地址,调用所述原始加密函数对所述加密聊天内容进行二次加密;
    将二次加密后的加密聊天内容发送至外部终端。
  10. 根据权利要求8或9所述的聊天加密方法,其特征在于,所述伪造加密函数预先配置有伪造加密算法和伪造加密密钥,对所述聊天内容进行加密,得到加密聊天内容的步骤包括:
    根据所述伪造加密密钥,利用所述伪造加密算法对所述聊天内容进行加密,得到所述加密聊天内容。
  11. 根据权利要求8至10任意一项所述的聊天加密方法,其特征在于,所述电子终 端与其他电子终端通信连接,所述其他电子终端配置有所述即时通信应用程序,该方法还包括:
    根据预设规则生成所述伪造加密密钥,将所述伪造加密密钥发送至所述其他电子终端。
  12. 一种聊天解密方法,其特征在于,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天解密方法包括:
    监视所述即时通信应用程序的通信过程;
    确定所述即时通信应用程序接收到的加密聊天内容;
    确定与所述加密聊天内容对应的原始解密函数;
    确定与所述原始解密函数对应的伪造解密函数;
    利用所述伪造解密函数对所述加密聊天内容进行解密,得到解密后的聊天内容。
  13. 根据权利要求12所述的聊天解密方法,其特征在于,确定所述加密聊天内容对应的原始解密函数的步骤包括:
    在所述即时通信应用程序对所述加密聊天内容进行解密前,确定与所述加密聊天内容对应的原始解密函数的原始函数地址;
    根据所述原始函数地址确定所述加密聊天内容对应的原始解密函数。
  14. 根据权利要求12或13所述的聊天解密方法,其特征在于,预先建立与所述原始解密函数对应的伪造解密函数,所述伪造解密函数配置有伪造函数地址;利用所述伪造解密函数对所述加密聊天内容进行解密,得到解密后的聊天内容的步骤包括:
    在所述即时通信应用程序对所述加密聊天进行解密时,将所述原始函数地址替换为所述伪造函数地址;
    根据所述伪造函数地址调用对应的伪造解密函数;
    利用所述伪造解密函数对所述加密聊天内容进行解密。
  15. 根据权利要求12至14任意一项所述的聊天解密方法,其特征在于,所述加密聊天内容通过伪造加密函数加密后再通过第一加密函数加密,所述第一加密函数预先配置有对应的第一解密函数,在利用所述伪造解密函数对所述加密聊天内容进行解密的步骤之前,该方法还包括:
    调用第一解密函数对所述加密聊天内容第一次解密。
  16. 根据权利要求12至15任意一项所述的聊天解密方法,其特征在于,利用所述伪造解密函数对所述加密聊天内容进行解密的步骤包括:
    调用所述伪造解密函数对第一次解密后的加密聊天内容进行第二次解密,所述伪造解密函数与所述伪造加密函数采用相同的密钥。
  17. 根据权利要求12至16任意一项所述的聊天解密方法,其特征在于,所述加密聊天内容通过伪造加密函数加密,所述伪造加密函数包括伪造加密密钥,该方法还包括:
    获得与所述加密聊天内容对应的伪造加密密钥。
  18. 根据权利要求12至17任意一项所述的聊天解密方法,其特征在于,所述伪造解密函数包括伪造解密密钥和伪造解密算法,利用所述伪造解密函数对所述加密聊天内容进行解密的步骤包括:
    确定与所述伪造加密密钥对应的伪造解密密钥;
    利用所述伪造解密密钥,调用所述伪造解密算法对所述加密聊天内容进行解密。
  19. 一种聊天加密装置,其特征在于,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天加密装置包括:
    查找模块,配置成通过动态调试即时通信应用程序的进程,查找所述即时通信应用程序对聊天内容的打包流程点;
    替换模块,配置成将该打包流程点后执行的原始加密函数的地址替换为预设的伪造加密函数的地址,所述伪造加密函数包括所述原始加密函数及二次加密函数;
    加密模块,配置成使用所述伪造加密函数对待发送的聊天内容进行两次加密得到目标加密聊天内容。
  20. 如权利要求19所述的聊天加密装置,其特征在于,所述加密模块包括:
    线程创建单元,配置成调用WindowsAPI函数的CreateRemoteThread函数在所述即时通信应用程序的进程中创建一个加密线程,所述加密线程配置成调用WindowsAPI函数LoadLibrary加载所述伪造加密函数的地址;
    加密执行单元,配置成执行所述伪造加密函数以对所述待发送的聊天内容进行两次加密得到所述目标加密聊天内容。
  21. 如权利要求19所述的聊天加密装置,其特征在于,所述装置还包括:
    解密模块,配置成接收到聊天内容后,使用替换原始解密函数的伪造解密函数对所述聊天内容进行解密后显示。
  22. 一种聊天加密装置,其特征在于,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述即时通信应用程度配置成生成聊天内容,包括:
    第一处理模块,配置成在对所述聊天内容进行加密时,确定原始加密函数的函数地址;
    第一处理模块,配置成确定与所述原始加密函数对应的伪造加密函数的函数地址;
    加密模块,配置成将所述原始加密函数的函数地址替换为所述伪造加密函数的函 数地址,以通过所述伪造加密函数的函数地址调用所述伪造加密函数,对所述聊天内容进行加密,得到加密聊天内容。
  23. 一种聊天解密装置,其特征在于,应用于电子终端,所述电子终端中安装有即时通信应用程序,所述聊天解密装置包括:
    监听模块,配置成监视所述即时通信应用程序的通信过程;
    内容确定模块,配置成确定所述即时通信应用程序接收到的加密聊天内容;
    第一确定模块,配置成确定与所述加密聊天内容对应的原始解密函数;
    第二确定模块,配置成确定与所述原始解密函数对应的伪造解密函数;
    解密模块,配置成利用所述伪造解密函数对所述加密聊天内容进行解密,得到解密后的聊天内容。
  24. 一种电子终端,其特征在于,包括:
    存储器;
    处理器;
    权利要求19-21任一项所述的聊天加密装置,该聊天加密装置存储于所述存储器并由所述处理器控制执行。
  25. 一种可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序在执行时实现上述权利要求1-7中任意一项所述的聊天加密方法。
PCT/CN2018/081391 2018-01-02 2018-03-30 聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质 WO2019134278A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810001257.7A CN108200058B (zh) 2018-01-02 2018-01-02 聊天加密方法、装置、电子终端及可读存储介质
CN201810001257.7 2018-01-02

Publications (1)

Publication Number Publication Date
WO2019134278A1 true WO2019134278A1 (zh) 2019-07-11

Family

ID=62587988

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/081391 WO2019134278A1 (zh) 2018-01-02 2018-03-30 聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质

Country Status (2)

Country Link
CN (1) CN108200058B (zh)
WO (1) WO2019134278A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2022519215A (ja) 2019-01-28 2022-03-22 ザ ケマーズ カンパニー エフシー リミテッド ライアビリティ カンパニー パッシベーション層を作製するための組成物及びそれを用いたパッシベーション層
CN114124880B (zh) * 2021-11-29 2023-07-18 北京天融信网络安全技术有限公司 基于公有云的保密通信方法、装置及计算机设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102625297A (zh) * 2011-01-27 2012-08-01 腾讯科技(深圳)有限公司 用于移动终端的身份管理方法及装置
US20160291822A1 (en) * 2015-04-03 2016-10-06 Glu Mobile, Inc. Systems and methods for message communication
US20170006009A1 (en) * 2015-07-01 2017-01-05 Christian J. Hessler System and method for mobile peer authentication and asset control
CN106411719A (zh) * 2016-11-22 2017-02-15 北京奇虎科技有限公司 一种用于对即时消息进行处理的方法及设备

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0211812D0 (en) * 2002-05-23 2002-07-03 Koninkl Philips Electronics Nv S-box encryption in block cipher implementations
TW200529623A (en) * 2004-01-14 2005-09-01 Nec Corp Communication encryption method, communication encryption system, terminal device, DNS server and program
CN103179128B (zh) * 2013-03-28 2016-03-16 国家电网公司 安卓平台浏览器与网站服务器间的通信安全增强代理系统
CN103441923B (zh) * 2013-08-27 2016-09-28 北京明朝万达科技股份有限公司 一种基于网络应用软件的安全文件传输方法和装置
CN104009841B (zh) * 2014-06-20 2018-01-19 天津理工大学 一种即时通信情境下的消息加密方法
CN105208041B (zh) * 2015-10-15 2018-09-21 厦门大学 基于hook的云存储应用加密数据包破解方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102625297A (zh) * 2011-01-27 2012-08-01 腾讯科技(深圳)有限公司 用于移动终端的身份管理方法及装置
US20160291822A1 (en) * 2015-04-03 2016-10-06 Glu Mobile, Inc. Systems and methods for message communication
US20170006009A1 (en) * 2015-07-01 2017-01-05 Christian J. Hessler System and method for mobile peer authentication and asset control
CN106411719A (zh) * 2016-11-22 2017-02-15 北京奇虎科技有限公司 一种用于对即时消息进行处理的方法及设备

Also Published As

Publication number Publication date
CN108200058A (zh) 2018-06-22
CN108200058B (zh) 2020-08-04

Similar Documents

Publication Publication Date Title
US10552238B2 (en) Secure inter-process communications for mobile devices
CN108769027B (zh) 安全通信方法、装置、移动终端和存储介质
CN108833091B (zh) 一种日志文件的加密方法、解密方法及装置
TW201909015A (zh) 登錄資訊處理方法及設備
US9659189B2 (en) Systems and methods of safeguarding user information while interacting with online service providers
EP3934295A2 (en) Key protection processing method, apparatus, device and storage medium
CN111193741B (zh) 一种信息发送方法、信息获取方法、装置及设备
CN112733180A (zh) 数据查询方法、装置和电子设备
CN109711178B (zh) 一种键值对的存储方法、装置、设备及存储介质
WO2019134278A1 (zh) 聊天加密方法、聊天解密方法、装置、电子终端及可读存储介质
CN113630412B (zh) 资源下载方法、资源下载装置、电子设备以及存储介质
CN109120576B (zh) 数据分享方法及装置、计算机设备及存储介质
CN111368322B (zh) 一种文件解密方法、装置、电子设备和存储介质
CN111400743B (zh) 基于区块链网络的事务处理方法、装置、电子设备和介质
CN113127844A (zh) 一种变量访问方法、装置、系统、设备和介质
CN108848094B (zh) 数据安全验证方法、装置、系统、计算机设备及存储介质
CN109995534B (zh) 一种对应用程序进行安全认证的方法和装置
WO2020103060A1 (zh) 数据处理方法、装置、系统、服务器以及电子设备
CN107463808B (zh) 集成在操作系统内的功能模块的调用方法
CN111831978A (zh) 一种对配置文件进行保护的方法及装置
CN114117388A (zh) 设备注册方法、设备注册装置、电子设备以及存储介质
US9537842B2 (en) Secondary communications channel facilitating document security
CN109462604B (zh) 一种数据传输方法、装置、设备及存储介质
CN107153791B (zh) 一种数据呈现方法及电子设备
US11176021B2 (en) Messaging systems with improved reliability

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18898013

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18898013

Country of ref document: EP

Kind code of ref document: A1