Device connection method and device, device debugging method
By generating and utilizing key pairs to enable data interaction between the debugging server, the device to be debugged, and the terminal device in the vehicle system, the problem of high efficiency and low cost in local debugging in the existing technology is solved, and a high-efficiency and low-cost solution for remote debugging is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-16
- Publication Date
- 2026-03-31
AI Technical Summary
In existing technologies, when problems occur with vehicle systems, R&D personnel need to debug them locally, which results in low efficiency and high cost, and timely debugging cannot be guaranteed in abnormal scenarios.
Generate key pairs, including a first key pair and a second key pair, which are used for data interaction between the debugging server and the device to be debugged and the terminal device, respectively. Establish a connection through the key pairs to realize remote debugging.
It enables remote debugging of devices in different local area networks, improving debugging efficiency and reducing costs.
Smart Images

Figure CN115348020B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of device connectivity, specifically to the field of data interaction within different local area networks to achieve remote debugging, and to a device connection method and apparatus, and a device debugging method. Background Technology
[0002] For current in-vehicle systems, when a customer's system malfunctions, R&D personnel need to debug the equipment locally to troubleshoot the problem. However, the uncertain location of the equipment to be debugged leads to time-consuming and labor-intensive business trips. Furthermore, if the problem occurs in an abnormal scenario, it's not guaranteed that R&D personnel can arrive on-site. Therefore, local debugging by R&D personnel results in low efficiency and high costs. Currently, no effective solution has been proposed to address these issues. Summary of the Invention
[0003] This application provides a device connection method and apparatus, and a device debugging method, to at least solve the technical problems of low efficiency and high cost in problem solving caused by the need for R&D personnel to debug the device locally when problems occur in the prior art.
[0004] According to one aspect of the embodiments of this application, a device connection method is provided, comprising: generating a key pair, wherein the key pair includes a first key pair and a second key pair, the first key pair and the second key pair respectively including a public key and a private key; sending the public key of the first key pair and the private key of the second key pair to a debugging server; sending the private key of the first key pair and the public key of the second key pair to a device to be debugged; and sending the private key of the first key pair to a terminal device, wherein the debugging server is used to debug the device to be debugged, the first key pair is used to realize data interaction between the debugging server and the device to be debugged, and the second key pair is used to realize data interaction between the device to be debugged and the terminal device.
[0005] Optionally, after sending the private key of the first key pair and the public key of the second key pair to the device to be debugged, and sending the private key of the first key pair to the terminal device, the process includes: establishing a connection between the debugging server and the device to be debugged based on the key pair; and establishing a connection between the debugging server and the terminal device based on the key pair, thereby establishing a connection between the device to be debugged and the terminal device.
[0006] Optionally, establishing a connection between the debugging server and the device under debugging based on the key pair includes: starting a server program using the public key of the second key pair and starting a client program using the private key of the first key pair, wherein the server program and the client program are programs based on the Secure Shell protocol; and using the private key and public key of the first key pair, enabling the device under debugging to reverse proxy to the debugging server through a target port via the server program and the client program, wherein the target port is any unused port on the device under debugging.
[0007] Optionally, establishing a connection between the debugging server and the terminal device based on a key pair includes: establishing a connection between the terminal device and the debugging server based on the private key and public key of the first key pair; and enabling the terminal device to connect to the target port on the device to be debugged through the private key of the second key pair.
[0008] Optionally, generating a key pair includes: receiving a debugging instruction issued by the device management platform, wherein the debugging instruction is used to instruct the device to be debugged to be debugged; and randomly generating a key pair upon triggering the debugging instruction.
[0009] Optionally, the device connection method further includes: receiving a stop debugging command issued by the device management platform, wherein the stop debugging command is used to instruct the device to be debugged to stop debugging; in response to the stop debugging command, closing the server program and client program running locally on the device to be debugged, wherein the server program and client program are programs based on the Secure Shell protocol; and deleting the key pair stored locally on the device to be debugged and the debugging server.
[0010] According to another aspect of the embodiments of this application, a device debugging method is provided, comprising: receiving a public key of a first key pair and a private key of a second key pair; establishing a connection between a debugging server and a terminal device using the first key pair, and establishing a connection between the debugging server and a device to be debugged using the second key pair; receiving a debugging instruction from the terminal device and forwarding the debugging instruction to the device to be debugged, wherein the debugging instruction is used to debug the device to be debugged.
[0011] According to another aspect of the embodiments of this application, a device connection apparatus is also provided, comprising: a generation module, configured to generate a key pair, wherein the key pair includes a first key pair and a second key pair, the first key pair and the second key pair respectively including a public key and a private key; and a sending module, configured to send the public key of the first key pair and the private key of the second key pair to a debugging server, send the private key of the first key pair and the public key of the second key pair to a device to be debugged, and send the private key of the first key pair to a terminal device, wherein the debugging server is used to debug the device to be debugged, the first key pair is used to realize data interaction between the debugging server and the device to be debugged, and the second key pair is used to realize data interaction between the device to be debugged and the terminal device.
[0012] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, wherein the non-volatile storage medium includes a stored program, wherein, when the program is running, it controls the device where the non-volatile storage medium is located to execute the above-described device connection method and device debugging method.
[0013] According to another aspect of the embodiments of this application, a processor is also provided, which is used to run a program stored in a memory, wherein the program executes the above-described device connection method and device debugging method when it runs.
[0014] In this embodiment, a key pair is generated, comprising a first key pair and a second key pair, each including a public key and a private key. The public key of the first key pair and the private key of the second key pair are sent to a debugging server, the private key of the first key pair and the public key of the second key pair are sent to the device to be debugged, and the private key of the first key pair is sent to a terminal device. The debugging server is used to debug the device to be debugged, the first key pair is used to enable data interaction between the debugging server and the device to be debugged, and the second key pair is used to enable data interaction between the device to be debugged and the terminal device. Through the two key pairs, the connection between the device to be debugged and the terminal device is achieved, enabling data interaction between them. This achieves the technical effect of remote debugging within different local area networks, thereby solving the problems of low efficiency and high cost in problem-solving caused by the requirement for R&D personnel to debug the device locally when problems occur in the prior art. Attached Figure Description
[0015] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0016] Figure 1 This is a flowchart of a device connection method according to an embodiment of this application;
[0017] Figure 2 This is a schematic diagram of a device for stopping debugging according to an embodiment of this application;
[0018] Figure 3 This is a flowchart of a device debugging method according to an embodiment of this application;
[0019] Figure 4 This is a schematic diagram of the structure of a connection device for a device according to an embodiment of this application;
[0020] Figure 5 This is a schematic diagram illustrating how a device management platform sends key pairs to various devices according to an embodiment of this application;
[0021] Figure 6 This is a schematic diagram of the connection of various devices according to an embodiment of this application. Detailed Implementation
[0022] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0024] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows:
[0025] SSH: A security protocol built on the application layer (Secure Shell protocol);
[0026] shell: A computer shell, a command interpreter used to refer to software that provides a user interface, receives user commands, and then calls the corresponding application.
[0027] Reverse proxy: The proxy server accepts network access connection requests from clients, then forwards the requests strategically to the actual business servers operating in the network, and returns the results processed by the business servers to the client that initiated the connection request on the network.
[0028] SSH client: A program used to log in to a remote computer and execute commands on the remote computer;
[0029] openSSH is a client / server based service used to run a secure shell on a remote system. It offers two authentication methods: password authentication and key pair authentication.
[0030] sshd: A service process that handles connection requests from robust remote SSH clients and performs encrypted authentication on those requests.
[0031] It should be noted that the connection and debugging methods for the above devices are implemented through OpenSSH reverse proxy. Therefore, in practical applications, only the device with the customized OpenSSH framework integrated needs to be debugged. The implementation of the above method requires: the developer's computer (i.e., the terminal device) to support SSH client connections; and the debugging server to be a server with a public IP address that supports both SSH server and SSH client connections.
[0032] According to an embodiment of this application, a device connection method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0033] Figure 1 This is a flowchart of a device connection method according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:
[0034] Step S102: Generate key pairs, wherein the key pairs include a first key pair and a second key pair, and the first key pair and the second key pair respectively include a public key and a private key.
[0035] In step S102, the key pair is generated by the device management platform. This platform communicates with the device to be debugged and stores a unique identifier for the device, represented by its device ID. The platform records the online and offline information of all devices, including the device to be debugged, and controls the devices, such as upgrading or restarting them. The target device logs in to the device management platform's website, locates the device to be debugged based on its device ID, and initiates debug mode. Then, the platform generates two sets of RSA keys using a public-key cryptography algorithm (RSA algorithm). Each set of keys includes a public key and a uniquely corresponding private key.
[0036] Step S104: Send the public key of the first key pair and the private key of the second key pair to the debugging server, send the private key of the first key pair and the public key of the second key pair to the device to be debugged, and send the private key of the first key pair to the terminal device. The debugging server is used to debug the device to be debugged, the first key pair is used to realize data interaction between the debugging server and the device to be debugged, and the second key pair is used to realize data interaction between the device to be debugged and the terminal device.
[0037] In step S104, the keys generated in step S102 are sent to the corresponding devices. The public key of the first key pair is represented by A1, and the private key of the first key pair is represented by A2. The public key of the second key pair is represented by B1, and the private key of the second key pair is represented by B2. A1 is sent to the debugging server, A2 is sent to the terminal device and the device to be debugged, B1 is sent to the device to be debugged, and B2 is sent to the debugging server. Since the above key pairs are generated based on the RSA algorithm and the key pairs have unique correspondence, the device can be debugged based on the Secure Shell (SSH) protocol by sending RSA keys.
[0038] The above steps provide a method for connecting and debugging devices, which can connect devices in different local area networks (LANs) to achieve the technical effect of remote debugging of devices in different LANs.
[0039] According to an optional embodiment of this application, the private key of the first key pair and the public key of the second key pair are sent to the device to be debugged. After the private key of the first key pair is sent to the terminal device, a connection between the debugging server and the device to be debugged needs to be established based on the key pair. The connection between the debugging server and the terminal device is established based on the key pair in order to establish a connection between the device to be debugged and the terminal device.
[0040] In this embodiment, since A2 and B1 are sent to the device under test, A1 and B2 are sent to the debugging server, and A2 is sent to the terminal device in step S104, based on the unique correspondence of the key pairs, the connection between the device under test and the debugging server is achieved by pairing B1 and B2, and the connection between the terminal device and the debugging server is established by pairing A1 and A2. Based on the above operations, both the device under test and the terminal device are connected to the server under test, so as to realize the connection between the terminal device and the device under test in the future.
[0041] According to another optional embodiment of this application, establishing a connection between a debugging server and a device to be debugged based on a key pair includes the following steps: starting a server program using the public key of a second key pair and starting a client program using the private key of a first key pair, wherein the server program and the client program are programs based on a secure shell protocol; and using the private key and public key of the first key pair, enabling the device to be debugged to reverse proxy to the debugging server through a target port via the server program and the client program, wherein the target port is any unused port on the device to be debugged.
[0042] In this embodiment, to establish a connection between the debugging server and the device under debugging, the following operations are required: The device under debugging starts the sshd server process (i.e., the server program) using B1 and starts the ssh process (i.e., the client program) using A2, and logs in (connects to) the debugging server through any unused port (i.e., the target port) on the debugging server; After the device under debugging starts the sshd server process using B1, since the device under debugging is within a local area network, its IP address cannot be accessed in the conventional way. Therefore, the device under debugging uses the private key A2 of the debugging server as an ssh reverse proxy to connect to any unused port of the debugging server, logs in to the debugging server, and establishes a connection with the debugging server. For example, the device under debugging can connect to the debugging server through the proxy port 5822.
[0043] According to another optional embodiment of this application, establishing a connection between a debugging server and a terminal device based on a key pair includes: establishing a connection between the terminal device and the debugging server based on the private key and public key of the first key pair; and enabling the terminal device to connect to the target port on the device to be debugged through the private key of the second key pair.
[0044] In this embodiment, to establish a connection between the terminal device and the debugging server, the following operations are required: The terminal device logs into the debugging server using the debugging server's private key A2 to establish a connection with the debugging server; Since the debugging server possesses the private key B2 of the device to be debugged, the terminal device uses B2 to SSH into the port connected to the device to be debugged. For example, if the device to be debugged connects to the debugging server through proxy port 5822, then the terminal device also connects to proxy port 5822.
[0045] According to some optional embodiments of this application, generating a key pair includes the following steps: receiving a debugging instruction issued by a device management platform, wherein the debugging instruction is used to instruct the device to be debugged to be debugged; and randomly generating a key pair upon triggering the debugging instruction.
[0046] In some optional embodiments, the key pairs mentioned above are generated by the device management platform under preset conditions. For example, in some preferred embodiments, when a developer logs in to the device management platform's website using a terminal device, finds the device to be debugged by deviceID, and clicks to enable remote debugging mode, the device management platform randomly generates two sets of RSA public and private keys using the RSA algorithm.
[0047] It should also be noted that in the embodiments of this application, passwordless login using RSA verification is used. This is because the principle of the RSA encryption algorithm is to publish the result of multiplying two prime numbers as the encryption key. Since factoring the product is difficult, it can achieve the effect of ensuring security. Furthermore, in the embodiments of this application, the key file changes each time it is debugged, and the SSH connection is encrypted with a 2048-bit RSA key. Therefore, the security of communication between devices is guaranteed.
[0048] According to an optional embodiment of this application, the device connection method further includes: receiving a stop debugging command issued by a device management platform, wherein the stop debugging command is used to instruct the device to be debugged to stop debugging; in response to the stop debugging command, closing the server program and client program running locally on the device to be debugged, wherein the server program and client program are programs based on the Secure Shell protocol; and deleting the key pair stored locally on the device to be debugged and the debugging server.
[0049] In this embodiment, if the device management platform finds the device to be debugged through the deviceID and chooses to disable the debugging function, the device management platform sends a stop debugging command to the debugging server and the device to be debugged. Upon receiving the stop debugging command, the debugging server will perform the following operations: delete A1 to prevent the device with A2 from logging into the debugging server without a password, and simultaneously clear B2. Upon receiving the stop debugging command, the device to be debugged will perform the following operations: first, stop the ssh process and the sshd process, and then delete A2 and B1. After these operations, unless the terminal device reconnects to the device to be debugged using the aforementioned device connection method, the terminal device will no longer be able to debug the device to be debugged.
[0050] Figure 2 This is a schematic diagram of a device for stopping debugging according to an embodiment of this application. For example, in a specific implementation, the process of stopping debugging is as follows: Figure 2 As shown, after the developer logs into the device management platform, finds the device by deviceID, and disables the debugging function, both the debugging server and the device being debugged will delete the RSA key. The device being debugged will also stop the ssh and sshd processes. At this point, the developer can no longer log into the debugging server and the device being debugged via passwordless ssh login to disable the debugging function. Since the ssh and sshd services of the device being debugged have stopped working, there will be no additional load on the device.
[0051] Figure 3 This is a flowchart of a device debugging method according to an embodiment of this application, such as... Figure 3 The method shown includes the following steps:
[0052] Step S302: Receive the public key of the first key pair and the private key of the second key pair.
[0053] Let A1 represent the public key of the first key pair and B2 represent the private key of the second key pair. In step S202, the debug server receives A1 and B2 from the device management platform and writes them to relevant files. For example, in one specific implementation, the debug server writes A1 to a folder in the root directory, for example, placing it in... ~ The folder is named ` / .ssh / authorized_keys`; place B2 in the user's root directory, for example, in... ~ This is the folder / .ssh / id_rsa.
[0054] Step S304: Establish a connection between the debugging server and the terminal device using the first key pair, and establish a connection between the debugging server and the device to be debugged using the second key pair.
[0055] A2 represents the private key of the first key pair, and B1 represents the public key of the second key pair. In step S204, since the terminal device has A2 and the device to be debugged has B1, the terminal device uses A1 to pair with the debug server's A2, logs into the debug server without a password, and establishes a connection between the debug server and the terminal device. The debug server uses B2 to pair with the device to be debugged's B1, logs into the device to be debugged without a password through a reverse proxy, and realizes a connection between the debug server and the device to be debugged. Through the above operations, the connection between the terminal device and the device to be debugged is finally realized.
[0056] Step S306: Receive a debugging instruction from the terminal device and forward the debugging instruction to the device to be debugged, wherein the debugging instruction is used to debug the device to be debugged.
[0057] In step S306, since the connection between the terminal device and the device to be debugged is ultimately achieved through the debugging server, the debugging server receives the debugging instructions from the terminal device and forwards them to the device to be debugged to achieve the purpose of debugging. For example, in a specific implementation, after the developer connects to the device to be debugged through the OpenSSH reverse proxy, they use the rich commands of the shell terminal, such as the top command to display the resource usage status of each process in the system in real time, the dumpsys command to diagnose the user system and provide system service status information, the am command to open or close processes, send broadcasts, etc., and the cat command to display files, create files, and merge files to debug the device to be debugged.
[0058] By following the steps above, it is possible to achieve the technical effect of remotely debugging equipment in different local area networks.
[0059] Figure 4 This is a schematic diagram of the structure of a connection device for a device according to an embodiment of this application, such as... Figure 4 As shown, the device includes:
[0060] The generation module 40 is used to generate key pairs, wherein the key pairs include a first key pair and a second key pair, and the first key pair and the second key pair respectively include a public key and a private key;
[0061] The sending module 42 is used to send the public key of the first key pair and the private key of the second key pair to the debugging server, send the private key of the first key pair and the public key of the second key pair to the device to be debugged, and send the private key of the first key pair to the terminal device. The debugging server is used to debug the device to be debugged, the first key pair is used to realize data interaction between the debugging server and the device to be debugged, and the second key pair is used to realize data interaction between the device to be debugged and the terminal device.
[0062] In this embodiment, a device connection device is provided. Figure 5 This diagram illustrates how the device management platform sends key pairs to various devices. The sending module 42 executes the following steps: Figure 5 As shown in the process, the terminal device sends A1, A2, B1, and B2 to the device management platform. The device management platform then sends A1 and B2 to the debugging server. The device management platform locates the device to be debugged using the device's unique identifier, deviceID, and sends A2 and B1 to the device to be debugged.
[0063] Figure 6 This is a schematic diagram of the connection of various devices according to an embodiment of this application, such as... Figure 6 As shown, the device to be debugged connects to the debug server using B1, starts the sshd server process, and then logs into the debug server without a password using A2; the terminal device logs into the debug server without a password using A2, the debug server connects to the device to be debugged using B2, and the terminal device connects to the device to be debugged using B2.
[0064] This application also provides a non-volatile storage medium, which includes a stored program, wherein, when the program is running, it controls the device where the non-volatile storage medium is located to execute the aforementioned device connection method and device debugging method.
[0065] The aforementioned non-volatile storage medium is used to store a program that performs the following functions: generating key pairs, wherein the key pairs include a first key pair and a second key pair, the first key pair and the second key pair each including a public key and a private key; sending the public key of the first key pair and the private key of the second key pair to a debugging server, sending the private key of the first key pair and the public key of the second key pair to the device under test, and sending the private key of the first key pair to a terminal device, wherein the debugging server is used to debug the device under test, the first key pair is used to realize data interaction between the debugging server and the device under test, and the second key pair is used to realize data interaction between the device under test and the terminal device; and receiving the public key of the first key pair and the private key of the second key pair; establishing a connection between the debugging server and the terminal device using the first key pair, and establishing a connection between the debugging server and the device under test using the second key pair; receiving debugging instructions from the terminal device and forwarding the debugging instructions to the device under test, wherein the debugging instructions are used to debug the device under test.
[0066] This application also provides a processor for running a program stored in a memory, wherein the program executes the above-mentioned device connection method and device debugging method during runtime.
[0067] The processor described above is used to run a program that performs the following functions: generating key pairs, wherein the key pairs include a first key pair and a second key pair, the first key pair and the second key pair each including a public key and a private key; sending the public key of the first key pair and the private key of the second key pair to a debugging server, sending the private key of the first key pair and the public key of the second key pair to the device under test, and sending the private key of the first key pair to a terminal device, wherein the debugging server is used to debug the device under test, the first key pair is used to realize data interaction between the debugging server and the device under test, and the second key pair is used to realize data interaction between the device under test and the terminal device; and receiving the public key of the first key pair and the private key of the second key pair; establishing a connection between the debugging server and the terminal device using the first key pair, and establishing a connection between the debugging server and the device under test using the second key pair; receiving debugging instructions from the terminal device and forwarding the debugging instructions to the device under test, wherein the debugging instructions are used to debug the device under test.
[0068] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0069] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0070] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0071] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0072] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0073] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0074] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A connection method of a device, characterized by, The method comprises: generating a key pair, wherein the key pair comprises a first key pair and a second key pair, and the first key pair and the second key pair each comprise a public key and a private key; sending the public key of the first key pair and the private key of the second key pair to a debugging server, sending the private key of the first key pair and the public key of the second key pair to a device to be debugged, and sending the private key of the first key pair to a terminal device, wherein the debugging server is configured to debug the device to be debugged, the first key pair is configured to enable data interaction between the debugging server and the device to be debugged, and the first key pair is configured to enable data interaction between the debugging server and the terminal device; wherein the first key pair is configured to enable data interaction between the debugging server and the device to be debugged comprises: based on the private key of the first key pair and the public key of the first key pair, enabling the device to be debugged to log in to the debugging server, connecting to a target port of the debugging server, and enabling the device to be debugged to be reverse- proxied to the debugging server through the target port; wherein the first key pair is configured to enable data interaction between the debugging server and the terminal device comprises: based on the private key of the first key pair and the public key of the first key pair, enabling the terminal device to log in to the debugging server and enabling the terminal device to connect to the debugging server; enabling the debugging server to pair with the private key of the second key pair and the public key of the second key pair of the device to be debugged, log in to a target port corresponding to the device to be debugged, and enable connection between the debugging server and the device to be debugged.
2. The method of claim 1, wherein, The method comprises: receiving a debugging instruction issued by a device management platform, wherein the debugging instruction is configured to instruct to debug the device to be debugged; under the triggering of the debugging instruction, randomly generating the key pair.
3. The method of connecting a device according to claim 2, wherein, The method further comprises: receiving a stop debugging instruction issued by the device management platform, wherein the stop debugging instruction is configured to instruct to stop debugging the device to be debugged; in response to the stop debugging instruction, closing a server program and a client program running locally on the device to be debugged, wherein the server program and the client program are programs based on a secure shell protocol; deleting the key pair stored locally on the device to be debugged and the debugging server.
4. A debugging method of a device, characterized by, The method comprises: receiving a public key of a first key pair and a private key of a second key pair; establishing connection between a debugging server and a terminal device by using the first key pair, and establishing connection between the debugging server and a device to be debugged by using the first key pair; wherein establishing connection between the debugging server and the device to be debugged by using the first key pair comprises: based on the private key of the first key pair and the public key of the first key pair, enabling the device to be debugged to log in to the debugging server, connecting to a target port of the debugging server, and enabling the device to be debugged to be reverse- proxied to the debugging server through the target port; establishing connection between the debugging server and the terminal device by using the first key pair comprises: The terminal device is logged in to the debugging server based on the private key of the first key pair and the public key of the first key pair, and is connected to the debugging server; The debugging server is paired with the private key of the second key pair and the public key of the second key pair of the to-be-debugged device, logs in to the target port corresponding to the to-be-debugged device, and realizes the connection between the debugging server and the to-be-debugged device. The debugging instruction from the terminal device is received, and the debugging instruction is forwarded to the to-be-debugged device, wherein the debugging instruction is used for debugging the to-be-debugged device.
5. A connection device of an apparatus, characterized in that, Comprise: The generation module is used for generating a key pair, wherein the key pair comprises a first key pair and a second key pair, and the first key pair and the second key pair respectively comprise a public key and a private key; The sending module is used for sending the public key of the first key pair and the private key of the second key pair to a debugging server, sending the private key of the first key pair and the public key of the second key pair to a to-be-debugged device, and sending the private key of the first key pair to a terminal device, wherein the debugging server is used for debugging the to-be-debugged device, the first key pair is used for realizing data interaction between the debugging server and the to-be-debugged device, and the first key pair is used for realizing data interaction between the debugging server and the terminal device; The first key pair is used for realizing data interaction between the debugging server and the to-be-debugged device, comprising: The to-be-debugged device is logged in to the debugging server based on the private key of the first key pair and the public key of the first key pair, and is connected to the target port of the debugging server, so that the to-be-debugged device is reverse-proxied to the debugging server through the target port; The first key pair is used for realizing data interaction between the to-be-debugged server and the terminal device, comprising: The terminal device is logged in to the debugging server based on the private key of the first key pair and the public key of the first key pair, and is connected to the debugging server; The debugging server is paired with the private key of the second key pair and the public key of the second key pair of the to-be-debugged device, logs in to the target port corresponding to the to-be-debugged device, and realizes the connection between the debugging server and the to-be-debugged device.
6. A non-volatile storage medium, comprising: The non-volatile storage medium comprises a stored program, wherein when the program runs, the device where the non-volatile storage medium is located executes the connection method of the device in any one of claims 1 to 3 and the debugging method of the device in claim 4.
7. A processor, comprising: The processor is used for running a program stored in the memory, wherein the program runs to execute the connection method of the device in any one of claims 1 to 3 and the debugging method of the device in claim 4.
Citation Information
Patent Citations
Method and device for determining permission of vehicle debugging equipment
CN110401668A
Setting up a protected data communication connection between a controller of a passenger transport system and a mobile device
CN113228014A