Card application test method and device, electronic equipment and storage medium

By analyzing and executing test instructions on the terminal and connecting with card applications, the compatibility problem in traditional card application testing methods is solved, and testing in a real operating environment is achieved and testing is improved.

CN119690821APending Publication Date: 2025-03-25CHINA MOBILE INTERNET CO LTD +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411601806.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The traditional card application testing method has not been tested on the real operating environment (mobile phone terminal), and there may be compatibility issues.

Method used

By receiving the connection request sent by the terminal, the test instruction set is parsed, and connected to the card application through the second terminal, the test instruction is sent for testing operations, and finally the test result is received and returned.

Benefits of technology

It solves the compatibility problem during card application testing, can be tested in a real operating environment, and improves testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690821A_ABST
    Figure CN119690821A_ABST
Patent Text Reader

Abstract

The invention discloses a card application test method, belongs to the technical field of user cards, and is used for effectively solving the problem of card application compatibility test. The method comprises the following steps: receiving a first connection request which is sent by a first terminal and requests to be connected with a server, wherein the first connection request comprises attribute information of a plurality of second terminals connected with the first terminal and attribute information of card applications in the second terminals; after a test instruction set which is sent by the first terminal and used for testing the multiple card applications is received, the test instruction set is analyzed, and test instructions corresponding to the card applications are obtained; the second terminal is connected with each card application, and the test instruction is sent to the corresponding card application, so that the card application performs a test operation; and receiving a test result returned by the card application through the second terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of user cards, and specifically relates to a card application testing method, device, electronic equipment and storage medium. Background Art

[0002] The traditional card application test method is to insert the SIM / USIM card into a card reader that complies with the PS / SC standard, and connect the card reader to a Windows computer via a USB interface. The tester writes a test script, parses the test script through the test software installed on the computer, interacts with the card reader through the dynamic link library and API functions of the operating system, and the card reader sends the received APDU instructions to the smart card, and the card application in the SIM / USIM card responds to the instructions. However, this card application test method has not been tested in a real operating environment (mobile terminal), and there may be compatibility issues.

[0003] Therefore, a card application testing method that can solve the card application compatibility problem is needed. Summary of the invention

[0004] The embodiment of the present application provides a card application testing method, which can solve the compatibility problem when testing the card application. In a first aspect, an embodiment of the present application provides a card application testing method, the method comprising: receiving a first connection request sent by a first terminal to connect to a server, the first terminal being a terminal requesting to test a card application, the first connection request comprising attribute information of a plurality of second terminals connected to the first terminal, and attribute information of the card application in each of the second terminals; after receiving a test instruction set sent by the first terminal to test the plurality of card applications, parsing the test instruction set to obtain a test instruction corresponding to each of the card applications; connecting to each of the card applications through the second terminal, and sending the test instruction to the card application corresponding thereto, so that the card application performs a test operation; and receiving the test result returned by the card application through the second terminal. In a second aspect, an embodiment of the present application provides a card application testing device, which includes: a first receiving module, used to receive a first connection request sent by a first terminal to connect to a server, the first terminal being a terminal requesting to test a card application, the first connection request including attribute information of multiple second terminals connected to the first terminal, and attribute information of the card application in each of the second terminals; a first parsing module, used to parse the test instruction set for testing multiple card applications after receiving the test instruction set sent by the first terminal, so as to obtain the test instructions corresponding to each of the card applications; a first sending module, used to connect to each of the card applications through the second terminal, and send the test instruction to the card application corresponding thereto, so that the card application performs a test operation; a second receiving module, used to receive the test result returned by the card application through the second terminal.

[0005] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0006] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0007] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0008] In an embodiment of the present application, a first connection request for connecting to a server is received by a first terminal, the first terminal being a terminal requesting to test a card application, the first connection request including attribute information of a plurality of second terminals connected to the first terminal, and attribute information of the card application in each of the second terminals; after receiving a test instruction set for testing the plurality of card applications sent by the first terminal, the test instruction set is parsed to obtain a test instruction corresponding to each of the card applications; a connection is made to each of the card applications through the second terminal, and the test instruction is sent to the card application corresponding thereto, so that the card application performs a test operation; and receiving the test result returned by the card application through the second terminal, compatibility issues when testing the card application can be resolved. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1It is a flowchart of a card application testing method provided in an embodiment of the present application; Figure 2 It is a swimming lane diagram of a card application testing method applied to an Android operating system provided in an embodiment of the present application; Figure 3 It is a swimming lane diagram of a card application testing method applied to an iOS operating system provided in an embodiment of the present application; Figure 4 It is a structural diagram of a card application test system provided by an embodiment of the present application; Figure 5 It is a structural schematic diagram of a card application testing device provided in an embodiment of the present application; Figure 6 It is a structural diagram of a card application testing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0009] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0010] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0011] The card application testing method provided in the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.

[0012] Figure 1 A card application test method provided by an embodiment of the present invention is shown. The method can be executed by an electronic device, and the electronic device may include: a server and / or a terminal device, wherein the terminal device may be, for example, a vehicle-mounted terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in the card application test device, and the method includes the following steps: Step 102: receiving a first connection request sent by a first terminal to connect to a server; The first terminal is a terminal requesting to test the card application, and the first connection request includes attribute information of a plurality of second terminals connected to the first terminal and attribute information of the card application in each of the second terminals.

[0013] The server receives a first connection request sent by a first terminal to itself to connect with itself, wherein the first terminal is a terminal requesting to test the card application, which may be a computer terminal, and the first connection request includes attribute information of multiple second terminals connected to the first terminal, and attribute information of the card application in each second terminal, and the second terminal is a terminal with the card application installed, which may be a mobile phone terminal.

[0014] Specifically, multiple mobile phone terminals installed with the card application to be tested are connected to a computer terminal. The computer terminal can obtain the attribute information of each mobile phone terminal and the attribute information of the card application in each mobile phone terminal, and generate a first connection request based on the acquired attribute information of the mobile phone terminal and the attribute information of the card application, thereby requesting to connect to the server.

[0015] Step 104: after receiving the test instruction set for testing the plurality of card applications sent by the first terminal, parsing the test instruction set to obtain the test instruction corresponding to each of the card applications; After receiving the test instruction set for testing multiple card applications sent by the first terminal, the server parses the received test instruction set to obtain the test instructions corresponding to each card application. That is, after the first terminal completes the connection with the server, the first terminal generates a test instruction set for multiple card applications to the server, and sends the test instruction set to the server, wherein the test instruction set is generated based on multiple card applications in multiple second terminals connected to the first terminal. After receiving the test instruction set, the server can parse the test instruction set based on the attribute information of each second terminal included in the first connection request and the attribute information of the card application in each second terminal, thereby determining the test instruction corresponding to each card application, that is, the APDU instruction.

[0016] Step 106: connecting to each of the card applications through the second terminal, and sending the test instruction to the corresponding card application, so that the card application performs a test operation; After obtaining the test instructions corresponding to each card application, the server connects to the card application through the second terminal, and sends the corresponding test instructions to each card application after the connection is successful, so that the card application receives and performs test operations based on the test instructions.

[0017] When the server connects to each card application through the second terminal, the server can first connect to the second terminal and connect the second terminal to the card application, thereby realizing an indirect connection between the server and the card application, and can also directly send connection information to the card application installed in the second terminal, thereby realizing a direct connection between the server and the card application.

[0018] Specifically, before sending the test instruction to the card application, the instruction preprocessing module of the server can also parse the test instruction, verify the test instruction according to 7816-4 and GP specifications, send the test instruction that passes the verification to the card application, and return the test instruction that fails the verification and error information to the first terminal.

[0019] Step 108: Receive the test result returned by the card application through the second terminal.

[0020] After sending the test instruction to the corresponding card application, the card application performs a test operation based on the test instruction and determines the test result, and then sends the test result to the server through the second terminal. After the card application sends the test result to the server through the second terminal, the server receives the test result returned by the second terminal.

[0021] The card application testing method provided by the embodiment of the present invention receives a first connection request sent by a first terminal to connect to a server, wherein the first terminal is a terminal requesting to test a card application, and the first connection request includes attribute information of multiple second terminals connected to the first terminal, and attribute information of the card application in each of the second terminals; after receiving a test instruction set sent by the first terminal to test the multiple card applications, the test instruction set is parsed to obtain a test instruction corresponding to each of the card applications; the card applications are connected to each other through the second terminal, and the test instruction is sent to the corresponding card application so that the card application performs a test operation; and the test result returned by the card application through the second terminal is received, so as to solve the compatibility problem when testing the card application.

[0022] In one implementation, the receiving of a first connection request from a first terminal for connecting to a server (step 102) may include executing steps A1-A2: Step A1: Determine a secure hypertext transfer protocol HTTPS server for card application testing; Before receiving the first connection request sent by the first terminal, the server first determines the HTTPS server used for card application testing, that is, the server pre-generates, opens and initializes an HTTPS server specifically used for card application testing. After determining the HTTPS server, the server waits to receive the first connection request sent by the second terminal by listening to the first port of HTTPS (such as port 8080).

[0023] Step A2: receiving the first connection request sent by the first terminal to the HTTPS server; The first connection request includes the serial number of the second terminal and the application identification AID number of the card application in the second terminal.

[0024] After determining the HTTPS server for performing the card application test, the server receives a first connection request sent by the first terminal, wherein the attribute information of the second terminal included in the first connection request is the serial number of the second terminal, and the attribute information of the application card in the second terminal included in the first connection request is the AID number of the card application.

[0025] In an implementation manner, after receiving the first connection request sent by the first terminal to the HTTPS server (step A2), steps B1-B2 may also be performed: Step B1: the HTTPS server generates session information based on the first connection request; The session information includes one or more of the sequence number, the AID number and the connection timeout duration.

[0026] After the server determines the HTTPS server and receives the first connection request, the HTTPS server on the server can generate session information based on the first connection request, that is, generate a session, wherein the generated session can save information such as the AID number of the card application, the serial number list of the second terminal, and the connection timeout duration.

[0027] Step B2: Send the session information to the first terminal.

[0028] After the HTTPS server generates the session information, the HTTPS server on the server sends the generated session information to the first terminal, that is, the HTTPS server returns the generated session to the first terminal. After the server returns the generated session to the first terminal, the data related to the card application test conducted between the server and the first terminal can be stored in the session.

[0029] In one implementation, the connecting with each of the card applications through the second terminal (step 106) may include executing steps C1-C2: Step C1: when the operating system of the second terminal is an Android system, connecting to a socket service port preset by the second terminal, and then connecting to the card application through a machine-card channel of the second terminal; When the server and the card application are connected through the second terminal, the server can select different connection methods according to different operating systems of the second terminal, that is, when the operating system of the second terminal is Android system or iOS system, different connection methods can be used.

[0030] Specifically, when the operating system of the second terminal is an Android system, the server can connect to the socket service port preset by the second terminal, and then connect to the card application through the machine-card channel of the second terminal. In other words, the server connects to the socket interface preset in the second terminal, and then after the connection is successful, an indirect connection is achieved with the card application based on the machine-card channel between the second terminal and the card application.

[0031] More specifically, the server forwards the local listening port to the second terminal Socket server port through ADB port forwarding for each first terminal, and then writes the mapping between the second terminal serial number and the local port number into the routing table. The local listening port numbers of different second terminals are different, and the socket server port numbers of all second terminals are the same.

[0032] The adb forward command is used for port forwarding. The usage is: adb forward local port to the second terminal port. The main function of port forwarding is to use the second terminal as a server and the server as a client. Through port forwarding, the service can use the forwarded port to develop a socket program to connect to the second terminal, and then interact with the server program in the second terminal.

[0033] Step C2: When the operating system of the second terminal is iOS system, connect to the socket service port of the second terminal and send proxy parameters to the card application, so that the card application establishes an independent transmission protocol BIP channel connection with the second terminal based on the proxy parameters.

[0034] Specifically, when the operating system of the second terminal is iOS, the server can connect to the preset socket service port of the second terminal and send proxy parameters to the card application in the second terminal, and the sent proxy parameters are used to establish a BIP channel connection between the card application and the second terminal. In other words, the server connects to the preset socket service port in the second terminal and sends proxy parameters to the card application. After receiving the proxy parameters, the card application can establish a BIP channel connection with the second terminal based on the proxy parameters, thereby realizing an indirect connection between the server and the card application.

[0035] In one implementation, before connecting to the socket service port preset by the second terminal (step C1), steps D1-D3 may also be performed: Step D1: Detect whether the first application is installed in the second terminal; The first application is used to start the socket service port in the second terminal.

[0036] Before the server connects to the socket service port preset by the second terminal, the server first detects whether the first application is installed in the second terminal, wherein the first application is used to start the socket service port in the second terminal. In other words, before the server connects to the socket service port of the second terminal, it needs to open the socket service port in the second terminal.

[0037] Specifically, the server needs to open the socket service port of the second terminal through the first application installed in the second terminal, so the server will download and install the first application in the second terminal when the first application is not installed in the second terminal. The server can read the first terminal serial number list in the first connection request sent by the first terminal, and use the ADB tool to detect whether the first application is installed in the terminal list of the first terminal, that is, check whether the APK is installed through adb shell pm list packages -f | grep "com.example.app". If not installed, install the APK through adb shell pm listpackages -f | grep "com.example.app".

[0038] Step D2: If yes, detecting whether the service port is in an open state; After the server determines that the first application is installed in the second terminal, the server detects whether the socket service port is in an open state.

[0039] Specifically, you can check whether the service port of the first terminal is open by the following method: 1. First, there is a service component in the APK and declared in AndroidManifest.xml.

[0040] <service android:name=".YourSocketService"> <intent-filter> <action android:name="your.package.name.ACTION_START_SERVICE" / > < / intent-filter> < / service> 2. In the Service class, you need to handle the creation and monitoring of Socket: public class YourSocketService extends Service { private ServerSocket serverSocket; @Override public int onStartCommand(Intent intent, int flags, int startId) { startSocketService(); return START_STICKY; } private void startSocketService() { try { serverSocket = new ServerSocket(12345); / / Use port number while (true) { / / Accept the connection and process the request Socket client = serverSocket.accept(); / / ... process the request } } catch (IOException e) { e.printStackTrace(); } } / / ... other lifecycle methods and service logic More specifically, after the second terminal receives the test instruction sent by the server, the second terminal can authenticate the first application according to the AC rule of the SIM card, and after the authentication is passed, the test phone APDU processing module sends the instruction to the adaptation layer, and selects different machine-card channel APIs to interact with the card application according to different test phone models. In other words, before sending the test instruction to the second terminal, the SHA1 value of the first application signature file is pre-written into the AC rule file of each SIM card through the card reader. Therefore, before using the machine-card channel to send the APDU instruction, the mobile phone Android system will verify the APK signature file according to the AC rule file to confirm whether the APK has the permission to access the card application, so that the first application can send the test instruction to the card application through the machine-card channel.

[0041] Step D3: If not, starting the socket service port based on the first application.

[0042] When the server determines that the service port in the second terminal is not enabled, the service port starts the service port, ie, the socket port, in the second terminal based on the first application. When the server determines that the service port in the second terminal is not enabled, no operation is required.

[0043] Specifically, when the service port is not open, you can use the adb command to start the service: adb shell amstartservice your.package.name / .YourSocketService.

[0044] In one implementation, the step of connecting to the socket service port of the second terminal and sending proxy parameters to the card application (step C2) may include executing step E: Step E: sending the proxy parameter to the second terminal via a short message gateway, so that the card application generates a connection instruction based on the proxy parameter, and sends the connection instruction to the second terminal; Among them, the proxy parameters include one or more of the connection establishment parameters, the server address, and the server port number of the second terminal. The connection instruction is used to instruct the card application to establish the BIP channel connection with the second terminal, and to instruct the socket service port in the second terminal to connect to the server.

[0045] When the operating system of the second terminal is iOS system and the server is connected to the socket service port of the second terminal, the server can send proxy parameters to the card application through the SMS gateway. The proxy parameters may include information such as connection establishment parameters, server address and service port number of the second terminal. After receiving the proxy parameters, the card application can generate a connection instruction based on the proxy parameters and establish a BIP channel connection with the second terminal based on the connection instruction. After the card application generates the connection instruction, the card application will also send the connection instruction to the second terminal so that the second terminal connects the preset socket service port to the server based on the connection instruction, thereby realizing an indirect connection between the server and the card application.

[0046] Specifically, the server can send the proxy parameters to the card application proxy pre-installed in the card application, so that the card application proxy generates and sends a connection instruction based on the proxy parameters. For example, the card application proxy monitors the received proxy parameter EVENT_EVENT_DOWNLOAD_DATA_AVAILABLE event, establishes a BIP channel with the mobile phone through the generated connection instruction "open channel", and sends the "open channel" instruction to the second terminal. After receiving the "open channel" instruction, the second terminal establishes a TCP connection with the socket of the server.

[0047] In one implementation, the test instruction is sent to the corresponding card application so that the card application performs a test operation (step 106), and step F may also be performed: Step F: Send the test instruction to the second terminal to which the corresponding card application belongs, so that the second terminal forwards the test instruction to the card application based on the machine-card channel.

[0048] When the server sends the test instruction to the corresponding card application through the second terminal, the server can first send the test instruction to the second terminal to which the corresponding card application belongs, and the second terminal forwards the received test instruction to the card application through the machine-card channel.

[0049] Specifically, the operating system of the second terminal may be Android or iOS. When the operating system of the second terminal is Android, the second terminal can directly send the received test instructions to the card application through the machine-card channel of the Android system, and can also send the test instructions to the card application through the machine-card channel through the first application pre-installed in the second terminal.

[0050] More specifically, when the operating system of the second terminal is iOS, the second terminal can not only directly send the test instruction to the card application (for example, send the test instruction to the card application agent pre-installed by the card application), but also send the test instruction to the card application through the BIP channel (for example, the second terminal sends the test instruction to the card application agent pre-installed by the card application through the BIP channel, and the card application agent parses the received test instruction and forwards it to the card application process method for processing). Among them, the system provides a shared interface MyShareable (the name can be customized) that inherits shareable, and defines the process (APDU apdu) method in the interface. The target card application implements the MyShareable interface and returns the target card application object (this object) through the getShareableInterfaceObject (AID clientAID ,byte param) method. For security reasons, it should first be determined whether the clientID is equal to the AID of the proxy card application. If they are equal, it returns itself, and if they are not equal, it returns null. After parsing the received APDU command, the card application agent obtains the AID of the target card application, obtains the target card application object through the JCSystem.getAppletShareableInterfaceObject(AID,byte) method, and calls the process(APDU apdu) method of the target application to process the test command.

[0051] In one implementation, each of the card applications corresponds to a plurality of the test instructions, and the test instructions are sent to the corresponding card applications so that the card applications perform a test operation (step 106), and steps G1-G2 may also be performed: Step G1: inputting the test instruction into a preset thread pool, so that a plurality of the test instructions corresponding to the card application are sent to the second terminal in sequence; The test instruction corresponding to each card application may be one or more. When each card application corresponds to multiple test instructions, that is, each card application needs to perform test operations on multiple test instructions, the server can input the test instructions into a pre-set thread pool, and the thread pool can send the test instructions corresponding to each card application to the second terminal in sequence. In other words, after the multiple test instructions are input into the thread pool, the thread pool can send the multiple test instructions to the second terminal one by one in the preset order.

[0052] Step G2: input the test instruction into a preset message queue, so that the multiple test instructions corresponding to the card application are sent to the second terminal in sequence.

[0053] When each card application corresponds to multiple test instructions, that is, each card application needs to perform test operations on multiple test instructions, the server can also input the test instructions into a preset message queue, and the message queue can send the test instructions corresponding to each card application to the second terminal in sequence. In other words, after the multiple test instructions are input into the message queue, the message queue can send the multiple test instructions to the second terminal one by one in the preset order.

[0054] In one implementation, the test instruction is input into the preset thread pool so that the multiple test instructions corresponding to the card application are sent to the second terminal in sequence (step G1), and steps H1-H2 may be executed: Step H1: creating a first number of thread pools; The thread pool is a single-threaded thread pool, and the first number is not greater than the number of the second terminals.

[0055] Before the server inputs the test instruction into the thread pool, the server needs to create a first number of thread pools, wherein the first number is less than or equal to the number of second terminals, and the created thread pool is a single-threaded thread pool. For example, the server can create a single-threaded thread pool with half the number of second terminals.

[0056] Thread pools usually only have parallel capabilities, but instruction execution has execution order requirements, and the first-in-line instructions need to be executed first. Therefore, it is necessary to use a JAVA thread pool with parallel-serial functions (such as: KeyAffinityExecutor) to asynchronously execute each APDU instruction. The thread pool includes multiple sub-thread pools. A test mobile phone can be mapped to a thread pool, and each sub-thread pool is single-threaded. Therefore, instructions corresponding to different mobile phones can be executed in parallel, and instructions for the same mobile phone are executed serially in the order of submission.

[0057] Specifically, the server uses the KeyAffinityExecutor.newSerializingExecutor() method to create a thread pool and specifies the number of sub-thread pools, which can be set to half the number of the second terminal to be tested, according to the daily instruction test situation, usually set to 100. Then the server uses the keyAffinityExecutor.submit(K, Callable) method to put it into the thread pool, where K is the serial number attribute of the second terminal and Callable is the execution result of the test task object.

[0058] Step H2: Input the test instructions into the plurality of thread pools.

[0059] After the server creates the thread pool, the server inputs the test instructions into the multiple thread pools that have been created. Specifically, the thread pool can put the test tasks corresponding to the second terminal into the corresponding thread pool according to the serial number of the second terminal. The thread pool has only one thread, thereby ensuring that the test instructions in the thread pool corresponding to each second terminal can be executed in sequence.

[0060] In one implementation, when the operating system of the second terminal is an Android system, the test result is sent by the card application to the second terminal through a machine-card channel and forwarded by the second terminal to the server; when the operating system of the second terminal is an iOS system, the test result is sent by the card application to the second terminal through a BIP channel and forwarded by the second terminal to the server.

[0061] After the server sends the test instruction to the card application through the second terminal, the card application can perform a test operation on the test instruction and obtain a test result, and then return the test result to the server. When the card application returns the test result to the server, the card application can send the test result to the second terminal through the machine-card channel and the second terminal forwards the test result to the server, and can also send the test result to the second terminal through the BIP channel and the second terminal forwards the test result to the server.

[0062] Specifically, the operating system of the second terminal may be an Android system or an iOS system. When the operating system of the second terminal is an Android system, the card application sends the test result to the second terminal through the machine-card channel of the Android system and the second terminal forwards the test result to the server. When the operating system of the second terminal is an iOS system, the card application sends the test result to the second terminal through the BIP channel and the second terminal forwards the test result to the server.

[0063] Figure 2 is a swimming lane diagram of a card application testing method applied to an Android operating system provided in an embodiment of this specification, such as Figure 2 Said schematic diagram comprises: Step 2.1: The server starts and initializes the HTTPS server; Step 2.2: Start the HTTPS Server service on the server; Step 2.3: The first terminal sends a first connection request to the server and connects to the HTTPS Server service; Step 2.4: The server sends the mobile APK to the second terminal; Step 2.5: The server calls the mobile APK and starts the Socket Server service port; Step 2.6: The server forwards the ADB port to the second terminal; Step 2.7: The server creates a session and returns the session to the first terminal; Step 2.8: The first terminal sends a test instruction set to the server; Step 2.9: The server parses the test instruction set and inputs the parsed test instructions into the instruction queue to send the test instructions in sequence; Step 2.10: The server establishes a Socket connection with the second terminal and sends a test instruction to the second terminal; Step 2.11: The second terminal authenticates the mobile phone APK to determine whether it has the test permission; Step 2.12: The second terminal establishes a machine-card channel with the card application and sends a test instruction; Step 2.13: The card application executes the test instruction and sends the test result obtained by the test to the second terminal; Step 2.14: The second terminal sends the test result to the server; Step 2.15: The server sends the test result to the first terminal.

[0064] This embodiment, when the operating system of the second terminal is the Android system, installs the test APK on multiple second terminals connected to the first terminal and opens the socket service port of the second terminal, so that the test instructions of the server can be sent to the second terminal, and the second terminal forwards the test instructions to the card application through the machine-card channel, thereby not only solving the compatibility problem when testing the card application, but also being able to simultaneously test the card application on multiple second terminals connected to the first terminal, thereby improving the efficiency of the card application test.

[0065] Figure 3 : is a swimming lane diagram of a card application testing method applied to an iOS operating system provided in an embodiment of this specification, such as Figure 3 As shown, the schematic diagram includes: Step 3.1: The server starts and initializes the HTTPS server; Step 3.2: The server installs the card application agent through remote application management; Step 3.3: Start the HTTPS Server service on the server Step 3.4: The first terminal sends a first connection request to the server and connects to the HTTPS Server service; Step 3.5: The server creates a session and returns the session to the first terminal; Step 3.6: The first terminal sends a test instruction set to the server; Step 3.7: The server parses the test instruction set and inputs the parsed test instructions into the instruction queue to send the test instructions in sequence; Step 3.8: The server creates a Socket connection pool; Step 3.9: The server sends a push sm command to the card application agent through the SMS gateway; Step 3.10: The card application agent establishes a BIP channel connection with the second terminal based on the push sm instruction; Step 3.11: The second terminal establishes a TCP connection with the server; Step 3.12: The server sends the test instruction to the card application agent; Step 3.13: The card application agent parses and forwards the test instruction to the card application; Step 3.14: The card application executes the test instruction and sends the execution result to the second terminal; Step 3.15: The second terminal sends the test instruction to the server; Step 3.16: The server sends a test instruction to the first terminal.

[0066] This embodiment installs a card application agent in the card application when the operating system of the second terminal is the iOS system, so that the test instructions of the server can be sent to the card application through the card application agent, and the test results returned by the card application to the second terminal through the BIP channel can be received, thereby solving the compatibility problem when testing the card application.

[0067] Figure 4 FIG. 1 is a schematic diagram of a card application test system provided in an embodiment of the present specification. Figure 4As shown, the card application test system includes a first terminal (i.e., a test computer), a service end (i.e., a server) and two second terminals (two mobile terminals with operating systems of Android system and iOS system, respectively), wherein the test computer includes a client library file and a test script, the test system server end included in the server also includes an HTTPS Server module, an instruction preprocessing module, an instruction thread pool, a controller and a status code interpreter, the mobile terminal with an operating system of Android system includes a SocketServer module, an APDU processor module and a terminal adapter, and the mobile terminal with an operating system of iOS system includes an iOS card application agent. Specifically, the client library file provides functions such as connecting to the test system server end, sending APDU instructions, encryption and decryption operations, and receiving return values. The HTTPS Server module is used to establish a connection between the HTTPS server and the test computer. Using the HTTPS mode can prevent the APDU instructions from being monitored during the transmission process, thereby ensuring the security of the card application. The instruction preprocessor module is used to parse and analyze the APDU instructions, and verify the APDU instruction format according to the 7816-4 and GP specifications. For APDUs that do not meet the requirements of the specifications, an error message is directly returned to the tester. The instruction thread pool module is used to put the test instructions sent by the test computer into the thread pool corresponding to the test mobile phone serial number, and send the earliest instruction to the controller. The controller module is used to create a Socket client, retrieve the routing table according to the mobile phone serial number of the instruction, and send the instruction to the corresponding mobile phone for execution. The status code interpreter is used to respond to APDU according to the 7816-4 protocol and return the SW1SW2 status code. Under normal circumstances, it is 9000 and 61XX. For other status codes, it means that when executing the instruction, the system or card application has an error or warning message. This information may be thrown by COS or the card application. Different codes have different meanings. The system administrator can save the information library corresponding to the status code in the database table in advance. In this way, when an error occurs in the APDU execution, the status code interpreter can retrieve the status code information library according to the status code to provide useful error prompt information for the tester. The Socket Server module is used to establish a Socket server on the mobile phone side and receive the APDU instructions sent by the controller. The APDU processor module is used to send the APDU instructions to the card application through the machine-card channel. The terminal adapter is used to adapt to different Android test terminals and use different machine-card channel APIs. The iOS card application agent is also a card application, which is used to establish a BIP channel with the test system server, receive the APDU instructions sent by the server, and forward them to the target card application for processing.

[0068] The embodiments of this specification are based on the machine-card channel and the BIP channel. The test APK and the card application agent are installed on the second terminal, so that when the operating system of the second terminal is the Android system, a machine-card channel can be established between the second terminal and the card application. When the operating system of the second terminal is the iOS system, a BIP channel is established between the second terminal and the card application, thereby realizing instruction test operations on the card application through the second terminal, that is, the test can be performed in a real operating environment (mobile terminal), which solves the compatibility problem when testing the card application.

[0069] It should be noted that the card application test method provided in the embodiment of the present application can be executed by a card application test device or a control module in the card application test device for executing the card application test method. In the embodiment of the present application, the card application test device provided in the embodiment of the present application is described by taking the card application test device executing the card application test method as an example.

[0070] Figure 5 FIG. 1 is a schematic diagram of the structure of a card application test device according to an embodiment of the present invention. Figure 5 As shown, the card application testing device includes: a first receiving module 502 , a first parsing module 504 , a first sending module 506 , and a second receiving module 508 .

[0071] A first receiving module 502 is used to receive a first connection request sent by a first terminal for requesting to connect to a server, wherein the first terminal is a terminal requesting to test a card application, and the first connection request includes attribute information of multiple second terminals connected to the first terminal and attribute information of the card application in each of the second terminals; A first parsing module 504 is used for parsing the test instruction set for testing the plurality of card applications after receiving the test instruction set sent by the first terminal to obtain the test instruction corresponding to each of the card applications; A first sending module 506, used to connect with each of the card applications through the second terminal, and send the test instruction to the corresponding card application, so that the card application performs a test operation; The second receiving module 508 is configured to receive the test result returned by the card application through the second terminal.

[0072] The card application test device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0073] The card application testing device in the embodiment of the present application may be a device having an operating system, which may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0074] The card application testing device provided in the embodiment of the present application can achieve Figures 1 to 4 To avoid repetition, the various processes implemented in the method embodiment are not described here.

[0075] Based on the same technical concept, an embodiment of the present application further provides an electronic device, which is used to execute the above-mentioned card application test method. Figure 6 A schematic diagram of the structure of an electronic device for implementing various embodiments of the present application. The electronic device may have relatively large differences due to different configurations or performances, and may include a processor (processor) 602, a communication interface (Communications Interface) 604, a memory (memory) 606, and a communication bus 608, wherein the processor 602, the communication interface 604, and the memory 606 communicate with each other through the communication bus 608. The processor 602 may call a computer program stored in the memory 606 and executable on the processor 602 to perform the following steps: receiving a first connection request sent by a first terminal for requesting to connect to a server, wherein the first terminal is a terminal requesting to test a card application, and the first connection request includes attribute information of a plurality of second terminals connected to the first terminal and attribute information of the card application in each of the second terminals; After receiving a test instruction set for testing the plurality of card applications sent by the first terminal, parsing the test instruction set to obtain a test instruction corresponding to each of the card applications; connecting with each of the card applications through the second terminal, and sending the test instruction to the corresponding card application, so that the card application performs a test operation; Receive a test result returned by the card application through the second terminal.

[0076] In one implementation, the receiving a first connection request sent by the first terminal to connect to the server includes: Identify a secure Hypertext Transfer Protocol (HTTPS) server for card application testing; The first connection request sent by the first terminal to the HTTPS server is received, where the first connection request includes the serial number of the second terminal and an application identification AID number of the card application in the second terminal.

[0077] In an implementation manner, after receiving the first connection request sent by the first terminal to the HTTPS server, the method further includes: The HTTPS server generates session information based on the first connection request, where the session information includes one or more of the sequence number, the AID number, and a connection timeout duration; The session information is sent to the first terminal.

[0078] In one implementation, the connecting with each of the card applications through the second terminal includes: When the operating system of the second terminal is an Android system, connecting to a socket service port preset by the second terminal, and then connecting to the card application through a machine-card channel of the second terminal; When the operating system of the second terminal is iOS system, connect to the socket service port of the second terminal, and send proxy parameters to the card application, so that the card application establishes an independent transmission protocol BIP channel connection with the second terminal based on the proxy parameters.

[0079] In one implementation, before connecting to the socket service port preset by the second terminal, the method further includes: detecting whether a first application is installed in the second terminal, the first application being used to start the socket service port in the second terminal; If yes, detecting whether the service port is in an open state; If not, the socket service port is started based on the first application.

[0080] In one implementation, the connecting to the socket service port of the second terminal and sending the proxy parameter to the card application includes: The proxy parameters are sent to the second terminal through a short message gateway, so that the card application generates a connection instruction based on the proxy parameters and sends the connection instruction to the second terminal, the proxy parameters include one or more of the connection establishment parameters, the server address, and the server port number of the second terminal, and the connection instruction is used to instruct the card application to establish the BIP channel connection with the second terminal, and to instruct the socket service port in the second terminal to connect to the server.

