Debugging method and system for application program and electronic equipment
By introducing a debugging manager to realize remote debugging of integrated development platform and secure components, the problem that application debugging methods in the prior art only support local debugging is solved, which improves debugging flexibility and efficiency, and ensures the secure transmission and accuracy of debugging information.
Patent Information
- Application Number
- CN202411784764.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-06
AI Technical Summary
现有技术中应用程序的调试方法主要支持本地调试,不支持远程调试,导致开发和维护过程中问题定位和解决困难且耗时。
By introducing a debug manager, remote debugging between the integrated development platform and the secure element is realized. The debug manager converts standard debugging request information into proprietary debugging request information, and executes it in the secure element, returning debug response information to the integrated development platform to determine the application's failure information.
Remote debugging of applications is realized, the flexibility and accessibility of debugging are improved, the difficulty of development is reduced, the debugging efficiency and security is improved, and the accurate transmission of debugging information is ensured.
Smart Images

Figure CN119759734A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of security chips, for example, to a debugging method and system for application programs, and electronic equipment. Background Art
[0002] In the field of security chips, with the continuous advancement of smart card and security element technology, the popularity and complexity of JavaCard applet applications are rapidly increasing. These applications not only play an important role in many fields such as financial services, mobile payment, transportation, and identity authentication, but also their functional and performance requirements are constantly improving, thus placing higher requirements on the performance and space occupation of applications. However, with the increase in application complexity, problem location and resolution in the development and maintenance process become more difficult and time-consuming.
[0003] In the related technology, developers first need to analyze and modify the code that is suspected to have problems based on the problem report or test results. The modified applet needs to be reloaded into the security chip. After loading the new applet version, the developer needs to execute test cases or observe the application behavior to verify whether the problem is solved.
[0004] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art: the debugging method of the existing application mainly supports local debugging but does not support remote debugging.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0007] The embodiments of the present disclosure provide a method and system for debugging an application program, and an electronic device to implement remote debugging of the application program, thereby improving the flexibility and accessibility of debugging.
[0008] In some embodiments, a debugging method for an application is applied to a debugging manager, which is connected to a security element and an integrated development platform, respectively, and the debugging method includes: obtaining standard debugging request information based on a standard debugging protocol sent by the integrated development platform; converting the standard debugging request information into proprietary debugging request information based on a proprietary debugging protocol; sending the proprietary debugging request information to the security element to obtain debugging response information of the proprietary debugging request information running in the security element; sending debugging response information to the integrated development platform, so that the integrated development platform analyzes the debugging response information and determines the fault information of the application in the security element.
[0009] In some embodiments, a debugging method for an application is applied to an integrated development platform, which is connected to a debugging manager, and the debugging method includes: generating standard debugging request information based on a standard debugging protocol; sending the standard debugging request information to the debugging manager so that the debugging manager converts the standard debugging request information into proprietary debugging request information based on a proprietary debugging protocol, and sending the proprietary debugging request information to a secure element to obtain debugging response information of the proprietary debugging request information of the application running in the secure element; obtaining and analyzing the debugging response information sent by the debugging manager to determine fault information of the application in the secure element.
[0010] In some embodiments, a debugging method for an application is applied to a secure element, the secure element is connected to a debugging manager, and the debugging method includes: obtaining proprietary debugging request information sent by the debugging manager; wherein the proprietary debugging request information is converted by the debugging manager from standard debugging request information based on a proprietary debugging protocol; the application in the secure element runs the proprietary debugging request information and obtains debugging response information; and sending debugging response information to the debugging manager so that the debugging manager sends debugging response information to an integrated development platform, so that the integrated development platform analyzes the debugging response information and determines fault information of the application in the secure element.
[0011] In some embodiments, a debugging system for an application includes: an integrated development platform, configured to generate standard debugging request information based on a standard debugging protocol, analyze debugging response information of an application in a security element running proprietary debugging request information and determine fault information of the application in the security element; a security element, having an application installed thereon, configured to execute proprietary debugging request information by the application and obtain debugging response information; a debugging manager, including an uplink connection manager and a downlink connection manager, connected to the integrated development platform through the uplink connection manager and connected to the security element through the downlink connection manager, configured to: obtain standard debugging request information sent by the integrated development platform; convert the standard debugging request information into proprietary debugging request information based on a proprietary debugging protocol; send proprietary debugging request information to the security element; and send debugging response information to the integrated development platform.
[0012] In some embodiments, the electronic device includes a processor and a memory storing program instructions, and the processor is configured to perform the aforementioned debugging method for an application program when executing the program instructions.
[0013] The debugging method and system for application programs and the electronic device provided by the embodiments of the present disclosure can achieve the following technical effects:
[0014] In the disclosed technical solution, the debug manager is connected to the safety element and the integrated development platform respectively. After obtaining the standard debug request information based on the standard debug protocol sent by the integrated development platform, the standard debug request information is converted into a proprietary debug request information based on the proprietary debug protocol, and then the proprietary debug request information is sent to the safety element to obtain the debug response information of the proprietary debug request information of the application running in the safety element, and the debug response information is sent to the integrated development platform so that the integrated development platform analyzes the debug response information and determines the fault information of the application in the safety element. That is, the communication between the integrated development platform and the safety element is realized through the debug manager. The debug manager acts as a bridge to receive the standard debug request information (based on the standard debug protocol) sent by the integrated development platform, and then converts it into a proprietary debug request information (based on the proprietary debug protocol) and sends it to the safety element. The safety element processes these proprietary debug requests and returns the debug response information. The debug manager then sends the debug response information back to the integrated development platform for it to analyze and determine the fault information of the application. In this way, through the debug manager, remote debugging of applications in the secure element can be achieved without directly contacting the secure element. The debug manager can handle the conversion between different protocols, allowing the integrated development platform to communicate with the secure element flexibly and improve the accessibility of debugging, allowing developers to more conveniently access and debug applications embedded in the secure element.
[0015] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0017] Figure 1 is a schematic diagram of a structure of a debugging system for an application program provided by an embodiment of the present disclosure;
[0018] Figure 2 is a schematic diagram of the structure of another debugging system for an application program provided by an embodiment of the present disclosure;
[0019] Figure 3 It is a flowchart of a debugging method for an application program provided by an embodiment of the present disclosure;
[0020] Figure 4 is a flowchart of another debugging method for an application provided by an embodiment of the present disclosure;
[0021] Figure 5 is a flowchart of another debugging method for an application provided by an embodiment of the present disclosure;
[0022] Figure 6 is a flowchart of another debugging method for an application provided by an embodiment of the present disclosure;
[0023] Figure 7-1 It is a schematic diagram of a data type of proprietary debugging information in a proprietary debugging protocol provided by an embodiment of the present disclosure being a request;
[0024] Figure 7-2 It is a schematic diagram of a data type of proprietary debugging information as a response in another proprietary debugging protocol provided by an embodiment of the present disclosure;
[0025] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0027] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0028] Unless otherwise specified, the term "plurality" means two or more than two. In the disclosed embodiment, the character " / " indicates that the objects before and after are in an "or" relationship. For example, A / B means: A or B. The term "and / or" is a description of the association relationship between objects, indicating that three relationships may exist. For example, A and / or B means: A or B, or, the three relationships of A and B. The term "corresponding" may refer to an association relationship or a binding relationship, and the correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0029] The following is a further explanation of some technical terms in this application:
[0030] An Integrated Development Environment (IDC) is a software application development platform for software developers that integrates functions such as code editors, compilers, debuggers, and project management tools to provide an integrated platform for writing, testing, and debugging code. IDE includes Eclipse, which is an open source, Java-based, extensible development platform that provides developers with a unified, extensible framework for building and deploying various types of applications.
[0031] A secure element (SE) is a microcomputer that implements functions such as data security storage and encryption and decryption operations through a secure chip and a chip operating system (COS). SE can be packaged in various forms, such as smart cards and embedded security modules (eSE). COS is an operating system specifically designed for secure chips, providing chip-level security functions and management.
[0032] Figure 1 FIG. 1 is a schematic diagram of a debugging system for an application program provided by an embodiment of the present disclosure. Figure 1 As shown, the debugging system for application includes an integrated development platform, a security element and a debugging manager, the debugging manager includes an uplink connection manager and a downlink connection manager, the debugging manager is connected to the integrated development platform through the uplink connection manager, and the debugging manager is connected to the security element through the downlink connection manager. Wherein:
[0033] The integrated development platform is configured to generate standard debugging request information based on a standard debugging protocol, analyze the debugging response information of the application running the proprietary debugging request information in the security element, and determine the fault information of the application in the security element. The security element is installed with an application, and is configured so that the application executes the proprietary debugging request information and obtains the debugging response information. The debugging manager is configured to: obtain the standard debugging request information sent by the integrated development platform; convert the standard debugging request information into proprietary debugging request information based on the proprietary debugging protocol; send the proprietary debugging request information to the security element; and send the debugging response information to the integrated development platform.
[0034] Combination Figure 2 As shown, the secure element includes a debugging agent terminal and a secure element SE body, and the debugging agent terminal is connected to the debugging manager and the secure element SE body respectively. Among them: the debugging agent terminal obtains the proprietary debugging request information sent by the debugging manager, and sends the proprietary debugging request information to the secure element body; the application in the secure element body runs the proprietary debugging request information and obtains the debugging response information, and sends the debugging response information to the debugging agent terminal; the debugging agent terminal sends the debugging response information to the debugging manager.
[0035] Here, the debugging agent terminal is located between the SE body and the debugging manager, and data transparent transmission is achieved through UART / SPI to ensure efficient transmission of debugging information between the SE cos and the debugging manager. The secure element SE body sets up a proprietary debugging protocol stack, including JCVM, GP, Applet / SD, HW, Driver, and COS. Among them, UART (Universal Asynchronous Receiver / Transmitter) is a protocol and standard for asynchronous serial communication, which is applied to data transmission between microcontrollers, computers and other devices. SPI (Serial Peripheral Interface) is a synchronous serial communication protocol, commonly used for short-distance communication, especially between components inside embedded systems. JCVM (Java Card Virtual Machine) is a Java virtual machine running on a secure element for executing Java card applications. GP (Global Platform) is an open standard organization dedicated to developing security management, application management and remote management standards for secure elements (such as smart cards, SIM cards, etc.). Applet / SD is a small application (Applet) and / or security domain (Security Domain) running in a Java Card or similar environment to perform specific security functions or business logic. HW (Hardware) refers to the physical components that make up a computer system and various electronic devices, such as circuit boards, processors, memory, etc. Driver is the software interface between computer hardware and the operating system, used to control the operation of hardware devices. COS (Card Operating System) is an operating system running on a secure element, used to manage resources, security functions and applications on the card.
[0036] The debug manager includes breakpoint management, log and output, call stack trace, standard debug protocol stack, debug protocol converter, proprietary debug protocol stack, uplink connection manager, session manager and downlink connection manager. Among them, breakpoint management is responsible for setting, managing and maintaining breakpoints, which are the locations where the program execution is suspended during debugging. The log and output functions are used to record key information and output results during debugging. The call stack trace function can display the order and context of function calls during program execution. The standard debug protocol stack is a set of components that follow the standard debug protocol and are used to implement data exchange and communication during debugging. The debug protocol converter is used to convert the data format of one debug protocol into the data format of another debug protocol. The proprietary debug protocol stack is a debug protocol stack customized for a specific application or system. The uplink connection manager is responsible for managing the connection of the integrated development platform connected to the debug manager. The session manager is used to manage session information during debugging, including the creation, maintenance and termination of sessions. The downlink connection manager is responsible for managing the connection of the secure element connected to the debug manager.
[0037] The integrated development platform sets the JavaCard perspective, which includes the debug view, standard debug protocol stack, performance analysis view, cap file attribute view, bytecode view, non-standard API analysis view, cap decompilation view, dtr / rtr storage usage analysis view, and application dependency analysis view. Among them: the debug view is the core part of the JavaCard perspective, allowing developers to monitor and debug JavaCard applications in real time, usually including breakpoint setting, variable monitoring, expression evaluation, stack tracing and other functions. The standard debug protocol stack is the basis for supporting the debug view, defining the protocol for communication between the debugger and the debugged. The performance analysis view provides an in-depth analysis of the performance of the JavaCard application, including monitoring of CPU usage, memory usage, thread activity, etc. The CAP file is the installation package of the JavaCard application. The CAP file attribute view allows developers to view detailed information of the CAP file, such as version number, package name, component list, etc. The bytecode view displays the bytecode instructions of the JavaCard application, which is the intermediate code executed by the Java Virtual Machine (JVM). The non-standard API analysis view is used to identify and analyze the non-standard APIs used in the JavaCard application. The CAP decompilation view allows developers to decompile CAP files into readable source code or pseudo code. DTR (Data Transfer Register) and RTR (Receive / Transmit Register) are registers used in JavaCard to communicate with external devices. The DTR / RTR storage occupancy analysis view provides an in-depth analysis of the usage of these registers. The application dependency analysis view shows the dependencies between JavaCard applications, including library dependencies, module dependencies, etc.
[0038] The debug manager communicates with the integrated development platform based on the standard debug protocol and is connected through the APDU (Application Protocol Data Unit) channel. The debug manager communicates with the secure element based on the proprietary debug protocol and is connected through the APDU channel.
[0039] The present disclosure provides a debugging method for an application program, which is applied to a debugging manager and combined with Figure 3 As shown, the following steps are included:
[0040] S301, obtaining standard debugging request information based on a standard debugging protocol sent by an integrated development platform.
[0041] The IDE sends a standard debugging request message, such as "read data at memory address 0x1000", through a standard debugging interface (such as a USB debugging bridge).
[0042] S302: Convert the standard debugging request information into proprietary debugging request information based on a proprietary debugging protocol.
[0043] Optionally, converting the standard debugging request information into proprietary debugging request information based on the proprietary debugging protocol includes: parsing and extracting debugging operation information in the standard debugging request information; mapping the debugging operation information to a data structure of the proprietary debugging protocol to obtain the proprietary debugging request information.
[0044] The debug manager parses the received standard debug request information and extracts the debug operation information, such as the operation type (read memory), target address (0x1000) and other key information. The debug manager maps the debug operation information to the data structure of the smart card proprietary debug protocol. For example, the proprietary debug protocol requires the use of specific command codes (such as CMD_READ_MEMORY), parameter formats (such as specific arrangements of address fields and length fields), etc.
[0045] Assume that the proprietary debug protocol uses the following format:
[0046] Command code: CMD_READ_MEMORY; address: 0x1000 (expressed in hexadecimal); length: 4 bytes (assuming only 4 bytes of data are read).
[0047] The debug manager combines this information into a proprietary debug request message "CMD_READ_MEMORY; 0x1000; 4 bytes".
[0048] The debug manager converts standard debug request information into proprietary debug request information, allowing the IDE to seamlessly communicate with multiple secure elements that use different proprietary debug protocols. Developers do not need to understand the details of the proprietary debug protocol for each secure element, and can debug using the familiar IDE and standard debug protocol. This reduces development difficulty and improves development efficiency. Moreover, the debug manager can be easily updated or expanded to support new standard debug protocols or proprietary debug protocols to adapt to the ever-changing secure element and technology environment.
[0049] S303, sending proprietary debugging request information to the secure element to obtain debugging response information of the proprietary debugging request information executed by the application in the secure element.
[0050] The debug manager sends proprietary debug request information to the smart card through a secure channel (such as APDU commands or specific communication protocols). After the smart card processes the request, it returns debug response information, such as "the data at memory address 0x1000 is 0xABCD1234".
[0051] S304, sending the debugging response information to the integrated development platform, so that the integrated development platform analyzes the debugging response information and determines the fault information of the application program in the security element.
[0052] The debug manager receives this response information, converts it back to the standard debug protocol format, and then sends it back to the IDE. After receiving the debug response information, the IDE analyzes and displays it to the developer to help the developer determine the status or fault information of the application.
[0053] Optionally, the data type of the proprietary debugging information in the proprietary debugging protocol is determined as follows: a proprietary identifier in the proprietary debugging information is parsed and extracted; when the proprietary identifier is not equal to the first preset identifier and the sum of the proprietary identifier and the second preset identifier is not zero, the data type of the proprietary debugging information is determined to be a response; when the proprietary identifier is equal to the first preset identifier, or the sum of the proprietary identifier and the second preset identifier is zero, the data type of the proprietary debugging information is determined to be a request.
[0054] Here, the proprietary debugging information includes proprietary debugging request information or proprietary debugging response information. The request refers to the data sent by the debug manager to the secure element, including the operation that the debug manager wants the secure element to perform or the information to be obtained, such as proprietary debugging request information. The response refers to the data returned by the secure element to the debug manager after receiving the request from the debug manager, including the processing result of the secure element on the request or the information requested by the debug manager, such as proprietary debugging response information.
[0055] The data structure of the proprietary debugging information is shown in Figure 7 below, where: Figure 7-1 A schematic diagram of the data structure of the data type requested for proprietary debugging information. Figure 7-2 The data structure diagram of the data type of the proprietary debugging information is a response. The data type of the proprietary debugging information is distinguished by the proprietary identifier in the proprietary debugging information.
[0056] In some optional implementations, the first preset identifier may be 0xFFFF and the second preset identifier may be 0x7FFF. The second preset identifier is a hexadecimal mask that is used to perform a bitwise AND operation with the message ID, and the low-order portion of the ID can be checked (in this case, the lowest 15 bits, because there are 15 consecutive 1s in the binary representation of 0x7FFF). If the result is not 0, according to the protocol rules, this usually means that the message is a response, because the response usually requires a unique ID to match the request, and the low-order portion of this ID is usually not 0 (unless there is a specific protocol provision). This ensures that the protocol can distinguish between requests and responses, thereby correctly processing the message flow.
[0057] In some embodiments, the debugging method for an application further includes: sending a debugging information deletion instruction to the secure element, so that the secure element deletes relevant debugging information of the application according to the debugging information deletion instruction.
[0058] The data structure of the debugging information deletion instruction includes an instruction header, a target application identifier, and a debugging information type. Among them, the instruction header includes an instruction type, an instruction version, and an instruction length. The instruction type identifies that this is an instruction to delete debugging information. The instruction version indicates the version of the debugging information deletion instruction data structure. The instruction length indicates the length of the entire debugging information deletion instruction data structure, including the instruction header and the subsequent data part. The target application identifier includes an application ID and an application name. The application ID is an identifier that uniquely identifies the target application, which may be a number, a letter, or a combination thereof. The application name is the name of the target application, which is used to further confirm the application for which the debugging information is to be deleted. The debugging information type includes an information type and an information range. The information type specifies the type of debugging information to be deleted, such as logs, breakpoints, variable values, etc. The information range specifies the range of debugging information to be deleted, such as information within a specific time period, information of a specific module or function, etc.
[0059] After the integrated development platform determines the fault information of the application in the security element and completes the debugging, the debugging manager sends a debugging information deletion instruction to the security element. The debugging information deletion instruction contains key information such as the application identifier to be deleted and the debugging information type to ensure that the security element can accurately identify and delete the relevant debugging information. After receiving the debugging information deletion instruction, the security element will perform the corresponding deletion operation and return the deletion confirmation information to the debugging manager. After receiving the deletion confirmation information, the debugging manager can confirm that the relevant debugging information has been successfully deleted.
[0060] By adopting encrypted communication protocols and secure channels, as well as adding debugging information deletion steps, the security and privacy of applications can be effectively protected.
[0061] Using the debugging method for applications provided by the embodiments of the present disclosure, the communication between the integrated development platform and the security element is realized through the debugging manager. The debugging manager acts as a bridge to receive the standard debugging request information (based on the standard debugging protocol) sent by the integrated development platform, and then converts it into proprietary debugging request information (based on the proprietary debugging protocol) and sends it to the security element. The security element processes these proprietary debugging requests and returns the debugging response information. The debugging manager then sends the debugging response information back to the integrated development platform for it to analyze and determine the fault information of the application. Through the debugging manager, remote debugging of the application in the security element can be realized without directly contacting the security element. The debugging manager can handle the conversion between different protocols, so that the integrated development platform can flexibly communicate with the security element, and improve the accessibility of debugging, so that developers can more conveniently access and debug the application embedded in the security element.
[0062] The present disclosure provides a debugging method for an application program, which is applied to an integrated development platform and is combined with Figure 4 As shown, the following steps are included:
[0063] S401, generating standard debugging request information based on a standard debugging protocol.
[0064] S402, sending standard debugging request information to the debugging manager, so that the debugging manager converts the standard debugging request information into proprietary debugging request information based on the proprietary debugging protocol, and sends the proprietary debugging request information to the secure element to obtain debugging response information of the proprietary debugging request information executed by the application in the secure element.
[0065] S403, obtaining and analyzing the debugging response information sent by the debugging manager, and determining the fault information of the application in the secure element.
[0066] In some embodiments, the debugging method for an application further includes: obtaining the user's identity information and work requirements; and displaying a view according to the user's identity information and work requirements.
[0067] In some specific application scenarios, when the user's identity information is a developer and the work requirement is to debug a newly developed application, the debugging view, bytecode view, and performance analysis view are displayed. In this way, the developer can view the program's running status, variable values, and performance data in real time to quickly locate and solve problems.
[0068] In some specific application scenarios, when the user's identity information is a security auditor and the job requirement is to evaluate the security of an application, the non-standard API analysis view and the cap decompilation view are displayed. In this way, the security auditor can analyze the non-standard APIs and source codes used in the application to accurately evaluate its potential security risks.
[0069] In some specific application scenarios, when the user's identity information is a project manager and the work requirement is to evaluate the overall progress and resource usage of the project, the application dependency analysis view and the dtr / rtr storage usage analysis view are displayed. In this way, the project manager can easily understand the dependencies and resource usage between applications to evaluate the overall progress of the project and potential resource bottlenecks.
[0070] Flexibly display corresponding views based on user identity information and work requirements, thereby improving debugging efficiency and user experience.
[0071] In the disclosed embodiment, by generating standard debugging request information based on the standard debugging protocol and communicating with the debugging manager, the debugging process can be simplified and the complexity and uncertainty in the debugging process can be reduced. The debugging manager can convert the standard debugging request information into proprietary debugging request information, which enables the debugging process to seamlessly adapt to the proprietary debugging protocol of the security element, thereby improving the accuracy and efficiency of debugging. At the same time, using a proprietary debugging protocol to communicate with the security element can ensure data security and privacy protection during the debugging process and prevent sensitive information from being leaked.
[0072] The present disclosure provides a debugging method for an application program, which is applied to a security element and combined with Figure 5 As shown, the following steps are included:
[0073] S501, obtaining proprietary debugging request information sent by a debugging manager; wherein the proprietary debugging request information is obtained by converting standard debugging request information by the debugging manager based on a proprietary debugging protocol.
[0074] S502: The application in the secure element runs the dedicated debugging request information and obtains the debugging response information.
[0075] S503, sending debugging response information to the debugging manager, so that the debugging manager sends the debugging response information to the integrated development platform, so that the integrated development platform analyzes the debugging response information and determines the fault information of the application in the secure element.
[0076] Optionally, the security element includes a debugging agent terminal and a security element body, and the debugging agent terminal is connected to the debugging manager and the security element body respectively; wherein: the debugging agent terminal obtains proprietary debugging request information sent by the debugging manager, and sends the proprietary debugging request information to the security element body; the application in the security element body runs the proprietary debugging request information and obtains debugging response information, and sends the debugging response information to the debugging agent terminal; the debugging agent terminal sends the debugging response information to the debugging manager.
[0077] By decomposing the debugging process into three main parts: the debugging manager, the debugging agent terminal, and the secure element body, the debugging process is provided with higher flexibility and scalability. As an intermediate layer, the debugging agent terminal can easily adapt to different secure elements and debugging protocols, so that the entire debugging system can cope with various complex application scenarios. This design makes it necessary to update the debugging agent terminal accordingly when a new secure element or debugging protocol needs to be introduced, without making large-scale modifications to the entire debugging system. The introduction of the debugging agent terminal also enhances the security and reliability of the debugging process. The debugging agent terminal can serve as a security isolation layer to prevent sensitive information in the debugging process from being leaked to external attackers. At the same time, the debugging agent terminal can also verify and filter the debugging request and response information to ensure that only legitimate debugging information can be passed to the secure element body. This design effectively protects sensitive data in the secure element and the safe operation of the application.
[0078] Combination Figure 6 As shown, the present disclosure provides a debugging method for an application program, comprising the following steps:
[0079] S601, the integrated development platform generates standard debugging request information based on the standard debugging protocol.
[0080] Configure the relevant parameters of remote debugging in the IDE (such as Eclipse, IntelliJ IDEA, etc.), including the IP address and port number of the debug manager. The IDE establishes a TCP / IP connection with the debug manager through the upstream connection manager.
[0081] S602: The integrated development platform sends standard debugging request information to the debugging manager.
[0082] Once the connection is established, the IDE can send a request packet containing standard debugging request information to the debug manager. The standard debugging request information follows the jdwp (Java Debug Wire Protocol) standard debugging protocol, including commands such as setting breakpoints, querying variable values, and executing steps.
[0083] In some specific implementations, a breakpoint is set at line 10 in the IDE, and remote debugging is started. The IDE sends a Request Packet containing "set a breakpoint at line 10" to the debug manager through the upstream connection manager.
[0084] S603: The debugging manager obtains standard debugging request information.
[0085] S604: The debugging manager converts the standard debugging request information into proprietary debugging request information based on a proprietary debugging protocol.
[0086] After receiving the Request Packet sent by the IDE, the debug manager converts it into a proprietary debug protocol that can be recognized by SE cos (Secure Element Card Operating System) through a debug protocol converter.
[0087] S605: The debugging manager sends a dedicated debugging request message to the secure element.
[0088] After the conversion is completed, the debugging manager sends the converted proprietary debugging request information to the device debugging agent terminal through the downlink connection manager.
[0089] In some specific implementations, after receiving the Request Packet of "Set breakpoint at line 10" sent by the IDE, the debug manager converts it into a "Set breakpoint" command of the SE cos proprietary debug protocol, and sends it to the device debug agent terminal through the downlink connection manager. After receiving the command, the device debug agent terminal forwards it to SE cos.
[0090] S606: The secure element obtains the proprietary debugging request information sent by the debugging manager.
[0091] S607, the application in the secure element runs the dedicated debugging request information and obtains debugging response information.
[0092] After receiving the proprietary debugging request information forwarded by the device debugging agent terminal, SE cos performs the corresponding debugging operation according to the proprietary debugging request information. For example, if the debugging information is "set breakpoint", SE cos will set a breakpoint on the specified code line.
[0093] S608: The secure element sends debugging response information to the debugging manager.
[0094] After executing the debugging operation, SE cos will return the debugging response information (such as whether the breakpoint is set successfully, variable value, etc.) to the debugging manager through the device debugging agent terminal.
[0095] In some specific implementations, after receiving the command "set breakpoint at line 10", SE cos successfully sets a breakpoint at line 10, and returns a debugging result including "breakpoint setting successful" information to the debugging manager through the device debugging agent terminal.
[0096] S609: The debugging manager sends debugging response information to the integrated development platform.
[0097] After receiving the debugging response information returned by SE cos, the debugging manager returns it to the IDE through the uplink connection manager.
[0098] S610: The integrated development platform obtains and analyzes the debugging response information sent by the debugging manager, and determines the fault information of the application program in the security element.
[0099] After receiving the debugging response information, the IDE will update the debugging view or debugging information panel according to the information. The IDE displays the corresponding debugging information according to the debugging response information, such as whether the breakpoint is set successfully, the change of variable value, stack information, etc.
[0100] In some specific implementations, after receiving the debugging response information "breakpoint set successfully" returned by SE cos, the debugging manager returns it to the IDE through the uplink connection manager. After receiving the debugging response information, the IDE displays the information "breakpoint has been set at line 10" in the debugging view or debugging information panel.
[0101] A specific application scenario is listed below to further illustrate the technical solution of the embodiment of the present disclosure.
[0102] Scenario description: Customer C needs a smart card application that supports a specific function (Applet1). R&D A is responsible for developing this application based on IDE (such as Eclipse) and completing preliminary testing locally. After the test passes, R&D A converts the application into a format suitable for smart card operation (such as CAP file) and hands it over to front-end technical support B. When B conducts docking testing at the customer site, he finds a bug that can only be reproduced in the customer site environment.
[0103] In this scenario, R&D A deploys a debug manager in the cloud, and technical support B connects to the debug manager deployed in the cloud through a device installed with Applet1 at the customer site. R&D A sends the debug information of Applet1 (such as breakpoints, variable information, etc.) to the SE (secure element) or COS (card operating system) in the smart card through the UI interface of the debug manager. R&D A starts the IDE and connects to the debug manager deployed in the cloud to receive and send debug information in real time. R&D A sets breakpoints in the IDE and sends instructions to the SE or smart card through the APDU (application protocol data unit) channel. When the COS in the SE or smart card executes to the set breakpoint, a breakpoint event is triggered and the IDE is notified. After the IDE receives the breakpoint event, the code stops at the breakpoint. R&D A uses the single-step debugging function of the IDE to execute the code step by step to find the code location where the exception occurs. After R&D A locates and fixes the problem in the IDE, he can continue debugging or testing until he confirms that the problem has been resolved. R&D A sends a command to delete the debug information of Applet1 from the COS in the SE or smart card through the UI interface of the debug manager to ensure the security of the application.
[0104] When the COS on the SE or smart card needs to be upgraded, R&D A only needs to send the COS upgrade file to technical support B. Since the debug manager has been deployed and configured, no other operations or migration work is required for remote debugging. Technical support B can use the upgrade file to upgrade the SE or smart card at the customer site and ensure the normal operation of the upgraded system.
[0105] In the technical solution of the present application, by introducing a debug manager as an intermediary, indirect communication between the integrated development platform and the security element is achieved. The debug manager can receive standard debug requests from the integrated development platform and convert them into proprietary debug requests that the security element can understand. This design allows developers to debug the security element without directly contacting it, thereby greatly improving the flexibility of debugging. Moreover, the proprietary debugging protocol between the debug manager and the security element ensures the accurate transmission of debugging information. The debug manager can receive the debug response returned by the security element and transmit it back to the integrated development platform. Developers can view and analyze the debug information in real time on the integrated development platform, so as to quickly locate and solve the faults in the application. This design not only improves the accessibility of debugging, but also reduces the difficulty and cost of debugging. In addition, as an intermediary, the debug manager can also filter and optimize the debug requests and responses to reduce unnecessary communication overhead and processing time. This design not only improves the security of debugging, but also optimizes the debugging process, making the debugging process more efficient and reliable.
[0106] Combination Figure 8As shown, the embodiment of the present disclosure provides an electronic device (e.g., a debugging manager, an integrated development platform, a security element, a computer, a server, etc.) 800, including a processor 80 and a memory 81, and may also include a communication interface 82 and a bus 83. Among them, the processor 80, the communication interface 82, and the memory 81 can communicate with each other through the bus 83. The communication interface 82 can be used for information transmission. The processor 80 can call the logic instructions in the memory 81 to execute the debugging method for the application program of the above embodiment.
[0107] In addition, the logic instructions in the above-mentioned memory 81 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0108] The memory 81 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 80 executes the functional application and data processing by running the program instructions / modules stored in the memory 81, that is, implementing the debugging method for the application in the above method embodiment.
[0109] The memory 81 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 81 may include a high-speed random access memory and may also include a non-volatile memory.
[0110] Using the electronic device provided by the embodiment of the present disclosure, the communication between the integrated development platform and the security element is realized through the debugging manager. The debugging manager acts as a bridge to receive the standard debugging request information (based on the standard debugging protocol) sent by the integrated development platform, and then converts it into proprietary debugging request information (based on the proprietary debugging protocol), and sends it to the security element. The security element processes these proprietary debugging requests and returns the debugging response information. The debugging manager then sends the debugging response information back to the integrated development platform for it to analyze and determine the fault information of the application. Through the debugging manager, remote debugging of the application in the security element can be realized without directly contacting the security element. The debugging manager can handle the conversion between different protocols, so that the integrated development platform can flexibly communicate with the security element, and improve the accessibility of debugging, so that developers can more conveniently access and debug the application embedded in the security element.
[0111] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute the above-mentioned debugging method for an application program.
[0112] An embodiment of the present disclosure provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the above-mentioned debugging method for an application program.
[0113] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0114] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes, or a transient storage medium.
[0115] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible changes. Unless explicitly required, individual components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. The scope of the embodiments of the present disclosure includes the entire scope of the claims, and all available equivalents of the claims. When used in this application, although the terms "first", "second", etc. may be used in this application to describe each element, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, without changing the meaning of the description, the first element can be called the second element, and similarly, the second element can be called the first element, as long as all occurrences of the "first element" are renamed consistently and all occurrences of the "second element" are renamed consistently. The first element and the second element are both elements, but may not be the same element. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms "a", "an" and "the" are intended to include the plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method or device including the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0116] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0117] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0118] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A debugging method for an application, characterized in that: Applied to the debug manager, the debug manager is connected to the security element and the integrated development platform respectively, and the debugging method includes: Obtaining standard debugging request information based on a standard debugging protocol sent by an integrated development platform; Converting standard debugging request information into proprietary debugging request information based on a proprietary debugging protocol; Sending proprietary debugging request information to the secure element to obtain debugging response information of the application running the proprietary debugging request information in the secure element; The debugging response information is sent to the integrated development platform, so that the integrated development platform analyzes the debugging response information and determines the fault information of the application in the security element.
2. The debugging method according to claim 1, characterized in that: Convert standard debugging request information into proprietary debugging request information based on a proprietary debugging protocol, including: Parse and extract debugging operation information from standard debugging request information; The debugging operation information is mapped to the data structure of the proprietary debugging protocol to obtain the proprietary debugging request information.
3. The debugging method according to claim 1, characterized in that: The data type of the proprietary debug information in the proprietary debug protocol is determined as follows: Parse and extract proprietary identifiers from proprietary debug information; When the proprietary identifier is not equal to the first preset identifier, and the sum of the proprietary identifier and the second preset identifier is not zero, determining that the data type of the proprietary debugging information is a response; When the proprietary identifier is equal to the first preset identifier, or the sum of the proprietary identifier and the second preset identifier is zero, it is determined that the data type of the proprietary debugging information is a request.
4. The debugging method according to claim 1, 2 or 3, characterized in that: Also includes: Send a debugging information deletion instruction to the security element, so that the security element deletes the relevant debugging information of the application according to the debugging information deletion instruction.
5. A debugging method for an application, characterized in that: Applied to the integrated development platform, the integrated development platform is connected to the debugging manager, and the debugging method includes: Generate a standard debugging request message based on a standard debugging protocol; Sending a standard debug request message to a debug manager so that the debug manager converts the standard debug request message into a proprietary debug request message based on a proprietary debug protocol, and sending the proprietary debug request message to the secure element to obtain debug response information of the proprietary debug request message executed by an application in the secure element; The debugging response information sent by the debugging manager is obtained and analyzed to determine the fault information of the application in the secure element.
6. The debugging method according to claim 5, characterized in that: Also includes: Obtain the user's identity information and work requirements; Display views based on the user's identity information and work requirements.
7. A debugging method for an application, characterized in that: Applied to the security element, the security element is connected to the debug manager, and the debugging method includes: Obtaining proprietary debugging request information sent by the debugging manager; wherein the proprietary debugging request information is converted by the debugging manager from the standard debugging request information based on the proprietary debugging protocol; The application in the secure element runs the proprietary debug request information and obtains the debug response information; The debugging response information is sent to the debugging manager, so that the debugging manager sends the debugging response information to the integrated development platform, so that the integrated development platform analyzes the debugging response information and determines the fault information of the application in the security element.
8. The debugging method according to claim 7, characterized in that: The security element includes a debugging agent terminal and a security element body, and the debugging agent terminal is connected to the debugging manager and the security element body respectively; wherein: The debugging agent terminal obtains the proprietary debugging request information sent by the debugging manager, and sends the proprietary debugging request information to the secure element body; The application in the secure element body runs the proprietary debugging request information and obtains the debugging response information, and sends the debugging response information to the debugging agent terminal; The debugging agent terminal sends debugging response information to the debugging manager.
9. A debugging system for an application, characterized in that: include: The integrated development platform is configured to generate standard debugging request information based on a standard debugging protocol, analyze debugging response information of the proprietary debugging request information of the application running in the secure element, and determine fault information of the application in the secure element; A secure element having an application installed therein and configured to execute proprietary debug request information for the application and obtain debug response information; The debugging manager includes an uplink connection manager and a downlink connection manager, is connected to the integrated development platform through the uplink connection manager, is connected to the security element through the downlink connection manager, and is configured to: obtain standard debugging request information sent by the integrated development platform; Converting the standard debug request information into a proprietary debug request information based on a proprietary debug protocol; sending the proprietary debug request information to the secure element; Send debugging response information to the integrated development platform.
10. An electronic device comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to perform the debugging method for an application program according to any one of claims 1 to 8 when executing the program instructions.
Citation Information
Patent Citations
Multiprotocol unit testing method and device, electronic equipment and storage medium
CN108347356A
Method of managing secure element
CN109479195A
Secure element access interface protocol adaptation method and device
CN110557395A
Integrity checking system
US20130061328A1
Cited By
Memory debugging information organization generation method and device and electronic equipment
CN120448248A