What is Max and Min size of Applet in java card

对着背影说爱祢 提交于 2019-12-12 02:52:34

问题


I am working on java card and i want to know:

  1. what is max and min size of an applet in java card and on which parameter it depends?
  2. How many applet we can install on smart card?

I am using:

  • smart card type = contact card
  • using java card 2.2.2 with jcop using apdu

回答1:


There is no official size limit (above the ones Robert already posted). Cards may have their own limits depending on available memory - but there is no fixed value for that; depends on what has already been installed, how their VM works internally and so on.




回答2:


I don't know a concrete limit for the applet size, however there are other limits that affect the maximum size:

According to the Java Card 2.2 Virtual Machine Specification the limits are as follows:

Package References: A package can reference at most 128 other packages.

Package Name: The fully qualified name of a package may contain a maximum of 255 characters. The package name size is further limited if it contains one or more characters which, when represented in UTF-8 format, requires multiple bytes.

Classes in a Package: A package can contain at most 255 classes and interfaces.

Interfaces: A class can implement at most 15 interfaces, including interfaces implemented by superclasses. An interface can inherit from at most 14 superinterfaces.

Static Fields: A class in an applet package can have at most 256 public or protected static non-final fields. A class in a library package can have at most 255 public or protected static non-final fields. There is no limit on the number of static final fields (constants) declared in a class.

Static Methods: A class in an applet package can have at most 256 public or protected static methods. A class in a library package can have at most 255 public or protected static methods.

Methods: A class can implement a maximum of 128 public or protected instance methods, and a maximum of 128 instance methods with package visibility. These limits include inherited methods.

Class Instances: Class instances can contain a maximum of 255 fields, where an int data type is counted as occupying two fields.

Arrays: Arrays can hold a maximum of 32767 fields.




回答3:


There is no specification that mentions the maximum size for an applet. It all depends on OS, so yeah you should definitely ask NXP.



来源:https://stackoverflow.com/questions/8628300/what-is-max-and-min-size-of-applet-in-java-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!