[0081] In one implementation, sending the test instruction to the corresponding card application so that the card application performs a test operation includes: The test instruction is sent to the second terminal to which the corresponding card application belongs, so that the second terminal forwards the test instruction to the card application based on the machine-card channel.

[0082] In one implementation, each of the card applications corresponds to a plurality of the test instructions, and the sending of the test instructions to the corresponding card applications so that the card applications perform the test operation further includes: Inputting the test instruction into a preset thread pool, so that a plurality of the test instructions corresponding to the card application are sent to the second terminal in sequence; The test instruction is input into a preset message queue, so that a plurality of the test instructions corresponding to the card application are sent to the second terminal in sequence.

[0083] In one implementation, the step of inputting the test instruction into the preset thread pool so that a plurality of the test instructions corresponding to the card application are sent to the second terminal in sequence includes: Creating a first number of thread pools, where the thread pools are single-threaded thread pools, and the first number is not greater than the number of the second terminals; A test instruction is input into the plurality of thread pools.

[0084] In one implementation, when the operating system of the second terminal is an Android system, the test result is sent by the card application to the second terminal through a machine-card channel and forwarded by the second terminal to the server; when the operating system of the second terminal is an iOS system, the test result is sent by the card application to the second terminal through a BIP channel and forwarded by the second terminal to the server.

