WO2018032653A1 - Function implementing method and apparatus for java card application - Google Patents

Function implementing method and apparatus for java card application Download PDF

Info

Publication number
WO2018032653A1
WO2018032653A1 PCT/CN2016/108304 CN2016108304W WO2018032653A1 WO 2018032653 A1 WO2018032653 A1 WO 2018032653A1 CN 2016108304 W CN2016108304 W CN 2016108304W WO 2018032653 A1 WO2018032653 A1 WO 2018032653A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
library
java
java card
application
Prior art date
Application number
PCT/CN2016/108304
Other languages
French (fr)
Chinese (zh)
Inventor
许晶
袁艳芳
张彦杰
付青琴
王于波
Original Assignee
北京智芯微电子科技有限公司
国网信息通信产业集团有限公司
国家电网公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 北京智芯微电子科技有限公司, 国网信息通信产业集团有限公司, 国家电网公司 filed Critical 北京智芯微电子科技有限公司
Publication of WO2018032653A1 publication Critical patent/WO2018032653A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation

Definitions

  • the present invention relates to the field of smart card technologies, and in particular, to a function implementation method and apparatus for a Java card application.
  • JAVA card is a kind of smart card that can run JAVA card program (JavaCard Applet). It makes full use of the platform independence of JAVA language, which makes JAVA technology "write once, run anywhere" on the smart card.
  • Sun released the first version of the JAVA card specification based on Schlumberger's research experience; in February 1997, Gemplus and Schlumberger launched the JAVA card forum, and several smart card manufacturers joined In this organization, the JAVA Card 2.0 specification was released at the end of 1997.
  • This version of the specification defines the specific API interface functions and introduces a JAVA card virtual machine that is much smaller than the JAVA virtual machine but also satisfies the basic features of the JAVA language.
  • the JAVA card with the virtual machine makes the JAVA card platform and application completely separate.
  • a card with JAVA card platform can download the application after the platform is released.
  • This is a JAVA card has a more convenient advantage than a native language such as C.
  • a JAVA card can adapt to different application scenarios. There is no need to develop multiple versions of the on-chip operating system (COS, Chip Operation System).
  • COS on-chip operating system
  • COS Chip Operation System
  • the separation of platform and application is achieved through a unified application programming interface (API).
  • API application programming interface
  • the platform layer implements the API function, and the application calls the API interface to implement the function.
  • the application When the application is developed, it is compiled by referring to the standard JAVA card library package to generate a downloadable file. After the application is downloaded to the platform, the platform of the platform library package is invoked by a dynamic link mechanism. The index of the Token value compiled by the platform is used to find the JAVA package, class and method that are called to implement the corresponding functions.
  • the traditional implementation methods include: The first method is to implement a set of the same function function for each application; the second method uses the traditional patching method of JAVA card to add the function implementation to the platform; the third method, re-develop the platform, if Cards with a Read-Only Memory (ROM) mask also need to be re-plated.
  • ROM Read-Only Memory
  • the first method each application implements a set of function functions within the application, which leads to redundancy of code amount, in a limited space of the smart card, if a single application The increase in the amount of code will result in a decrease in the number of loadable applications, or an increase in the cost of the card;
  • the second method the traditional patching method of the JAVA card, is generally in the JAVA card runtime environment, and is patched when the method is called. The function judges that if the method has a patch function, the patch function is run. If there is no patch function, the existing function is run.
  • This method increases the judgment time, so that the card operation efficiency is lowered, and the development of the patch function is more More restrictions; the third method, re-developing a new version of the platform, which not only causes the chip to have the cost of re-masking, but also increases the maintenance cost of multiple versions in the development.
  • the technical problem to be solved by the embodiments of the present invention is how to provide an effective means for implementing new functions on a Java card.
  • the first embodiment of the present invention provides a method for implementing a function of a Java card application, including:
  • the library implementation Java card loadable file and the Java Card loadable file of the application are sequentially installed into the Java card.
  • the implementing the source file generation library according to the library implementation function to implement the Java card loadable file includes:
  • the library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
  • the implementing a source file generating library interface source file according to the library includes:
  • the generating a library interface Java card library file according to the library interface source file includes:
  • the library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
  • the library interface Java loadable file is referenced by the Java Card compiler tool converter to the JavaCard and the application security management platform Global Platform API, and the library interface Java card external interface file is generated;
  • the library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
  • the generating a Java loadable file according to an application source file, and generating, according to the Java loadable file of the application and the library interface Java card library file include:
  • the Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
  • the installing the Java card loadable file and the Java card loadable file of the application into the Java card in sequence includes:
  • the Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
  • the embodiment of the present invention provides a function implementation device for a Java card application, including:
  • a first generation module configured to implement a Java file loadable file according to a library implementation source library according to a function to be implemented
  • a second generation module configured to generate a library interface source file according to the library implementation source file
  • a third generation module configured to generate a library interface Java card library file according to the library interface source file
  • a fourth generation module configured to generate a Java loadable file of the application according to the application source file, and generate a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
  • a file loading module configured to sequentially install the library implementation Java card loadable file and the Java Card loadable file of the application into the Java card.
  • the first generating module is specifically configured to:
  • the library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
  • the second generating module is specifically configured to:
  • the third generating module is specifically configured to:
  • the library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
  • the library interface Java loadable file is referenced by the Java Card compiler tool converter to the JavaCard and the application security management platform Global Platform API, and the library interface Java card external interface file is generated;
  • the library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
  • the fourth generating module is specifically configured to:
  • the Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
  • the file loading module is specifically configured to:
  • the Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
  • the first generation module, the second generation module, the third generation module, the fourth generation module, and the file loading module may use a specific software on a PC to use a programming language when performing processing.
  • the programming language can be set in each hardware entity (such as a central processing unit, a digital signal processor, or a programmable logic array), and through the central processing unit (CPU, Central Processing Unit), digital Implemented by a DSP (Digital Singnal Processor) or a Field-Programmable Gate Array (FPGA).
  • a method and apparatus for implementing a function of a Java card application reduces code amount compared to the first method in the background art. If the amount of code implemented by the library function is n kbytes, the amount of code implemented by the application is m kbytes. When there are i applications on a card that need to be transferred to the library, the amount of code required by the first method is i* ( n+m) kbytes, and the amount of code required for this method is n+i*m kbytes, which reduces the amount of code of (i-1)*n kbytes. The reduction in the amount of code makes it possible to select a chip with a smaller space and a lower cost when the chip is selected.
  • the function implementation method and device for the Java card application provided by the embodiment of the present invention shortens the development time, reduces the development difficulty, and improves the operation efficiency, compared with the second method in the background art.
  • the function library function by means of the traditional patch method, it is necessary to consider the possible problems in the design, design the patch entry, and in the implementation, call the global variable, etc., there are development restrictions, using Java card package to achieve new
  • the library function of the enhanced function can shorten the development time and reduce the development difficulty.
  • the traditional patch needs to determine whether there is a patch function when the function is called. The runtime cost is increased before each method call. This method does not require a judgment function, which improves the operation efficiency.
  • a method and an apparatus for implementing a function of a Java card application provided by an embodiment of the present invention reduce the cost of version maintenance compared with the third method in the background art, and if the chip is on the ROM mask, Saves on chip mask cost.
  • This method is missing in function function or needs to be added At that time, you only need to use the Java library implementation package to download to the Java card, and provide the corresponding library interface package to the application development user, without re-developing a version of COS, reducing the number of COS versions.
  • On the chip of the ROM mask it is not necessary to perform the chip mask again, and the function library is directly downloaded, which greatly saves the cost of multiple masks.
  • FIG. 1 is a flowchart of a method for implementing a function of a Java Card application according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of step S101 of Embodiment 1 of the present invention.
  • FIG. 3 is a flowchart of step S102 of the first embodiment of the present invention.
  • FIG. 4 is a flowchart showing step S103 of the first embodiment of the present invention.
  • FIG. 5 is a flowchart of step S104 of Embodiment 1 of the present invention.
  • FIG. 6 is a flowchart of step S105 of Embodiment 1 of the present invention.
  • FIG. 7 is a schematic structural diagram of a function implementing apparatus of a Java card application according to Embodiment 1 of the present invention.
  • the present application solves the problems in the background art, and refines the general functions added by the JAVA card into a library package. Each application does not need to implement these functions separately, and directly calls the newly added library package, thereby reducing the space occupation. First download the library package to the Java card, and then download the application that calls the library package function to the Java card. When implementing the function of the library package, the implementation of the JAVA card package is adopted, and the implementation mode is flexible and convenient for rapid development. After development, there is no need to maintain multiple versions of the platform, only the maintenance of the library package; on the platform of the ROM mask, the cost of re-masking is also eliminated.
  • the library package in this application refers to the API package that implements the functions.
  • the common JAVA card standard library package includes: java.io, java.lang, javacard.framework, javacard.security, javacardx.crypto, and so on.
  • the library packages java.io and java.lang define some common exceptions (Exceptions).
  • javacard.framework defines various operation interfaces for the JAVA card platform runtime environment.
  • javacard.security and javacardx.crypto define international algorithms and passwords. Security interface.
  • the library in this application refers to the Java card external library, that is, the library that is not preset in the card, and the library package that needs new functions.
  • the source files are .java files
  • the Java loadable files are .class files
  • the Java card loadable files are .cap files
  • the package is a collection of source files.
  • the file is a jar package that needs to be referenced for Java Card application development.
  • the library implementation package contains the library implementation source file, and the library implements the library function in the source file;
  • the library interface package contains the library interface source file, and the library interface source file only contains the function interface, and no specific function is implemented.
  • FIG. 1 is a flowchart of a method for implementing a function of a Java card application according to an embodiment of the present invention. As shown in the figure, the method includes:
  • Step S101 Implementing a source file generation library according to a library to be implemented to implement a Java card loadable file
  • the library implementation package contains all the library implementation source files.
  • a JAVA card package it is developed based on the JAVA card standard library package to implement the function functions of the new library.
  • the specific implementation process of this step is: firstly, the Java API is referenced by the javac compiler, and the library implementation package Java loadable file is generated. Then, the Java Card and the Application Security Management Platform (GP, Global Platform) API are referenced through the Java Card Compiler Tool Converter, and the library is implemented to implement the Java Card loadable file.
  • GP Application Security Management Platform
  • Javac is a java language programming compiler, the full name of the javacompilation.javac tool, the definition of classes and interfaces written in the java language, and compiled into a class file of byte code. Javac can implicitly compile some source files that are not mentioned on the command line, and use the -verbose option to track automatic compilation.
  • the compiler When compiling a source file, the compiler often needs information about the types it has not yet identified. The compiler needs its type information for each class or interface that is used, extended, or implemented in the source file. This includes classes and interfaces that are not explicitly mentioned in the source file but provide information through inheritance.
  • the Application Programming Interface is a predefined function that provides the ability for applications and developers to access a set of routines based on a piece of software or hardware without having to access source code or understand internals. The details of the working mechanism.
  • the Java API class file used by the virtual machine loader's class file when running a Java program. All loaded class files (including extracted from the application and extracted from the Java API) and all that have been loaded.
  • the loaded dynamic libraries (including native methods) together make up the entire program running on the Java virtual machine.
  • the functionality of the API must be explicitly implemented on this particular platform.
  • the Java API calls the native method. Since the Java API class file calls the native method, the Java program does not need to call them anymore. In this way, the Java API class file provides a Java program with a platform-independent, standard interface for the underlying host. For Java programs, the Java API will have the same performance and predictable behavior regardless of the internals of the platform. Because the Java Virtual Machine and Java API are explicitly implemented on each specific host platform, the Java program itself can become a platform-independent program.
  • the Java Card Compiler Tool Converter is a converter in Java that is responsible for data type conversion.
  • the Java Card technology is mainly used to implement a small Java Applet in a secure manner on a smart card or a device similar to a smart card. This technology is also widely used in SIM cards and ATM cards.
  • GlobalPlatform is a cross-industry international standards organization dedicated to the development, development and release of technical standards for security chips to facilitate the management of multi-application industrial environments and their secure, interoperable business deployment.
  • SE security unit
  • TEE trusted execution environment
  • Mobile Messaging mobile Messaging
  • SE security unit
  • TEE trusted execution environment
  • Mobile Messaging mobile Messaging
  • Step S102 Generate a library interface source file according to the library implementation source file
  • the specific implementation process of this step is: according to the library implementation source file generation library interface source file, the implementation code of all functions in the library implementation source file is removed, leaving only the class declaration.
  • the library interface package (the library interface package is a collection of library interface source files) with the fewest function declarations, you can compile the classes and functions of the interfaces you need to provide at the top. Since the JAVA card external class in the Java Card Compiler tool converter generates the sorted class Token values in alphabetical order, the class that provides the interface needs to be arranged at the forefront of the package.
  • Step S103 Generate a library interface Java card library file according to the library interface source file
  • the JAR package of the library interface Java card library file is generated.
  • the specific implementation process of this step is as follows: First, the library interface source file refers to the Java API through the javac compiler, and the library interface Java can be generated. Load the file. Then, the JavaCard and GP APIs are referenced through the Java Card Compiler tool converter to generate a library interface Java card external interface file. Finally, use the library interface Java loadable file and the library interface Java card external interface file together with the jar tool to generate the library interface Java card library file.
  • the jar (Java ARchive, Java Archive) tool is a platform-independent file format that combines multiple files into one file. Users can bind multiple Java applets and their required components (.class files, images, and sounds) to a JAR file, and then download them to the browser as a single simple HTTP (Hypertext Tranfer Protocal) transaction. , which greatly increases the download speed.
  • the JAR format also supports compression, which reduces file size and further reduces download time.
  • applet writers can also sign items in a JAR file with a digital signature to confirm their source. It is written in Java and is fully backward compatible with existing applet code and fully extensible.
  • Step S104 Generate a Java loadable file of the application according to the application source file, and generate a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
  • This step is a process of generating a loadable file, and the application needs to obtain a library interface Java card library file.
  • the specific implementation process of this step is: after the application source file (the application source file is a source file that implements the application function developed according to the application specification), the Java API is used to generate the application Java loadable file by using the Javac compiler. Then use the Java Card Compiler Tool converter to reference the JavaCard, the GP API, and the library interface Java card library file generated in step S103 to generate the Java of the application. The card can be loaded with files.
  • Step S105 The library implementation Java card loadable file and the Java card loadable file of the application are sequentially installed into the Java card.
  • the specific implementation process of this step is: before the application is loaded, the Java card loadable file is first installed on the existing standard Java card through the JavaCard downloader (Loader) to install the Java card loadable file to the Java card. in. Then, through the JavaCard Loader and Installer, the Java Card loadable file of the application is downloaded and installed into the Java card, and the application is downloaded and installed, and can be used.
  • the JavaCard downloader Loader
  • the function implementation method of the Java card application reduces the amount of code compared with the first method in the background art. If the amount of code implemented by the library function is n kbytes, the amount of code implemented by the application is m kbytes. When there are i applications on a card that need to be transferred to the library, the amount of code required by the first method is i* ( n+m) kbytes, and the amount of code required for this method is n+i*m kbytes, which reduces the amount of code of (i-1)*n kbytes. The reduction in the amount of code makes it possible to select a chip with a smaller space and a lower cost when the chip is selected.
  • the development time is shortened, the development difficulty is lowered, and the operation efficiency is improved.
  • the function library function by means of the traditional patch method, it is necessary to consider the possible problems in the design, design the patch entry, and in the implementation, call the global variable, etc., there are development restrictions, using Java card package to achieve new
  • the library function of the enhanced function can shorten the development time and reduce the development difficulty.
  • the traditional patch needs to determine whether there is a patch function when the function is called. The runtime cost is increased before each method call. This method does not require a judgment function, which improves the operation efficiency.
  • the cost of version maintenance is reduced, and if the chip of the ROM mask is used, the cost of the chip mask is also saved.
  • This method only needs to use the Java library implementation package to download to the Java card when the function function is missing or needs to be added, and provides the corresponding library interface package to the application development user, without re-developing a version of COS, reducing the COS The number of versions.
  • ROM On the mask chip, it is not necessary to perform the chip mask again, and the function library is directly downloaded, which greatly saves the cost of multiple masks.
  • FIG. 7 is a schematic structural diagram of a device for implementing a function of a Java card application according to an embodiment of the present invention. As shown in the figure, the device includes:
  • the first generating module 71 is configured to implement a Java card loadable file by implementing a source file generating library according to a library to be implemented.
  • the second generating module 72 is configured to generate a library interface source file according to the library implementation source file
  • the third generating module 73 is configured to generate a library interface Java card library file according to the library interface source file;
  • the fourth generation module 74 is configured to generate a Java loadable file of the application according to the application source file, and generate a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
  • the file loading module 75 is configured to sequentially install the library implementation Java card loadable file and the Java Card loadable file of the application into the Java card.
  • the first generating module 71 is specifically configured to:
  • the library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
  • the second generating module 72 is specifically configured to:
  • the third generating module 73 is specifically configured to:
  • the library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
  • the library interface Java loadable file is referenced by the Java Card compiler tool converter to the JavaCard and the application security management platform Global Platform API, and the library interface Java card external interface file is generated;
  • the library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
  • the fourth generating module 74 is specifically configured to:
  • the Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
  • the file loading module 75 is specifically configured to:
  • the Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
  • the device corresponding to the method of the first embodiment has all the beneficial technical effects of the first embodiment, and details are not described herein again.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may It may or may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.
  • a method and device for implementing a function of a Java card application provided by an embodiment of the present invention reduces the amount of code compared with the first method in the background art. If the amount of code implemented by the library function is n kbytes, the amount of code implemented by the application is m kbytes. When there are i applications on a card that need to be transferred to the library, the amount of code required by the first method is i* ( n+m) kbytes, and the amount of code required for this method is n+i*m kbytes, which reduces the amount of code of (i-1)*n kbytes. The reduction in the amount of code makes it possible to select a chip with a smaller space and a lower cost when the chip is selected.
  • the function implementation method and device for the Java card application provided by the embodiment of the present invention shortens the development time, reduces the development difficulty, and improves the operation efficiency compared with the second method in the background art.
  • the function library function by means of the traditional patch method, it is necessary to consider the possible problems in the design, design the patch entry, and in the implementation, call the global variable, etc., there are development restrictions, using Java card package to achieve new
  • the library function of the enhanced function can shorten the development time and reduce the development difficulty.
  • the traditional patch needs to determine whether there is a patch function when the function is called. The runtime cost is increased before each method call. This method does not require a judgment function, which improves the operation efficiency.
  • the method and device for implementing the function of the Java card application reduces the cost of the version maintenance compared with the third method in the background art, and saves on the chip of the ROM mask.
  • Chip mask cost This method only needs to use the Java library implementation package to download to the Java card when the function function is missing or needs to be added, and provides the corresponding library interface package to the application development user, without re-developing a version of COS, reducing the COS The number of versions. On the chip of the ROM mask, it is not necessary to perform the chip mask again, and the function library is directly downloaded, which greatly saves the cost of multiple masks.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

A function implementing method and apparatus for a Java card application, wherein said method comprises: generating a library-implementing Java card loadable file according to a library-implementing source file of a function to be implemented (S101); generating a library interface source file according to said library-implementing source file (S102); generating a library interface Java card library file according to said library interface source file (S103); generating a Java loadable file for an application according to an application source file, and generating a Java card loadable file for the application according to said Java loadable file for the application and said library interface Java card library file (S104); installing said library-implementing Java card loadable file and said Java card loadable file for the application into a Java card in sequence (S105).

Description

一种Java卡应用的功能实现方法及装置Function realization method and device of Java card application 技术领域Technical field
本发明涉及智能卡技术领域,尤其涉及一种Java卡应用的功能实现方法及装置。The present invention relates to the field of smart card technologies, and in particular, to a function implementation method and apparatus for a Java card application.
背景技术Background technique
JAVA卡是一种可以运行JAVA卡程序(JavaCard Applet)的智能卡,它充分利用了JAVA语言的平台无关性,使得JAVA技术“一次编写,随处运行”的思想在智能卡上得以实现。1996年10月,Sun基于斯伦贝谢的研究经验发布了第一版JAVA卡技术规范;1997年2月,金普斯和斯伦贝谢发起了JAVA卡论坛,多家智能卡制造商先后加入到这个组织中,并于1997年底发布了JAVA卡2.0规范。此版规范定义了具体的API接口函数,并引入一个比JAVA虚拟机小得多、但同样满足JAVA语言基本特性的JAVA卡虚拟机。JAVA card is a kind of smart card that can run JAVA card program (JavaCard Applet). It makes full use of the platform independence of JAVA language, which makes JAVA technology "write once, run anywhere" on the smart card. In October 1996, Sun released the first version of the JAVA card specification based on Schlumberger's research experience; in February 1997, Gemplus and Schlumberger launched the JAVA card forum, and several smart card manufacturers joined In this organization, the JAVA Card 2.0 specification was released at the end of 1997. This version of the specification defines the specific API interface functions and introduces a JAVA card virtual machine that is much smaller than the JAVA virtual machine but also satisfies the basic features of the JAVA language.
拥有虚拟机的JAVA卡,使得JAVA卡平台和应用完全分离。一张搭载JAVA卡平台的卡片,能够在平台发行后再下载应用,这是JAVA卡比使用本地语言如C语言的Native卡有着更为便利的优势,一张JAVA卡能够适应不同的应用场景,而不需要开发多个版本的片上操作系统(COS,Chip Operation System)。而平台和应用的分离,是通过统一的应用程序编程接口(API,Application Program Interface)来实现的。想要制定出一个版本的JAVA卡API国际标准,平台层实现API函数,而应用调用API接口来实现功能。The JAVA card with the virtual machine makes the JAVA card platform and application completely separate. A card with JAVA card platform can download the application after the platform is released. This is a JAVA card has a more convenient advantage than a native language such as C. A JAVA card can adapt to different application scenarios. There is no need to develop multiple versions of the on-chip operating system (COS, Chip Operation System). The separation of platform and application is achieved through a unified application programming interface (API). To develop a version of the JAVA card API international standard, the platform layer implements the API function, and the application calls the API interface to implement the function.
应用开发时,引用标准JAVA卡库包进行编译,生成可下载文件。应用下载到平台后,对平台库包API的调用采用动态链接机制,通过平台编译的Token值索引,找到调用的JAVA包、类和方法,实现相应的功能。在一张JAVA卡发行后,如果不同的应用需要实现相同的功能,传统的实现方法包括: 第一种方法,是每个应用都实现一套相同的功能函数;第二种方法,采用JAVA卡传统的补丁方式,将功能实现增加到平台中;第三种方法,重新开发平台,如果为只读存储器(ROM,Read-Only Memory)掩膜的卡片,还需要重新进行平台掩膜。When the application is developed, it is compiled by referring to the standard JAVA card library package to generate a downloadable file. After the application is downloaded to the platform, the platform of the platform library package is invoked by a dynamic link mechanism. The index of the Token value compiled by the platform is used to find the JAVA package, class and method that are called to implement the corresponding functions. After a JAVA card is released, if different applications need to implement the same function, the traditional implementation methods include: The first method is to implement a set of the same function function for each application; the second method uses the traditional patching method of JAVA card to add the function implementation to the platform; the third method, re-develop the platform, if Cards with a Read-Only Memory (ROM) mask also need to be re-plated.
现有的新增通用功能的方法都有各自的问题:第一种方法,每个应用在应用内部实现一套功能函数,这样导致代码量的冗余,在智能卡有限的空间中,如果单个应用的代码量增大,会导致可加载应用的个数减少,或者卡片成本的增加;第二种方法,JAVA卡传统的补丁方式,一般是在JAVA卡运行环境中,在调用方法的时候进行补丁函数的判断,如果该方法有补丁函数,则运行补丁函数,如果没有补丁函数,则运行现有的函数,这种方法增加了判断的时间,使得卡运行效率降低,而且补丁函数的开发具有较多的限制;第三种方法,重新开发一版新平台,这样不仅导致芯片可能有重新掩膜的成本,而且开发中增加了多个版本的维护成本。Existing methods for adding common functions have their own problems: the first method, each application implements a set of function functions within the application, which leads to redundancy of code amount, in a limited space of the smart card, if a single application The increase in the amount of code will result in a decrease in the number of loadable applications, or an increase in the cost of the card; the second method, the traditional patching method of the JAVA card, is generally in the JAVA card runtime environment, and is patched when the method is called. The function judges that if the method has a patch function, the patch function is run. If there is no patch function, the existing function is run. This method increases the judgment time, so that the card operation efficiency is lowered, and the development of the patch function is more More restrictions; the third method, re-developing a new version of the platform, which not only causes the chip to have the cost of re-masking, but also increases the maintenance cost of multiple versions in the development.
公开于该背景技术部分的信息仅仅旨在增加对本发明的总体背景的理解,而不应当被视为承认或以任何形式暗示该信息构成已为本领域一般技术人员所公知的现有技术。The information disclosed in this Background section is only intended to provide an understanding of the general background of the invention, and should not be construed as an admission
发明内容Summary of the invention
有鉴于此,本发明实施例要解决的技术问题是,如何提供一种能够在Java卡上实现新增功能的有效手段。In view of this, the technical problem to be solved by the embodiments of the present invention is how to provide an effective means for implementing new functions on a Java card.
为解决以上技术问题,本发明实施例在第一方面提供一种Java卡应用的功能实现方法,包括:To solve the above technical problem, the first embodiment of the present invention provides a method for implementing a function of a Java card application, including:
根据待实现功能的库实现源文件生成库实现Java卡可装载文件;Implementing a source file generation library according to a library to be implemented to implement a Java card loadable file;
根据所述库实现源文件生成库接口源文件;Generating a library interface source file according to the library implementation source file;
根据所述库接口源文件生成库接口Java卡库文件;Generating a library interface Java card library file according to the library interface source file;
根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可 装载文件和所述库接口Java卡库文件生成应用的Java卡可装载文件;Generating an application's Java loadable file according to the application source file, and according to the application's Java Loading a file and the library interface Java card library file generating application Java card loadable file;
依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中。The library implementation Java card loadable file and the Java Card loadable file of the application are sequentially installed into the Java card.
在一种可能的实现方式中,所述根据待实现功能的库实现源文件生成库实现Java卡可装载文件包括:In a possible implementation manner, the implementing the source file generation library according to the library implementation function to implement the Java card loadable file includes:
将所述库实现源文件通过javac编译器引用Java API,生成库实现Java可装载文件;Passing the library implementation source file to the Java API through a javac compiler, and generating a library to implement a Java loadable file;
将所述库实现Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库实现Java卡可装载文件。The library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
在一种可能的实现方式中,所述根据所述库实现源文件生成库接口源文件包括:In a possible implementation manner, the implementing a source file generating library interface source file according to the library includes:
去除所述库实现源文件中所有功能的实现代码,只留下类的声明,生成库接口源文件。Remove the implementation code of all functions in the library implementation source file, leaving only the declaration of the class, and generating the library interface source file.
在一种可能的实现方式中,所述根据所述库接口源文件生成库接口Java卡库文件包括:In a possible implementation manner, the generating a library interface Java card library file according to the library interface source file includes:
将库接口包源文件通过javac编译器引用Java API,生成库接口Java可装载文件;The library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
将所述库接口Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库接口Java卡外部接口文件;The library interface Java loadable file is referenced by the Java Card compiler tool converter to the JavaCard and the application security management platform Global Platform API, and the library interface Java card external interface file is generated;
根据所述库接口Java可装载文件和所述库接口Java卡外部接口文件,采用jar工具生成库接口Java卡库文件。The library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
在一种可能的实现方式中,所述根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可装载文件和所述库接口Java卡库文件生成应 用的Java卡可装载文件包括:In a possible implementation manner, the generating a Java loadable file according to an application source file, and generating, according to the Java loadable file of the application and the library interface Java card library file The Java Card loadable files used include:
将所述应用源文件通过javac编译器引用Java API生成应用的Java可装载文件;Generating the application source file into a Java loadable file of the application by referring to the Java API through a javac compiler;
将所述应用的Java可装载文件采用Java卡编译器工具converter引用JavaCard、应用安全管理平台Global PlatformAPI和所述库接口Java卡库文件,生成应用的Java卡可装载文件。The Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
在一种可能的实现方式中,所述依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中包括:In a possible implementation manner, the installing the Java card loadable file and the Java card loadable file of the application into the Java card in sequence includes:
先在现有的标准Java卡上,通过JavaCard下载器Loader将所述库实现Java卡可装载文件安装到Java卡中;First install the Java card loadable file into the Java card through the JavaCard Downloader Loader on the existing standard Java card;
再通过JavaCard下载器Loader和安装器Installer将所述应用的Java卡可装载文件下载并安装到Java卡中。The Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
为解决以上技术问题,本发明实施例在第二方面提供一种Java卡应用的功能实现装置,包括:In order to solve the above technical problem, the embodiment of the present invention provides a function implementation device for a Java card application, including:
第一生成模块,配置为根据待实现功能的库实现源文件生成库实现Java卡可装载文件;a first generation module, configured to implement a Java file loadable file according to a library implementation source library according to a function to be implemented;
第二生成模块,配置为根据所述库实现源文件生成库接口源文件;a second generation module, configured to generate a library interface source file according to the library implementation source file;
第三生成模块,配置为根据所述库接口源文件生成库接口Java卡库文件;a third generation module, configured to generate a library interface Java card library file according to the library interface source file;
第四生成模块,配置为根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可装载文件和所述库接口Java卡库文件生成应用的Java卡可装载文件;a fourth generation module, configured to generate a Java loadable file of the application according to the application source file, and generate a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
文件加载模块,配置为依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中。A file loading module configured to sequentially install the library implementation Java card loadable file and the Java Card loadable file of the application into the Java card.
在一种可能的实现方式中,所述第一生成模块,具体配置为: In a possible implementation manner, the first generating module is specifically configured to:
将所述库实现源文件通过javac编译器引用Java API,生成库实现Java可装载文件;Passing the library implementation source file to the Java API through a javac compiler, and generating a library to implement a Java loadable file;
将所述库实现Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库实现Java卡可装载文件。The library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
在一种可能的实现方式中,所述第二生成模块,具体配置为:In a possible implementation manner, the second generating module is specifically configured to:
去除所述库实现源文件中所有功能的实现代码,只留下类的声明,生成库接口源文件。Remove the implementation code of all functions in the library implementation source file, leaving only the declaration of the class, and generating the library interface source file.
在一种可能的实现方式中,所述第三生成模块,具体配置为:In a possible implementation manner, the third generating module is specifically configured to:
将库接口包源文件通过javac编译器引用Java API,生成库接口Java可装载文件;The library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
将所述库接口Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库接口Java卡外部接口文件;The library interface Java loadable file is referenced by the Java Card compiler tool converter to the JavaCard and the application security management platform Global Platform API, and the library interface Java card external interface file is generated;
根据所述库接口Java可装载文件和所述库接口Java卡外部接口文件,采用jar工具生成库接口Java卡库文件。The library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
在一种可能的实现方式中,所述第四生成模块,具体配置为:In a possible implementation manner, the fourth generating module is specifically configured to:
将所述应用源文件通过javac编译器引用Java API生成应用的Java可装载文件;Generating the application source file into a Java loadable file of the application by referring to the Java API through a javac compiler;
将所述应用的Java可装载文件采用Java卡编译器工具converter引用JavaCard、应用安全管理平台Global PlatformAPI和所述库接口Java卡库文件,生成应用的Java卡可装载文件。The Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
在一种可能的实现方式中,所述文件加载模块具体配置为:In a possible implementation manner, the file loading module is specifically configured to:
先在现有的标准Java卡上,通过JavaCard下载器Loader将所述库实现Java卡可装载文件安装到Java卡中; First install the Java card loadable file into the Java card through the JavaCard Downloader Loader on the existing standard Java card;
再通过JavaCard下载器Loader和安装器Installer将所述应用的Java卡可装载文件下载并安装到Java卡中。The Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
所述第一生成模块、所述第二生成模块、所述第三生成模块、所述第四生成模块、所述文件加载模块在执行处理时,可以使用PC机上用特定的软件,使用编程语言实现,在实际应用中,该编程语言可以设置于各个硬件实体(如中央处理器、数字信号处理器或可编程逻辑阵列)中,并通过所述中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital Singnal Processor)或可编程逻辑阵列(FPGA,Field-Programmable Gate Array)实现。The first generation module, the second generation module, the third generation module, the fourth generation module, and the file loading module may use a specific software on a PC to use a programming language when performing processing. Implementation, in practical applications, the programming language can be set in each hardware entity (such as a central processing unit, a digital signal processor, or a programmable logic array), and through the central processing unit (CPU, Central Processing Unit), digital Implemented by a DSP (Digital Singnal Processor) or a Field-Programmable Gate Array (FPGA).
一方面,本发明实施例提供的一种Java卡应用的功能实现方法及装置,与背景技术中第一种方法相比,减少了代码量。如果库功能实现的代码量为n kbytes,应用实现的代码量是m kbytes,当一张卡上有i个应用需要调到该库的功能时,第一种方法需要的代码量是i*(n+m)kbytes,而本方法需要的代码量是n+i*m kbytes,减少了(i-1)*n kbytes的代码量。代码量的减少,使得可以在芯片选型时,选择空间较小,成本较低的芯片。另一方面,本发明实施例提供的一种Java卡应用的功能实现方法及装置,与背景技术中第二种方法相比,缩短开发时间,降低开发难度,并提高了运行效率。依靠传统的补丁方式实现功能库函数时,需要在设计时就考虑到有可能出现的问题,设计好补丁入口,在实现时,调用全局变量等都有开发的限制,采用Java卡包来实现新增功能的库函数,能缩短开发时间,降低开发难度。运行时,传统的补丁需要在函数调用时判断是否具有补丁函数,在每个方法调用前都增加了运行时间成本,本方法不需要判断函数,提高了运行效率。再一方面,本发明实施例提供的一种Java卡应用的功能实现方法及装置,与背景技术中第三种方法相比,减少了版本维护的成本,如果在ROM掩膜的芯片上,还节约了芯片掩膜成本。此方法在功能函数缺失或需要新增的 时候,只需用Java库实现包下载到Java卡中,并提供相应的库接口包给应用开发的用户,无需重新开发一版COS,减少了COS的版本数量。在ROM掩膜的芯片上,无需再次进行芯片掩膜,直接将功能库进行下载,大大节约了多次掩膜的成本。In one aspect, a method and apparatus for implementing a function of a Java card application provided by an embodiment of the present invention reduces code amount compared to the first method in the background art. If the amount of code implemented by the library function is n kbytes, the amount of code implemented by the application is m kbytes. When there are i applications on a card that need to be transferred to the library, the amount of code required by the first method is i* ( n+m) kbytes, and the amount of code required for this method is n+i*m kbytes, which reduces the amount of code of (i-1)*n kbytes. The reduction in the amount of code makes it possible to select a chip with a smaller space and a lower cost when the chip is selected. On the other hand, the function implementation method and device for the Java card application provided by the embodiment of the present invention shortens the development time, reduces the development difficulty, and improves the operation efficiency, compared with the second method in the background art. When implementing the function library function by means of the traditional patch method, it is necessary to consider the possible problems in the design, design the patch entry, and in the implementation, call the global variable, etc., there are development restrictions, using Java card package to achieve new The library function of the enhanced function can shorten the development time and reduce the development difficulty. At runtime, the traditional patch needs to determine whether there is a patch function when the function is called. The runtime cost is increased before each method call. This method does not require a judgment function, which improves the operation efficiency. In another aspect, a method and an apparatus for implementing a function of a Java card application provided by an embodiment of the present invention reduce the cost of version maintenance compared with the third method in the background art, and if the chip is on the ROM mask, Saves on chip mask cost. This method is missing in function function or needs to be added At that time, you only need to use the Java library implementation package to download to the Java card, and provide the corresponding library interface package to the application development user, without re-developing a version of COS, reducing the number of COS versions. On the chip of the ROM mask, it is not necessary to perform the chip mask again, and the function library is directly downloaded, which greatly saves the cost of multiple masks.
根据下面参考附图对示例性实施例的详细说明,本发明的其它特征及方面将变得清楚。Further features and aspects of the present invention will become apparent from the Detailed Description of the Drawing.
附图说明DRAWINGS
包含在说明书中并且构成说明书的一部分的附图与说明书一起示出了本发明的示例性实施例、特征和方面,并且用于解释本发明的原理。The accompanying drawings, which are incorporated in FIG
图1示出了本发明实施例一的一种Java卡应用的功能实现方法的流程图;1 is a flowchart of a method for implementing a function of a Java Card application according to Embodiment 1 of the present invention;
图2示出了本发明实施例一的步骤S101的流程图;FIG. 2 is a flowchart of step S101 of Embodiment 1 of the present invention;
图3示出了本发明实施例一的步骤S102的流程图;FIG. 3 is a flowchart of step S102 of the first embodiment of the present invention;
图4示出了本发明实施例一的步骤S103的流程图;FIG. 4 is a flowchart showing step S103 of the first embodiment of the present invention;
图5示出了本发明实施例一的步骤S104的流程图;FIG. 5 is a flowchart of step S104 of Embodiment 1 of the present invention;
图6示出了本发明实施例一的步骤S105的流程图;FIG. 6 is a flowchart of step S105 of Embodiment 1 of the present invention;
图7示出了本发明实施例一的一种Java卡应用的功能实现装置的结构示意图。FIG. 7 is a schematic structural diagram of a function implementing apparatus of a Java card application according to Embodiment 1 of the present invention.
具体实施方式detailed description
下面结合附图,对本发明的具体实施方式进行详细描述,但应当理解本发明的保护范围并不受具体实施方式的限制。The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings, but it is understood that the scope of the present invention is not limited by the specific embodiments.
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。 基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。除非另有其它明确表示,否则在整个说明书和权利要求书中,术语“包括”或其变换如“包含”或“包括有”等等将被理解为包括所陈述的元件或组成部分,而并未排除其它元件或其它组成部分。The technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. It is a partial embodiment of the invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention. The term "comprising" or variations such as "comprises" or "comprises", etc., are to be understood to include the recited elements or components, and Other components or other components are not excluded.
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustrative." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or preferred.
另外,为了更好的说明本发明,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本发明同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件未作详细描述,以便于凸显本发明的主旨。In addition, numerous specific details are set forth in the Detailed Description of the invention in the Detailed Description. Those skilled in the art will appreciate that the invention may be practiced without some specific details. In some instances, methods, means, and components that are well known to those skilled in the art are not described in detail in order to facilitate the invention.
本申请解决了背景技术中存在的问题,将JAVA卡新增的通用功能提炼成库包,每个应用不必单独实现这些功能,直接调用新增的库包,减少了空间的占用。先将库包下载到Java卡上,再将调用库包功能的应用下载到Java卡上。在实现库包的功能时,采用JAVA卡包的实现方式,实现方式灵活,便于快速开发。开发后不需要维护多个版本的平台,只用维护库包;在ROM掩膜的平台上,也免除了重新掩膜的成本。The present application solves the problems in the background art, and refines the general functions added by the JAVA card into a library package. Each application does not need to implement these functions separately, and directly calls the newly added library package, thereby reducing the space occupation. First download the library package to the Java card, and then download the application that calls the library package function to the Java card. When implementing the function of the library package, the implementation of the JAVA card package is adopted, and the implementation mode is flexible and convenient for rapid development. After development, there is no need to maintain multiple versions of the platform, only the maintenance of the library package; on the platform of the ROM mask, the cost of re-masking is also eliminated.
本申请中的库包是指实现了功能的API包,常见的JAVA卡标准库包包括:java.io、java.lang、javacard.framework、javacard.security、javacardx.crypto等。库包java.io和java.lang定义了一些常见的异常(Exception),javacard.framework定义了JAVA卡平台运行环境的各种操作接口,javacard.security和javacardx.crypto定义了国际算法和密码相关的安全接口。The library package in this application refers to the API package that implements the functions. The common JAVA card standard library package includes: java.io, java.lang, javacard.framework, javacard.security, javacardx.crypto, and so on. The library packages java.io and java.lang define some common exceptions (Exceptions). javacard.framework defines various operation interfaces for the JAVA card platform runtime environment. javacard.security and javacardx.crypto define international algorithms and passwords. Security interface.
本申请中的库,指的是Java卡外部库,即卡内未预置的库,需要新增功能的库包。在本申请中,源文件均为.java文件,Java可装载文件为.class文件,Java卡可装载文件为.cap文件,库包(Package)为一系列源文件的集合,库 文件为Java卡应用开发需要引用的jar包。库实现包中包含了库实现源文件,库实现源文件中实现了库的功能;库接口包中包含了库接口源文件,库接口源文件只包含了函数接口,没有具体功能实现。The library in this application refers to the Java card external library, that is, the library that is not preset in the card, and the library package that needs new functions. In this application, the source files are .java files, the Java loadable files are .class files, the Java card loadable files are .cap files, and the package is a collection of source files. The file is a jar package that needs to be referenced for Java Card application development. The library implementation package contains the library implementation source file, and the library implements the library function in the source file; the library interface package contains the library interface source file, and the library interface source file only contains the function interface, and no specific function is implemented.
实施例1Example 1
图1示出本发明实施例提供的一种Java卡应用的功能实现方法的流程图,如图所示,该方法包括:FIG. 1 is a flowchart of a method for implementing a function of a Java card application according to an embodiment of the present invention. As shown in the figure, the method includes:
步骤S101:根据待实现功能的库实现源文件生成库实现Java卡可装载文件;Step S101: Implementing a source file generation library according to a library to be implemented to implement a Java card loadable file;
库实现包中包含所有库实现源文件,其作为一个JAVA卡的包,基于JAVA卡标准库包进行开发,实现新增库的功能函数。如图2所示,本步骤的具体实现过程为:先通过javac编译器引用Java API,生成库实现包Java可装载文件。然后,通过Java卡编译器工具converter引用JavaCard和应用安全管理平台(GP,Global Platform)API,生成库实现Java卡可装载文件。The library implementation package contains all the library implementation source files. As a JAVA card package, it is developed based on the JAVA card standard library package to implement the function functions of the new library. As shown in FIG. 2, the specific implementation process of this step is: firstly, the Java API is referenced by the javac compiler, and the library implementation package Java loadable file is generated. Then, the Java Card and the Application Security Management Platform (GP, Global Platform) API are referenced through the Java Card Compiler Tool Converter, and the library is implemented to implement the Java Card loadable file.
javac是java语言编程编译器,全称javacompilation.javac工具,由java语言编写的类和接口的定义,并将它们编译成字节代码的class文件。javac可以隐式编译一些没有在命令行中提及的源文件,用-verbose选项可跟踪自动编译。当编译源文件时,编译器常常需要它还没有识别出的类型的有关信息。对于源文件中使用、扩展或实现的每个类或接口,编译器都需要其类型信息。这包括在源文件中没有明确提及、但通过继承提供信息的类和接口。Javac is a java language programming compiler, the full name of the javacompilation.javac tool, the definition of classes and interfaces written in the java language, and compiled into a class file of byte code. Javac can implicitly compile some source files that are not mentioned on the command line, and use the -verbose option to track automatic compilation. When compiling a source file, the compiler often needs information about the types it has not yet identified. The compiler needs its type information for each class or interface that is used, extended, or implemented in the source file. This includes classes and interfaces that are not explicitly mentioned in the source file but provide information through inheritance.
应用程序编程接口(API,Application Programming Interface)是一些预先定义的函数,目的是提供应用程序与开发人员基于某软件或硬件的以访问一组例程的能力,而又无需访问源码,或理解内部工作机制的细节。运行Java程序时,虚拟机装载程序的class文件所使用的Java API class文件。所有被装载的class文件(包括从应用程序中和从Java API中提取的)和所有已 经装载的动态库(包含本地方法)共同组成了在Java虚拟机上运行的整个程序。The Application Programming Interface (API) is a predefined function that provides the ability for applications and developers to access a set of routines based on a piece of software or hardware without having to access source code or understand internals. The details of the working mechanism. The Java API class file used by the virtual machine loader's class file when running a Java program. All loaded class files (including extracted from the application and extracted from the Java API) and all that have been loaded The loaded dynamic libraries (including native methods) together make up the entire program running on the Java virtual machine.
在一个平台能够支持Java程序以前,必须在这个特定平台上明确地实现API的功能。为访问主机上的本地资源,Java API调用了本地方法。由于Java API class文件调用了本地方法,Java程序就不需要再调用它们了。通过这种方法,Java API class文件为底层主机提供了具有平台无关性、标准接口的Java程序。对Java程序而言,无论平台内部如何,Java API都会有同样的表现和可预测的行为。正是由于在每个特定的主机平台上明确地实现了Java虚拟机和Java API,因此,Java程序自身就能够成为具有平台无关性的程序。Before a platform can support Java programs, the functionality of the API must be explicitly implemented on this particular platform. To access local resources on the host, the Java API calls the native method. Since the Java API class file calls the native method, the Java program does not need to call them anymore. In this way, the Java API class file provides a Java program with a platform-independent, standard interface for the underlying host. For Java programs, the Java API will have the same performance and predictable behavior regardless of the internals of the platform. Because the Java Virtual Machine and Java API are explicitly implemented on each specific host platform, the Java program itself can become a platform-independent program.
Java卡编译器工具converter是java中的转换器,负责数据类型的转换。Java Card技术主要是让智慧卡或与智慧卡相近的装置上,以具有安全防护性的方式来执行小型的Java Applet,此技术也被广泛运用在SIM卡、提款卡上。The Java Card Compiler Tool Converter is a converter in Java that is responsible for data type conversion. The Java Card technology is mainly used to implement a small Java Applet in a secure manner on a smart card or a device similar to a smart card. This technology is also widely used in SIM cards and ATM cards.
GlobalPlatform(GP)是跨行业的国际标准组织,致力于开发、制定并发布安全芯片的技术标准,以促进多应用产业环境的管理及其安全、可互操作的业务部署。作为一个国际标准组织,其工作重心主要集中在安全单元(SE)、可信执行环境(TEE)和系统消息(Mobile Messaging)等领域,其成熟的技术规范是建立端到端可信业务解决方案的工具,并服务于产业环境的多个成员,支持多种商业模式。GP是全球基于安全芯片的安全基础设施统一的标准的制定者。GlobalPlatform (GP) is a cross-industry international standards organization dedicated to the development, development and release of technical standards for security chips to facilitate the management of multi-application industrial environments and their secure, interoperable business deployment. As an international standards organization, its focus is on security unit (SE), trusted execution environment (TEE) and mobile messaging (Mobile Messaging). Its mature technical specification is to establish an end-to-end trusted service solution. The tools and services of multiple members of the industrial environment support multiple business models. The GP is the global standard for the unification of security chip-based security infrastructure.
步骤S102:根据所述库实现源文件生成库接口源文件;Step S102: Generate a library interface source file according to the library implementation source file;
如图3所示,本步骤的具体实现过程为:根据库实现源文件生成库接口源文件,将库实现源文件中所有功能的实现代码去掉,只留下类的声明。As shown in FIG. 3, the specific implementation process of this step is: according to the library implementation source file generation library interface source file, the implementation code of all functions in the library implementation source file is removed, leaving only the class declaration.
如果希望库接口包(库接口包为库接口源文件的集合)中含有最少的函数声明,可以将需要提供的接口所在的类和函数都放在最前位置编译。 由于Java卡编译器工具converter中JAVA卡外部类按照字母顺序来生成排序的类Token值,需要将提供接口的类排列在包的最前位置。If you want the library interface package (the library interface package is a collection of library interface source files) with the fewest function declarations, you can compile the classes and functions of the interfaces you need to provide at the top. Since the JAVA card external class in the Java Card Compiler tool converter generates the sorted class Token values in alphabetical order, the class that provides the interface needs to be arranged at the forefront of the package.
步骤S103:根据所述库接口源文件生成库接口Java卡库文件;Step S103: Generate a library interface Java card library file according to the library interface source file;
根据库接口源文件生成库接口Java卡库文件的JAR包,如图4所示,本步骤的具体实现过程为:首先,将库接口源文件通过javac编译器引用Java API,生成库接口Java可装载文件。然后,通过Java卡编译器工具converter引用JavaCard和GP API,生成库接口Java卡外部接口文件。最后,用库接口Java可装载文件和库接口Java卡外部接口文件一起用jar工具生成库接口Java卡库文件。According to the library interface source file, the JAR package of the library interface Java card library file is generated. As shown in FIG. 4, the specific implementation process of this step is as follows: First, the library interface source file refers to the Java API through the javac compiler, and the library interface Java can be generated. Load the file. Then, the JavaCard and GP APIs are referenced through the Java Card Compiler tool converter to generate a library interface Java card external interface file. Finally, use the library interface Java loadable file and the library interface Java card external interface file together with the jar tool to generate the library interface Java card library file.
jar(Java ARchive,Java归档)工具是一种与平台无关的文件格式,可将多个文件合成一个文件。用户可将多个Java applet及其所需组件(.class文件、图像和声音)绑定到JAR文件中,而后作为单个的简单HTTP(Hypertext Tranfer Protocal,超文本传输协议)事务下载到浏览器中,从而大大提高下载速度。JAR格式也支持压缩,从而减小了文件的大小,进一步缩短下载时间。另外,applet编写者也可在JAR文件中用数字签名的方式签写各项以确认其来源。它用Java编写,可与现有的applet代码完全向后兼容且可充分扩展。The jar (Java ARchive, Java Archive) tool is a platform-independent file format that combines multiple files into one file. Users can bind multiple Java applets and their required components (.class files, images, and sounds) to a JAR file, and then download them to the browser as a single simple HTTP (Hypertext Tranfer Protocal) transaction. , which greatly increases the download speed. The JAR format also supports compression, which reduces file size and further reduces download time. In addition, applet writers can also sign items in a JAR file with a digital signature to confirm their source. It is written in Java and is fully backward compatible with existing applet code and fully extensible.
步骤S104:根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可装载文件和所述库接口Java卡库文件生成应用的Java卡可装载文件;Step S104: Generate a Java loadable file of the application according to the application source file, and generate a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
本步骤为应用可装载文件的生成过程,应用需要获取库接口Java卡库文件。如图5所示,本步骤的具体实现过程为:将应用源文件(应用源文件是根据应用规范开发的实现应用功能的源文件)通过javac编译器引用Java API生成应用Java可装载文件后,然后使用Java卡编译器工具converter引用JavaCard、GP API以及步骤S103生成的库接口Java卡库文件,生成应用的Java 卡可装载文件。This step is a process of generating a loadable file, and the application needs to obtain a library interface Java card library file. As shown in FIG. 5, the specific implementation process of this step is: after the application source file (the application source file is a source file that implements the application function developed according to the application specification), the Java API is used to generate the application Java loadable file by using the Javac compiler. Then use the Java Card Compiler Tool converter to reference the JavaCard, the GP API, and the library interface Java card library file generated in step S103 to generate the Java of the application. The card can be loaded with files.
步骤S105:依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中。Step S105: The library implementation Java card loadable file and the Java card loadable file of the application are sequentially installed into the Java card.
如图6所示,本步骤的具体实现过程为:在应用装载前,需要先在现有的标准Java卡上,通过JavaCard下载器(Loader)先将库实现Java卡可装载文件安装到Java卡中。然后,再通过JavaCard Loader和安装器(Installer)将应用的Java卡可装载文件下载并安装进Java卡中,完成应用的下载和安装,并可以使用。As shown in FIG. 6, the specific implementation process of this step is: before the application is loaded, the Java card loadable file is first installed on the existing standard Java card through the JavaCard downloader (Loader) to install the Java card loadable file to the Java card. in. Then, through the JavaCard Loader and Installer, the Java Card loadable file of the application is downloaded and installed into the Java card, and the application is downloaded and installed, and can be used.
本发明实施例提供的一种Java卡应用的功能实现方法,与背景技术中第一种方法相比,减少了代码量。如果库功能实现的代码量为n kbytes,应用实现的代码量是m kbytes,当一张卡上有i个应用需要调到该库的功能时,第一种方法需要的代码量是i*(n+m)kbytes,而本方法需要的代码量是n+i*m kbytes,减少了(i-1)*n kbytes的代码量。代码量的减少,使得可以在芯片选型时,选择空间较小,成本较低的芯片。The function implementation method of the Java card application provided by the embodiment of the present invention reduces the amount of code compared with the first method in the background art. If the amount of code implemented by the library function is n kbytes, the amount of code implemented by the application is m kbytes. When there are i applications on a card that need to be transferred to the library, the amount of code required by the first method is i* ( n+m) kbytes, and the amount of code required for this method is n+i*m kbytes, which reduces the amount of code of (i-1)*n kbytes. The reduction in the amount of code makes it possible to select a chip with a smaller space and a lower cost when the chip is selected.
与背景技术中第二种方法相比,缩短开发时间,降低开发难度,并提高了运行效率。依靠传统的补丁方式实现功能库函数时,需要在设计时就考虑到有可能出现的问题,设计好补丁入口,在实现时,调用全局变量等都有开发的限制,采用Java卡包来实现新增功能的库函数,能缩短开发时间,降低开发难度。运行时,传统的补丁需要在函数调用时判断是否具有补丁函数,在每个方法调用前都增加了运行时间成本,本方法不需要判断函数,提高了运行效率。Compared with the second method in the background art, the development time is shortened, the development difficulty is lowered, and the operation efficiency is improved. When implementing the function library function by means of the traditional patch method, it is necessary to consider the possible problems in the design, design the patch entry, and in the implementation, call the global variable, etc., there are development restrictions, using Java card package to achieve new The library function of the enhanced function can shorten the development time and reduce the development difficulty. At runtime, the traditional patch needs to determine whether there is a patch function when the function is called. The runtime cost is increased before each method call. This method does not require a judgment function, which improves the operation efficiency.
与背景技术中第三种方法相比,减少了版本维护的成本,如果在ROM掩膜的芯片上,还节约了芯片掩膜成本。此方法在功能函数缺失或需要新增的时候,只需用Java库实现包下载到Java卡中,并提供相应的库接口包给应用开发的用户,无需重新开发一版COS,减少了COS的版本数量。在ROM 掩膜的芯片上,无需再次进行芯片掩膜,直接将功能库进行下载,大大节约了多次掩膜的成本。Compared with the third method in the background art, the cost of version maintenance is reduced, and if the chip of the ROM mask is used, the cost of the chip mask is also saved. This method only needs to use the Java library implementation package to download to the Java card when the function function is missing or needs to be added, and provides the corresponding library interface package to the application development user, without re-developing a version of COS, reducing the COS The number of versions. In ROM On the mask chip, it is not necessary to perform the chip mask again, and the function library is directly downloaded, which greatly saves the cost of multiple masks.
实施例2Example 2
图7示出本发明实施例提供的一种Java卡应用的功能实现装置的结构示意图,如图所示,该装置包括:FIG. 7 is a schematic structural diagram of a device for implementing a function of a Java card application according to an embodiment of the present invention. As shown in the figure, the device includes:
第一生成模块71,配置为根据待实现功能的库实现源文件生成库实现Java卡可装载文件;The first generating module 71 is configured to implement a Java card loadable file by implementing a source file generating library according to a library to be implemented.
第二生成模块72,配置为根据所述库实现源文件生成库接口源文件;The second generating module 72 is configured to generate a library interface source file according to the library implementation source file;
第三生成模块73,配置为根据所述库接口源文件生成库接口Java卡库文件;The third generating module 73 is configured to generate a library interface Java card library file according to the library interface source file;
第四生成模块74,配置为根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可装载文件和所述库接口Java卡库文件生成应用的Java卡可装载文件;The fourth generation module 74 is configured to generate a Java loadable file of the application according to the application source file, and generate a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
文件加载模块75,配置为依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中。The file loading module 75 is configured to sequentially install the library implementation Java card loadable file and the Java Card loadable file of the application into the Java card.
在一种可能的实现方式中,所述第一生成模块71,具体配置为:In a possible implementation manner, the first generating module 71 is specifically configured to:
将所述库实现源文件通过javac编译器引用Java API,生成库实现Java可装载文件;Passing the library implementation source file to the Java API through a javac compiler, and generating a library to implement a Java loadable file;
将所述库实现Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库实现Java卡可装载文件。The library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
在一种可能的实现方式中,所述第二生成模块72,具体配置为:In a possible implementation manner, the second generating module 72 is specifically configured to:
去除所述库实现源文件中所有功能的实现代码,只留下类的声明,生成库接口源文件。Remove the implementation code of all functions in the library implementation source file, leaving only the declaration of the class, and generating the library interface source file.
在一种可能的实现方式中,所述第三生成模块73,具体配置为: In a possible implementation manner, the third generating module 73 is specifically configured to:
将库接口包源文件通过javac编译器引用Java API,生成库接口Java可装载文件;The library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
将所述库接口Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库接口Java卡外部接口文件;The library interface Java loadable file is referenced by the Java Card compiler tool converter to the JavaCard and the application security management platform Global Platform API, and the library interface Java card external interface file is generated;
根据所述库接口Java可装载文件和所述库接口Java卡外部接口文件,采用jar工具生成库接口Java卡库文件。The library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
在一种可能的实现方式中,所述第四生成模块74,具体配置为:In a possible implementation manner, the fourth generating module 74 is specifically configured to:
将所述应用源文件通过javac编译器引用Java API生成应用的Java可装载文件;Generating the application source file into a Java loadable file of the application by referring to the Java API through a javac compiler;
将所述应用的Java可装载文件采用Java卡编译器工具converter引用JavaCard、应用安全管理平台Global PlatformAPI和所述库接口Java卡库文件,生成应用的Java卡可装载文件。The Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
在一种可能的实现方式中,所述文件加载模块75具体配置为:In a possible implementation manner, the file loading module 75 is specifically configured to:
先在现有的标准Java卡上,通过JavaCard下载器Loader将所述库实现Java卡可装载文件安装到Java卡中;First install the Java card loadable file into the Java card through the JavaCard Downloader Loader on the existing standard Java card;
再通过JavaCard下载器Loader和安装器Installer将所述应用的Java卡可装载文件下载并安装到Java卡中。The Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
本实施例为实施例一的方法相对应的装置,具有实施例一的全部有益技术效果,在此不再赘述。The device corresponding to the method of the first embodiment has all the beneficial technical effects of the first embodiment, and details are not described herein again.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。 Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
前述对本发明的具体示例性实施方案的描述是为了说明和例证的目的。这些描述并非想将本发明限定为所公开的精确形式,并且很显然,根据上述教导,可以进行很多改变和变化。对示例性实施例进行选择和描述的目的在于解释本发明的特定原理及其实际应用,从而使得本领域的技术人员能够实现并利用本发明的各种不同的示例性实施方案以及各种不同的选择和改变。本发明的范围意在由权利要求书及其等同形式所限定。The foregoing description of the specific exemplary embodiments of the present invention has The description is not intended to limit the invention to the precise forms disclosed. The embodiments were chosen and described in order to explain the particular embodiments of the invention Choose and change. The scope of the invention is intended to be defined by the claims and their equivalents.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以 是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may It may or may not be a physical unit, that is, it may be located in one place, or it may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.
工业实用性Industrial applicability
1)本发明实施例提供的一种Java卡应用的功能实现方法及装置,与背景技术中第一种方法相比,减少了代码量。如果库功能实现的代码量为n kbytes,应用实现的代码量是m kbytes,当一张卡上有i个应用需要调到该库的功能时,第一种方法需要的代码量是i*(n+m)kbytes,而本方法需要的代码量是n+i*m kbytes,减少了(i-1)*n kbytes的代码量。代码量的减少,使得可以在芯片选型时,选择空间较小,成本较低的芯片。2)本发明实施例提供的一种Java卡应用的功能实现方法及装置,与背景技术中第二种方法相比,缩短开发时间,降低开发难度,并提高了运行效率。依靠传统的补丁方式实现功能库函数时,需要在设计时就考虑到有可能出现的问题,设计好补丁入口,在实现时,调用全局变量等都有开发的限制,采用Java卡包来实现新增功能的库函数,能缩短开发时间,降低开发难度。运行时,传统的补丁需要在函数调用时判断是否具有补丁函数,在每个方法调用前都增加了运行时间成本,本方法不需要判断函数,提高了运行效率。3)本发明实施例提供的一种Java卡应用的功能实现方法及装置,与背景技术中第三种方法相比,减少了版本维护的成本,如果在ROM掩膜的芯片上,还节约了芯片掩膜成本。此方法在功能函数缺失或需要新增的时候,只需用Java库实现包下载到Java卡中,并提供相应的库接口包给应用开发的用户,无需重新开发一版COS,减少了COS的版本数量。在ROM掩膜的芯片上,无需再次进行芯片掩膜,直接将功能库进行下载,大大节约了多次掩膜的成本。 1) A method and device for implementing a function of a Java card application provided by an embodiment of the present invention reduces the amount of code compared with the first method in the background art. If the amount of code implemented by the library function is n kbytes, the amount of code implemented by the application is m kbytes. When there are i applications on a card that need to be transferred to the library, the amount of code required by the first method is i* ( n+m) kbytes, and the amount of code required for this method is n+i*m kbytes, which reduces the amount of code of (i-1)*n kbytes. The reduction in the amount of code makes it possible to select a chip with a smaller space and a lower cost when the chip is selected. 2) The function implementation method and device for the Java card application provided by the embodiment of the present invention shortens the development time, reduces the development difficulty, and improves the operation efficiency compared with the second method in the background art. When implementing the function library function by means of the traditional patch method, it is necessary to consider the possible problems in the design, design the patch entry, and in the implementation, call the global variable, etc., there are development restrictions, using Java card package to achieve new The library function of the enhanced function can shorten the development time and reduce the development difficulty. At runtime, the traditional patch needs to determine whether there is a patch function when the function is called. The runtime cost is increased before each method call. This method does not require a judgment function, which improves the operation efficiency. 3) The method and device for implementing the function of the Java card application provided by the embodiment of the present invention reduces the cost of the version maintenance compared with the third method in the background art, and saves on the chip of the ROM mask. Chip mask cost. This method only needs to use the Java library implementation package to download to the Java card when the function function is missing or needs to be added, and provides the corresponding library interface package to the application development user, without re-developing a version of COS, reducing the COS The number of versions. On the chip of the ROM mask, it is not necessary to perform the chip mask again, and the function library is directly downloaded, which greatly saves the cost of multiple masks.

