Terminal device and data encryption method
Patent Information
- Application Number
- CN202310237489.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-13
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2043-03-13
AI Technical Summary
[0005]本申请一些实施例提供一种终端设备及数据加密的方法,以解决数据传输过程中数据安全性低的问题
[0018] As can be seen from the above technical solutions, some embodiments of this application provide a terminal device and a data encryption method. After obtaining initial data, the terminal device can perform integer encoding on the initial data to obtain an initial integer; then, it obtains a secure random number of arbitrary length and combines the initial integer and the secure random number to obtain a combined random integer; then, it performs masking processing on the combined random integer to obtain a new random integer, which is then transmitted to the data receiver as the target data. Through the technical solution of this application, the initial data transmitted by the sender can be encrypted into a random integer for transmission. By randomizing the initial data, the result after each encryption is different, which can prevent the initial data from being intercepted or leaked, ensuring the security of the initial data. Simultaneously, during the encryption process, relevant parameters can be adjusted to ensure the randomness of the result, thereby solving the problem of low data security during data transmission.
Smart Images

Figure CN116455604B_ABST
Abstract
Description
Technical Field
[0001] Some embodiments of this application relate to the field of terminal device technology, and in particular to a terminal device and a method for data encryption. Background Technology
[0002] In applications involving smart TVs and other terminal devices, various types of data need to be transmitted. For example, data transmission can occur between terminal devices, between terminal devices and servers, and between different functional modules deployed within a terminal device.
[0003] In data transmission, transmission methods can be divided into two types: encrypted transmission and unencrypted transmission. Encrypted transmission is a method used to protect the security of data transmission. The sender can use specific encryption technologies to encrypt the data before sending it to the receiver. Only the sender and receiver can access and decrypt the data. For example, encryption algorithms can include symmetric encryption and asymmetric encryption. Using encryption algorithms to encrypt data can improve data security.
[0004] However, algorithms such as symmetric and asymmetric encryption require the sender to transmit a key to the receiver and involve significant computational demands. Extensive use of these algorithms can lead to performance degradation in terminal devices. Therefore, unencrypted transmission is often used for some data. However, unencrypted data transmission suffers from low security because the transmitted data is not encrypted. Summary of the Invention
[0005] Some embodiments of this application provide a terminal device and a method for data encryption to solve the problem of low data security during data transmission.
[0006] In a first aspect, some embodiments of this application provide a terminal device, including:
[0007] A communicator is configured to establish a communication connection with a data receiver.
[0008] The controller is configured as follows:
[0009] Obtain initial data, and perform integer encoding on the initial data to obtain an initial integer;
[0010] Get a safe random number of any length;
[0011] Combine the initial integer and the secure random number to obtain the combined random integer;
[0012] The combined random integer is masked to obtain a new random integer, which is then used as the target data transmission data to the data receiver.
[0013] Secondly, some embodiments of this application also provide a data encryption method applied to the terminal device of the first aspect, the terminal device including a communicator and a controller that establish a communication connection with a data receiver; the data encryption method includes:
[0014] Obtain initial data, and perform integer encoding on the initial data to obtain an initial integer;
[0015] Get a safe random number of any length;
[0016] Combine the initial integer and the secure random number to obtain the combined random integer;
[0017] The combined random integer is masked to obtain a new random integer, which is then used as the target data transmission data to the data receiver.
[0018] As can be seen from the above technical solutions, some embodiments of this application provide a terminal device and a data encryption method. After obtaining initial data, the terminal device can perform integer encoding on the initial data to obtain an initial integer; then, it obtains a secure random number of arbitrary length and combines the initial integer and the secure random number to obtain a combined random integer; then, it performs masking processing on the combined random integer to obtain a new random integer, which is then transmitted to the data receiver as the target data. Through the technical solution of this application, the initial data transmitted by the sender can be encrypted into a random integer for transmission. By randomizing the initial data, the result after each encryption is different, which can prevent the initial data from being intercepted or leaked, ensuring the security of the initial data. Simultaneously, during the encryption process, relevant parameters can be adjusted to ensure the randomness of the result, thereby solving the problem of low data security during data transmission. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in some embodiments of this application or in the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram illustrating the operational scenarios between a terminal device and a control device provided in some embodiments of this application;
[0021] Figure 2 Hardware configuration block diagrams of terminal devices provided in some embodiments of this application;
[0022] Figure 3Hardware configuration block diagrams of control devices provided in some embodiments of this application;
[0023] Figure 4 This is a schematic diagram of the software configuration in a terminal device provided in some embodiments of this application;
[0024] Figure 5 A flowchart illustrating the data encryption method performed by a terminal device according to some embodiments of this application;
[0025] Figure 6 This is a schematic diagram of the functional module structure configured in a terminal device provided in some embodiments of this application;
[0026] Figure 7 This is a schematic diagram illustrating the effect of an encoder performing integer encoding as provided in some embodiments of this application;
[0027] Figure 8 A schematic diagram illustrating the process of performing integer encoding on initial data to obtain an initial integer, provided for some embodiments of this application;
[0028] Figure 9 A schematic diagram illustrating the process of a combiner combining an initial integer and a secure random number to obtain a combined random integer, provided in some embodiments of this application;
[0029] Figure 10 A schematic diagram illustrating the effect of a combiner provided in some embodiments of this application combining an initial integer and a secure random number to obtain a combined random integer;
[0030] Figure 11 A schematic diagram illustrating the process of a combiner that combines an initial integer and a secure random number to obtain a combined random integer, provided in some other embodiments of this application;
[0031] Figure 12 A schematic diagram illustrating the effect of a combiner provided in other embodiments of this application combining an initial integer and a secure random number to obtain a combined random integer;
[0032] Figure 13 This is a schematic diagram illustrating the process of performing masking processing on concatenated random integers to obtain new random integers, provided in some embodiments of this application.
[0033] Figure 14 A flowchart illustrating the process of obtaining a new random integer based on the insertion position of a static mask, provided for some embodiments of this application;
[0034] Figure 15 This application provides schematic diagrams of static mask insertion and process integer grouping for some embodiments;
[0035] Figure 16 This is a schematic diagram illustrating the masking and grouping operation on process integers provided in some embodiments of this application;
[0036] Figure 17 This is a schematic diagram illustrating the process of configuring different dynamic random masks for packet data in a terminal device provided in some embodiments of this application. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of some embodiments of this application clearer, the technical solutions of some embodiments of this application will be clearly and completely described below with reference to specific embodiments and corresponding drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0038] It should be noted that the brief descriptions of terms in some embodiments of this application are only for the convenience of understanding the implementation methods described below, and are not intended to limit the implementation methods of some embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0039] In some embodiments of this application, the terms "first," "second," "third," etc., in the specification, claims, and accompanying drawings are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms can be used interchangeably where appropriate.
[0040] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0041] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0042] Figure 1 This is a schematic diagram illustrating an operational scenario between a terminal device and a control device provided in some embodiments of this application. For example... Figure 1 As shown, a user can operate a terminal device 200 via a mobile terminal 300 and a control device 100.
[0043] In some embodiments, the mobile terminal 300 can install software applications with the terminal device 200 to establish a connection and communication via a network communication protocol, thereby achieving one-to-one control operation and data communication. Alternatively, audio and video content displayed on the mobile terminal 300 can be transmitted to the terminal device 200 to achieve synchronous display.
[0044] like Figure 1The document also shows that terminal device 200 can communicate with server 400 via various communication methods. Terminal device 200 can communicate via local area network (LAN), wireless local area network (WLAN), and other networks.
[0045] In addition to providing broadcast television reception functions, terminal device 200 can also be equipped with intelligent network television functions that provide computer support, including but not limited to network television, smart television, Internet Protocol television (IPTV), etc.
[0046] Figure 2 Provided for some embodiments of this application Figure 1 Hardware configuration block diagram of terminal device 200.
[0047] In some embodiments, the terminal device 200 includes at least one of a tuner 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a memory, a power supply, and a user interface.
[0048] In some embodiments, the detector 230 is used to collect signals from the external environment or to interact with the outside world.
[0049] In some embodiments, the display 260 includes a display screen component for presenting an image, a driving component for driving image display, a component for receiving image signals output from a controller, and a user control UI interface, etc.
[0050] In some embodiments, the communicator 220 is a component for communicating with external devices or the server 400 according to various communication protocol types.
[0051] In some embodiments, the controller 250 controls the operation of the terminal device and responds to user operations through various software control programs stored in the memory. The controller 250 controls the overall operation of the terminal device 200.
[0052] In some embodiments, a user can input user commands through a graphical user interface (GUI) displayed on a display 260, and the user input interface receives user input commands through the graphical user interface (GUI).
[0053] In some embodiments, user interface 280 is an interface that can be used to receive control input.
[0054] Figure 3 Provided for some embodiments of this application Figure 1 Hardware configuration block diagram of the central control device. (Example) Figure 3As shown, the control device 100 includes a controller 110, a communication interface 130, a user input / output interface, a memory, and a power supply.
[0055] The control device 100 is configured to control the terminal device 200, and can receive user input operation commands and convert the operation commands into commands that the terminal device 200 can recognize and respond to, thus acting as an intermediary for interaction between the user and the terminal device 200.
[0056] In some embodiments, the control device 100 may be an intelligent device. For example, the control device 100 may be equipped with various applications of the control terminal device 200 according to user needs.
[0057] In some embodiments, such as Figure 1 As shown, the mobile terminal 300 or other smart electronic devices can perform similar functions to the control device 100 after the application of the control terminal device 200 is installed.
[0058] The controller 110 includes a processor unit 112, RAM 113 and ROM 114, a communication interface 130, and a communication bus. The controller 110 is used to control the operation of the control device 100, as well as the communication and cooperation between internal components and the external and internal data processing functions.
[0059] Under the control of the controller 110, the communication interface 130 enables communication of control signals and data signals with the terminal device 200. The communication interface 130 may include at least one of other near-field communication modules such as WiFi chip 131, Bluetooth module 132, and NFC module 133.
[0060] User input / output interface 140, wherein the input interface includes at least one of other input interfaces such as microphone 141, touchpad 142, sensor 143, button 144, etc.
[0061] In some embodiments, the control device 100 includes at least one of a communication interface 130 and an input / output interface 140. The control device 100 is configured with the communication interface 130, such as a WiFi, Bluetooth, or NFC module, which can encode user input commands via WiFi, Bluetooth, or NFC protocols and send them to the terminal device 200.
[0062] The memory 190 is used to store various operating programs, data, and applications for driving and controlling the control device 100 under the control of the controller. The memory 190 can also store various control signal instructions input by the user.
[0063] The power supply 180 is used to provide operating power support for the various components of the control device 100 under the control of the controller.
[0064] Figure 4 Provided for some embodiments of this application Figure 1 The diagram illustrates the software configuration in a terminal device. In some embodiments, the system is divided into four layers, from top to bottom: the Applications layer (referred to as the "Application Layer"), the Application Framework layer (referred to as the "Framework Layer"), the System Library layer (referred to as the "System Runtime Library Layer"), and the Kernel layer.
[0065] In some embodiments, at least one application runs in the application layer. These applications may be Windows programs that come with the operating system, system settings programs, clock programs, camera applications, etc., or they may be applications developed by third-party developers.
[0066] The framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer includes predefined functions. It acts as a central processing unit, determining the actions taken by applications within the application layer.
[0067] like Figure 4 As shown, in some embodiments of this application, the application framework layer includes managers, content providers, and a view system. The managers include at least one of the following modules: an Activity Manager for interacting with all activities running in the system; a Location Manager for providing system services or applications with access to system location services; a Package Manager for retrieving various information related to application packages currently installed on the device; a Notification Manager for controlling the display and clearing of notification messages; and a Window Manager for managing icons, windows, toolbars, wallpapers, and desktop widgets on the user interface.
[0068] In some embodiments, the Activity Manager is used to: manage the lifecycle of individual applications and the usual navigation back functionality.
[0069] In some embodiments, the window manager is used to manage all window programs.
[0070] In some embodiments, the system runtime library layer provides support for the upper layer, namely the framework layer. When the framework layer is accessed, the operating system runs the C / C++ libraries contained in the system runtime library layer to implement the functions that the framework layer needs to perform.
[0071] In some embodiments, the kernel layer is a layer between hardware and software. For example... Figure 4 As shown, the kernel layer includes at least one of the following drivers: audio driver, display driver, Bluetooth driver, camera driver, WIFI driver, USB driver, HDMI driver, sensor driver (such as fingerprint sensor, temperature sensor, touch sensor, pressure sensor, etc.).
[0072] In some embodiments, the kernel layer also includes a power driver module for power management.
[0073] In some embodiments, Figure 4 The software programs and / or modules corresponding to the software architecture in the document are stored in [the relevant database]. Figure 2 or Figure 3 In the first or second memory shown.
[0074] Based on the aforementioned terminal device 200, specific display images can be output. Taking a smart TV as an example, users can use the video player installed on the smart TV to watch various media resources on the network, such as movies, TV series, videos, and other media resources. Simultaneously, the terminal device 200 can also present various user interfaces.
[0075] In application scenarios of smart TVs and other terminal devices, various types of data need to be transmitted. For example, data transmission can occur between terminal devices, between terminal devices and servers, and between various functional modules deployed within a terminal device. For instance, when terminal device A interacts with terminal device B, terminal device A can transmit its internal data to terminal device B, and similarly, terminal device B can transmit its internal data to terminal device A. It is understandable that when multiple functional modules are deployed in terminal device 200, data interaction also exists between these modules.
[0076] In some embodiments, data transmission can be categorized into encrypted and unencrypted transmission. Encrypted transmission is a method used to protect the security of data transmission. The sender can use specific encryption techniques to encrypt data before sending it to the receiver. Only the sender and receiver can access and decrypt the data. Encryption algorithms can include symmetric and asymmetric encryption. Symmetric encryption uses a single-key cryptosystem, where the same key can be used for both encryption and decryption. For example, the Advanced Encryption Standard (AES) is an example of symmetric encryption. Asymmetric encryption, on the other hand, uses a pair of encryption and decryption keys. Once data is encrypted with the encryption key, it can only be decrypted using the corresponding decryption key. For example, RSA is an example of asymmetric encryption. Both symmetric and asymmetric encryption can encrypt data, thereby improving data security.
[0077] However, while the aforementioned encryption algorithms can improve data security, their extensive use can lead to performance degradation in terminal devices due to the significant computational demands of symmetric and asymmetric encryption algorithms. Therefore, some data is transmitted unencrypted. For example, short data can be transmitted without encryption. However, unencrypted transmission results in low security and vulnerability to interception because the transmitted data is not encrypted.
[0078] To address the issue of low data security during data transmission, some embodiments of this application provide a terminal device 200, which includes a controller 250 and a communicator 220 for establishing a communication connection with a data receiver. The terminal device 200 can encrypt the initial data transmitted by the sender into one or more integers for transmission, while simultaneously randomizing the initial data. This ensures that the encrypted result is different each time, preventing data interception or leakage. Furthermore, relevant parameters can be adjusted during the encryption process to adapt to the characteristics of different communication data.
[0079] To facilitate understanding of the technical solutions in some embodiments of this application, the steps are described in detail below with reference to some specific embodiments and accompanying drawings. Figure 5 This is a flowchart illustrating the data encryption method performed by a terminal device according to some embodiments of this application, such as... Figure 5 As shown, when performing data encryption, the terminal device 200 may include the following steps S1-S4, the specific contents of which are as follows:
[0080] Step S1: The terminal device 200 acquires initial data and performs integer encoding on the initial data to obtain an initial integer.
[0081] To enable the terminal device 200 to perform the data encryption process, multiple functional modules can be deployed within the terminal device 200. For example, see [link to example]. Figure 6 , Figure 6 This is a schematic diagram of the functional module structure configured in a terminal device provided in some embodiments of this application. In some embodiments, the terminal device 200 may be configured with an encoder 201, a random number generator 202, a combiner 203, and a mask 204. The encoder 201 is used to digitize and encode the initial data, encoding it into one or more integers according to the actual business needs, with the aim of shortening the length of the initial data as much as possible with minimal computation. The random number generator 202 is used to generate secure random numbers of arbitrary length. The combiner 203 is used to combine the secure random number and the integer output by the encoder 201 according to predetermined rules to form a new random integer. The mask 204 is used to mask the random integer generated by the combiner 203 according to rules. The specific functions performed by each functional module will be described in detail below.
[0082] In some embodiments, the encoder 201 performs integer encoding on the initial data. Figure 7 This is a schematic diagram illustrating the effect of the encoder performing integer encoding according to some embodiments of this application, such as... Figure 7 As shown, after inputting initial data of arbitrary length into encoder 201, one or more integers can be output after encoding by encoder 201. For example, the output integers can be fixed-length integers, such as 64-bit or 32-bit integers. When performing specific integer encoding, encoder 201 can use various algorithms, including common encoding methods and custom encoding schemes based on the actual characteristics of the initial data. For example, compression algorithms such as zip and rar can be used to save storage space, followed by data segmentation. This application does not specifically limit this approach.
[0083] It should be noted that during the transmission of initial data, the data sending and receiving modules must use the same encoding scheme so that the data receiver can decode the data according to the same encoding rules. For example, when performing integer encoding on the initial data, the length information of the initial data can first be obtained. Then, integer encoding can be performed on the initial data according to the length information and preset encoding rules to generate an initial integer of fixed length.
[0084] Figure 8This application provides schematic diagrams illustrating the process of performing integer encoding on initial data to obtain an initial integer, as shown in some embodiments. Figure 8 As shown, the terminal device 200 can first traverse the strings and non-strings in the initial data, then obtain the correspondence between the strings and the encoded numbers according to the preset base encoding form, then encode the strings according to the correspondence to form string integers, and finally generate the initial integer based on the non-strings and string integers.
[0085] For example, taking the initial data as HIGH, this initial data contains four strings: H, I, G, and H. In some embodiments, referring to Table 1, the initial data and the encoded numbers can have the following correspondence:
[0086]
[0087] As shown in Table 1, the encoded numbers for strings H, I, G, and H' are 17 for H, 18 for I, and 16 for G. The encoded numbers for each string can be converted to base-36 as follows:
[0088] "HIGH" = 17 * 36 3 +18*36 2 +16*36+17=817073=0xC77B1;
[0089] The encoded string “HIGH” corresponds to the integer 817073. It can be understood that in this example, all strings are strings, so the integer string is the final initial integer.
[0090] In some embodiments, the initial data may include multiple letters and numbers, in which case the calculation can be performed in the same way as described above. For example, in Table 1, when the initial data is 0, its corresponding encoded number is also 0; when the initial data is 1, its corresponding encoded number is also 1. Referring to the calculation method described above, the integers corresponding to non-strings can also be calculated, and finally, the initial integer is generated based on the non-string and string integers. After step S1 is completed, step S2 can be performed.
[0091] Step S2: Terminal device 200 obtains a secure random number of arbitrary length.
[0092] In some embodiments, the terminal device 200 may be equipped with a random number generator 202 to generate secure random numbers of arbitrary length. For example, the random number generator 202 may generate a specified number of random numbers, such as secure random numbers, based on the specific characteristics of the initial data. These secure random numbers can then be combined with the initial data or subjected to other operations to enhance the security of the initial data. After step S2 is completed, step S3 can be executed.
[0093] Step S3: Terminal device 200 combines the initial integer and the secure random number to obtain a combined random integer.
[0094] To enhance the security of initial data during transmission, terminal device 200 may be equipped with a combiner 203. The combiner 203 combines the secure random number generated by random number generator 202 and the initial integer output by encoder 201 according to predetermined rules to form a combined random integer, thereby improving the security of the initial data. Through this combination process, the initial integer and the secure random number can be merged into a larger integer.
[0095] It should be noted that certain concatenation rules need to be defined before performing the concatenation. For example, these rules can be defined based on the actual situation of the initial data or the needs of the data sender and receiver. These rules must be consistent between the data sending and receiving modules. The concatenation process is further described below.
[0096] Figure 9 This is a schematic diagram illustrating the process of a combiner in some embodiments of this application combining an initial integer and a secure random number to obtain a combined random integer, as shown below. Figure 9 As shown, when merging an initial integer and a secure random number, the merger 203 in the terminal device 200 first iterates through the initial integer and the secure random number to obtain the first bit occupancy of the initial integer and the second bit occupancy of the secure random number. The first bit occupancy can be understood as all the bits occupied by the initial integer, and the second bit occupancy can be understood as all the bits occupied by the secure random number. After determining the first and second bit occupancy, the merge occupancy of the merged random integer can be obtained based on the first and second bit occupancy. It can be understood that the merge occupancy can be the sum of the first and second bit occupancy. Then, the occupancy positions of all bits of the merged random integer are determined based on the merge occupancy. Finally, the bits of the initial integer and the bits of the secure random number are interleaved and added to the occupancy positions according to a preset merging rule to generate the merged random integer.
[0097] For example, the initial integer received by the combiner 203 from the encoder 201 can be Mn, and the secure random number received from the random number generator 202 can be Rn. During the combining process, the position of each bit of the initial integer Mn and each bit of the secure random number Rn in the combined random integer can be defined in the form of bits.
[0098] In some embodiments, each bit of the initial integer Mn and the secure random number Rn can be interleaved into each bit of the concatenated random integer. Taking the concatenated random integer Kn as an example... Figure 10 This is a schematic diagram illustrating the effect of the combiner provided in some embodiments of this application combining an initial integer and a secure random number to obtain a combined random integer, such as... Figure 10 As shown, the binary representation of the initial integer Mn can be 1100, and the binary representation of the secure random number Rn can be 0101. The preset concatenation rules can be customized according to actual needs.
[0099] For example, the preset concatenation rule can be An, represented as 1010. The concatenation order can be defined in the preset concatenation rule. For instance, 1 indicates that when interleaving the initial integer Mn and the secure random number Rn, the bits of the secure random number Rn are placed before the initial integer Mn; 0 indicates that the bits of the secure random number Rn are placed after the initial integer Mn. Thus, when interleaving the initial integer Mn and the secure random number Rn into the bit placeholders of the concatenated random integer Kn, they can be inserted bit by bit according to this rule. It should be noted that the above is only an example of the concatenation rule and does not constitute a limitation.
[0100] When the combiner 203 executes the combining process, it first iterates through the initial integer Mn and the secure random number Rn. This allows it to determine the number of bits to be used in combining the random integer Kn. In the above embodiment, the initial integer Mn is 1100, the secure random number Rn is 0101, and the preset combining rule is 1010, where 1 indicates that the bits of the secure random number Rn are placed before the initial integer Mn, and 0 indicates that the bits of the secure random number Rn are placed after the initial integer Mn.
[0101] In the specific concatenation process, when determining the first two bits of the concatenated random integer Kn, the corresponding rule number is 1. Therefore, the first two bits of the concatenated random integer Kn should be the first bit "0" of the secure random number Rn followed by the first bit "1" of the initial integer Mn. Similarly, when determining the third and fourth bits of the concatenated random integer Kn, the corresponding rule number is 0. Therefore, the third and fourth bits of the concatenated random integer Kn should be the second bit "1" of the secure random number Rn followed by the second bit "1" of the initial integer Mn. First, when determining the fifth and sixth bits of the combined random integer Kn, if the corresponding rule number is 1, then the fifth and sixth bits of the combined random integer Kn should be the third bit "0" of the secure random number Rn first, and the third bit "0" of the initial integer Mn second; when determining the seventh and eighth bits of the combined random integer Kn, if the corresponding rule number is 0, then the seventh and eighth bits of the combined random integer Kn should be the fourth bit "1" of the secure random number Rn second, and the fourth bit "0" of the initial integer Mn first, as follows. Figure 10 As shown. In this way, the bits of the initial integer Mn and all the bits of the secure random number Rn can be interleaved into the corresponding placeholder positions according to the preset concatenation rules to generate the final concatenated random integer Kn.
[0102] Figure 11 This application provides schematic diagrams illustrating the process of a combiner combining an initial integer and a secure random number to obtain a combined random integer in other embodiments of the present application. Figure 11 As shown, when the concatenator 203 in the terminal device 200 concatenates the initial integer and the secure random number, it iterates through the initial integer and the secure random number to obtain the first bit placeholder of the initial integer and the second bit placeholder of the secure random number. After obtaining the concatenation placeholder of the concatenated random integer based on the first bit placeholder and the second bit placeholder, the terminal device 200 can generate a placeholder sequence for the concatenated random integer based on the concatenation placeholder. This placeholder sequence can be generated randomly or according to certain rules, which is not limited in this application. After generating the placeholder sequence, the storage positions of the bits of the initial integer and the secure random number are determined according to the placeholder sequence to generate the concatenated random integer.
[0103] For example, the position of each bit of the initial integer Mn and the secure random number Rn in the concatenated random integer Kn can be specified by a pre-generated placeholder sequence. It is understood that the rules used during the transmission of the concatenated random integer should be consistent between the data sending module and the transmission module.
[0104] In some embodiments, each bit of the initial integer Mn and the secure random number Rn can be stored in the form of an array. Figure 12 This is a schematic diagram illustrating the effect of the combiner in other embodiments of this application combining an initial integer and a secure random number to obtain a combined random integer, such as... Figure 12 As shown, each bit of the concatenated random integer Kn can be numbered. Taking an initial integer Mn and a secure random number Rn as 32-bit integers as an example, their numbering range is 0 to 63, thus generating a non-repeating placeholder sequence in the range of 0 to 63. In one implementation, a bit storage rule can be set. For example, the 0th bit of the initial integer Mn can be stored in the 1st bit of the concatenated random integer Kn, the 1st bit of Mn can be stored in the 2nd bit of the concatenated random integer Kn, and so on. After the initial integer Mn is stored, each bit of the secure random number Rn is stored according to the sequence. After all bits are stored, the concatenation process of the concatenated random integer Kn is completed. After step S3 is completed, step S4 can be executed.
[0105] Step S4: The terminal device 200 performs masking processing on the concatenated random integers to obtain new random integers, and transmits the new random integers as the target data to the data receiver.
[0106] To further enhance the security of the initial data, in some embodiments, the terminal device 200 may also perform masking processing on the concatenated random integer to obtain a new random integer, and transmit the new random integer as the target data to the data receiver, thereby further enhancing the security of the initial data during transmission.
[0107] Figure 13 This is a flowchart illustrating the process of performing masking processing on concatenated random integers to obtain new random integers, as provided in some embodiments of this application. Figure 13 As shown, the terminal device 200 can first determine the insertion position of the static mask based on the placeholder number of the combined random integer. This static mask can also be a random integer. The purpose of inserting the static mask is to further enhance the security of the initial data. After the insertion position is determined, a static mask with a preset number of bits is obtained. The specific number of bits can be determined based on the actual situation of the initial data, the data usage scenario, user needs, and other factors. Finally, the static mask is inserted based on the insertion position to obtain a new random integer.
[0108] In some embodiments, the masker 204 can perform masking processing on the concatenated random integer. Before performing masking processing, the random number generator 202 can generate an N1-bit random number, such as a static mask, where the length of N1 can be arbitrarily specified; however, N1 is usually no greater than the length of the integer output by the concatenator 203. After the length of the static mask is determined, the insertion position of the static mask can be determined based on the concatenation placeholder of the concatenated random integer. Taking the insertion position as Nk as an example and the static mask as Mk as an example, when defining the static mask Mk, the static mask can be any N1-bit integer. Finally, the static mask is inserted based on the insertion position to obtain a new random integer.
[0109] Figure 14 This application provides a flowchart illustrating the process of obtaining a new random integer by inserting a static mask based on the insertion position in some embodiments, such as... Figure 14 As shown, when the terminal device 200 inserts a static mask based on the insertion position, it can first obtain the process integer after inserting the static mask, then group the process integer according to a preset bit length such as N to obtain group data, then obtain a dynamic random mask with a preset number of bits, and finally perform an XOR mapping operation on the group data according to the dynamic random mask to obtain the final new random integer.
[0110] In some embodiments, when determining the insertion position of the static mask, a preset bit length for grouping the procedural integers can first be obtained. Then, the bit occupant corresponding to the insertion position is set to a multiple of the preset bit length, and the static mask is inserted according to the insertion position corresponding to that bit occupant. That is, the insertion position Nk should be an integer multiple of the preset bit length N. In some embodiments, the length N1 of the static mask can be equal to the preset bit length N, and this application does not specifically limit this. The process of inserting the static mask and generating a new random integer are described below with reference to practical examples.
[0111] For example, when inserting a static mask, a static mask value Mk can first be inserted at the Nk-th bit position of the concatenated random integer Kn output by the concatenator 203 to obtain a process integer Km, where Nk should be an integer multiple of the preset bit length N. Then, the process integer Km is split into m bit sequences of length N. In some embodiments, bit positions that are not integer multiples of N can be padded with 0.
[0112] Figure 15 This is a schematic diagram of static mask insertion and process integer grouping provided in some embodiments of this application, such as... Figure 15 As shown, taking N=4 as an example, meaning the preset bit length is 4, and the data is divided into groups of 4 bits each. Therefore, when inserting the static mask Mk, it can be inserted at the 4th bit position of the concatenated random integer Kn. It should be noted that... Figure 15The example only shows grouping according to a preset bit length of 4, with the static mask inserted at position Nk=4. In real-world scenarios, there can be various grouping methods, and the mask can also be inserted into placeholder sequences that are multiples of the preset bit length N; this application does not impose any specific limitations on this. Thus, different grouping methods result in different positions for the static mask, leading to different generated process integers and the final new random integer. This ensures the randomness of the result after each encryption, thereby improving data security.
[0113] Figure 16 This is a schematic diagram illustrating the masking and grouping operation on process integers provided in some embodiments of this application, such as... Figure 16 As shown, after inserting a static mask value Mk at the Nk-th bit position of the concatenated random integer Kn to obtain the process integer Km, the process integer Km is split into m bit sequences of length N, where m is a positive integer. For each bit sequence, a segment-by-segment XOR operation can be performed. For example, a dynamic random mask Mr can be used to perform an XOR mapping operation on each group of data. In some embodiments, the binary form of the dynamic random mask Mr can be 1010. After performing the XOR mapping operation on each group of data, a new randomized random integer Mk is obtained.
[0114] It should be noted that after randomizing the initial data according to the processing method of the above embodiments, the processing result of the initial data is different each time, which can ensure the security of the initial data during transmission. For example, when the terminal device 200 needs to send a request to the server, it needs to transmit the request to the server through a Uniform Resource Locator (URL), and the request will include some parameter information. For example, the initial data transmitted by the terminal device 200 is: https: / / hostname / request?param1=msgA param2=msgB. However, during transmission, for some sensitive data, such as user accounts, user passwords, or other data related to important scenarios, it is not desirable for them to be intercepted or discovered by third parties during transmission. Therefore, based on the technical solution of this application, the above-mentioned initial data can be randomly processed.
[0115] For example, in the initial data above, the parameters are msgA and msgB. Using the technical solution of this application, the result of the first randomization is https: / / hostname / request?1234=12345678&5678=12345678, and the result of the second randomization is https: / / hostname / request?4321=987654321&8765=987654321. As can be seen from the two processing results, the same parameters msgA and msgB become completely different random integers after randomization. Therefore, even if the initial data is intercepted by a third party during transmission, it is impossible to analyze the data pattern and thus impossible to parse the content of the initial data before randomization, thereby ensuring the security of the initial data.
[0116] It should be noted that in the aforementioned embodiments, due to differences in the concatenation rules, mask positions, and static mask values, the resulting new random integers are also different. If any of these parameters changes, the final generation result will change. Therefore, the technical solution of this application can guarantee the randomness of the new random integer. Furthermore, the entire calculation process requires minimal computation, thus ensuring the security of the initial data while maintaining the performance of the terminal device.
[0117] As can be seen from the above technical solutions, after obtaining initial data, the terminal device 200 provided in the above embodiments can perform integer encoding on the initial data to obtain an initial integer; then, it obtains a secure random number of arbitrary length and combines the initial integer and the secure random number to obtain a combined random integer; then, it performs masking processing on the combined random integer to obtain a new random integer, which is then transmitted to the data receiver as the target data. Through the technical solution of this application, the initial data transmitted by the sender can be encrypted into a random integer for transmission. By randomizing the initial data, the result after each encryption is different, which can prevent the initial data from being intercepted or leaked, ensuring the security of the initial data. Simultaneously, during the encryption process, relevant parameters can be adjusted to ensure the randomness of the result, thereby solving the problem of low data security during data transmission.
[0118] To enhance security during initial data transmission, in some embodiments, the terminal device 200 may further extend the preset bit length of the process integer packets and use a wider range of random masks. For example, the above describes a preset bit length of 4 bits; however, it can also be 6 bits, 8 bits, or other bit lengths.
[0119] To enhance security during the initial data transmission process, the terminal device 200 can also configure different dynamic random masks for the packet data. Figure 17 This application provides schematic diagrams illustrating the process of configuring different dynamic random masks for packet data in terminal devices according to some embodiments, such as... Figure 17 As shown, in some embodiments, the terminal device 200 can traverse all the packet data, then configure a different dynamic random mask for each packet data, and set separate derivation rules for each dynamic random mask. This further ensures the randomness of the final random integer, thus further improving the security of the initial data transmission process.
[0120] In some embodiments, after the terminal device 200 sends the initial data to the data receiver in the aforementioned randomly encrypted form, the receiver can perform reverse processing to decrypt and obtain the initial data. It should be noted that the receiver can only successfully decrypt the initial data if both communicating parties agree on and establish the same rules in advance.
[0121] For example, the receiver can obtain the value of the random mask used in this encryption by using the inverse operation of dynamic masking, based on the position and value of the static mask. Then, according to the random mask and a preset grouping method, the receiver performs an inverse masking operation on each group of encrypted data to obtain a randomly concatenated integer value. Next, using a pre-agreed random concatenation rule, the receiver decrypts the initial integer before concatenation. Finally, using a pre-agreed encoding method, the receiver performs an inverse encoding operation on the encoded initial integer to obtain the initial data transmitted by both parties.
[0122] This application also provides a data encryption method in some embodiments, which corresponds to the terminal device 200 in the foregoing embodiments and can be applied to the terminal device 200 in the foregoing embodiments. The terminal device 200 may include a controller 250 and a communicator 220 for establishing a communication connection with a data receiver. In some embodiments, a data encryption method may include the following steps:
[0123] Terminal device 200 acquires initial data and performs integer encoding on the initial data to obtain an initial integer. In some embodiments, encoder 201 can be used to perform integer encoding on the initial data. After inputting initial data of arbitrary length into encoder 201, one or more integers can be output after encoding by encoder 201.
[0124] Terminal device 200 obtains a secure random number of arbitrary length. In some embodiments, terminal device 200 may be equipped with a random number generator 202 to generate secure random numbers of arbitrary length.
[0125] Terminal device 200 combines an initial integer and a secure random number to obtain a combined random integer. To enhance the security of the initial data during transmission, terminal device 200 may be equipped with a combiner 203. This combiner 203 combines the secure random number generated by random number generator 202 and the initial integer output by encoder 201 according to predetermined rules to form a combined random integer, thereby improving the security of the initial data through the combining process. By combining the initial integer and the secure random number, the two integers can be combined into a larger integer.
[0126] Terminal device 200 performs masking processing on the concatenated random integers to obtain new random integers, which are then transmitted to the data receiver as the target data. To further enhance the security of the initial data, in some embodiments, terminal device 200 can also perform masking processing on the concatenated random integers to obtain new random integers, which are then transmitted to the data receiver as the target data, thereby further enhancing the security of the initial data during transmission. Because different concatenation rules, mask positions, and static mask values result in different newly generated random integers, the final generated result will change if any of these parameters change. Therefore, the randomness of the new random integers can be guaranteed through the technical solution of this application. Simultaneously, the entire calculation process requires minimal computation, thus ensuring the security of the initial data while maintaining the performance of terminal device 200.
[0127] As can be seen from the above technical solutions, the data encryption method in the above embodiments can encrypt the initial data transmitted by the sender into random integers for transmission. By randomizing the initial data, the result after each encryption is different, which can prevent the initial data from being intercepted or leaked, and ensure the security of the initial data. At the same time, during the encryption process, relevant parameters can be adjusted to ensure the randomness of the result, thereby solving the problem of low data security during data transmission.
[0128] The same or similar parts between the various embodiments in this specification can be referred to mutually, and will not be repeated here.
[0129] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or certain parts of the embodiments of the present invention.
[0130] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0131] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
Claims
1. A terminal device, characterized in that, include: A communicator is configured to establish a communication connection with a data receiver. The controller is configured as follows: Obtain initial data, and perform integer encoding on the initial data to obtain an initial integer; Get a safe random number of any length; Combine the initial integer and the secure random number to obtain the combined random integer; The concatenated random integer is masked to obtain a new random integer, which is then used as the target data transmission data to the data receiver. The controller performs the concatenation of the initial integer and the secure random number to obtain a concatenated random integer, which is further configured as follows: Iterate through the initial integer and the secure random number to obtain the first bit occupancy of the initial integer and the second bit occupancy of the secure random number; The concatenation occupancy of the concatenated random integer is obtained based on the first bit occupancy and the second bit occupancy. The position of each bit in the combined random integer is determined based on the number of bits to be combined. The bits of the initial integer and the bits of the secure random number are interleaved and added to the placeholder positions according to a preset concatenation rule to generate a concatenated random integer; Alternatively, a placeholder sequence of randomly combined integers can be generated based on the combined placeholders; The positions for storing the bits of the initial integer and the secure random number are determined based on the placeholder sequence to generate a concatenated random integer.
2. The terminal device according to claim 1, characterized in that, The step of performing integer encoding on the initial data to obtain an initial integer is further configured as follows: Obtain the length information of the initial data; The initial data is encoded into integers according to the length information and preset encoding rules to generate an initial integer of fixed length.
3. The terminal device according to claim 1, characterized in that, The step of performing integer encoding on the initial data to obtain an initial integer is further configured as follows: Iterate through the string and non-string data in the initial data; The correspondence between the string and the encoded number is obtained according to the preset base encoding format; The string is encoded according to the correspondence to form a string integer; The initial integer is generated based on the non-string and the string integer.
4. The terminal device according to claim 1, characterized in that, The step of performing masking processing on the concatenated random integer to obtain a new random integer, as described by the controller, is further configured as follows: The insertion position of the static mask is determined based on the placeholder number of the concatenated random integer; Obtain a static mask with a preset number of bits; The static mask is inserted based on the insertion position to obtain a new random integer.
5. The terminal device according to claim 4, characterized in that, The controller's step of inserting the static mask based on the insertion position to obtain a new random integer is further configured as follows: Obtain the process integer after inserting the static mask; The process integers are grouped according to a preset bit length to obtain grouped data; Obtain a dynamic random mask with a preset number of bits; Perform an XOR mapping operation on the grouped data according to the dynamic random mask to obtain a new random integer.
6. The terminal device according to claim 5, characterized in that, The controller is further configured to: Obtain the preset bit length; Set the bit occupancy corresponding to the insertion position to a multiple of the preset bit length; The static mask is inserted at the insertion position corresponding to the bit occupancy.
7. The terminal device according to claim 5, characterized in that, The controller is further configured to: Iterate through the grouped data; Configure different dynamic random masks for the grouped data, and set separate derivation rules for the dynamic random masks.
8. A method for data encryption, characterized in that, include: Obtain initial data, and perform integer encoding on the initial data to obtain an initial integer; Get a safe random number of any length; Combine the initial integer and the secure random number to obtain the combined random integer; The concatenated random integer is masked to obtain a new random integer, which is then used as the target data transmission data to the data receiver. The controller performs a concatenation of the initial integer and the secure random number to obtain a concatenated random integer, which is further configured as follows: Iterate through the initial integer and the secure random number to obtain the first bit occupancy of the initial integer and the second bit occupancy of the secure random number; The concatenation occupancy of the concatenated random integer is obtained based on the first bit occupancy and the second bit occupancy. The position of each bit in the combined random integer is determined based on the number of bits to be combined. The bits of the initial integer and the bits of the secure random number are interleaved and added to the placeholder positions according to a preset concatenation rule to generate a concatenated random integer; Alternatively, a placeholder sequence of randomly combined integers can be generated based on the combined placeholders; The positions for storing the bits of the initial integer and the secure random number are determined based on the placeholder sequence to generate a concatenated random integer.
Citation Information
Patent Citations
Data processing method and apparatus, system and computer readable storage medium
CN107786331A
Data encryption method, decryption method and apparatus
WO2016206504A1