Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Question about javacard getInstance() API

JavaCard Applet Development Related Questions and Answers.
nearsunshine
Posts: 8
Joined: Wed Aug 12, 2015 6:27 am
Points :21
Contact:

Question about javacard getInstance() API

Post by nearsunshine » Thu Jan 21, 2016 2:18 am

I know that there are many getInstance methods(e.g. Cipher class, Cipher.getInstance(byte algorithm,boolean externalAccess) throws CryptoException.) in java card API.

My Question:
How many instances will I get if I call Cipher.getInstance(...) twice consecutively?
In RAM, only one instance at all times or each instance per getInstance method invocation?

Tarantino
Posts: 101
Joined: Wed Aug 19, 2015 1:56 am
Points :478
Contact:

Re: Question about javacard getInstance() API

Post by Tarantino » Thu Jan 21, 2016 10:02 pm

getInstance() allocates memory from EEPROM not RAM for each call.
The greatest glory in living lies not in never falling, but in rising every time we fall.--Nelson Mandela

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Question about javacard getInstance() API

Post by UNKNwYSHSA » Thu Jan 21, 2016 10:16 pm

1 getInstance() create instance for each time this method called. Because instance of Cipher/Signature/RandomData/MessageDigest/KeyAgreement/Checksum has method init/update/doFinal, each instance need to save their own instance data, the instance can not be shared.
2 The RAM space are allocated for each instance.
sense and simplicity

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Question about javacard getInstance() API

Post by UNKNwYSHSA » Thu Jan 21, 2016 10:22 pm

Tarantino wrote:getInstance() allocates memory from EEPROM not RAM for each call.

There has any variables (internal data) ban be stored in RAM.
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 62 guests

JavaCard OS : Disclaimer