[0085] The specific execution steps can refer to the various steps of the above-mentioned card application test method embodiment, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.

[0086] It should be noted that the electronic devices in the embodiments of the present application include: servers, terminals, or other devices except terminals.

[0087] The above electronic device structure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the input unit may include a graphics processing unit (GPU) and a microphone, and the display unit may be configured with a display panel in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit includes a touch panel and at least one of other input devices. The touch panel is also called a touch screen. Other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0088] The memory can be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM).

[0089] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor.

[0090] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned card application test method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0091] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0092] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned card application testing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0093] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0094] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0095] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0096] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A card application testing method, applied to a server, comprising: receiving a first connection request sent by a first terminal for requesting to connect to a server, wherein the first terminal is a terminal requesting to test a card application, and the first connection request includes attribute information of a plurality of second terminals connected to the first terminal and attribute information of the card application in each of the second terminals; After receiving a test instruction set for testing the plurality of card applications sent by the first terminal, parsing the test instruction set to obtain a test instruction corresponding to each of the card applications; connecting with each of the card applications through the second terminal, and sending the test instruction to the corresponding card application, so that the card application performs a test operation; Receive a test result returned by the card application through the second terminal.

2. According to the method of claim 1, the step of receiving a first connection request sent by a first terminal to connect to a server comprises: Identify a secure Hypertext Transfer Protocol (HTTPS) server for card application testing; The first connection request sent by the first terminal to the HTTPS server is received, where the first connection request includes the serial number of the second terminal and an application identification AID number of the card application in the second terminal.

3. The method according to claim 2, after receiving the first connection request sent by the first terminal to the HTTPS server, the method further comprises: The HTTPS server generates session information based on the first connection request, where the session information includes one or more of the sequence number, the AID number, and a connection timeout duration; The session information is sent to the first terminal.

4. The method according to claim 1, wherein the connecting with each of the card applications through the second terminal comprises: When the operating system of the second terminal is an Android system, connecting to a socket service port preset by the second terminal, and then connecting to the card application through a machine-card channel of the second terminal; When the operating system of the second terminal is iOS system, connect to the socket service port of the second terminal, and send proxy parameters to the card application, so that the card application establishes an independent transmission protocol BIP channel connection with the second terminal based on the proxy parameters.

5. The method according to claim 4, before connecting to the socket service port preset by the second terminal, the method further comprises: detecting whether a first application is installed in the second terminal, the first application being used to start the socket service port in the second terminal; If yes, detecting whether the service port is in an open state; If not, the socket service port is started based on the first application.

6. The method according to claim 4, wherein the connecting to the socket service port of the second terminal and sending proxy parameters to the card application comprises: The proxy parameters are sent to the second terminal through a short message gateway, so that the card application generates a connection instruction based on the proxy parameters and sends the connection instruction to the second terminal, the proxy parameters include one or more of the connection establishment parameters, the server address, and the server port number of the second terminal, and the connection instruction is used to instruct the card application to establish the BIP channel connection with the second terminal, and to instruct the socket service port in the second terminal to connect to the server.

7. The method according to claim 4, wherein sending the test instruction to the corresponding card application so that the card application performs a test operation comprises: The test instruction is sent to the second terminal to which the corresponding card application belongs, so that the second terminal forwards the test instruction to the card application based on the machine-card channel.

8. The method according to claim 1, wherein each of the card applications corresponds to a plurality of the test instructions, and the sending of the test instructions to the corresponding card applications so that the card applications perform a test operation further comprises: Inputting the test instruction into a preset thread pool, so that a plurality of the test instructions corresponding to the card application are sent to the second terminal in sequence; The test instruction is input into a preset message queue, so that a plurality of the test instructions corresponding to the card application are sent to the second terminal in sequence.

9. The method according to claim 8, wherein the step of inputting the test instruction into the preset thread pool so that the plurality of test instructions corresponding to the card application are sent to the second terminal in sequence comprises: Creating a first number of thread pools, where the thread pools are single-threaded thread pools, and the first number is not greater than the number of the second terminals; A test instruction is input into the plurality of thread pools.

10. According to the method described in claim 1, when the operating system of the second terminal is an Android system, the test result is sent by the card application to the second terminal through a machine-card channel and forwarded by the second terminal to the server; when the operating system of the second terminal is an iOS system, the test result is sent by the card application to the second terminal through a BIP channel and forwarded by the second terminal to the server.

Citation Information

Patent Citations

  • Intelligent card application detection method and system for NFC equipment

    CN105184337A

  • Smart card application program remote testing method and apparatus

    CN105528291A

  • Intelligent card testing method, mobile terminal and testing system

    CN106817276A

  • Test method and device, computer readable storage medium and computer equipment

    CN110162453A

  • Method and system for using SIM card as TCP client to communicate with terminal application

    CN117041918A