Application downloading method and device, smart card and medium

By building application methods and platform function interface structures in NativeCOS, compiling and generating application scripts, the post-download of smart card applications is realized, solving the problem that users cannot dynamically install or update applications, and improving the flexibility and user experience of smart cards.

CN119645522BActive Publication Date: 2025-11-07GUANGDONG CHUTIAN DRAGON SMART CARD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411728698.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-11-07
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

In the existing technology, the application of NativeCOS smart cards is pre-installed before leaving the factory, which makes it impossible for users to dynamically install or update applications according to their needs, reducing the flexibility of smart cards and increasing user costs.

Method used

This paper provides an application download method that constructs an application method structure and a platform function interface structure in NativeCOS, compiles the executable file of the target application project, generates application scripts using external devices, registers identification information, creates an application module directory, and realizes the installation and updating of the target application.

Benefits of technology

This improves the flexibility of smart card applications, allowing users to dynamically install or update applications as needed after delivery, reducing the need for users to purchase multiple smart cards and lowering costs and management complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645522B_ABST
    Figure CN119645522B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of smart card operating system, and discloses an application downloading method and device, a smart card and a medium, the method comprising the following steps: obtaining a target application project, allocating an address for the target application project in a flash area; compiling the target application project to obtain a corresponding executable file; constructing an application module parameter structure body based on a starting address, identification information and an application method structure body of the target application project, and compiling the application module parameter structure body, and placing the compiled application module parameter structure body into the executable file; receiving an application script sent by an external device, executing instructions in the application script, and creating an application module directory; obtaining the application module parameter structure body based on the starting address of the target application project, installing the target application based on the application method structure body, and storing installation data of the target application under the target application directory. The application can realize smart card application post downloading.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of smart card operating system, and particularly relates to an application downloading method and device, a smart card and a medium. BACKGROUND

[0002] In the prior art, the applications on the smart card using the NativeCOS are usually pre-installed in the NativeCOS before leaving the factory, which means that the functions of the smart card using the NativeCOS are fixed after leaving the factory, and this results in that the user cannot install or update the applications according to his own needs. SUMMARY

[0003] Therefore, the embodiments of the present application provide an application downloading method and device, a smart card and a medium, which can realize the post downloading of the smart card applications and improve the flexibility of the smart card.

[0004] In a first aspect, the embodiments of the present application provide an application downloading method, which is applied to the applications of the NativeCOS, the NativeCOS includes a file system, and the file system includes a security domain directory and an application module directory; the method comprises the following steps:

[0005] Obtaining a target application project, and allocating an address for the target application project in a flash area;

[0006] Compiling the target application project to obtain an executable file of the target application project;

[0007] Constructing an application method structure and a platform function interface structure based on the functions of the target application project, wherein the target application project calls an application method in the application method structure based on the platform function interface structure;

[0008] Obtaining a starting address and identification information of the target application project, constructing an application module parameter structure based on the starting address and the identification information of the target application project and the application method structure, compiling the application module parameter structure, and placing the compiled application module parameter structure into the executable file of the target application project;

[0009] Receiving an application script sent by an external device, executing instructions in the application script, registering the identification information under the security domain directory, creating an application module directory, creating a target application directory under the application module directory, wherein the application script is obtained by converting the executable file through a preset conversion tool;

[0010] The application module parameter structure is obtained based on the starting address of the target application project, the target application is installed based on the application method structure, and installation data of the target application is stored under the target application directory.

[0011] In some embodiments, the number of target application projects is multiple.

[0012] The address allocation for the target application projects in the flash area includes allocating a unique storage address for each target application project in the flash area.

[0013] In some embodiments, the application method structure includes an application installation method, an application selection method, an application deselecting method, an application instruction processing method, an application deleting method, an application multi-selection method, a multi-selection application push selection method, and an application sharing method.

[0014] The platform function interface structure includes a communication processing interface, an application registration and callback interface, a checksum operation interface, a key management interface, a key pair management interface, a password operation interface, a hash operation interface, a random number generation interface, a signature calculation interface, and a PIN management interface.

[0015] In some embodiments, the method further includes a process of converting the executable file into an application script based on a preset conversion tool, specifically:

