CN113760244A - Method and system for realizing multiple entrances and multiple interfaces based on C language mode - Google Patents
Method and system for realizing multiple entrances and multiple interfaces based on C language mode Download PDFInfo
- Publication number
- CN113760244A CN113760244A CN202110914780.0A CN202110914780A CN113760244A CN 113760244 A CN113760244 A CN 113760244A CN 202110914780 A CN202110914780 A CN 202110914780A CN 113760244 A CN113760244 A CN 113760244A
- Authority
- CN
- China
- Prior art keywords
- language
- function module
- operating system
- application
- layer function
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 147
- 230000006870 function Effects 0.000 claims description 63
- 230000008569 process Effects 0.000 claims description 28
- 238000011161 development Methods 0.000 claims description 3
- 230000007246 mechanism Effects 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 6
- 238000009434 installation Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000004590 computer program Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000004140 cleaning Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The invention discloses a method and a system for realizing multiple inlets and multiple interfaces based on a C language mode, relating to the field of IC cards, wherein the method comprises the steps of establishing a compiler capable of analyzing C language and an operating system capable of analyzing C language byte codes, wherein the operating system comprises a plurality of functional modules for supporting upper-layer application; writing an application program supporting a runtime entry method based on the C language; compiling the compiled application program through a compiler to generate byte codes; and downloading the generated bytecode to an operating system, and analyzing and running the bytecode by the operating system. The invention can make the application compiled by C language download across platforms, so that the application upgrade is more convenient and the expansibility is better.
Description
Technical Field
The invention relates to the field of IC cards, in particular to a method and a system for realizing multiple inlets and multiple interfaces based on a C language mode.
Background
Currently, the programming languages of IC (Integrated Circuit) card applications generally include C language and Java language. The following problems mainly exist for the application program written in the C language or the Java language: for the application program written in the C language, the application program can only be used as an entrance by a Main method, the modification difficulty is high after the application program is integrated and solidified, and the application program does not support cross-platform downloading and use; for an application program written by the Java language, although the application program can support cross-platform downloading and use, the application program needs to completely depend on a matching basic environment provided by the Java language, and great limitations exist.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method and a system for realizing multiple entrances and multiple interfaces based on a C language mode, which can enable applications written in the C language to be downloaded across platforms, so that the applications are more convenient to upgrade and have better expansibility.
In order to achieve the above object, the method for implementing multiple portals and multiple interfaces based on a C language mode provided by the present invention specifically includes the following steps:
creating a compiler capable of analyzing C language and an operating system capable of analyzing C language byte codes, wherein the operating system comprises a plurality of functional modules for supporting upper-layer applications;
writing an application program supporting a runtime entry method based on the C language;
compiling the compiled application program through a compiler to generate byte codes;
and downloading the generated bytecode to an operating system, and analyzing and running the bytecode by the operating system.
On the basis of the technical scheme, the function modules comprise a hardware layer function module, an operating system layer function module, a virtual machine layer function module, a running environment layer function module, an API interface layer function module and an application layer function module.
On the basis of the technical proposal, the device comprises a shell,
the hardware layer functional module is used for realizing the driving of a hardware interface;
the operating system layer functional module is used for realizing the link between hardware and use;
the virtual machine layer function module is used for defining a byte code specification and realizing a Card virtual machine;
the operation environment layer function module is used for defining card operation specifications, a command distribution mechanism and firewall rules;
the API interface layer functional module is used for defining an application development interface;
the application layer function module is used for realizing upper layer application.
On the basis of the technical scheme, the entrance method comprises an install method, a select method, a process method, a deselect method and an uninstant method.
On the basis of the technical proposal, the device comprises a shell,
the install method is used for applying for task resources and registering application programs, and when the install method is called, only one application program is registered at a time;
the select method is used for selecting an application program;
the process method is used to send the APDU in the logical channel to the application selected by the select method.
On the basis of the technical proposal, the device comprises a shell,
the deselect method is used for executing a clear operation;
the uninstantall method is used for acquiring the association relation of the application program before the application program is deleted.
On the basis of the technical scheme, the application program comprises a header file, declaration and definition of variables and declaration and definition of functions.
On the basis of the technical scheme, the application program can also realize a plurality of PROCESS entries, and each PROCESS entry maps an ID entry of the operating system.
The invention provides a system for realizing multiple entrances and multiple interfaces based on a C language mode, which comprises:
a creating module for creating a compiler capable of parsing C language and an operating system capable of parsing C language bytecode, the operating system including a plurality of functional modules for supporting upper layer applications;
the compiling module is used for compiling an application program supporting the runtime entry method based on the C language;
the compiling module is used for driving a compiler to compile the compiled application program to generate byte codes;
and the analysis module is used for downloading the generated bytecode to the operating system and driving the operating system to analyze and operate the bytecode.
On the basis of the technical proposal, the device comprises a shell,
the function module comprises a hardware layer function module, an operating system layer function module, a virtual machine layer function module, a running environment layer function module, an API interface layer function module and an application layer function module;
the entry methods include an install method, a select method, a process method, a deselect method, and an uninstant method.
Compared with the prior art, the invention has the advantages that: an entry method is added when an Application program is written, the function realization of the Application program does not depend on a Java virtual machine, a Java runtime environment and a Java API (Application Programming Interface), the Application program is written in a C language mode and then converted into an executable download script to be downloaded to an operating system, and the executable download script is downloaded to an Application cross-platform written in the C language, so that the Application is more convenient to upgrade and has better expansibility.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for implementing multiple portals and multiple interfaces based on a C language mode in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method for realizing multiple inlets and multiple interfaces based on a C language mode, wherein an inlet method is added when an Application program is written, the function realization of the Application program does not depend on a Java virtual machine, a Java runtime environment and a Java API (Application Programming Interface), the Application program is converted into an executable download script after being written in the C language mode and downloaded to an operating system, and the executable download script is downloaded across platforms when the Application program is written in the C language, so that the Application upgrading is more convenient and the expansibility is better. The embodiment of the invention correspondingly provides a system for realizing multiple entrances and multiple interfaces based on the C language mode.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, in the method for implementing multiple entries and multiple interfaces based on the C language provided in the embodiment of the present invention, a C language compiler is supported to generate a bytecode and download the bytecode to an IC card operating environment, so as to support multiple entries and multiple interfaces, and thus, an application implemented by the C language can also perform operations such as downloading, installation, and deletion. The method specifically comprises the following steps:
s1: creating a compiler capable of analyzing C language and an operating system capable of analyzing C language byte codes, wherein the operating system comprises a plurality of functional modules for supporting upper-layer applications;
in the embodiment of the invention, the function modules comprise a hardware layer function module, an operating system layer function module, a virtual machine layer function module, a running environment layer function module, an API interface layer function module and an application layer function module, and different function modules are responsible for different functions.
Specifically, the hardware layer function module is used for implementing the driving of the hardware interface; the operating system layer functional module is used for realizing the link between hardware and use; the virtual machine layer function module is used for defining byte code specification and realizing a Card virtual machine; the operation environment layer function module is used for defining card operation specifications, a command distribution mechanism and firewall rules; the API interface layer functional module is used for defining an application development interface; the application layer function module is used for realizing upper layer application.
S2: and writing an application program supporting the runtime entry method based on the C language.
In the embodiment of the invention, the entrance method comprises an install method, a select method, a process method, a deselect method and an uninstant method. The application lifecycle begins at install for install and ends at delete package and applet, and the application in this embodiment of the invention supports 5 runtime install method, select method, process method, deselect method and uninhibit method.
S3: compiling the compiled application program through a compiler to generate byte codes;
s4: and downloading the generated bytecode to an operating system, and analyzing and running the bytecode by the operating system.
The 5 entry methods can be used as an executable program as long as the executable program is realized, the executable program can be operated after being compiled by a compiler and downloaded to an operating system, the bytecode generated by the operating system in analysis during the operation meets the corresponding function, and meanwhile, the operating system is managed according to the unused life cycle. The application includes header files, declaration and definition of variables, and declaration and definition of functions, consistent with standard C language.
In the embodiment of the invention, the install method is used for applying for task resources and registering application programs, and when the install method is called, only one application program is registered at a time. Specifically, when the method install method is called, an instance of the application program is not created yet, and the main task of the install method in the application program is to apply for a resource and register the application program. The data field of Installo for Install will be passed into the Install method, and then the initialization parameters can be obtained from the input byte array parameters, with different personalization as required. Typically, an application creates various objects and initializes them with predefined values, sets some internal state variables, if the installation fails, such as a resource-starved application fails, an exception is not thrown, but the installation failure is prompted, and when the runtime environment is controlled, all cleaning work should be performed, that is, all the automatically updated persistent objects should be restored to the state before the install method is called; if the installation is successful, the runtime environment should mark that application may be selected. When the runtime environment calls the install method, only one application instance can be successfully registered at a time.
In the embodiment of the invention, a select method is used for selecting the application program. Specifically, the Application remains in a suspended state until explicitly selected, which occurs when the runtime environment receives an SELECT FILE APDU command and the name Data in the APDU (Application Protocol Data Unit) command matches the AID of the Application. Before calling the select method, the runtime environment should deselect the previously selected application program, and the runtime environment calls the select method of this application. The application may refuse to be selected by either returning a false in the select method or throwing an exception, and if the applet (an applet written in the Java programming language) returns true, the actual SELECT FILE APDU command will be passed to the application through a subsequent process method call so that the application can check the contents of the APDU. The applet can process SELECT FILE APDU commands like other APDU commands, and it can respond to SELECT FILE APDU commands with data or throw an error ISOException (input or output exception) identified with an appropriate return status word, the status word and optionally data back to the reader. If the application refuses to be selected, the runtime environment will return the APDU status word iso7816.sw _ APPLET _ SELECT _ FAILED to the reader, and if the selection fails, the runtime environment status will be set to no application selected. After the application is successfully selected, all APDUs directly going to the specified logical channel will be distributed to the currently selected application through the process method.
In the embodiment of the present invention, the process method is used to send the APDUs in the logical channel to the application program selected by the select method, and specifically, all the APDUs are received by the runtime environment and are preprocessed. All commands will be encapsulated into one instance of the APDU class and passed to the process method of the currently selected application. On a normal return, the runtime environment will automatically append a 0x9000 status word after any data returned by the applet. At any time during the processing, the applet can throw the ISOException with the corresponding status word, and at this time, the runtime environment will return the status word to the card reader after catching the exception. If any other exception is thrown during processing, the runtime environment will catch the exception and return the status word ISO7816.SW _ UNKNOWN to the reader.
In the embodiment of the present invention, the deselect method is used to perform the clear operation. Specifically, when the runtime environment receives an SELECT FILE APDU command whose name matches the AID (application identifier) of a certain applet, the runtime environment calls the deselect method of the currently selected applet, allowing the applet to execute any cleanup operation applet so that other applets can execute.
In the embodiment of the invention, the uninstantall method is used for acquiring the association relation of the application program before the application program is deleted. Specifically, when the runtime environment is ready to delete an application, if the uninstantall method should be implemented, the runtime environment will call the uninstantall method, informing it of the delete request. Upon returning from the uninstantall method, the runtime environment will check the reference associations before deleting the application.
In the embodiment of the present invention, the application program may further implement a plurality of PROCESS entries, and each PROCESS entry maps an ID (Identity Document) entry of the operating system. That is, to adapt to different external IO (Input/Output) interfaces, the application may implement multiple PROCESS entries, such as PROCESS _ A, PROCESS _ B, where each entry maps an ID entry of the operating system, and the operating system may automatically select different entries according to different protocols. For example, PROCESS _ a corresponds to an IO Interface through a 1444-3 or 7816 protocol, PROCESS _ B corresponds to an IO Interface through an I2C (Inter-Integrated Circuit) protocol, and PROCESS _ C corresponds to an IO Interface through an SPI (Serial Peripheral Interface) protocol.
The application program realizes C files containing 5 runtime entries, namely an install method, a select method, a process method, a deselect method and an uninstant method, and corresponding application functions in a C language mode, and is matched with a specific virtual machine, a runtime environment and an API (application program interface). Meanwhile, the configuration mode is supported to adapt to various external interfaces (I2C, SPI and the like) through a plurality of PROCESS modes, so that the same application can be downloaded to different IO scenes to directly run without modifying the application.
According to the method for realizing multiple inlets and multiple interfaces based on the C language mode, the inlet method is added when the Application program is compiled, the function realization of the Application program does not depend on a Java virtual machine, a Java runtime environment and a Java API (Application Programming Interface), the Application program is converted into an executable download script after being compiled in the C language mode and downloaded to an operating system, and the Application program is downloaded across platforms when being compiled in the C language, so that the Application upgrading is more convenient, and the expansibility is better.
The embodiment of the invention also provides a system for realizing the multiple inlets and the multiple interfaces based on the C language mode, which comprises a creating module, a compiling module and a resolving module. The creating module is used for creating a compiler capable of resolving the C language and an operating system capable of resolving the C language byte codes, and the operating system comprises a plurality of functional modules used for supporting upper-layer applications; the compiling module is used for compiling an application program supporting the runtime entry method based on the C language; the compiling module is used for driving a compiler to compile the compiled application program to generate byte codes; the analysis module is used for downloading the generated bytecode to the operating system, and driving the operating system to analyze the bytecode and operate.
In the embodiment of the invention, the function module comprises a hardware layer function module, an operating system layer function module, a virtual machine layer function module, a running environment layer function module, an API interface layer function module and an application layer function module; the inlet methods include an install method, a select method, a process method, a deselect method, and an uninstant method.
The above description is merely exemplary of the present application and is presented to enable those skilled in the art to understand and practice the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Claims (10)
1. A method for realizing multiple entrances and multiple interfaces based on a C language mode is characterized by specifically comprising the following steps:
creating a compiler capable of analyzing C language and an operating system capable of analyzing C language byte codes, wherein the operating system comprises a plurality of functional modules for supporting upper-layer applications;
writing an application program supporting a runtime entry method based on the C language;
compiling the compiled application program through a compiler to generate byte codes;
and downloading the generated bytecode to an operating system, and analyzing and running the bytecode by the operating system.
2. The method for implementing multiple portals and multiple interfaces based on a C language approach as claimed in claim 1, wherein: the function module comprises a hardware layer function module, an operating system layer function module, a virtual machine layer function module, a running environment layer function module, an API interface layer function module and an application layer function module.
3. The method of claim 2, wherein the method comprises:
the hardware layer functional module is used for realizing the driving of a hardware interface;
the operating system layer functional module is used for realizing the link between hardware and use;
the virtual machine layer function module is used for defining a byte code specification and realizing a Card virtual machine;
the operation environment layer function module is used for defining card operation specifications, a command distribution mechanism and firewall rules;
the API interface layer functional module is used for defining an application development interface;
the application layer function module is used for realizing upper layer application.
4. The method for implementing multiple portals and multiple interfaces based on a C language approach as claimed in claim 1, wherein: the entry methods include an install method, a select method, a process method, a deselect method, and an uninstant method.
5. The method of claim 4, wherein the method comprises:
the install method is used for applying for task resources and registering application programs, and when the install method is called, only one application program is registered at a time;
the select method is used for selecting an application program;
the process method is used to send the APDU in the logical channel to the application selected by the select method.
6. The method of claim 4, wherein the method comprises:
the deselect method is used for executing a clear operation;
the uninstantall method is used for acquiring the association relation of the application program before the application program is deleted.
7. The method for implementing multiple portals and multiple interfaces based on a C language approach as claimed in claim 1, wherein: the application programs include header files, declaration and definition of variables, and declaration and definition of functions.
8. The method for implementing multiple portals and multiple interfaces based on a C language approach as claimed in claim 1, wherein: the application may also implement multiple PROCESS entries, and each PROCESS entry maps an ID entry of the operating system.
9. A system for realizing multiple entrances and multiple interfaces based on a C language mode is characterized by comprising:
a creating module for creating a compiler capable of parsing C language and an operating system capable of parsing C language bytecode, the operating system including a plurality of functional modules for supporting upper layer applications;
the compiling module is used for compiling an application program supporting the runtime entry method based on the C language;
the compiling module is used for driving a compiler to compile the compiled application program to generate byte codes;
and the analysis module is used for downloading the generated bytecode to the operating system and driving the operating system to analyze and operate the bytecode.
10. The system according to claim 9, wherein the system for implementing multiple portals and multiple interfaces based on C language approach comprises:
the function module comprises a hardware layer function module, an operating system layer function module, a virtual machine layer function module, a running environment layer function module, an API interface layer function module and an application layer function module;
the entry methods include an install method, a select method, a process method, a deselect method, and an uninstant method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110914780.0A CN113760244A (en) | 2021-08-10 | 2021-08-10 | Method and system for realizing multiple entrances and multiple interfaces based on C language mode |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110914780.0A CN113760244A (en) | 2021-08-10 | 2021-08-10 | Method and system for realizing multiple entrances and multiple interfaces based on C language mode |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113760244A true CN113760244A (en) | 2021-12-07 |
Family
ID=78788913
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110914780.0A Pending CN113760244A (en) | 2021-08-10 | 2021-08-10 | Method and system for realizing multiple entrances and multiple interfaces based on C language mode |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113760244A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023142535A1 (en) * | 2022-01-26 | 2023-08-03 | 中国银联股份有限公司 | Hardware calling method and device for ic card application, and intelligent ic card |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111880800A (en) * | 2020-06-19 | 2020-11-03 | 深圳融卡智能科技有限公司 | Application downloading method and application downloading system |
-
2021
- 2021-08-10 CN CN202110914780.0A patent/CN113760244A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111880800A (en) * | 2020-06-19 | 2020-11-03 | 深圳融卡智能科技有限公司 | Application downloading method and application downloading system |
Non-Patent Citations (1)
Title |
---|
中国人民银行移动支付技术标准课题研究组编: "《中国移动支付技术标准体系研究报告》", 中国金融出版社, pages: 29 - 30 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023142535A1 (en) * | 2022-01-26 | 2023-08-03 | 中国银联股份有限公司 | Hardware calling method and device for ic card application, and intelligent ic card |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110597531B (en) | Distributed module upgrading method and device and storage medium | |
CN109062617B (en) | Application method of platform supporting multiple types of equipment and mobile terminal | |
CN105657191B (en) | Application increment upgrading method and system based on Android system | |
US8661407B2 (en) | Framework for programming embedded system applications | |
CN102915247B (en) | APK plug-in unit management method | |
US10846073B2 (en) | Methods, apparatuses, terminals, servers, and systems for container generation | |
CN106020873B (en) | Patch package loading method and device | |
KR20000052759A (en) | Using a high level programming language with a microcontroller | |
CN106598647B (en) | Intelligent device development platform | |
CN114072765B (en) | Method for container-based virtualization system | |
CN112882732A (en) | Method and device for updating function codes in Software Development Kit (SDK) | |
KR100489783B1 (en) | Smart-card and the management method for optional applet | |
CN112114896A (en) | Plug-in framework and method for service function expansion | |
CN113760244A (en) | Method and system for realizing multiple entrances and multiple interfaces based on C language mode | |
CN111651169A (en) | Block chain intelligent contract operation method and system based on web container | |
CN111427617B (en) | Data processing method, device and equipment | |
CN103677933A (en) | Patching method and system for smart card | |
EP1280051A1 (en) | Information processing method and system | |
CN114490103A (en) | Operating system interface calling method and device and electronic equipment | |
CN116643761A (en) | Customized mirror image manufacturing and deploying method, device, terminal and medium | |
CN109933355B (en) | Application program upgrading method and device | |
CN108694048B (en) | Method for realizing batch publishing service | |
CN108228266A (en) | Start the method and apparatus of Fragment components under a kind of Android card cages between different plug-in units | |
CN113553068B (en) | Method and device for downloading application package and electronic equipment | |
US20020038454A1 (en) | Method of compiling code in an object oriented programming language |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |