CN114489593A - Java card convenient for application upgrading and Java card application upgrading method - Google Patents
Java card convenient for application upgrading and Java card application upgrading method Download PDFInfo
- Publication number
- CN114489593A CN114489593A CN202111613810.0A CN202111613810A CN114489593A CN 114489593 A CN114489593 A CN 114489593A CN 202111613810 A CN202111613810 A CN 202111613810A CN 114489593 A CN114489593 A CN 114489593A
- Authority
- CN
- China
- Prior art keywords
- application
- data
- java card
- service
- upgrading
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a Java card convenient for application upgrading and a Java card application upgrading method.A Java card runs at least one service application responsible for service logic and at least one data application responsible for data access, and the data of the service application is stored in the data application in real time; and after the service application is upgraded, the upgraded service application acquires corresponding data from the corresponding data application by calling the sharing interface. The Java card provided by the application does not need the upgrading function defined by GP, and is friendly to the realization of the function on the existing equipment. The separation of the service and the data is achieved through the design of the service application and the data application, and the processing method for protecting the data in the upgrading process of the service application is realized. By adopting the application designed by the scheme, the target data can be quickly retrieved, and other applications running on the platform cannot be influenced during upgrading. The data storage is independent of the business application, and the abnormal business logic and code can be prevented from influencing the correctness of the data in a certain program.
Description
Technical Field
The invention relates to the technical field of Java cards, in particular to a Java card convenient for application upgrading and a Java card application upgrading method.
Background
The Java Card application is an application written by using a JAVA language and running on a Java Card, the writing mode of the application needs to conform to the Java Card API specification of Sun, and in the Java Card API specification of Sun, an abstract class of the Java Card application is provided, defines a plurality of abstract methods, and the application needs to realize the abstract methods.
When a Java card application is released for commercial distribution, some user-dependent initialization data is written to the application after the application is downloaded and installed, a process called personalization of the application, and these data are called personalization data. When an application is released, the data will change continuously according to the use scene of the user. Therefore, the data may be different for different users and different usage scenarios.
Since the coding logic of the Java card application is established according to the current commercialization requirements when the application is written, when the requirements change, the application already installed in the Java card cannot meet the changed requirements, and the application needs to be upgraded. Meanwhile, if errors are generated due to negligence and the like when the Java card application program is written, the errors may cause problems after the application has been commercially released, causing an abnormality in use by the user. Thus, this situation also requires that the application can be updated upgradeably.
However, since the abstract class of the application in the Java Card API specification does not provide an upgrading abstract method, before the solution comes out, only the old version application is deleted and then the new version application is installed, and all data of the Java Card application exists in a manner of referring to objects in the application program, so that all data does not exist when the old version application is deleted. Therefore, when the old version application is deleted and the new version application is installed, the new version application needs to be personalized again. However, these new personalization data may be completely different from the personalization data of the old version application, which may cause trouble to the user. In addition, since many Java cards are financial in nature and their issuing card is tied to the user's financial account, the environment of use also dictates that many sensitive data cannot be deleted or re-personalized.
Aiming at the upgrading requirement of the Java card application, the international organization GP of the Java card issues an API package, the package defines some classes and some methods, data are temporarily stored in the NVM of the Java card through the methods, then the old version application is deleted, then the new version application is installed, and finally the temporarily stored data are merged and restored into the new version application.
Because some commands, classes and API methods are defined by an upgrading API packet issued by GP, the commands, classes and methods need to occupy additional space of the Java card, and after the commands, the classes and methods are issued, upgrading is carried out continuously, and the API after upgrading is not compatible with the previous API. Therefore, if the solution of GP is adopted, firstly, the COS (Chip Operating System) of the Java card needs to be modified, extra space is needed to implement the commands and APIs defined in the specification of the upgrade API package, and meanwhile, the application of the Java card also needs extra space to call these upgrade APIs; secondly, if the version of the API is updated, the Java card application using the old API method cannot be upgraded to the Java card application using the new API method, which introduces the difficult problem of how to upgrade the API; finally, if the commands for the upgrade and the implementation of the API itself are subject to errors, they cannot be eliminated regardless of the upgrade.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a Java card convenient for application upgrading and a Java card application upgrading method, so as to solve the technical problems in the background technology.
In a first aspect, an embodiment of the present invention provides a Java card convenient for application upgrade, where at least one service application responsible for service logic and at least one data application responsible for data access run in the Java card, and data of the service application is stored in the data application in real time;
and after the service application is upgraded, the upgraded service application acquires corresponding data from the corresponding data application by calling a sharing interface.
Further, the data application defines an extended class of javacard.
Further, the service application acquires a shared object through a getappshareability interface object () method, and then uses a method of an associated shared interface in the data application.
Further, the functions of the shared interface include adding data, searching data, updating data, and deleting data.
Further, the data application uses the dynamic array as a data storage structure.
In a second aspect, an embodiment of the present invention further provides a method for upgrading a Java card application, where at least one service application responsible for service logic and at least one data application responsible for data access are run in the Java card, and data of the service application is stored in the data application in real time;
the method comprises the following steps:
and after the service application is upgraded, the upgraded service application acquires corresponding data from the corresponding data application by calling a sharing interface.
Further, before the service application uses the shared interface, the data application defines an extended class of javacard.
Further, the service application acquires a shared object through a getappshareability interface object () method, and then uses a method of an associated shared interface in the data application.
Further, the functions of the shared interface include adding data, searching data, updating data, and deleting data.
Further, the data application uses the dynamic array as a data storage structure.
The invention has the beneficial effects that:
the Java card provided by the application does not need the upgrading function defined by GP, and is friendly to the realization of the function on the existing equipment. The separation of the service and the data is achieved through the design of the service application and the data application, and the processing method for protecting the data in the upgrading process of the service application is realized. By adopting the application designed by the scheme, the target data can be quickly retrieved, and other applications running on the platform cannot be influenced during upgrading. The data storage is independent of the business application, and the abnormal business logic and code can be prevented from influencing the correctness of the data in a certain program.
Drawings
In order to more clearly illustrate the detailed description of the invention or the technical solutions in the prior art, the drawings that are needed in the detailed description of the invention or the prior art will be briefly described below. Throughout the drawings, like elements or portions are generally identified by like reference numerals. In the drawings, elements or portions are not necessarily drawn to scale.
Fig. 1 is a schematic structural diagram of a Java card for facilitating application upgrade according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a data interaction architecture of a service application and a data application provided in an embodiment of the present invention;
fig. 3 is a flowchart of upgrading a service application according to an embodiment of the present invention;
fig. 4 is a flowchart of loading data by an upgraded service application according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and therefore are only examples, and the protection scope of the present invention is not limited thereby.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which the invention pertains.
In a first aspect, an embodiment of the present invention provides a Java card for facilitating application upgrade, where at least one service application responsible for service logic and at least one data application responsible for data access are run in the Java card, and data of the service application is stored in the data application in real time. And after the service application is upgraded, the upgraded service application acquires corresponding data from the corresponding data application by calling a sharing interface.
It should be noted that there may be a plurality of service applications and data applications running in the Java card. In order to make the features and advantages of the present invention more obvious and understandable, as shown in fig. 1, it is assumed that there are two applications in the Java card, which are respectively a business application and a data application, and key data in the business application is stored in the data application in real time.
The data interaction architecture of business applications and data applications is shown in fig. 2. Specifically, before the service application uses the shared interface, the data application defines an extended class of javacard. The service application acquires a shared object through a getappsharableinterfaceobject () method and then uses a method of an associated shared interface in the data application. The functions of the shared interface include adding data, searching data, updating data, and deleting data.
The data application sharing interface is defined as follows:
public interface SharedInterface extends Shareable
{
public short addNode(byte[]buff,short Off,short Len);
public short searchNode(short id,byte[]outBuff,short offset);
public boolean updateNode(short id,byte[]srcBuff,short srcOff,short desOff,short len);
public void delNode(short id);
};
the service application acquires the shared object:
void initSIO()
{
if(sio==null)
{
sio=(SharedInterface)JCSystem.getAppletShareableInterfaceObject(serverAID,(byte)0);
if(sio==null)
ISOException.throwIt(ISO7816.SW_COMMAND_NOT_ALLOWED);
}
}
example of a service application call sharing method:
idx=sio.addNode(buff,offset,len);
the main function of data applications is to serve data access, so they should be designed as traffic-independent as possible, and also to meet the requirements for fast data storage and reading for improved performance. Therefore, the data application uses the dynamic array as the data storage structure most suitably, and the characteristics are as follows:
1. and (3) quick retrieval: when the storage space is applied, indexes are distributed to the space, corresponding data can be obtained only by using the indexes in subsequent use, time-consuming data retrieval operation like a linked list is not needed, and the larger the data volume is, the more obvious the advantages of the dynamic array are.
2. The space is flexible: the business application can dynamically apply for different use spaces according to the implementation use requirements, and precious card storage space cannot be wasted.
The function of the shared interface is defined as follows:
and (3) adding data:
short addNode
(
byte[]buff,//in
short Off,//in
short Len//in
);
inputting parameter description:
byte [ ] buff,// storage space for data
short Off,// data migration in storage space
short Len// data length
And (3) output parameter description:
is free of
Returning parameters:
an index assigned to the space.
Searching data:
short searchNode
(
short id,//in
byte[]outBuff,//out
short offset//out
);
inputting parameter description:
short id,// data index
And (3) output parameter description:
byte [ ] outBuff,// output data storage space
short offset/offset of output data in storage space
Returning parameters:
the length of the data found.
Updating data:
boolean updateNode
(
short id,//in
byte[]srcBuff,//in
short srcOff,//in
short desOff,//in
short len//in
);
inputting parameter description:
short id,// data index
byte [ ] srcBuff,// data storage space to be updated
short srcOff,// offset of data to be updated in storage space
short desOff,// offset of data to be updated in target space
short len// equal update data length
And (3) output parameter description:
is free of
Returning parameters:
true success of update
False is failure of update.
And (4) deleting data:
void delNode
(
short id,//in
);
inputting parameter description:
short id,// data index
And (3) output parameter description:
is free of
Returning parameters:
none.
When the function is upgraded, only the service application is updated, and the problem of data storage is not considered in the updating process. After the update is completed, the data in the data APPLET is automatically loaded directly through the shared interface, as shown in fig. 3.
The data loading is to synchronize the current state of the service application according to the state flag data recorded in the data application when the new version service application is selected for the first time after the new version service application is successfully installed. Specifically, if the status flag is in an uninitialized state, the service application waits for an external initialization operation; if the status flag is in the user status, the service application loads corresponding user data from the data application, so that it can be ensured that the service application continues to use the previous data in operation, as shown in fig. 4.
The Java card provided by the application does not need the upgrading function defined by GP, and is friendly to the realization of the function on the existing equipment. The separation of the service and the data is achieved through the design of the service application and the data application, and the processing method for protecting the data in the upgrading process of the service application is realized. By adopting the application designed by the scheme, the target data can be quickly retrieved, and other applications running on the platform cannot be influenced during upgrading. The data storage is independent of the business application, and the abnormal business logic and code can be prevented from influencing the correctness of the data in a certain program.
In a second aspect, based on the same inventive concept, an embodiment of the present invention further provides a method for upgrading a Java card application. At least one service application responsible for service logic and at least one data application responsible for data access are operated in the Java card, and data of the service application are stored in the data application in real time, wherein the method comprises the following steps: and after the service application is upgraded, the upgraded service application acquires corresponding data from the corresponding data application by calling a sharing interface.
In this embodiment, before the service application uses the shared interface, the data application defines an extended class of javacard. The service application acquires a shared object through the getappsharableinterfaceobject () method and then uses a method of an associated shared interface in the data application. The functions of the shared interface include adding data, searching data, updating data, and deleting data.
In this embodiment, the data application uses a dynamic array as a data storage structure.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being covered by the appended claims and their equivalents.
Claims (10)
1. A Java card convenient to application upgrade is characterized in that: at least one service application responsible for service logic and at least one data application responsible for data access are operated in the Java card, and data of the service application are stored in the data application in real time;
and after the service application is upgraded, the upgraded service application acquires corresponding data from the corresponding data application by calling a sharing interface.
2. The Java card for facilitating application upgrade according to claim 1, wherein: the data application defines an extended javacard.
3. The Java card for facilitating application upgrade as claimed in claim 2, wherein: the service application acquires a shared object through a getappsharableinterfaceobject () method and then uses a method of an associated shared interface in the data application.
4. The Java card for facilitating application upgrade according to claim 1, wherein: the functions of the shared interface include adding data, searching data, updating data, and deleting data.
5. The Java card for facilitating application upgrade according to claim 1, wherein: the data application uses a dynamic array as a data storage structure.
6. A Java card application upgrading method is characterized in that at least one service application responsible for service logic and at least one data application responsible for data access are operated in a Java card, and data of the service application are stored in the data application in real time;
the method comprises the following steps:
and after the service application is upgraded, the upgraded service application acquires corresponding data from the corresponding data application by calling a sharing interface.
7. The method for upgrading the Java card application according to claim 6, wherein the method comprises the following steps: before the service application uses the shared interface, the data application defines an extended class of java card, frame, and shared, and is used for defining the shared interface method which can be accessed by other applications, and implementing the specific implementation process of the shared interface method internally.
8. The method for upgrading the Java card application according to claim 7, wherein: the service application acquires a shared object through a getappsharableinterfaceobject () method and then uses a method of an associated shared interface in the data application.
9. The method for upgrading the Java card application according to claim 6, wherein the method comprises the following steps: the functions of the shared interface include adding data, finding data, updating data, and deleting data.
10. The method for upgrading the Java card application according to claim 6, wherein the method comprises the following steps: the data application uses a dynamic array as a data storage structure.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111613810.0A CN114489593A (en) | 2021-12-27 | 2021-12-27 | Java card convenient for application upgrading and Java card application upgrading method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111613810.0A CN114489593A (en) | 2021-12-27 | 2021-12-27 | Java card convenient for application upgrading and Java card application upgrading method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114489593A true CN114489593A (en) | 2022-05-13 |
Family
ID=81496433
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111613810.0A Pending CN114489593A (en) | 2021-12-27 | 2021-12-27 | Java card convenient for application upgrading and Java card application upgrading method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114489593A (en) |
-
2021
- 2021-12-27 CN CN202111613810.0A patent/CN114489593A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10140113B2 (en) | Data processing method and device of preset application after upgrading | |
US6668261B1 (en) | Method of upgrading a program using associated configuration data | |
US8176142B2 (en) | Shared JAVA jar files | |
US20230393840A1 (en) | File update method and apparatus, device and storage medium | |
US20060064576A1 (en) | Boot systems and methods | |
KR101555210B1 (en) | Apparatus and method for downloadin contents using movinand in portable terminal | |
CN110543369A (en) | Construction method and device of storage space structure of android system and construction structure of storage space structure of android system | |
CN102667714B (en) | Support the method and system that the function provided by the resource outside operating system environment is provided | |
CN108228077B (en) | Storage area management method, operation method, device, equipment and readable medium | |
WO2002075531A1 (en) | Method for loading and executing an application in an embedded environment | |
CN114185491B (en) | Partition file downloading method and device, storage medium and computer equipment | |
CN115543224B (en) | ZNS SSD-based file system control method, device and equipment | |
WO2008054074A1 (en) | Terminal device having function of interfacing compilation libraries in heterogeneous languages, method of calling api, and method of creating compile function | |
CN113326078A (en) | Method, equipment and storage medium for dynamically updating software development kit | |
US10599444B2 (en) | Extensible input stack for processing input device data | |
US6336215B1 (en) | Apparatus and method for on-line code only replacement of a running program using checkpoints | |
JP2007510211A (en) | Mapping dynamic link libraries on computer equipment | |
CN114489593A (en) | Java card convenient for application upgrading and Java card application upgrading method | |
US7350210B2 (en) | Generic data persistence application program interface | |
CN106843895B (en) | Method, system and readable storage medium for processing requests | |
US20190213015A1 (en) | Extensible input stack for processing input device data | |
US20040015943A1 (en) | Embedded computer system equipped with an upgradeable software library | |
US20050149270A1 (en) | Componentware creating method, apparatus and recording medium | |
CN114253615B (en) | Method and device for setting bootstrap program, electronic equipment and storage medium | |
CN115562697B (en) | Upgrade method, device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |