A data transmission method and related equipment

During the data transmission process between the virtual machine and the C++ layer, the data storage structure with cache and the preset function are used for decryption, and the data transmission is completed through a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine, solving the problems in the existing technology. The problem that decryption operations are easily imitated improves the security and efficiency of data transmission.

CN115499140BActive Publication Date: 2025-01-21SHENZHEN KINGSPEC ELECTRONICS TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110670251.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-17
Publication Date
2025-01-21
Estimated Expiration
2041-06-17

AI Technical Summary

Technical Problem

In the data transmission process between virtual machines and the C++ layer, decryption operations are easily imitated, resulting in low data transmission security.

Method used

Obtain the encrypted data issued by the server through the virtual machine, use a data storage structure with cache to store the encrypted data as information to be transmitted, call the preset function to send the information to be transmitted to the C++ layer for decryption, and pass the C++ layer and virtual The data interface of machine mapping relationship completes data transmission.

Benefits of technology

It improves the security of data transmission, avoids the problem of the decryption process occupying virtual machine performance resources and slow decryption speed, and enhances the protection effect through non-linear continuous code logic and Hook operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115499140B_ABST
    Figure CN115499140B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a data transmission method and related equipment, the method comprising: obtaining target data, the target data being encrypted data sent from the server; using a data storage structure with a cache to store the encrypted data to obtain information to be transmitted; sending the information to be transmitted to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function with a decryption function; obtaining the class name of the executable body in the virtual machine through a preset interface based on the execution information to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine. The technical solution of the embodiment of the present invention solves the problem in the prior art that when a virtual machine receives server-side data, when the data is encrypted, the decryption performance and decryption speed of the virtual machine are slow, and the data transmission between the virtual machine and the C++ layer is unsafe.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a data transmission method and related equipment. Background Art

[0002] In the existing technical solution, when data is transmitted between the virtual machine and the C++ layer, when the transmitted data is encrypted data, the encrypted data is called through the system function to obtain the return value of the completed call, and the decryption function is called based on the return value of the completed call to complete the decryption of the encrypted data, thereby realizing the transmission of the encrypted data. The transmission process is plain text transmission. The developer needs to call the decryption function to obtain the plain text data. After calling the system function to obtain the original data, the decryption function is called immediately. Then, in the code logic, the system function call and the decryption function are in a continuous linear relationship. When reverse debugging and analyzing the code, it is easy to obtain the data acquisition and decryption code, so the decryption operation is easy to be imitated, which makes the data transmission security low. Summary of the invention

[0003] The embodiment of the present invention provides a data transmission method and related equipment, which avoids the problem of slow first frame transmission time of data transmission.

[0004] In a first aspect, an embodiment of the present invention provides a data transmission method, which is used for a client, comprising:

[0005] The virtual machine obtains target data, where the target data is encrypted data sent by the server;

[0006] The encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, wherein the information to be transmitted is data stored in a byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache;

[0007] Sending the information to be transmitted to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted;

[0008] Based on the execution information, return information corresponding to the execution information is obtained through a preset interface to complete data transmission, wherein the preset interface is a data interface that complies with the mapping relationship between the C++ layer and the virtual machine.

[0009] Optionally, before the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, the step further includes:

[0010] Obtaining calling information of the preset function;

[0011] Based on the comparison between the calling information and the preset path information, wherein the preset path information is the path information of the preset function being normally called;

[0012] If the calling information does not match the preset path information, the information to be transmitted is not decrypted, and the C++ layer cannot obtain execution information based on the information to be transmitted;

[0013] If the calling information matches the preset path information, the information to be transmitted is decrypted, and the C++ layer can obtain execution information based on the information to be transmitted.

[0014] Optionally, before the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, the step further includes:

[0015] Obtaining the calling information of the preset function;

[0016] Based on the comparison between the called information and the preset list information, wherein the preset list information is the caller list information when the preset function is normally called;

[0017] If the calling information does not match the preset list information, the information to be transmitted is not decrypted, and the C++ layer cannot obtain execution information based on the information to be transmitted;

[0018] If the calling information matches the preset list information, the information to be transmitted is decrypted, and the C++ layer can obtain execution information based on the information to be transmitted.

[0019] Optionally, the preset function is a function obtained by performing a HOOK operation on the system function GetDirectBufferAddress and having a function of retrieving data and decrypting the information to be transmitted.

[0020] Optionally, also include:

[0021] Get C++ layer management information and virtual machine management information;

[0022] Generate a smart pointer based on the C++ layer management information and the virtual machine management information;

[0023] The life cycles of the information to be transmitted and the execution information are controlled according to the smart pointer.

[0024] Optionally, the step of using a data storage structure with a cache to store the encrypted data to obtain information to be transmitted includes:

[0025] Define a ByteBuffer object, wherein the ByteBuffer object is a data object occupying memory;

[0026] The encrypted data is stored in the memory corresponding to the ByteBuffer object, and the object to be transmitted is obtained;

[0027] The object to be transmitted is used as information to be transmitted.

[0028] Optionally, the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, includes:

[0029] By presetting the function:

[0030] public native void nativeRecv(ByteBuffer data, String[]javastack){

[0031] The information to be transmitted is sent to the c++ layer, wherein the ByteBuffer is the data transmission format, the String[]javastack is the referenced data type as a stack, the native is the native framework, public is the function statement defining the global variable, and the nativeRecv is the native framework programming function.

[0032] In a second aspect, an embodiment of the present application provides a data transmission device, including:

[0033] A data acquisition module, used for the virtual machine to acquire target data, wherein the target data is encrypted data sent by the server;

[0034] A storage module, used to store the encrypted data in a data storage structure with a cache to obtain information to be transmitted, wherein the information to be transmitted is data corresponding to the encrypted data stored in a byte buffer, and the byte buffer is a data storage structure with a cache;

[0035] A transmission module, used for sending the information to be transmitted to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted;

[0036] A feedback module is used to obtain return information corresponding to the execution information through a preset interface based on the execution information to complete data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine.

[0037] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the above-mentioned memory and executable on the above-mentioned processor, wherein the above-mentioned processor is used to implement the steps of the above-mentioned data transmission method when executing the computer program stored in the memory.

[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored: when the above-mentioned computer program is executed by a processor, the steps of the data transmission method as described above are implemented.

[0039] The embodiments of the above invention have the following advantages or beneficial effects:

[0040] The target data is obtained through a virtual machine, and the target data is the encrypted data sent by the server; the encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, and the information to be transmitted is the data stored in the byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache; the data type transmitted during data transmission is changed, and the information to be transmitted is a ByteBuffer object, and the internal data structure of the ByteBuffer object is relatively complex, so the cracking difficulty is higher; the information to be transmitted is sent to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function with the function of decrypting the information to be transmitted; the hook operation is to perform a Path operation on the system code to obtain a preset function, and what is modified is the system-level code, and the system The code at the system level cannot be directly seen in the program, and based on the Hook operation, the code logic jumps from the location of calling the system function to the decryption logic after the Hook, so the code of the calling function and the code of the decryption function are non-linearly continuous, and the decryption code is separated from the original encrypted data, so the protection effect is better; based on the execution information, the return information corresponding to the execution information is obtained through the preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine; by adopting the data interface that conforms to the mapping relationship between the C++ layer and the virtual machine, the VBuff object in C++ can be associated with the ByteBuffer object in the virtual machine, so that data transmission can be completed without data conversion, which is convenient and fast, avoiding the risk of data leakage caused by data conversion in the prior art, and having higher security. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a flow chart of a data transmission method provided by an embodiment of the present application;

[0042] Figure 2 It is a structural schematic diagram of a data transmission device provided in an embodiment of the present application;

[0043] Figure 3 is a structural schematic diagram of an electronic device provided in an embodiment of the present application;

[0044] Figure 4 It is a structural schematic diagram of a storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0046] Figure 1 This is a flowchart of a data transmission method provided in an embodiment of the present application. The data transmission method provided in this embodiment can be applied to scenarios where application development is based on a virtual machine and C++. The method can be executed by a data transmission device, which can be implemented by software and / or hardware, and is usually integrated in a terminal.

[0047] like Figure 1 As shown, an embodiment of the present invention provides a data transmission method for a client terminal, which specifically includes the following steps:

[0048] S101, the virtual machine obtains target data, where the target data is encrypted data sent by the server;

[0049] In an existing implementation, a network function is developed in a virtual machine to receive data from a server. When the encrypted data sent from the server is decrypted in the virtual machine, the performance of the virtual machine is limited, so that the decryption process of the encrypted data has low security and slow decryption speed.

[0050] Compared with the prior art, this solution enables the decryption process to be carried out in the server, so that when the server and the virtual machine are transmitting data, the type of data transmitted is the object corresponding to the decrypted data, making the transmission and decryption process safer and avoiding the problem of the decryption process occupying the performance resources of the virtual machine and the slow decryption speed.

[0051] S102, using a data storage structure with a cache to store the encrypted data to obtain information to be transmitted, where the information to be transmitted is data stored in a byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache;

[0052] In a possible implementation, the step of using a data storage structure with a cache to store the encrypted data to obtain information to be transmitted includes:

[0053] Define a ByteBuffer object, wherein the ByteBuffer object is a data object occupying memory;

[0054] The encrypted data is stored in the memory corresponding to the ByteBuffer object, and the object to be transmitted is obtained;

[0055] The object to be transmitted is used as information to be transmitted.

[0056] Exemplarily, when the virtual machine obtains data from the server, it creates a ByteBuffer to store the data sent by the server. At the same time, when transmitting to the C++ layer for decryption, it also uses the ByteBuffer object to exchange with the C++ layer. The specific steps include:

[0057] Allocate a very large ByteBuffer object in the virtual machine. The ByteBuffer object will use the memory in the virtual machine to store a large amount of data later. Allocate enough memory at one time, and the ByteBuffer object can be reused later.

[0058] Design a data storage solution, where all encrypted data sent by the server is stored in the ByteBuffer object. In the storage solution, the ByteBuffer object allocates a relatively large memory, so it is necessary to find available space in the memory, which is conducive to clearing the data in the space after use, rather than releasing the memory. For each data, the starting location and storage size of the storage are recorded to facilitate subsequent data transmission, and the performance of the entire virtual machine is further improved by reusing the memory space;

[0059] The data sent by the server is encrypted, so the data stored in the memory of the ByteBuffer object is also encrypted and not decrypted. It is decrypted when used in C++. This ensures that the virtual machine interface and the C++ interface keep the encrypted state when transmitting the information to be transmitted.

[0060] In a possible implementation manner, before the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, the step further includes:

[0061] Obtaining calling information of the preset function;

[0062] Based on the comparison between the calling information and the preset path information, wherein the preset path information is the path information of the preset function being normally called;

[0063] If the calling information does not match the preset path information, the information to be transmitted is not decrypted, and the C++ layer cannot obtain execution information based on the information to be transmitted;

[0064] If the calling information matches the preset path information, the information to be transmitted is decrypted, and the C++ layer can obtain execution information based on the information to be transmitted.

[0065] Exemplarily, the calling information of the preset function is used to determine whether the call stack of the caller is consistent with the preset calling path. If it is inconsistent, it is considered to be an illegal call and the encrypted data will not be decrypted.

[0066] By verifying the caller's calling path, it is ensured that the caller's current calling request is reasonable, thus ensuring the security of data calling.

[0067] In a possible implementation manner, before the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, the step further includes:

[0068] Obtaining the calling information of the preset function;

[0069] Based on the comparison between the called information and the preset list information, wherein the preset list information is the caller list information when the preset function is normally called;

[0070] If the calling information does not match the preset list information, the information to be transmitted is not decrypted, and the C++ layer cannot obtain execution information based on the information to be transmitted;

[0071] If the calling information matches the preset list information, the information to be transmitted is decrypted, and the C++ layer can obtain execution information based on the information to be transmitted.

[0072] Exemplarily, the function call stack of the preset function is obtained, the function call stack information of the current native C++ is obtained, and the function call stack information in the virtual machine corresponding to the native C++ interface is obtained. Based on the above two stack information, the call stack of the program itself is sorted out in advance, and then the call stack of the program itself is used as a whitelist and considered to be a legal call stack. Only the call stack in the whitelist will decrypt the data in the Hook logic of the function GetDirectBufferAddress, so the caller gets a plaintext data; if it is not in the whitelist, the returned data is still encrypted, and no decryption operation is performed.

[0073] Verifying the current call through a whitelist facilitates setting and comparison, and has a better effect in preventing data leakage.

[0074] S103, sending the information to be transmitted to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted;

[0075] In a possible implementation, the preset function is a function obtained by performing a HOOK operation on the system function GetDirectBufferAddress and having a function of retrieving data and a function of decrypting the information to be transmitted.

[0076] Exemplarily, when obtaining data of the virtual machine at the C++ layer, the system function void*addr=GetDirectBufferAddress(this) is called to obtain the information to be transmitted from the virtual machine, and a function having the functions of data retrieval and decryption of the information to be transmitted is obtained by hooking the above system function GetDirectBufferAddress.

[0077] The specific process of the hook operation is: the hook function is a hook function, and before the system calls the above-mentioned system function GetDirectBufferAddress, the hook function first captures the call message of calling the above-mentioned system function GetDirectBufferAddress, and the hook function first obtains the control right of the above-mentioned system function GetDirectBufferAddress, then the hook function can change the execution behavior of the above-mentioned system function GetDirectBufferAddress, thereby enabling the above-mentioned system function GetDirectBufferAddress to have the function of data retrieval and the function of decrypting the information to be transmitted.

[0078] The order of decryption and data transmission in the prior art is changed so that the code logic jumps from the location of calling the system function to the decryption logic after the Hook. The code of the calling function and the code of the decryption function are non-linearly continuous, and the decryption code is separated from the original encrypted data, so the protection effect is better.

[0079] S104. Based on the execution information, the return information corresponding to the execution information is obtained through a preset interface to complete the data transmission, wherein the preset interface is a data interface that complies with the mapping relationship between the C++ layer and the virtual machine.

[0080] In a possible implementation, a data transmission mode between the virtual machine and C++ is designed so that the virtual machine and C++ complete data transmission. The specific steps include:

[0081] Design a mapping class between C++ and the virtual machine, and design a class to encapsulate the way to exchange with the nioByteBuffer class in the virtual machine, specifically:

[0082] Preset member variables:

[0083] By defining the function:

[0084] static auto constexpr kDesc="ByteBuffer";

[0085] Define a static member variable to store the class name corresponding to the executable in the virtual machine. That is, there is a conversion relationship between the mapping class and the class "ByteBuffer" in the virtual machine;

[0086] Design the member function createBytes of the mapping class:

[0087] Through the conversion function:

[0088] static local <vbuff>createBytes(uint8_t*data,size_t size){

[0089] Create a VBuff interface, which is used to give the decryption result to the virtual machine after C++ decrypts the data. The virtual machine can only accept the types in the virtual machine. Therefore, the conversion function is written to construct a data object of a buffer in the virtual machine through the original C++ data.

[0090] Call the method provided by the virtual machine to allocate a data memory and copy the data to the allocated memory.

[0091] The constructed data object can be converted to a corresponding virtual machine object, so that the VBuff object in C++ can be associated with the virtual machine object ByteBuffer.

[0092] By associating the VBuff object in C++ with the virtual machine object ByteBuffer, object transmission is feasible, thereby achieving data transmission without data conversion, which is convenient and fast, avoids the risk of data leakage during data conversion in the prior art, and has higher security.

[0093] In a possible implementation, it further includes:

[0094] Get C++ layer management information and virtual machine management information;

[0095] Generate a smart pointer based on the C++ layer management information and the virtual machine management information;

[0096] The life cycles of the information to be transmitted and the execution information are controlled according to the smart pointer.

[0097] For example, by assigning a function:

[0098] Object=NewDirectByteBuffer(data,size);

[0099] The decrypted data is assigned to the Object object.

[0100] return Object; it will be automatically converted into a smart pointer local <vbuff>Object, because C++ and the virtual machine have different life cycle management for objects, a smart pointer type Local is returned, which can automatically manage the life cycle of this object, without the need to set up special management object life cycle in C++ or the virtual machine.

[0101] Design its member function getBuff:

[0102] Through the function:

[0103] uint8_t* getBuff()const{

[0104] Get the original memory cache that can be directly read and written by C++ from the VBuff object.

[0105] void*addr=GetDirectBufferAddress(this);

[0106] Call the GetDirectBufferAddress function:

[0107] void*addr=GetDirectBufferAddress(this);

[0108] To get the corresponding pointer addr, and then through a type conversion function static_cast:

[0109] return static_cast<uint8_t*> (addr);

[0110] }

[0111] Convert the corresponding pointer addr into the original pointer type.

[0112] Design its member function getSize:

[0113] By size function:

[0114] size_t getSize()const{

[0115] int size=GetDirectBufferCapacity(this);

[0116] Get the size of the corresponding data:

[0117] Through the system interface GetDirectBufferCapacity:

[0118] return size;}

[0119] The size of the corresponding data is received.

[0120] By automatically managing the life cycle of an object through a smart pointer, it is avoided to set up a special management object life cycle in C++ or a virtual machine. On the premise of ensuring that the life cycle of the object in C++ and the virtual machine is consistent, the research and development work of researchers is reduced.

[0121] In a possible implementation, the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, includes:

[0122] By presetting the function:

[0123] public native void nativeRecv(ByteBuffer data, String[]javastack){

[0124] The information to be transmitted is sent to the c++ layer, wherein the ByteBuffer is the data transmission format, the String[]javastack is the referenced data type as a stack, the native is the local framework, public is the function statement defining the global variable, and the nativeRecv is the local framework programming function.

[0125] For example, the interface corresponding to the C++ layer is set in the virtual machine through the above preset function, in which there is a parameter ByteBuffer, and this data is the preset data transmission mode. Then, it is not necessary to convert it into the conventional data format byte array during data transmission, because byte data can be directly copied one-to-one in the memory model of the virtual machine and the memory model of C++, while other data modes do not support such one-to-one data copy. According to the parameter ByteBuffer setting, the ByteBuffer object is directly transferred, and the data is not converted and directly delivered to the C++ layer. Only data extraction operations are performed inside the C++ layer.

[0126] Then it saves the transmission of the object during the entire transmission process, and the internal data structure of the object is more complex so it is more difficult to crack.

[0127] Exemplarily, the virtual machine interface corresponding to the C++ layer is set:

[0128] Void Process(VBuff::object data,jstring[]stack){

[0129] So that the virtual machine and the C++ layer of the server can perform data transmission, wherein there is a corresponding mapping relationship between the parameter VBuff::object data in the C++ layer and the ByteBuffer object in the virtual machine, which makes it convenient for R&D personnel to access and operate data.

[0130] The target data is obtained through a virtual machine, and the target data is the encrypted data sent by the server; the encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, and the information to be transmitted is the data stored in the byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache; the data type transmitted during data transmission is changed, and the information to be transmitted is a ByteBuffer object, and the internal data structure of the ByteBuffer object is relatively complex, so the cracking difficulty is higher; the information to be transmitted is sent to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function with the function of decrypting the information to be transmitted; the hook operation is to perform a Path operation on the system code to obtain a preset function, and what is modified is the system-level code, and the system The code at the system level cannot be directly seen in the program, and based on the Hook operation, the code logic jumps from the location of calling the system function to the decryption logic after the Hook, so the code of the calling function and the code of the decryption function are non-linearly continuous, and the decryption code is separated from the original encrypted data, so the protection effect is better; based on the execution information, the return information corresponding to the execution information is obtained through the preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine; by adopting the data interface that conforms to the mapping relationship between the C++ layer and the virtual machine, the VBuff object in C++ can be associated with the ByteBuffer object in the virtual machine, so that data transmission can be completed without data conversion, which is convenient and fast, avoiding the risk of data leakage caused by data conversion in the prior art, and having higher security.

[0131] The following is an embodiment of a data transmission device provided in an embodiment of the present invention. The device and the data transmission methods of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the data transmission device, reference can be made to the embodiment of the above-mentioned text processing method.

[0132] In a possible implementation, Figure 2 As shown, an embodiment of the present application provides a data transmission device, including:

[0133] Data acquisition module 201, used for the virtual machine to acquire target data, wherein the target data is encrypted data sent by the server;

[0134] A storage module 202 is used to store the encrypted data in a data storage structure with a cache to obtain information to be transmitted, where the information to be transmitted is data corresponding to the encrypted data stored in a byte buffer, and the byte buffer is a data storage structure with a cache;

[0135] The transmission module 203 is used to send the information to be transmitted to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted;

[0136] The feedback module 204 is used to obtain return information corresponding to the execution information through a preset interface based on the execution information to complete data transmission, wherein the preset interface is a data interface that complies with the mapping relationship between the C++ layer and the virtual machine.

[0137] The target data is obtained through a virtual machine, and the target data is the encrypted data sent by the server; the encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, and the information to be transmitted is the data stored in the byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache; the data type transmitted during data transmission is changed, and the information to be transmitted is a ByteBuffer object, and the internal data structure of the ByteBuffer object is relatively complex, so the cracking difficulty is higher; the information to be transmitted is sent to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function with the function of decrypting the information to be transmitted; the hook operation is to perform a Path operation on the system code to obtain a preset function, and what is modified is the system-level code, and the system The code at the system level cannot be directly seen in the program, and based on the Hook operation, the code logic jumps from the location of calling the system function to the decryption logic after the Hook, so the code of the calling function and the code of the decryption function are non-linearly continuous, and the decryption code is separated from the original encrypted data, so the protection effect is better; based on the execution information, the return information corresponding to the execution information is obtained through the preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine; by adopting the data interface that conforms to the mapping relationship between the C++ layer and the virtual machine, the VBuff object in C++ can be associated with the ByteBuffer object in the virtual machine, so that data transmission can be completed without data conversion, which is convenient and fast, avoiding the risk of data leakage caused by data conversion in the prior art, and having higher security.

[0138] In one possible real-time approach, such as Figure 3 As shown, an embodiment of the present application provides an electronic device, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor 320. When the processor 320 executes the computer program 311, the following is achieved: the virtual machine obtains target data, wherein the target data is encrypted data sent by the server; the encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, wherein the information to be transmitted is data corresponding to the encrypted data stored in a byte buffer, and the byte buffer is a data storage structure with a cache; the information to be transmitted is sent to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted; based on the execution information, the return information corresponding to the execution information is obtained through a preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine.

[0139] The target data is obtained through a virtual machine, and the target data is the encrypted data sent by the server; the encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, and the information to be transmitted is the data stored in the byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache; the data type transmitted during data transmission is changed, and the information to be transmitted is a ByteBuffer object, and the internal data structure of the ByteBuffer object is relatively complex, so the cracking difficulty is higher; the information to be transmitted is sent to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function with the function of decrypting the information to be transmitted; the hook operation is to perform a Path operation on the system code to obtain a preset function, and what is modified is the system-level code, and the system The code at the system level cannot be directly seen in the program, and based on the Hook operation, the code logic jumps from the location of calling the system function to the decryption logic after the Hook, so the code of the calling function and the code of the decryption function are non-linearly continuous, and the decryption code is separated from the original encrypted data, so the protection effect is better; based on the execution information, the return information corresponding to the execution information is obtained through the preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine; by adopting the data interface that conforms to the mapping relationship between the C++ layer and the virtual machine, the VBuff object in C++ can be associated with the ByteBuffer object in the virtual machine, so that data transmission can be completed without data conversion, which is convenient and fast, avoiding the risk of data leakage caused by data conversion in the prior art, and having higher security.

[0140] In a possible real-time mode, an embodiment of the present application provides a computer-readable storage medium 400, on which a computer program 411 is stored, and when the computer program 411 is executed by a processor, it implements: the virtual machine obtains target data, the target data is encrypted data sent by the server; the encrypted data is stored in a cached data storage structure to obtain information to be transmitted, the information to be transmitted is data corresponding to the encrypted data stored in a byte buffer, and the byte buffer is a cached data storage structure; the information to be transmitted is sent to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function with a function of decrypting the information to be transmitted; based on the execution information, the return information corresponding to the execution information is obtained through a preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine.

[0141] The target data is obtained through a virtual machine, and the target data is the encrypted data sent by the server; the encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, and the information to be transmitted is the data stored in the byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache; the data type transmitted during data transmission is changed, and the information to be transmitted is a ByteBuffer object, and the internal data structure of the ByteBuffer object is relatively complex, so the cracking difficulty is higher; the information to be transmitted is sent to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function with the function of decrypting the information to be transmitted; the hook operation is to perform a Path operation on the system code to obtain a preset function, and what is modified is the system-level code, and the system The code at the system level cannot be directly seen in the program, and based on the Hook operation, the code logic jumps from the location of calling the system function to the decryption logic after the Hook, so the code of the calling function and the code of the decryption function are non-linearly continuous, and the decryption code is separated from the original encrypted data, so the protection effect is better; based on the execution information, the return information corresponding to the execution information is obtained through the preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine; by adopting the data interface that conforms to the mapping relationship between the C++ layer and the virtual machine, the VBuff object in C++ can be associated with the ByteBuffer object in the virtual machine, so that data transmission can be completed without data conversion, which is convenient and fast, avoiding the risk of data leakage caused by data conversion in the prior art, and having higher security.

[0142] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0143] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0144] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0145] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0146] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0147] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described above, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.< / vbuff> < / vbuff>

Claims

1. A data transmission method, characterized in that: For clients, including: The virtual machine obtains target data, where the target data is encrypted data sent by the server; The encrypted data is stored in a data storage structure with a cache to obtain information to be transmitted, wherein the information to be transmitted is data stored in a byte buffer corresponding to the encrypted data, and the byte buffer is a data storage structure with a cache; Sending the information to be transmitted to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted; Based on the execution information, the return information corresponding to the execution information is obtained through a preset interface to complete the data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine; The preset function is a function obtained by performing a HOOK operation on the system function GetDirectBufferAddress and having the functions of data retrieval and decrypting the information to be transmitted.

2. The data transmission method according to claim 1, characterized in that: Before the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, the method further includes: Obtaining calling information of the preset function; Based on the comparison between the calling information and the preset path information, wherein the preset path information is the path information of the preset function being normally called; If the calling information does not match the preset path information, the information to be transmitted is not decrypted; If the calling information matches the preset path information, the information to be transmitted is decrypted by the decryption function of the preset function, so that the C++ layer can obtain execution information based on the information to be transmitted.

3. The data transmission method according to claim 2, characterized in that: Before the step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, the method further includes: Obtaining the calling information of the preset function; Based on the comparison between the called information and the preset list information, wherein the preset list information is the caller list information when the preset function is normally called; If the calling information does not match the preset list information, the information to be transmitted is not decrypted, so that the C++ layer cannot obtain execution information based on the information to be transmitted; If the calling information matches the preset list information, the information to be transmitted is decrypted so that the C++ layer can obtain execution information based on the information to be transmitted.

4. The data transmission method according to claim 1, characterized in that: Also includes: Get C++ layer management information and virtual machine management information; Generate a smart pointer based on the C++ layer management information and the virtual machine management information; The life cycles of the information to be transmitted and the execution information are controlled according to the smart pointer.

5. The data transmission method according to claim 1, characterized in that: The step of using a data storage structure with a cache to store the encrypted data to obtain information to be transmitted includes: Define a ByteBuffer object, wherein the ByteBuffer object is a data object occupying memory; The encrypted data is stored in the memory corresponding to the ByteBuffer object, and the object to be transmitted is obtained; The object to be transmitted is used as information to be transmitted.

6. The data transmission method according to claim 5, characterized in that: The step of sending the information to be transmitted to the C++ layer by calling a preset function so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, comprises: By presetting the function: public native void nativeRecv(ByteBuffer data, String[] javastack){ The information to be transmitted is sent to the c++ layer, wherein the data type referenced by String[] javastack is a stack, the ByteBuffer is a data transmission format, the native is a local framework, public is a function statement defining a global variable, and the nativeRecv is a local framework programming function.

7. A data transmission device, characterized in that: include: A data acquisition module, used for the virtual machine to acquire target data, wherein the target data is encrypted data sent by the server; A storage module, used to store the encrypted data in a data storage structure with a cache to obtain information to be transmitted, wherein the information to be transmitted is data corresponding to the encrypted data stored in a byte buffer, and the byte buffer is a data storage structure with a cache; A transmission module, used for sending the information to be transmitted to the C++ layer by calling a preset function, so that the C++ layer obtains execution information based on the information to be transmitted, wherein the preset function is a function function having a function of decrypting the information to be transmitted, and the preset function is a function function having a data retrieval function and a function of decrypting the information to be transmitted obtained by performing a HOOK operation on the system function GetDirectBufferAddress; A feedback module is used to obtain return information corresponding to the execution information through a preset interface based on the execution information to complete data transmission, wherein the preset interface is a data interface that conforms to the mapping relationship between the C++ layer and the virtual machine.

8. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is used to implement the data transmission method according to any one of claims 1 to 6 when executing the computer program stored in the memory.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data transmission method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Application running method and device

    CN108804913A

  • Data transmission method and device based on virtual machine

    CN111143265A