[0016] The preset conversion tool obtains the executable file of the target application project based on the file path selected by the user, and judges whether the executable file corresponding to the file path is in a preset format.

[0017] In the case where the executable file corresponding to the file path is in the preset format, the package identification information input by the user is received, and it is verified whether the package identification information is legal.

[0018] In the case where the package identification information is legal, the executable file of the target application project corresponding to the file path is converted into an application script.

[0019] In some embodiments, the name of the application script contains the package identification information, and the application script includes an installation instruction. Before executing the installation instruction in the application script, the method further includes:

[0020] Based on the package identification information in the name of the application script, it is judged whether there is the same package identification information in the flash area. If not, the installation instruction is executed, otherwise, an error is reported.

[0021] In some embodiments, the application script further comprises a plurality of download instructions; and the step of registering the identification information in the secure domain directory according to the instructions in the application script comprises:

[0022] executing a first download instruction in the application script, caching a data meta tag, reading a first write address corresponding to the first download instruction, and writing executable file data in the first download instruction into the first write address;

[0023] determining whether there is a next download instruction, if there is, continuing to execute the next download instruction, reading a next write address corresponding to the next download instruction, and writing executable file data in the next download instruction into the next write address, and if there is not, registering the package identification information and the module identification information in the secure domain directory.

[0024] In some embodiments, the application module parameter structure further comprises an initialization application method, and the method further comprises:

[0025] selecting the target application project based on an application selection method in the application method structure, and passing an interface library address corresponding to the platform function interface structure to the target application project through the initialization application method, so that the target application project calls a registration callback function of the interface library to pass an application method in the application method structure to the NativeCOS.

[0026] In a second aspect, the embodiments of the present application provide an application downloading device based on a NativeCOS, which is applied to an application of the NativeCOS, the NativeCOS comprises a file system, and the file system comprises a secure domain directory and an application module directory; and the device comprises:

[0027] an address allocation module configured to obtain a target application project and allocate an address for the target application project in a flash area;

[0028] an executable file generation module configured to compile the target application project to obtain an executable file of the target application project;

[0029] a structure construction module configured to construct an application method structure and a platform function interface structure based on a function of the target application project, wherein the target application project calls an application method in the application method structure based on the platform function interface structure;

[0030] The structure building module is further configured to obtain a starting address and identification information of the target application project, build an application module parameter structure based on the starting address and the identification information of the target application project and the application method structure, compile the application module parameter structure, and place the compiled application module parameter structure into an executable file of the target application project.

[0031] The application script execution module is configured to receive an application script sent by an external device, execute instructions in the application script, register the identification information under the security domain directory, create an application module directory, and create a target application directory under the application module directory. The application script is obtained by converting the executable file by using the preset conversion tool.

[0032] The application installation module is configured to obtain the application module parameter structure based on the starting address of the target application project, install the target application based on the application method structure, and store installation data of the target application under the target application directory.

[0033] In a third aspect, an embodiment of the present application provides an intelligent card, which comprises a processor and a memory. The memory stores a computer program. The processor is configured to execute the computer program to implement the application downloading method.

[0034] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program. The computer program is executed on a processor to implement the application downloading method.

[0035] The embodiments of the present application have the following beneficial effects: The embodiments of the present application first compile a target application project to obtain an executable file of the target application project. Then, an application method structure and a platform function interface structure are constructed based on functions of the target application project in advance in a NativeCOS, and an application module parameter structure is further constructed and compiled and placed into the executable file. The executable file is compiled by an external device to generate an application script, which is then sent to the NativeCOS. The NativeCOS receives the application script sent by the external device, executes instructions in the application script, registers identification information under a security domain directory, creates an application module directory, and then creates a target application directory under the application module directory. When the target application is installed, the corresponding target application is installed according to the application method structure in the corresponding application module parameter structure. Through the method, the application can be dynamically installed or updated after the intelligent card is manufactured, and the flexibility of the intelligent card application installation or update is improved. BRIEF DESCRIPTION OF DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be regarded as limiting the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor.

[0037] Figure 1 The file system diagram of the embodiments of the present application is shown;

[0038] Figure 2 The first flow chart of the application downloading method of the embodiments of the present application is shown;

[0039] Figure 3 The second flow chart of the application downloading method of the embodiments of the present application is shown;

[0040] Figure 4 The first schematic diagram of the application script generation of the embodiments of the present application is shown;

[0041] Figure 5 The second schematic diagram of the application script generation of the embodiments of the present application is shown;

[0042] Figure 6 The third flow chart of the application downloading method of the embodiments of the present application is shown;

[0043] Figure 7 The structure schematic diagram of the application downloading device of the embodiments of the present application is shown. DETAILED DESCRIPTION

[0044] The technical solutions of the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments.

[0045] The components of the embodiments of the present application generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of the present application.

[0046] Hereinafter, the terms "include", "have", and their conjugates, used in the various embodiments of the present application, merely indicate the presence of the features, numbers, steps, operations, elements, components, or combinations thereof, and do not preclude the presence or addition of one or more other features, numbers, steps, operations, elements, components, or combinations thereof.

[0047] Unless defined otherwise, all terms used herein (including technical terms and scientific terms) have the same meanings as those generally understood by those having ordinary knowledge in the field to which the various embodiments of the present application belong. Such terms, as defined in generally used dictionaries, will be interpreted to have the same meanings as those in the context of relevant technology and will not be interpreted to have ideal or excessively formal meanings unless clearly defined in the various embodiments of the present application.

[0048] Some embodiments of the present application will be described below in detail with reference to the accompanying drawings. The following embodiments and features of the embodiments described below can be combined with each other in the case of no conflict.

[0049] The smart card using the NativeCOS (Native Card Operating System) in the prior art has an application that is usually pre-installed before leaving the factory, which results in poor flexibility of the smart card (the user cannot dynamically install or update the application according to the demand), poor user experience (the user needs to purchase multiple smart cards to meet different application scenarios, increasing the cost and management difficulty); for example, a user has a bank card, which initially only installs a payment-related application, but later the user finds that he also needs to use a transportation card function, but the bank card cannot install a new transportation application, so the user has to purchase a new smart card to use as a transportation card, which not only increases the cost of the user, but also increases the difficulty of the user to manage the smart card.

[0050] Based on this, the present application proposes an application downloading method to enable the user to dynamically install or update the application in the smart card after the smart card leaves the factory according to the demand.

[0051] Before describing the application downloading method of the NativeCOS of the embodiments of the present application, the NativeCOS of the embodiments of the present application is first described.

[0052] As Figure 1As shown, the NativeCOS includes a file system 10 for supporting various function implementations of the application, such as installation, loading, deletion of the application package, installation and deletion of the application, application selection, and establishment of a secure channel, etc. The specific NativeCOS runs on the smart card, and divides the flash area of the smart card into a data management area 20 and a code management area 30; wherein the data management area 20 includes a secure domain directory 40 and an application module directory 50, i.e. the data of the data management area 20 is stored in the form of a directory file, which facilitates data isolation between applications. The data in the application module directory 50 is generated after the application is downloaded and installed by the NativeCOS; the data in the secure domain directory 40 is generated by the preset specification function supported by the NativeCOS, and is used to manage and maintain the internal structure and security mechanism of the smart card, such as the smart card supporting the GP function, the data in the secure domain directory 40 is generated by the GP function supported by the NativeCOS. The code management area 30 includes an operating system function interface library; wherein the operating system function interface library includes a structure (application method structure, platform function interface structure, and application module parameter structure, etc.) for installing the smart card application.

[0053] The main directory includes a security domain directory 40 and an application module directory 50; the security domain directory 40 includes a main security domain directory, and the data in the main security domain directory is data created after the smart card is powered on for the first time, including but not limited to a registry file, a main security domain key file, a load package management file, an application module management file, and an audit data file. Among them, under the main security domain directory, the registry file stores the life cycle of the smart card, the loaded application information (including the application identifier, the application installation quantity, the life cycle and the permission, the corresponding application module directory number, the directory number in the application module directory), and the data meta tag; the main security domain key file is a record file, and the main security domain key file can include multiple records, such as 8 records, the first record is a management record, and the subsequent 7 records store keys, records 2-4 store a group of security channel keys respectively, records 5-8 are reserved for temporary use; the management record has the first three bytes as the default security channel key version number and the counter on the main security domain, and the subsequent data is in the format: key version + counter + key type + key ID + key length, the key record is to store the key value + check, and the security channel key stores three key values + check; the load package management file is used to manage the load package (executable file package) information, the load file identifier, the file start address and the end address, and the load file information quantity that can be loaded can be limited in the package management file, such as the load package management file can store a maximum of four load file information; the application module management file is used to manage the application module information, the application module identifier, the application module directory number, the application module start address, the instance directory map (i.e. the application module corresponding application instance directory number information, which can exist multiple instance directory numbers), and the load package management information is matched with each other; the audit data file is used to manage abnormal audit data records.

[0054] The number of application module directories 50 can be determined according to the number limited in the load package management file, such as the load package management file limits a maximum of four load file information, and the application module directory 50 can create a maximum of four, corresponding to four application executable files (load files), and each application module directory 50 can create multiple applications, but the total number of applications is limited to eight; in addition, each application module directory 50 corresponds to an auxiliary security domain directory, and if the application module directory 50 creates a maximum of four, the auxiliary security domain directory is also a maximum of four.

[0055] The application module directory 50 is a directory file created when the executable file is successfully loaded, and an application directory is created under the application directory file when the application module is installed.

[0056] The application download method will be described below in combination with some specific embodiments.

[0057] Figure 2 A flowchart of the application download method of the embodiment of the application is shown. The application download method exemplarily includes the following steps:

[0058] In step S100, a target application project is acquired, and an address is allocated to the target application project in a flash area.

[0059] The target application project is the application program project of the smart card to be developed, and includes writing source code and resources according to the functions and requirements of the target application after the requirements and functions of the target application are determined, for generating an application program that can run on the smart card.

[0060] After the target application project is determined, a fixed address is allocated to the corresponding target application project in the flash area of the NativeCOS, i.e., the start address and the end address of the corresponding target application project in the flash area are defined for storing the related data of the corresponding target application project.

[0061] If the target application project includes multiple target application projects, a corresponding area is allocated to each target application project in the flash area, and the start address and the end address of each target application project in the flash area are defined, so as to ensure that the storage address allocated to each target application project in the flash area is unique and avoid storage address conflict.

[0062] In step S200, the target application project is compiled to obtain an executable file of the target application project.

[0063] When the target application project is compiled, the development environment and the programming language are first determined, and the code is written according to the functions and requirements to be realized by the target application project through the programming language. After the code writing is completed, the corresponding compiling instruction is run to generate the executable file.

[0064] In step S300, an application method structure and a platform function interface structure are constructed based on the functions of the target application project.

[0065] In this step, when constructing the local target application project, the application method structure and the platform function interface structure are defined according to the function and requirement of the target application project, and then the defined application method structure and the platform function interface structure are provided to the target application project for application development. The target application project can only call the interface provided by the NativeCOS, and the target application project calls the application method in the application method structure through the provided platform function interface structure.

[0066] As shown in Figure 3 The application method structure includes but is not limited to the application installation method, the application selection method, the application deselect method, the application instruction processing method, the application deletion method, the application multiple selection method, the multiple selection application deselect method, and the application sharing method.

[0067] The structure of the application method structure is as follows:

[0068] typedef struct appletInfo{

[0069] selectFunc selectMethod; / / application selection method

[0070] deselectFunc deselectMethod; / / application deselect method

[0071] processFunc processMethod; / / application instruction processing method

[0072] uninstallFunc uninstallMethod; / / application deletion method

[0073] mulSelectFunc mulSelectMethod; / / application multiple selection method

[0074] mulDeselectFunc mulDeselectMethod; / / multiple selection application deselect method

[0075] getSccLibInterface getSccLibInterfaceMethod; / / application sharing method

[0076] }appletInfo; / / application method structure

[0077] As shown in Figure 4As shown, the platform function interface structure body includes but is not limited to a communication processing interface, an application registration and callback interface, a checksum operation interface, a key management interface, a key pair management interface, a password operation interface, a hash operation interface, a random number generation interface, a signature calculation interface and a PIN management interface.

[0078] The platform function interface structure body is constructed as follows:

[0079]

[0080]