Claims (12)

  1. 一种Java卡应用的功能实现方法,包括:A function implementation method of a Java card application, including:
    根据待实现功能的库实现源文件生成库实现Java卡可装载文件;Implementing a source file generation library according to a library to be implemented to implement a Java card loadable file;
    根据所述库实现源文件生成库接口源文件;Generating a library interface source file according to the library implementation source file;
    根据所述库接口源文件生成库接口Java卡库文件;Generating a library interface Java card library file according to the library interface source file;
    根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可装载文件和所述库接口Java卡库文件生成应用的Java卡可装载文件;Generating a Java loadable file of the application according to the application source file, and generating a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
    依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中。The library implementation Java card loadable file and the Java Card loadable file of the application are sequentially installed into the Java card.
  2. 根据权利要求1所述的Java卡应用的功能实现方法,其中,所述根据待实现功能的库实现源文件生成库实现Java卡可装载文件包括:The function implementation method of the Java card application according to claim 1, wherein the implementing the source file generation library according to the library to be implemented to implement the Java card loadable file comprises:
    将所述库实现源文件通过javac编译器引用Java API,生成库实现Java可装载文件;Passing the library implementation source file to the Java API through a javac compiler, and generating a library to implement a Java loadable file;
    将所述库实现Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库实现Java卡可装载文件。The library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
  3. 根据权利要求1所述的Java卡应用的功能实现方法,其中,所述根据所述库实现源文件生成库接口源文件包括:The function implementation method of the Java card application according to claim 1, wherein the implementing the source file generating library interface source file according to the library comprises:
    去除所述库实现源文件中所有功能的实现代码,只留下类的声明,生成库接口源文件。Remove the implementation code of all functions in the library implementation source file, leaving only the declaration of the class, and generating the library interface source file.
  4. 根据权利要求1所述的Java卡应用的功能实现方法,其中,所述根据所述库接口源文件生成库接口Java卡库文件包括:The function implementation method of the Java card application according to claim 1, wherein the generating the library interface Java card library file according to the library interface source file comprises:
    将库接口包源文件通过javac编译器引用Java API,生成库接口Java可装载文件;The library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
    将所述库接口Java可装载文件通过Java卡编译器工具converter引用 JavaCard和应用安全管理平台Global PlatformAPI,生成库接口Java卡外部接口文件;Passing the library interface Java loadable file through the Java Card Compiler tool converter JavaCard and application security management platform Global PlatformAPI, generate library interface Java card external interface file;
    根据所述库接口Java可装载文件和所述库接口Java卡外部接口文件,采用jar工具生成库接口Java卡库文件。The library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
  5. 根据权利要求1所述的Java卡应用的功能实现方法,其中,所述根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可装载文件和所述库接口Java卡库文件生成应用的Java卡可装载文件包括:The function implementing method of the Java Card application according to claim 1, wherein the Java loadable file of the application is generated according to the application source file, and the Java loadable file and the library interface Java card library file according to the application The Java Card loadable files that generate the app include:
    将所述应用源文件通过javac编译器引用Java API生成应用的Java可装载文件;Generating the application source file into a Java loadable file of the application by referring to the Java API through a javac compiler;
    将所述应用的Java可装载文件采用Java卡编译器工具converter引用JavaCard、应用安全管理平台Global PlatformAPI和所述库接口Java卡库文件,生成应用的Java卡可装载文件。The Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
  6. 根据权利要求1所述的Java卡应用的功能实现方法,其中,所述依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中包括:The function implementation method of the Java card application according to claim 1, wherein the installing the Java card loadable file and the Java card loadable file of the application into the Java card in sequence comprises:
    先在现有的标准Java卡上,通过JavaCard下载器Loader将所述库实现Java卡可装载文件安装到Java卡中;First install the Java card loadable file into the Java card through the JavaCard Downloader Loader on the existing standard Java card;
    再通过JavaCard下载器Loader和安装器Installer将所述应用的Java卡可装载文件下载并安装到Java卡中。The Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
  7. 一种Java卡应用的功能实现装置,包括:A function implementing device for a Java card application, comprising:
    第一生成模块,配置为根据待实现功能的库实现源文件生成库实现Java卡可装载文件;a first generation module, configured to implement a Java file loadable file according to a library implementation source library according to a function to be implemented;
    第二生成模块,配置为根据所述库实现源文件生成库接口源文件;a second generation module, configured to generate a library interface source file according to the library implementation source file;
    第三生成模块,配置为根据所述库接口源文件生成库接口Java卡库文件; a third generation module, configured to generate a library interface Java card library file according to the library interface source file;
    第四生成模块,配置为根据应用源文件生成应用的Java可装载文件,并根据所述应用的Java可装载文件和所述库接口Java卡库文件生成应用的Java卡可装载文件;a fourth generation module, configured to generate a Java loadable file of the application according to the application source file, and generate a Java card loadable file of the application according to the Java loadable file of the application and the library interface Java card library file;
    文件加载模块,配置为依次将所述库实现Java卡可装载文件和所述应用的Java卡可装载文件安装到Java卡中。A file loading module configured to sequentially install the library implementation Java card loadable file and the Java Card loadable file of the application into the Java card.
  8. 根据权利要求7所述的Java卡应用的功能实现装置,其中,所述第一生成模块,还配置为:The function implementing device of the Java card application according to claim 7, wherein the first generating module is further configured to:
    将所述库实现源文件通过javac编译器引用Java API,生成库实现Java可装载文件;Passing the library implementation source file to the Java API through a javac compiler, and generating a library to implement a Java loadable file;
    将所述库实现Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库实现Java卡可装载文件。The library implements the Java loadable file by referring to the JavaCard and the application security management platform Global Platform API through the Java Card compiler tool converter, and the generated library implements the Java card loadable file.
  9. 根据权利要求7所述的Java卡应用的功能实现装置,其中,所述第二生成模块,还配置为:The function implementation device of the Java card application according to claim 7, wherein the second generation module is further configured to:
    去除所述库实现源文件中所有功能的实现代码,只留下类的声明,生成库接口源文件。Remove the implementation code of all functions in the library implementation source file, leaving only the declaration of the class, and generating the library interface source file.
  10. 根据权利要求7所述的Java卡应用的功能实现装置,其中,所述第三生成模块,还配置为:The function implementation device of the Java card application according to claim 7, wherein the third generation module is further configured to:
    将库接口包源文件通过javac编译器引用Java API,生成库接口Java可装载文件;The library interface package source file is referenced to the Java API by the javac compiler, and the library interface Java loadable file is generated;
    将所述库接口Java可装载文件通过Java卡编译器工具converter引用JavaCard和应用安全管理平台Global PlatformAPI,生成库接口Java卡外部接口文件;The library interface Java loadable file is referenced by the Java Card compiler tool converter to the JavaCard and the application security management platform Global Platform API, and the library interface Java card external interface file is generated;
    根据所述库接口Java可装载文件和所述库接口Java卡外部接口文件,采用jar工具生成库接口Java卡库文件。 The library interface Java card library file is generated by using the jar tool according to the library interface Java loadable file and the library interface Java card external interface file.
  11. 根据权利要求7所述的Java卡应用的功能实现装置,其中,所述第四生成模块,还配置为:The function implementation device of the Java card application according to claim 7, wherein the fourth generation module is further configured to:
    将所述应用源文件通过javac编译器引用Java API生成应用的Java可装载文件;Generating the application source file into a Java loadable file of the application by referring to the Java API through a javac compiler;
    将所述应用的Java可装载文件采用Java卡编译器工具converter引用JavaCard、应用安全管理平台Global PlatformAPI和所述库接口Java卡库文件,生成应用的Java卡可装载文件。The Java loadable file of the application is referenced by a Java Card compiler tool converter, a JavaCard, an application security management platform, a Global Platform API, and the library interface Java card library file, to generate a Java card loadable file of the application.
  12. 根据权利要求7所述的Java卡应用的功能实现装置,其中,所述文件加载模块还配置为:The function implementing apparatus of the Java card application according to claim 7, wherein the file loading module is further configured to:
    先在现有的标准Java卡上,通过JavaCard下载器Loader将所述库实现Java卡可装载文件安装到Java卡中;First install the Java card loadable file into the Java card through the JavaCard Downloader Loader on the existing standard Java card;
    再通过JavaCard下载器Loader和安装器Installer将所述应用的Java卡可装载文件下载并安装到Java卡中。 The Java Card loadable file of the application is downloaded and installed into the Java Card through the JavaCard Downloader Loader and the Installer Installer.
