Terminal device data encryption method and apparatus, computer device, and medium
By using custom plug-in components for serial port connection with the host computer, handshake verification, and encryption algorithms, the problem of serial port data leakage in terminal devices was solved, thus improving data security performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2026-03-20
AI Technical Summary
In existing terminal devices, serial port data is not encrypted during debugging, making it vulnerable to malicious intrusion or tampering, posing a data leakage security risk.
A custom plug-in component is used to establish a serial port connection with the host computer. User key information is obtained through handshake verification to determine the target log level. The target log data is encrypted and transmitted using a preset encryption algorithm, and hardware design is used to prevent eavesdropping.
It improves the data security performance of terminal devices, prevents serial port data leakage and tampering, and enhances information protection capabilities.
Smart Images

Figure CN114817963B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data security, and particularly relates to a terminal device data encryption method and device, computer equipment and medium. BACKGROUND
[0002] With the development of Internet of Vehicles technology, the application quantity and performance requirements of vehicle terminal devices are gradually improved. When the terminal device is debugged, the host computer configures or functionally debugs the terminal device through serial port debugging software, and displays the log information of the terminal device on the host computer to realize debugging and troubleshooting.
[0003] In the existing terminal debugging system, the terminal device is usually connected with the host computer through a standard serial port, and the system does not encrypt the serial port data. The standardization design of the serial port is prone to malicious intrusion or tampering, and there are security risks such as data leakage, which affects the data security performance. SUMMARY
[0004] The present application provides a terminal device data encryption method, device, computer equipment and medium, which realizes the terminal serial port information anti-interception function by combining serial port hardware design and software encryption transmission, and improves the terminal data security performance.
[0005] According to an aspect of the present application, a terminal device data encryption method is provided, wherein the terminal device establishes a serial port connection with a host computer by using a self-defined plug-in component. The method comprises the following steps:
[0006] Detecting the connection state of the self-defined plug-in component and the host computer;
[0007] Performing handshake verification with the host computer;
[0008] Obtaining user secret key information in the handshake confirmation message, and determining target log level and target log data corresponding to the target log level according to the user secret key information, wherein the target log level and the secret key level of the user secret key information correspond one by one;
[0009] Encrypting the target log data by using a preset encryption algorithm, and sending the encrypted ciphertext to the host computer, so that the host computer performs log printing.
[0010] According to another aspect of the present application, there is provided a terminal device data encryption apparatus for implementing the terminal device data encryption method, the apparatus comprising: a custom plug-in component, a connection state detection unit, a handshake verification execution unit, a log data extraction unit and a data encryption unit; the custom plug-in component is configured to serially connect the terminal device and the host computer; the connection state detection unit is configured to detect the connection state of the custom plug-in component and the host computer; the handshake verification execution unit is configured to perform handshake verification with the host computer; the log data extraction unit is configured to obtain user secret key information in a handshake confirmation message, and determine a target log level and target log data corresponding to the target log level according to the user secret key information, the target log level corresponding to the secret key level of the user secret key information in one-to-one manner; and the data encryption unit is configured to encrypt the target log data using a preset encryption algorithm, and send the encrypted ciphertext to the host computer, so that the host computer performs log printing.
[0011] According to another aspect of the present application, there is provided a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the terminal device data encryption method when executing the program.
[0012] According to another aspect of the present application, there is provided a computer readable storage medium having a computer program stored thereon, wherein the program is executable on a processor to implement the terminal device data encryption method.
[0013] The technical scheme of the embodiments of the present application, the terminal device uses a custom plug-in component to establish a serial connection with a host computer, and implements a data encryption method, which detects the connection state of the custom plug-in component and the host computer, performs handshake verification with the host computer, obtains user secret key information in a handshake confirmation message, and determines a target log level and target log data corresponding to the target log level according to the user secret key information, the target log level corresponding to the secret key level of the user secret key information in one-to-one manner, and encrypts the target log data using a preset encryption algorithm, and sends the encrypted ciphertext to the host computer, so that the host computer performs log printing, thereby solving the problem of easy serial data leakage of existing terminal devices, improving the terminal serial port information protection capability, avoiding serial data from being monitored and tampered, and improving the terminal data security performance. BRIEF DESCRIPTION OF DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0015] Figure 1 is a flow chart of a terminal device data encryption method provided by an embodiment of the present application;
[0016] Figure 2 is a flow chart of another terminal device data encryption method provided by an embodiment of the present application;
[0017] Figure 3 is a flow chart of yet another terminal device data encryption method provided by an embodiment of the present application;
[0018] Figure 4 is a structural schematic diagram of a terminal device data encryption apparatus provided by an embodiment of the present application;
[0019] Figure 5 is a structural schematic diagram of a self-defined plug-in component provided by an embodiment of the present application;
[0020] Figure 6 is a structural schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to make the personnel in the technical field better understand the present application scheme, the technical scheme in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by the personnel of ordinary skill in the art without making creative efforts should belong to the scope of protection of the present application.
[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0023] Embodiment one
[0024] Figure 1is a flowchart of a terminal device data encryption method provided by an embodiment of the present application. The embodiment can be applied to an application scenario in which an upper computer obtains log information of a terminal device through a debugging serial port. The method can be executed by a data encryption device in the form of hardware and / or software. The data encryption device can be configured in the terminal device.
[0025] In the embodiment of the present application, the debugging serial port of the terminal device is improved by hardware design. The terminal device establishes a serial port connection with the upper computer by using an improved custom plug-in component. The custom plug-in component is provided with a first serial port plug-in, a second serial port plug-in, and a level conversion chip (for example, SP3232). The second serial port plug-in is connected to the first serial port plug-in. The first serial port plug-in is provided with a terminal connection terminal, a bus connection terminal, and a conversion connection terminal. The terminal connection terminal is used to connect a control unit (MCU) of the terminal device. The conversion connection terminal is used to connect an input end of the level conversion chip. The bus connection terminal is used to connect an output end of the level conversion chip and a communication bus of the upper computer. When the second serial port plug-in is connected to the first serial port plug-in, the terminal connection terminal is in communication with the conversion connection terminal. The wiring mode between the control unit of the terminal device and the level conversion chip and the pin position of the bus connection terminal are customized by the custom plug-in component. Only when the second serial port plug-in is connected to the first serial port plug-in, the upper computer can be correctly connected to the terminal debugging serial port, and the hardware part of the serial port anti-monitoring design is realized.
[0026] As shown in Figure 1 , the terminal device data encryption method specifically includes the following steps:
[0027] Step S1: Detect the connection state of the custom plug-in component and the upper computer.
[0028] The connection state detection refers to testing whether the terminal device and the upper computer software can normally communicate after the custom plug-in component is connected.
[0029] In an embodiment, the connection state detection of the custom plug-in component and the upper computer includes: sending a heartbeat packet to the upper computer; and determining the connection state according to a heartbeat feedback data packet issued by the upper computer.
[0030] The sending frequency of the heartbeat packet can be determined according to the communication refresh frequency between the upper computer and the terminal device. For example, the sending frequency can be equal to an integer multiple of the communication refresh frequency.
[0031] Step S2: Perform handshake verification with the upper computer.
[0032] The handshake verification refers to a strategy of identity verification between the terminal device and the upper computer through handshake messages.
[0033] In an embodiment, the handshake verification with the host computer includes: sending a handshake message to the host computer; obtaining a handshake confirmation message issued by the host computer, the handshake confirmation message including an authentication field, a firmware version number field and a user secret key information field; and determining whether the handshake verification is successful according to the authentication field and the firmware version number field.
[0034] Specifically, the terminal device stores a pre-stored authentication code and a pre-stored firmware version number, the pre-stored authentication code being a unique code randomly assigned by the platform to the terminal when the terminal is connected to the platform, and the authentication code being 0x00000000 by default when the terminal device is not authenticated. After the terminal device receives the handshake confirmation message, the authentication field, the firmware version number field and the user secret key information field in the handshake confirmation message are identified, the authentication field is compared with the pre-stored authentication code, and the firmware version number field is compared with the pre-stored firmware version number of the terminal device. If the authentication field matches the pre-stored authentication code and the firmware version number field matches the pre-stored firmware version number of the terminal device, it is determined that the handshake verification is successful; otherwise, the handshake verification fails. By setting a fixed part and a randomly generated authentication code to form a login secret key, the reliability of the secret key is improved.
[0035] It should be noted that the type of handshake protocol between the terminal device and the host computer is not limited in the embodiment.
[0036] Step S3: obtaining the user secret key information in the handshake confirmation message, and determining a target log level and target log data corresponding to the target log level according to the user secret key information.
[0037] The user secret key information refers to information required by a user to log in to a terminal serial port through a secret key method. Typically, the user secret key information includes multiple groups of private keys of different security levels and login passwords. The user secret key level refers to a security level specified by the user on the host computer. The target log level refers to an output level of a log. The target log level corresponds to the user secret key level one-to-one, that is, the terminal device can send log data to the host computer according to the security level specified by the user on the host computer.
[0038] Specifically, the user can log in to the terminal serial port using login passwords of different levels on the host computer, so that the terminal device can identify the user identity and the user secret key level through the private key after obtaining the handshake confirmation message. Then, the target log level corresponding to the user secret key level can be determined through a table lookup method, and the target log data corresponding to the target log level can be extracted and printed.
[0039] Exemplarily, four levels of secret key levels and four levels of target log levels can be set, the secret key levels and the target log levels correspond to each other one by one, and the log priorities from high to low are: F level > E level > W level > I level 4, wherein the log data of the F level is data of an error event that can cause the application to terminate execution; the log data of the E level is data of an error event; the log data of the W level is data of a potentially dangerous condition; and the log data of the I level is data describing the running process of the application.
[0040] It should be noted that the higher the level of the user secret key level is, the higher the target log level is, and the smaller the data amount of the corresponding log data is.
[0041] Step S4: encrypt the target log data by using a preset encryption algorithm, and send the encrypted ciphertext to the upper computer, so that the upper computer performs log printing.
[0042] In an embodiment, the preset encryption algorithm is an algorithm for encrypting the target log data according to a random secret key and a preset encoding format. The random secret key is a secret key generated by the terminal device according to a random algorithm; and the preset encoding format is a character encoding format used by the terminal device when sending logs through a serial port.
[0043] Typically, the preset encoding format includes any one of the following: American Standard Code for Information Interchange (ASCII), Unicode code (also known as unified code), or UTF-8 (8-bit Unicode Transformation Format) code.
[0044] Specifically, when the log information of the terminal device needs to be read, the self-defined plug-in component is used to establish the serial port connection between the host computer and the terminal device on the hardware; after the hardware connection is completed, the terminal device interacts with the host computer through the serial port, sends a heartbeat packet to the host computer, and determines whether the terminal device and the host computer are connected; if the terminal device and the host computer are connected, a handshake message is sent to the host computer, and a handshake confirmation message sent by the host computer is received, wherein the handshake confirmation message sent by the host computer carries user secret key information input by the user on the host computer, and the secret key level of the user secret key information is specified by the login secret key of the user. After the handshake verification is passed, the terminal device takes the log data corresponding to the user secret key level as the target log data, sends the encrypted ciphertext and the secret key to the host computer in an encrypted form, and the host computer receives the random secret key and the encrypted ciphertext, and restores and inversely decrypts the log data in the form of "encrypted ciphertext minus secret key", and prints the inversely decrypted data. Therefore, by combining the serial port hardware design and the software encryption transmission, the terminal serial port information monitoring prevention function is realized, the problem of easy serial port data leakage of the existing terminal device is solved, the terminal serial port information protection capability is improved, the serial port data is prevented from being monitored and tampered, and the terminal data security performance is improved; by setting the hierarchical login secret key, the log information is printed according to the login secret key, and the security protection capability of the terminal log information is improved.
[0045] Optionally, Figure 2 is a flowchart of another terminal device data encryption method provided by the embodiment one of the present application, which exemplarily shows a specific implementation of an encryption algorithm, rather than a limitation of the above-mentioned encryption algorithm. Figure 1
[0046] As shown in Figure 2 , the terminal device data encryption method specifically includes the following steps:
[0047] Step S1: detecting the connection state of the self-defined plug-in component and the host computer.
[0048] Step S2: performing handshake verification with the host computer.
[0049] Step S3: obtaining the user secret key information in the handshake confirmation message, and determining the target log level and the target log data corresponding to the target log level according to the user secret key information.
[0050] Step S401: determining the random secret key according to the power-on time of the terminal device when the handshake verification is successful.
[0051] Optionally, the random key is determined according to the power-on time of the terminal device when the handshake verification is successful, comprising: obtaining a power-on time character corresponding to the power-on time and any random number character; performing summation operation on the power-on time character and the random number character, and extracting the last two digits of the summation operation result; performing modulo operation on the extracted value, and determining the modulo operation result as the random key.
[0052] Exemplarily, the password generator can be used to generate the random number, the power-on time character can be 4-byte hexadecimal encoding, the random number character can be 2-byte hexadecimal encoding, summation operation is performed on the 4-byte hexadecimal power-on time character and the 2-byte random number character, the last two digits of the addition result are extracted, the extracted value is taken modulo 128, and the modulo operation result is determined as the random key.
[0053] Step S402: encoding conversion is performed on the target log data based on a preset mapping table, and encoded data is obtained.
[0054] Typically, the encoded data can be data in ASCII code format.
[0055] Step S403: the encoded data is encrypted by using the random key, and encrypted ciphertext is formed.
[0056] Step S404: the encrypted ciphertext is sent to the host computer, so that the host computer performs log printing.
[0057] Specifically, the above steps S401 to S404 describe a specific method for encrypting the target log data by using a preset encryption algorithm. In the preset encryption algorithm, the encryption rule is ASCII code + random key, the terminal device sends the target log data in ASCII code format, and each ASCII code to be output is encrypted by using the random key to form the encrypted ciphertext, and the encrypted ciphertext is sent to the host computer. After the handshake verification is successful, the terminal device can periodically send the random key to the host computer by using the method of cyclic transmission of the random key and the random number. After the terminal device generates the random key, the key can be cyclically transmitted in the format of "random number random number random key random number random number", and the number of bytes of the random number is not limited. For example, the key can be cyclically transmitted in the format of "0x61 61 random key 31 31".
[0058] It should be noted that the person skilled in the art can also generate a random key by using other encryption algorithms, and send the terminal serial port information after encryption by using the random key. By setting the random key, the encryption key is updated in each terminal running period, and the difficulty of listening to the terminal serial port is increased.
[0059] Optionally, Figure 3 is a flowchart of another terminal device data encryption method provided by Embodiment One of the present application, in whichFigure 1 On the basis of the above, an exit rule of log printing is exemplarily shown.
[0060] As shown in Figure 3 The terminal device data encryption method specifically comprises the following steps:
[0061] Step S1: detecting the connection state of the self-defined plug-in component and the upper computer.
[0062] Step S2: performing handshake verification with the upper computer.
[0063] Step S3: obtaining user secret key information in the handshake confirmation message, and determining the target log level and the target log data corresponding to the target log level according to the user secret key information.
[0064] Step S4: encrypting the target log data by using a preset encryption algorithm, and sending the encrypted ciphertext to the upper computer, so that the upper computer performs log printing.
[0065] Step S5: judging whether a preset shutdown instruction is received.
[0066] If the preset shutdown instruction is received, step S6 is performed; otherwise, step S3 is returned to be executed.
[0067] In an embodiment, the preset shutdown instruction can be 00000000.
[0068] Step S6: stopping the encryption of the target log data.
[0069] In another embodiment, if the terminal device is powered off or the terminal device is powered on again, the encryption of the target log data is stopped.
[0070] Specifically, in the process of sending the secret key and the encrypted ciphertext by the terminal device to the upper computer, if the preset shutdown instruction (for example, 00000000) is received, or the terminal device is powered on again, the terminal device stops the encryption processing of the target log data and exits the current log printing program. By designing the terminal log printing exit mechanism, the encryption program is interrupted, and the excessive occupation of the memory by the encryption processing is avoided.
[0071] Embodiment Two
[0072] Based on the above-mentioned embodiments, the embodiment two of the present application provides a terminal device data encryption device, which is used for executing the terminal device data encryption method provided in any of the above-mentioned embodiments, and has the corresponding function modules and beneficial effects of the execution method.
[0073] Figure 4 is a structural schematic diagram of a terminal device data encryption device provided in the embodiment two of the present application.
[0074] As Figure 4 shown, the terminal device data encryption apparatus 100 comprises a self-defined plug-in component 101, a connection state detection unit 102, a handshake verification execution unit 103, a log data extraction unit 104 and a data encryption unit 105. The self-defined plug-in component 101 is used for serial port connection between the terminal device and the host computer 1; the connection state detection unit 102 is used for connection state detection between the self-defined plug-in component 101 and the host computer 1; the handshake verification execution unit 103 is used for handshake verification with the host computer 1; the log data extraction unit 104 is used for obtaining user secret key information in the handshake confirmation message, and determining a target log level and target log data corresponding to the target log level according to the user secret key information, the target log level corresponding to the secret key level of the user secret key information one by one; and the data encryption unit 105 is used for encrypting the target log data by using a preset encryption algorithm, and sending the encrypted ciphertext to the host computer, so that the host computer performs log printing.
[0075] Optionally, the data encryption unit 105 is configured to determine a random secret key according to the power-on time of the terminal device when the handshake verification is successful; encode and convert the target log data based on a preset mapping table to obtain encoded data; and encrypt the encoded data by using the random secret key to form the encrypted ciphertext.
[0076] Optionally, determining the random secret key according to the power-on time of the terminal device when the handshake verification is successful comprises: obtaining a power-on time character corresponding to the power-on time and any random number character; performing summation operation on the power-on time character and the random number character, and extracting the last two bits of the summation operation result; and performing remainder operation on the extracted value, and determining the remainder operation result as the random secret key.
[0077] Optionally, the connection state detection unit 102 periodically sends a heartbeat packet to the host computer; and determines the connection state according to a heartbeat feedback data packet issued by the host computer.
[0078] Optionally, the handshake verification execution unit 103 is configured to send a handshake message to the host computer, and obtain a handshake confirmation message issued by the host computer, the handshake confirmation message comprising an authentication field, a firmware version number field and a user secret key information field; and determine whether the handshake verification is successful according to the authentication field and the firmware version number field.
[0079] Optionally, the terminal device data encryption apparatus 100 further comprises a shutdown detection unit configured to determine whether a preset shutdown instruction is received, and stop encrypting the target log data when the preset shutdown instruction is received.
[0080] Optionally, Figure 5 is a structural schematic diagram of a self-defined plug-in component provided in Embodiment Two of the present application, Figure 5Only a specific embodiment of the custom plug-in assembly is exemplarily shown, and in actual use, the difficulty of cracking the serial port hardware can be increased by increasing the number of pins in the plug-in assembly.
[0081] As shown in Figure 5 The custom plug-in assembly 101 is provided with a first serial port plug-in 101A, a second serial port plug-in 101B, and a level conversion chip SP, and the second serial port plug-in 101B is in plug-in connection with the first serial port plug-in 101A. The first serial port plug-in 101A is provided with a terminal connection terminal A1, a bus connection terminal A2, and a conversion connection terminal A3. The terminal connection terminal A1 is used to connect a control unit MCU of a terminal device, the conversion connection terminal A3 is used to connect an input end of the level conversion chip, and the bus connection terminal A2 is used to connect an output end of the level conversion chip and a communication bus of an upper computer. The second serial port plug-in 101B is used to connect the terminal connection terminal A1 and the conversion connection terminal A3 when being plugged into the first serial port plug-in 101A.
[0082] The level conversion chip SP is integrated on a printed circuit board of the terminal device, and is used to convert a serial port voltage rail of the control unit MCU to a bus communication voltage rail. The first serial port plug-in 101A is a plug-in port provided on the printed circuit board of the terminal device, and the second serial port plug-in 101B is a pluggable connector. The first serial port plug-in 101A and the second serial port plug-in 101B form a switching circuit between the control unit MCU and the level conversion chip SP.
[0083] Specifically, the plug-in male head can be used as the first serial port plug-in 101A, and the plug-in female head can be used as the second serial port plug-in 101B. When and only when the first serial port plug-in 101A and the second serial port plug-in 101B are in plug-in connection, a communication channel between the control unit MCU and the level conversion chip SP is in communication. When the first serial port plug-in 101A and the second serial port plug-in 101B are not in plug-in connection, the communication channel between the control unit MCU and the level conversion chip SP is disconnected. Thus, the serial port connection between the terminal device and the upper computer is established through the custom plug-in assembly 101, that is, only when the custom plug-in assembly 101 is connected to the plug-in port on the printed circuit board of the terminal device, the upper computer can be correctly connected to the terminal serial port.
[0084] Exemplarily, taking the RS232 serial port communication between the terminal device and the host computer 1 as an example, the communication output pins (for example, the transmission pin RS232_Tx and the receiving pin RS232_Rx) of the RS232 level conversion chip SP are connected with the bus connection terminal A2 of the first serial port plug-in 101A, the communication pins (for example, the receiving pin UART_Rx and the transmission pin UART_Tx) of the control unit MCU of the terminal device are connected with the terminal connection terminal A1 of the first serial port plug-in 101A, and the communication input pins (for example, the receiving pin SP3232_Rx and the transmission pin SP3232_Tx) of the RS232 level conversion chip SP are connected with the conversion connection terminal A3 of the first serial port plug-in 101A, when the second serial port plug-in 101B is plugged with the first serial port plug-in 101A, the UART_Rx pin is connected with the SP3232_Tx pin, the UART_Tx pin is connected with the SP3232_Rx pin, and the control unit MCU of the terminal device is connected with the RS232 serial port communication line of the host computer through the level conversion chip SP.
[0085] Therefore, the technical scheme of the embodiment of the present application customizes the wiring mode between the control unit of the terminal device and the level conversion chip and the pin position of the bus connection terminal, and only when the second serial port plug-in is plugged with the first serial port plug-in, the host computer can be correctly connected to the terminal debugging serial port, and the hardware part serial port anti-monitoring design is realized.
[0086] Embodiment three
[0087] According to another aspect of the present application, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the terminal device data encryption method when executing the program.
[0088] Figure 6 is a structural schematic diagram of a computer device provided by the embodiment three of the present application. The computer device is intended to represent various forms of digital computers, such as a laptop computer, a desktop computer, a workstation, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The computer device can also represent various forms of mobile devices, such as a personal digital processing, a cellular phone, a smart phone, a wearable device (such as a helmet, glasses, a watch, etc.), and other similar computing devices. The components shown herein, their connections, and relationships, and their functions, are merely examples and are not intended to limit the implementations of the present application described and / or claimed herein.
[0089] As Figure 6As shown, the computer device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer programs stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the computer device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0090] Multiple components in computer device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows computer device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0091] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as terminal device data encryption methods.
[0092] In some embodiments, the terminal device data encryption method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the computer device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the terminal device data encryption method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the terminal device data encryption method by any other suitable means (e.g., by means of firmware).
[0093] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0094] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine or entirely on a remote machine or server.
[0095] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0096] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0097] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0098] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0099] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in series, or executed in different orders, as long as the desired results of the technical solutions of the present disclosure are achieved, and the present disclosure is not limited herein.
[0100] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for encrypting data in a terminal device, characterized in that, The terminal device establishes a serial port connection with the host computer using a custom plug-in component, and the method includes: The connection status between the custom plug-in component and the host computer is detected; Perform a handshake verification with the host computer; Obtain the user key information from the handshake confirmation message, and determine the target log level and the target log data corresponding to the target log level based on the user key information. The target log level corresponds one-to-one with the key level in the user key information. The target log data is encrypted using a preset encryption algorithm, and the encrypted ciphertext is sent to the host computer so that the host computer can execute log printing; The handshake verification with the host computer includes: Send a handshake message to the host computer; Obtain the handshake confirmation message sent by the host computer, the handshake confirmation message including an authentication field, a firmware version number field, and a user key information field; The success of the handshake verification is determined based on the authentication field and the firmware version number field.
2. The method according to claim 1, characterized in that, The target log data is encrypted using a preset encryption algorithm, including: The random key is determined based on the power-on time of the terminal device when the handshake verification is successful; The target log data is encoded and converted based on a preset mapping table to obtain encoded data. The encoded data is encrypted using the random key to form encrypted ciphertext.
3. The method according to claim 2, characterized in that, The random key is determined based on the power-on time of the terminal device when the handshake verification is successful, including: Obtain the power-on time character and any random number character corresponding to the power-on time; The power-on time character and the random number character are summed, and the last two digits of the summation result are extracted. Perform a modulo operation on the extracted values, and use the result of the modulo operation as the random key.
4. The method according to claim 1, characterized in that, The connection status detection between the custom plug-in component and the host computer includes: Send a heartbeat packet to the host computer; The connection status is determined based on the heartbeat feedback data packets sent by the host computer.
5. The method according to any one of claims 1-4, characterized in that, Also includes: Determine whether a preset shutdown command has been received; Upon receiving the preset shutdown command, the encryption of the target log data is stopped.
6. A data encryption device for a terminal device, characterized in that, The device is used to execute the terminal device data encryption method according to any one of claims 1-5, and the device includes: a custom plug-in component, a connection status detection unit, a handshake verification execution unit, a log data extraction unit, and a data encryption unit; The custom plug-in component is used to connect the terminal device and the host computer via a serial port. The connection status detection unit is used to detect the connection status between the custom plug-in component and the host computer; The handshake verification execution unit is used to perform handshake verification with the host computer; The handshake verification execution unit is specifically used for: sending a handshake message to the host computer; obtaining a handshake confirmation message sent by the host computer, the handshake confirmation message including an authentication field, a firmware version number field, and a user key information field; and determining whether the handshake verification is successful based on the authentication field and the firmware version number field. The log data extraction unit is used to obtain user key information in the handshake confirmation message, and determine the target log level and the target log data corresponding to the target log level based on the user key information. The target log level corresponds one-to-one with the key level of the user key information. The data encryption unit is used to encrypt the target log data using a preset encryption algorithm and send the encrypted ciphertext to the host computer so that the host computer can execute log printing.
7. The terminal device data encryption device according to claim 6, characterized in that, The custom plug-in component includes a first serial port plug-in, a second serial port plug-in, and a level conversion chip. The second serial port plug-in is plugged into and connected to the first serial port plug-in. The first serial port plug-in is provided with a terminal connection terminal, a bus connection terminal and a conversion connection terminal. The terminal connection terminal is used to connect to the control unit of the terminal device, the conversion connection terminal is used to connect to the input terminal of the level conversion chip, and the bus connection terminal is used to connect to the output terminal of the level conversion chip and the communication bus of the host computer. The second serial port plug-in is used to connect the terminal connection terminal and the conversion connection terminal when plugged into the first serial port plug-in.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the terminal device data encryption method as described in any one of claims 1-5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the terminal device data encryption method as described in any one of claims 1-5.
Citation Information
Patent Citations
Business logic debugging method, device and equipment and computer readable storage medium
CN111506497A
Vehicle-mounted CAN connector
CN215956408U