[0081] In step S400, the starting address and identification information of the target application project are acquired, an application module parameter structure body is constructed based on the starting address, identification information and application method structure body of the target application project, the application module parameter structure body is compiled, and the compiled application module parameter structure body is placed in the executable file of the target application project.

[0082] The application module parameter structure body is mainly used for organizing and storing key information about the application module, so as to effectively manage and use the corresponding application module in the system. Since the starting address of the corresponding target application project in the flash area defined in step S100 needs to be acquired in order to accurately locate the position of the corresponding application module in the flash area, the application module parameter structure body is constructed.

[0083] The identification information includes but is not limited to application module identification and associated security domain identification. Among them, the application module identification is a string used to uniquely identify an application module, which is usually used to distinguish different application modules in smart card application development, to ensure that each application module has a unique identifier; when constructing the application module parameter structure body, the application module identification is constructed in the application module parameter structure body, so that the configuration information or execution code of the corresponding application module can be quickly located through the application module identifier. The associated security domain identification is used to associate the security domain to which each application module belongs, which helps the system to perform fine-grained security management on the application module, to ensure that the application module runs in its own security domain, and through the associated security domain identifier, the system can better control the permissions of the application module, such as which modules can access specific resources, perform specific operations, etc., so the associated security domain identification is usually included in the construction of the application module parameter structure body.

[0084] Based on this, when constructing the application module parameter structure, the application method structure, the starting address, the application module identifier and the associated security domain identifier of the corresponding target application module are constructed together to form the application module parameter structure. In addition, in order to ensure the correctness and efficiency of the identifier processing, the application module identifier length and the associated security domain identifier length can also be included when constructing the application module parameter structure. Therefore, the constructed application module parameter structure includes the application method structure, the starting address, the application module identifier, the application module identifier length, the application module identifier and the application module identifier length. After the application module parameter structure is constructed, the application module parameter structure is compiled, and the compiled application module parameter structure is placed in the executable file of the target application project, usually in the starting position (file header position) of the executable file of the target application project. In this way, the system can immediately access these key information when loading the executable file without additional search or read operation. In addition, placing the module parameter structure at the starting position of the executable file also helps to maintain the continuity of the memory layout, reduce memory fragmentation and page table complexity.

[0085] In some embodiments, the application module parameter structure further includes an initialization application method, and the method further includes:

[0086] Based on the application selection method in the application method structure, the target application project is selected, and the interface library address corresponding to the platform function interface structure is transmitted to the target application project through the initialization application method, so that the target application project calls the registration callback function of the interface library to transmit the application method in the application method structure to the NativeCOS.

[0087] It can be understood that the initialization application method is called when the target application project receives the application selection instruction. In the initialization application method, the target application project receives the starting address of the interface library provided by the NativeCOS, and finds the specific registration callback function according to the address. Then the application method implemented by the target application project is transmitted to the NativeCOS. In this way, communication and interaction is realized between the target application project and the NativeCOS. The target application project registers its own method in the NativeCOS through the initialization application method, so that the NativeCOS can call these methods when needed, thereby realizing the expansion and interaction of functions.

[0088] Step S500, receiving the application script sent by the external device, executing the instructions in the application script, registering the identification information under the security domain directory, creating an application module directory, and creating a target application directory under the application module directory.

[0089] The external device is a terminal device capable of communicating with the NativeCOS, and the application script is obtained by converting the executable file by using a preset conversion tool installed on the external device.

[0090] As shown in the figure, Figure 3 the process of converting the executable file into the application script based on the preset conversion tool includes the following steps:

[0091] In step S10, the preset conversion tool acquires the executable file of the target application project based on the file path selected by the user, and determines whether the executable file corresponding to the file path is in a preset format.

[0092] The preset conversion tool can be a Python environment implementation tool or other compiling tools. Figure 4 As shown in the example, the user can click the path selection button to select the required file path, and after selecting the file path, the executable file of the target application project can be directly acquired based on the file path. After obtaining the executable file, it is determined whether the format of the executable file is the preset format. If it is determined that the executable file corresponding to the file path is in the preset format, step S20 is performed to receive the package identification information input by the user, and it is verified whether the package identification information is legal.

[0093] If the preset format is a hex format file, if the executable file acquired in step S10 is in the hex format, step S20 is performed, and if the executable file acquired in step S10 is not in the hex format, step S40 is performed to perform error processing; the error processing can be to display an ERROR indication and specify that the file is not in the hex format.

[0094] In step S20, after the user inputs the package identification information, the preset conversion tool verifies whether the package identification information is legal, such as verifying whether the length of the package identification information meets a preset length. If not, it is illegal, and if so, it is legal. Figure 6 As shown in the figure, the user can input the package identification information in the AID input box. If it is illegal, step S50 is performed to perform error processing.

[0095] If it is determined in step S20 that the package identification information is legal, step S30 is performed to convert the executable file of the target application project corresponding to the file path into the application script.

[0096] As shown in the figure, Figure 5In the shown example, after the input package identifier, the script generation is clicked, and the preset conversion tool starts the script generation work, and the name of each generated application script contains package identifier information, wherein the package identifier is a string used to uniquely identify an application package, and in the smart card application development, the package identifier is usually used to distinguish different application packages to ensure that each application package has a unique identifier. The generated application script includes installation instructions.

[0097] In step S500, before installing the application, after the NativeCOS receives the application script sent by the external device, the instructions in the application script need to be executed one by one, and before executing the installation instruction, it is necessary to judge whether the same package identifier information is stored in the flash area according to the package identifier in the current application script name. If it is judged that the same package identifier information is stored in the flash area, an error instruction is issued. If it is judged that there is no same package identifier information in the flash area, the instructions in the current application script can be executed normally. After executing the instructions in the application script, the identifier information (including the application module identifier information) and the package identifier of the current application script are registered in the registry file under the NativeCOS security domain directory, and an application module directory is created, and when installing the target application, the corresponding target application directory is created under the corresponding application module directory.

[0098] In some embodiments, the application script further includes a plurality of download instructions, such as Figure 6 As shown, the instructions in the application script are executed, and the identifier information is registered in the security domain directory, including:

[0099] Step S510, execute the first download instruction of the application script, cache the data meta tag, read the first write address corresponding to the first download instruction, and write the executable file data in the first download instruction to the first write address.

[0100] Step S520, judge whether there is a next download instruction.

[0101] If it is judged in step S520 that there is a next download instruction, step S530 is executed to continue to execute the next download instruction, read the next write address corresponding to the next download instruction, and write the executable file data in the next download instruction to the next write address.

[0102] If it is judged in step S520 that there is no next download instruction, step S540 is executed to register the package identifier information and the module identifier information in the security domain directory.

[0103] It can be understood that the application script can include multiple download instructions, which need to be executed in sequence during execution. The download instruction instructs the NativeCOS to read data from a certain storage location; the cache data meta tag includes but is not limited to verifying the integrity of the data or recording the location information of the data. The write address corresponding to each download instruction is predefined, and each download instruction corresponds to an independent write address, which can ensure that the data of each executable file does not interfere with each other, and at the same time, such design facilitates tracking and debugging, because the write position of each executable file is clear; in addition, by storing the data of different executable files in different addresses, the risk of data overwrite is avoided.

[0104] In step S600, the application module parameter structure is obtained based on the starting address of the target application project, the target application is installed based on the application method structure in the application module parameter structure, and the installation data of the target application is stored in the target application directory.

[0105] During application installation, the corresponding application module parameter structure is obtained through the starting address of the target application project, and the corresponding target application is installed based on the application installation method in the application method structure in the determined application module parameter structure. The data written during installation is stored in the form of a file in the corresponding target application directory, and if the installation process is normal, the application installation is successful.

[0106] The embodiment of the application first compiles the target application project to obtain an executable file of the target application project, then pre-constructs an application method structure and a platform function interface structure based on the functions of the target application project in the NativeCOS, and further constructs an application module parameter structure, and compiles the application module parameter structure and inserts it into the executable file. The executable file is compiled by an external device to generate an application script, which is then sent to the NativeCOS. The NativeCOS receives the application script sent by the external device, executes the instructions in the application script, registers the identification information in the security domain directory, creates an application module directory, and then creates a target application directory in the application module directory. When installing the target application, the corresponding target application is installed according to the application installation method in the corresponding application module parameter structure. Through the method of the application, the post-download of the smart card application of the NativeCOS can be realized, and the flexibility of the smart card application installation or update is improved.

[0107] Figure 7 A structural schematic diagram of an application download device according to an embodiment of the application is shown. The application download device is applied to the application of the NativeCOS, the NativeCOS includes a file system, and the file system includes a security domain directory and an application module directory. The application download device based on the NativeCOS includes:

[0108] The address allocation module 100 is configured to obtain a target application project and allocate an address for the target application project in a flash region.

[0109] The executable file generation module 200 is configured to compile the target application project to obtain an executable file of the target application project.

[0110] The structure construction module 300 is configured to construct an application method structure and a platform function interface structure based on a function of the target application project, and the target application project calls an application method in the application method structure based on the platform function interface structure.

[0111] The structure construction module 300 is further configured to obtain a starting address and identification information of the target application project, construct an application module parameter structure based on the starting address, the identification information and the application method structure of the target application project, compile the application module parameter structure, and place the compiled application module parameter structure into the executable file of the target application project.

[0112] The application script execution module 400 is configured to receive an application script sent by an external device, execute an instruction in the application script, register the identification information under a security domain directory, create an application module directory, and create a target application directory under the application module directory, wherein the application script is obtained by converting the executable file by using a preset conversion tool.

[0113] The application installation module 500 is configured to obtain the application module parameter structure based on the starting address of the target application project, install the target application based on the application method structure, and store installation data of the target application under the target application directory.

[0114] It can be understood that the device of the embodiment corresponds to the application downloading method of the above-described embodiment, and the optional items in the above-described embodiment are also applicable to the embodiment, and thus are not repeatedly described herein.

[0115] The application further provides an intelligent card, which exemplarily comprises a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program, so that the terminal device executes the functions of the modules in the above-described application downloading method or application downloading device.

[0116] The processor can be an integrated circuit chip with a processing capability of signals. The processor can be a general processor, including a central processing unit (CPU), a graphics processing unit (GPU), and a network processor (NP), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, a discrete gate or transistor logic device, a discrete hardware component, at least one of the above. The general processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0117] The memory can be, but is not limited to, a random access memory (RAM), 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) and the like. The memory is used to store a computer program. After receiving an execution instruction, the processor can execute the computer program accordingly.

[0118] The present application also provides a computer readable storage medium for storing the computer program used in the terminal device. For example, the computer readable storage medium can include, but is not limited to, a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk and various program code storage media.

[0119] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented by other means. The apparatus embodiments described above are only illustrative, for example, the flowcharts and structural diagrams in the drawings show the possible implementation architecture, function and operation of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that in alternative implementation, the functions noted in the block can also occur in different order from that noted in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the structural diagram and / or flowchart, and the combination of blocks in the structural diagram and / or flowchart, can be implemented by a dedicated hardware-based system for executing the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0120] In addition, each functional module or unit in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0121] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application.

[0122] The above description is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application.

Claims

1. A method for downloading an application, characterized by, The application download method is applied to an application of a NativeCOS, the NativeCOS includes a file system, and the file system includes a security domain directory and an application module directory; the method comprises the following steps: An address is allocated for a target application project in a flash area; An executable file of the target application project is obtained by compiling the target application project; An application method structure and a platform function interface structure are constructed based on the function of the target application project, wherein the target application project calls an application method in the application method structure based on the platform function interface structure; the application method structure comprises an application installation method, an application selection method, an application selection cancellation method, an application instruction processing method, an application deletion method, an application multi-selection method, a multi-selection application selection method and an application sharing method; and the platform function interface structure comprises a communication processing interface, an application registration and callback interface, a checksum operation interface, a key management interface, a key pair management interface, a password operation interface, a hash operation interface, a random number generation interface, a signature calculation interface and a PIN management interface; A starting address and identification information of the target application project are obtained, an application module parameter structure is constructed based on the starting address, the identification information of the target application project and the application method structure, the application module parameter structure is compiled, and the compiled application module parameter structure is placed in the executable file of the target application project; An application script sent by an external device is received, instructions in the application script are executed, the identification information is registered under the security domain directory, an application module directory is created, a target application directory is created under the application module directory, and the application script is obtained by converting the executable file through a preset conversion tool; The application module parameter structure is obtained based on the starting address of the target application project, the target application is installed based on the application method structure, and installation data of the target application is stored under the target application directory; The application module parameter structure further comprises an initialization application method, and the method further comprises the following steps: the target application project is selected by the application selection method in the application method structure, the interface library address corresponding to the platform function interface structure is transmitted to the target application project through the initialization application method, and the registration callback function of the interface library is called by the target application project to transmit the application method in the application method structure to the NativeCOS.

2. The application download method of claim 1, wherein, The number of target application projects is multiple; The address is allocated for the target application project in the flash area, comprising the following steps: a unique storage address is allocated for each target application project in the flash area.

3. The application download method of claim 1, wherein, The method further comprises the process of converting the executable file into an application script based on a preset conversion tool, specifically comprising the following steps: The preset conversion tool obtains the executable file of the target application project based on a file path selected by a user, and judges whether the executable file corresponding to the file path is in a preset format. In a case where it is judged that the executable file corresponding to the file path is of a preset format, package identification information input by a user is received, and it is checked whether the package identification information is legal; In a case where the package identification information is legal, the executable file of the target application project corresponding to the file path is converted into an application script.

4. The application download method of claim 3, wherein, The name of the application script contains the package identification information, and the application script includes installation instructions; before the installation instructions in the application script are executed, the method further includes: Judging, based on the package identification information in the name of the application script, whether the same package identification information exists in the flash area, and if not, executing the installation instructions, otherwise, reporting an error.

5. The application download method of claim 4, wherein, The application script further includes a plurality of download instructions; the step of registering the identification information under the secure domain directory by executing the instructions in the application script includes: Executing a first download instruction of the application script, caching a data meta tag, reading a first write address corresponding to the first download instruction, and writing executable file data in the first download instruction into the first write address; Judging whether a next download instruction exists, if so, continuing to execute the next download instruction, reading a next write address corresponding to the next download instruction, and writing executable file data in the next download instruction into the next write address, if not, registering the package identification information and module identification information under the secure domain directory.

6. An application download apparatus characterized by comprising: The application downloading device is applied to an application of a NativeCOS, the NativeCOS includes a file system, and the file system includes a secure domain directory and an application module directory; the device includes: An address allocation module configured to obtain a target application project and allocate an address for the target application project in a flash area; An executable file generation module configured to compile the target application project to obtain an executable file of the target application project; A structure construction module configured to construct an application method structure and a platform function interface structure based on a function of the target application project, wherein the target application project calls an application method in the application method structure based on the platform function interface structure; the application method structure includes an application installation method, an application selection method, an application rejection method, an application instruction processing method, an application deletion method, an application multi-selection method, a multi-selection application selection method, and an application sharing method; and the platform function interface structure includes a communication processing interface, an application registration and callback interface, a check sum operation interface, a key management interface, a key pair management interface, a password operation interface, a hash operation interface, a random number generation interface, a signature calculation interface, and a PIN management interface; The structure construction module is further configured to obtain a starting address and identification information of the target application project, construct an application module parameter structure based on the starting address and the identification information of the target application project and the application method structure, compile the application module parameter structure, and place the compiled application module parameter structure into the executable file of the target application project. The application script execution module is configured to receive an application script sent by an external device, execute instructions in the application script, register the identification information under the security domain directory, create an application module directory, and create a target application directory under the application module directory; wherein the application script is obtained by converting the executable file by using a preset conversion tool; The application installation module is configured to obtain the application module parameter structure based on a starting address of the target application project, install the target application based on the application method structure, and store installation data of the target application under the target application directory. The application module parameter structure further includes an initialization application method, and the method further includes: selecting the target application project based on an application selection method in the application method structure, and transmitting an interface library address corresponding to the platform function interface structure to the target application project by using the initialization application method, so that the target application project calls a registered callback function of the interface library to transmit the application method in the application method structure to the NativeCOS.

7. A smart card, characterized by The smart card includes a processor and a memory, the memory stores a computer program, and the processor is configured to execute the computer program to implement the application downloading method in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The memory stores a computer program, and the computer program is executed on the processor to implement the application downloading method in any one of claims 1-5.

Citation Information

Patent Citations

  • Method and equipment for dynamically switching Native and JavaCard

    CN113692576A