PCT/CN2016/108304 2016-08-18 2016-12-01 Function implementing method and apparatus for java card application WO2018032653A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610686188.9 2016-08-18
CN201610686188.9A CN106227576A (en) 2016-08-18 2016-08-18 The function realizing method of a kind of Java card application and device

Publications (1)

Publication Number Publication Date
WO2018032653A1 true WO2018032653A1 (en) 2018-02-22

Family

ID=57553171

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/108304 WO2018032653A1 (en) 2016-08-18 2016-12-01 Function implementing method and apparatus for java card application

Country Status (2)

Country Link
CN (1) CN106227576A (en)
WO (1) WO2018032653A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287695A (en) * 2019-06-25 2019-09-27 恒宝股份有限公司 A kind of management method of Java card and its temporary object
CN111125687A (en) * 2018-11-01 2020-05-08 北京润信恒达科技有限公司 Method and system for developing application program in secure element
CN113568637A (en) * 2021-07-14 2021-10-29 武汉天喻信息产业股份有限公司 Smart card system package updating management method and device

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124373A (en) * 2019-12-26 2020-05-08 武汉精鸿电子技术有限公司 Test software development method and device and test equipment
CN111880800B (en) * 2020-06-19 2023-10-31 无锡融卡科技有限公司 Application downloading method and application downloading system
CN112148296B (en) * 2020-08-18 2022-03-15 华控清交信息科技(北京)有限公司 Compiling and running method and device and compiling and running device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010007146A1 (en) * 1999-12-23 2001-07-05 Uwe Hansmann Method for providing a set of software components
US20020093856A1 (en) * 2000-11-06 2002-07-18 International Business Machines Corporation File language verification
CN101739404A (en) * 2008-11-05 2010-06-16 爱思开电讯投资(中国)有限公司 Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod
CN101986740A (en) * 2010-09-14 2011-03-16 中国联合网络通信集团有限公司 JAVA card

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7155702B2 (en) * 2001-09-13 2006-12-26 Axalto Sa Interface and stub generation for code distribution and synthesis
CN103309696B (en) * 2012-03-15 2017-02-08 中国移动通信集团公司 Method and device for updating Java card extended library, and Java card
CN104102507B (en) * 2014-06-24 2017-05-10 飞天诚信科技股份有限公司 Method for extending JavaCard application functions
CN105630516A (en) * 2014-10-28 2016-06-01 苏州融卡智能科技有限公司 Patch upgrading method suitable for application software in JAVA card

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010007146A1 (en) * 1999-12-23 2001-07-05 Uwe Hansmann Method for providing a set of software components
US20020093856A1 (en) * 2000-11-06 2002-07-18 International Business Machines Corporation File language verification
CN101739404A (en) * 2008-11-05 2010-06-16 爱思开电讯投资(中国)有限公司 Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod
CN101986740A (en) * 2010-09-14 2011-03-16 中国联合网络通信集团有限公司 JAVA card

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125687A (en) * 2018-11-01 2020-05-08 北京润信恒达科技有限公司 Method and system for developing application program in secure element
CN110287695A (en) * 2019-06-25 2019-09-27 恒宝股份有限公司 A kind of management method of Java card and its temporary object
CN113568637A (en) * 2021-07-14 2021-10-29 武汉天喻信息产业股份有限公司 Smart card system package updating management method and device
CN113568637B (en) * 2021-07-14 2024-05-03 武汉天喻信息产业股份有限公司 Method and device for updating and managing smart card system package

Also Published As

Publication number Publication date
CN106227576A (en) 2016-12-14

Similar Documents

Publication Publication Date Title
WO2018032653A1 (en) Function implementing method and apparatus for java card application
US9811360B2 (en) Dynamic determination of application server runtime classloading
US7231635B2 (en) Remote incremental program verification using API definitions
US6986132B1 (en) Remote incremental program binary compatibility verification using API definitions
US6883163B1 (en) Populating resource-constrained devices with content verified using API definitions
WO2015055074A1 (en) Method and device for dynamically loading and invoking program
US20160202961A1 (en) Specialization of Generic Methods
US6981245B1 (en) Populating binary compatible resource-constrained devices with content verified using API definitions
CN101387956B (en) Method and apparatus for expandably implementing non functional logic
WO2020001112A1 (en) Application method for platform supporting multiple types of devices, and mobile terminal
US20020093856A1 (en) File language verification
CN102455931B (en) Method and system for developing Android platform engineering
US8001518B2 (en) Configuring a shared library to accommodate relocatable data in a pervasive device
CN111367510A (en) Android function module development method and device
US8141042B2 (en) Extending portability of java code through the use of AOP
US9032359B1 (en) Method and apparatus for modifying a platform-independent programming language build tool
CN106778270B (en) Malicious application detection method and system
WO2002023331A2 (en) Remote incremental program binary compatibility verification using api definitions
CN113326481B (en) Project code automatic construction and packaging method, device, system and medium
EP2828746A1 (en) Methods of distributing a computer program product, and a computer system
CN102375740A (en) Handheld device and method for implementing interoperation of Java component and custom member by same
CN113986207A (en) Software architecture generating and calling method and device
AU2001289078B2 (en) Method for remote incremental program verification and installation on resource-constrained devices
AU2001290842B2 (en) Remote incremental program binary compatibility verification using API definitions
CN115525359A (en) Unified configuration system and method for domestic embedded operating system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16913407

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16913407

Country of ref document: EP

Kind code of ref document: A1